1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-09 20:52:56 +01:00

Enabled specifying invoice padding

This commit is contained in:
Hillel Coren 2016-04-19 14:26:42 +03:00
parent cd52faa3bf
commit 32d5a25f61
4 changed files with 10 additions and 6 deletions

View File

@ -753,6 +753,7 @@ class AccountController extends BaseController
$account->custom_invoice_item_label1 = trim(Input::get('custom_invoice_item_label1'));
$account->custom_invoice_item_label2 = trim(Input::get('custom_invoice_item_label2'));
$account->invoice_number_padding = Input::get('invoice_number_padding');
$account->invoice_number_counter = Input::get('invoice_number_counter');
$account->quote_number_prefix = Input::get('quote_number_prefix');
$account->share_counter = Input::get('share_counter') ? true : false;

View File

@ -551,7 +551,7 @@ class Account extends Eloquent
$replace = [date('Y')];
$search[] = '{$counter}';
$replace[] = str_pad($this->getCounter($invoice->is_quote), 4, '0', STR_PAD_LEFT);
$replace[] = str_pad($this->getCounter($invoice->is_quote), $this->invoice_number_padding, '0', STR_PAD_LEFT);
if (strstr($pattern, '{$userId}')) {
$search[] = '{$userId}';
@ -617,7 +617,7 @@ class Account extends Eloquent
// confirm the invoice number isn't already taken
do {
$number = $prefix . str_pad($counter, 4, '0', STR_PAD_LEFT);
$number = $prefix . str_pad($counter, $this->invoice_number_padding, '0', STR_PAD_LEFT);
$check = Invoice::scope(false, $this->id)->whereInvoiceNumber($number)->withTrashed()->first();
$counter++;
$counterOffset++;

View File

@ -1130,6 +1130,8 @@ $LANG = array(
'live_preview' => 'Live Preview',
'page_size' => 'Page Size',
'live_preview_disabled' => 'Live preview has been disabled to support selected font',
'invoice_number_padding' => 'Padding',
);
return $LANG;

View File

@ -59,12 +59,13 @@
{!! Former::text('invoice_number_prefix')
->addGroupClass('invoice-prefix')
->label(' ') !!}
->label(trans('texts.prefix')) !!}
{!! Former::text('invoice_number_pattern')
->appendIcon('question-sign')
->addGroupClass('invoice-pattern')
->label(' ')
->label(trans('texts.pattern'))
->addGroupClass('number-pattern') !!}
{!! Former::text('invoice_number_padding') !!}
{!! Former::text('invoice_number_counter')
->label(trans('texts.counter'))
->help(trans('texts.invoice_number_help') . ' ' .
@ -84,12 +85,12 @@
{!! Former::text('quote_number_prefix')
->addGroupClass('quote-prefix')
->label(' ') !!}
->label(trans('texts.prefix')) !!}
{!! Former::text('quote_number_pattern')
->appendIcon('question-sign')
->addGroupClass('quote-pattern')
->addGroupClass('number-pattern')
->label(' ') !!}
->label(trans('texts.pattern')) !!}
{!! Former::text('quote_number_counter')
->label(trans('texts.counter'))
->addGroupClass('pad-checkbox')