mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-09 20:52:56 +01:00
Apply the terms/footer when the recurring invoice is created #1203
This commit is contained in:
parent
75900c296e
commit
011032b585
@ -390,7 +390,7 @@ class InvoiceRepository extends BaseRepository
|
||||
|
||||
if (isset($data['terms']) && trim($data['terms'])) {
|
||||
$invoice->terms = trim($data['terms']);
|
||||
} elseif ($isNew && $account->{"{$entityType}_terms"}) {
|
||||
} elseif ($isNew && ! $invoice->is_recurring && $$account->{"{$entityType}_terms"}) {
|
||||
$invoice->terms = $account->{"{$entityType}_terms"};
|
||||
} else {
|
||||
$invoice->terms = '';
|
||||
@ -866,8 +866,8 @@ class InvoiceRepository extends BaseRepository
|
||||
$invoice->discount = $recurInvoice->discount;
|
||||
$invoice->po_number = $recurInvoice->po_number;
|
||||
$invoice->public_notes = Utils::processVariables($recurInvoice->public_notes);
|
||||
$invoice->terms = Utils::processVariables($recurInvoice->terms);
|
||||
$invoice->invoice_footer = Utils::processVariables($recurInvoice->invoice_footer);
|
||||
$invoice->terms = Utils::processVariables($recurInvoice->terms ?: $recurInvoice->account->invoice_terms);
|
||||
$invoice->invoice_footer = Utils::processVariables($recurInvoice->invoice_footer ?: $recurInvoice->account->invoice_footer);
|
||||
$invoice->tax_name1 = $recurInvoice->tax_name1;
|
||||
$invoice->tax_rate1 = $recurInvoice->tax_rate1;
|
||||
$invoice->tax_name2 = $recurInvoice->tax_name2;
|
||||
|
@ -161,11 +161,11 @@ function InvoiceModel(data) {
|
||||
self.frequency_id = ko.observable(4); // default to monthly
|
||||
self.terms = ko.observable('');
|
||||
self.default_terms = ko.observable(account.{{ $entityType }}_terms);
|
||||
self.terms_placeholder = ko.observable({{ !$invoice->id && $account->{"{$entityType}_terms"} ? "account.{$entityType}_terms" : false}});
|
||||
self.terms_placeholder = ko.observable({{ (!$invoice->id || $invoice->is_recurring) && $account->{"{$entityType}_terms"} ? "account.{$entityType}_terms" : false}});
|
||||
self.set_default_terms = ko.observable(false);
|
||||
self.invoice_footer = ko.observable('');
|
||||
self.default_footer = ko.observable(account.invoice_footer);
|
||||
self.footer_placeholder = ko.observable({{ !$invoice->id && $account->invoice_footer ? 'account.invoice_footer' : false}});
|
||||
self.footer_placeholder = ko.observable({{ (!$invoice->id || $invoice->is_recurring) && $account->invoice_footer ? 'account.invoice_footer' : false}});
|
||||
self.set_default_footer = ko.observable(false);
|
||||
self.public_notes = ko.observable('');
|
||||
self.po_number = ko.observable('');
|
||||
@ -492,11 +492,11 @@ function InvoiceModel(data) {
|
||||
}
|
||||
|
||||
self.showResetTerms = function() {
|
||||
return self.default_terms() && self.terms() && self.terms() != self.default_terms();
|
||||
return self.default_terms() && self.terms() != self.default_terms();
|
||||
}
|
||||
|
||||
self.showResetFooter = function() {
|
||||
return self.default_footer() && self.invoice_footer() && self.invoice_footer() != self.default_footer();
|
||||
return self.default_footer() && self.invoice_footer() != self.default_footer();
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user