mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Support using idNumber in invoice number pattern
This commit is contained in:
parent
d29a8269c5
commit
c3daea3b83
@ -60,6 +60,7 @@ class Invoice extends EntityModel implements BalanceAffecting
|
|||||||
'counter',
|
'counter',
|
||||||
'custom1',
|
'custom1',
|
||||||
'custom2',
|
'custom2',
|
||||||
|
'idNumber',
|
||||||
'userId',
|
'userId',
|
||||||
'year',
|
'year',
|
||||||
'date:',
|
'date:',
|
||||||
|
@ -115,7 +115,7 @@ trait GeneratesNumbers
|
|||||||
{
|
{
|
||||||
$pattern = $invoice->invoice_type_id == INVOICE_TYPE_QUOTE ? $this->quote_number_pattern : $this->invoice_number_pattern;
|
$pattern = $invoice->invoice_type_id == INVOICE_TYPE_QUOTE ? $this->quote_number_pattern : $this->invoice_number_pattern;
|
||||||
|
|
||||||
return strstr($pattern, '$custom');
|
return strstr($pattern, '$custom') || strstr($pattern, '$idNumber');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -176,11 +176,13 @@ trait GeneratesNumbers
|
|||||||
$search = [
|
$search = [
|
||||||
'{$custom1}',
|
'{$custom1}',
|
||||||
'{$custom2}',
|
'{$custom2}',
|
||||||
|
'{$idNumber}',
|
||||||
];
|
];
|
||||||
|
|
||||||
$replace = [
|
$replace = [
|
||||||
$invoice->client->custom_value1,
|
$invoice->client->custom_value1,
|
||||||
$invoice->client->custom_value2,
|
$invoice->client->custom_value2,
|
||||||
|
$invoice->client->id_number,
|
||||||
];
|
];
|
||||||
|
|
||||||
return str_replace($search, $replace, $pattern);
|
return str_replace($search, $replace, $pattern);
|
||||||
|
@ -1596,6 +1596,7 @@
|
|||||||
var number = '{{ $account->applyNumberPattern($invoice) }}';
|
var number = '{{ $account->applyNumberPattern($invoice) }}';
|
||||||
number = number.replace('{$custom1}', client.custom_value1 ? client.custom_value1 : '');
|
number = number.replace('{$custom1}', client.custom_value1 ? client.custom_value1 : '');
|
||||||
number = number.replace('{$custom2}', client.custom_value2 ? client.custom_value1 : '');
|
number = number.replace('{$custom2}', client.custom_value2 ? client.custom_value1 : '');
|
||||||
|
number = number.replace('{$idNumber}', client.id_number ? client.id_number : '');
|
||||||
model.invoice().invoice_number(number);
|
model.invoice().invoice_number(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user