mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Improve date resolution in recurring invoices
This commit is contained in:
parent
870da39eb3
commit
3a8b1eb7e3
@ -29,10 +29,7 @@ class RecurringInvoiceToInvoiceFactory
|
||||
$invoice->terms = self::tranformObject($recurring_invoice->terms, $client);
|
||||
$invoice->public_notes = self::tranformObject($recurring_invoice->public_notes, $client);
|
||||
$invoice->private_notes = $recurring_invoice->private_notes;
|
||||
//$invoice->date = now()->format($client->date_format());
|
||||
//$invoice->due_date = $recurring_invoice->calculateDueDate(now());
|
||||
$invoice->is_deleted = $recurring_invoice->is_deleted;
|
||||
// $invoice->line_items = $recurring_invoice->line_items;
|
||||
$invoice->line_items = self::transformItems($recurring_invoice, $client);
|
||||
$invoice->tax_name1 = $recurring_invoice->tax_name1;
|
||||
$invoice->tax_rate1 = $recurring_invoice->tax_rate1;
|
||||
|
@ -578,6 +578,16 @@ class InvoiceController extends BaseController
|
||||
return response()->json(['message' => ctrans('texts.sent_message')], 200);
|
||||
}
|
||||
|
||||
if($action == 'download' && $invoices->count() >=1 && auth()->user()->can('view', $invoices->first())) {
|
||||
|
||||
$file = $invoices->first()->service()->getInvoicePdf();
|
||||
|
||||
return response()->streamDownload(function () use ($file) {
|
||||
echo Storage::get($file);
|
||||
}, basename($file), ['Content-Type' => 'application/pdf']);
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* Send the other actions to the switch
|
||||
*/
|
||||
|
@ -73,6 +73,6 @@ class UpdateGroupSettingRequest extends Request
|
||||
}
|
||||
}
|
||||
|
||||
return $settings;
|
||||
return (array)$settings;
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ namespace App\Jobs\Cron;
|
||||
|
||||
use App\Jobs\RecurringInvoice\SendRecurring;
|
||||
use App\Libraries\MultiDB;
|
||||
use App\Models\Invoice;
|
||||
use App\Models\RecurringInvoice;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Support\Carbon;
|
||||
@ -107,7 +108,7 @@ class RecurringInvoicesCron
|
||||
nlog("Trying to send {$recurring_invoice->number}");
|
||||
|
||||
if ($recurring_invoice->company->stop_on_unpaid_recurring) {
|
||||
if ($recurring_invoice->invoices()->whereIn('status_id', [2, 3])->where('is_deleted', 0)->where('balance', '>', 0)->exists()) {
|
||||
if (Invoice::where('recurring_id', $recurring_invoice->id)->whereIn('status_id', [2, 3])->where('is_deleted', 0)->where('balance', '>', 0)->exists()) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -73,8 +73,8 @@ class SendRecurring implements ShouldQueue
|
||||
$invoice->auto_bill_enabled = false;
|
||||
}
|
||||
|
||||
$invoice->date = now()->format('Y-m-d');
|
||||
$invoice->due_date = $this->recurring_invoice->calculateDueDate(now()->format('Y-m-d'));
|
||||
$invoice->date = date('Y-m-d');
|
||||
$invoice->due_date = $this->recurring_invoice->calculateDueDate(date('Y-m-d'));
|
||||
$invoice->recurring_id = $this->recurring_invoice->id;
|
||||
$invoice->saveQuietly();
|
||||
|
||||
|
@ -560,7 +560,7 @@ class RecurringInvoice extends BaseModel
|
||||
break;
|
||||
|
||||
case 'on_receipt':
|
||||
return Carbon::Parse($date)->copy();
|
||||
return Carbon::parse($date)->copy();
|
||||
break;
|
||||
|
||||
default:
|
||||
|
Loading…
x
Reference in New Issue
Block a user