mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
Add invoice/estimate/payment number length setting (#425)
* Add invoice/estimate/payment number length setting
This commit is contained in:
@ -82,6 +82,9 @@ class Invoice extends Model implements HasMedia
|
||||
->orderBy('invoice_number', 'desc')
|
||||
->first();
|
||||
|
||||
// Get number length config
|
||||
$numberLength = CompanySetting::getSetting('invoice_number_length', request()->header('company'));
|
||||
$numberLengthText = "%0{$numberLength}d";
|
||||
|
||||
if (!$lastOrder) {
|
||||
// We get here if there is no order at all
|
||||
@ -98,7 +101,7 @@ class Invoice extends Model implements HasMedia
|
||||
// the %06d part makes sure that there are always 6 numbers in the string.
|
||||
// so it adds the missing zero's when needed.
|
||||
|
||||
return sprintf('%06d', intval($number) + 1);
|
||||
return sprintf($numberLengthText, intval($number) + 1);
|
||||
}
|
||||
|
||||
public function emailLogs()
|
||||
|
||||
Reference in New Issue
Block a user