1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 05:02:36 +01:00

bug fixes

This commit is contained in:
Hillel Coren 2014-01-09 11:15:19 +00:00
parent ac917c2b51
commit bb3a7b9d1c
3 changed files with 8 additions and 8 deletions

View File

@ -43,11 +43,11 @@ class SendRecurringInvoices extends Command {
$invoice->amount = $recurInvoice->amount;
$invoice->balance = $recurInvoice->amount;
$invoice->currency_id = $recurInvoice->currency_id;
$invoice->invoice_date = date_create();
$invoice->invoice_date = date_create()->format('Y-m-d');
if ($invoice->client->payment_terms)
{
$invoice->due_date = date_create()->modify($invoice->client->payment_terms . ' day');
$invoice->due_date = date_create()->modify($invoice->client->payment_terms . ' day')->format('Y-m-d');
}
$invoice->save();
@ -71,7 +71,7 @@ class SendRecurringInvoices extends Command {
$invoice->invitations()->save($invitation);
}
$recurInvoice->last_sent_date = new DateTime();
$recurInvoice->last_sent_date = Carbon::now()->toDateTimeString();
$recurInvoice->save();
$this->mailer->sendInvoice($invoice);

View File

@ -314,7 +314,7 @@ class ConfideSetupUsersTable extends Migration {
$t->unsignedInteger('frequency_id');
$t->date('start_date')->nullable();
$t->date('end_date')->nullable();
$t->timestamp('last_sent_date')->nullable();
$t->timestamp('last_sent_date')->nullable();
$t->unsignedInteger('recurring_invoice_id')->index()->nullable();
$t->string('tax_name');

View File

@ -105,16 +105,16 @@ class Account extends Eloquent
public function getNextInvoiceNumber()
{
$orders = Invoice::withTrashed()->scope(false, $this->id)->get();
$invoices = Invoice::withTrashed()->scope(false, $this->id)->get();
$max = 0;
foreach ($orders as $order)
foreach ($invoices as $invoice)
{
$number = intval(preg_replace("/[^0-9]/", "", $order->invoice_number));
$number = intval(preg_replace("/[^0-9]/", "", $invoice->invoice_number));
$max = max($max, $number);
}
if ($max > 0)
{
return str_pad($max+1, 4, "0", STR_PAD_LEFT);