1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-13 22:54:25 +01:00

Bug fixes

This commit is contained in:
Hillel Coren 2015-10-25 09:49:10 +02:00
parent 12ff43420f
commit 6a2fc89962
3 changed files with 20 additions and 18 deletions

View File

@ -346,13 +346,13 @@ class Account extends Eloquent
// if we're using a pattern we don't know the next number until a client // if we're using a pattern we don't know the next number until a client
// is selected, to support this the default value is blank // is selected, to support this the default value is blank
public function getDefaultInvoiceNumber($invoice = false, $prefix = '') public function getDefaultInvoiceNumber($invoice = false)
{ {
if ($this->hasClientNumberPattern($invoice)) { if ($this->hasClientNumberPattern($invoice)) {
return false; return false;
} }
return $this->getNextInvoiceNumber($invoice, $prefix = ''); return $this->getNextInvoiceNumber($invoice);
} }
public function getCounter($isQuote) public function getCounter($isQuote)
@ -360,14 +360,14 @@ class Account extends Eloquent
return $isQuote && !$this->share_counter ? $this->quote_number_counter : $this->invoice_number_counter; return $isQuote && !$this->share_counter ? $this->quote_number_counter : $this->invoice_number_counter;
} }
public function getNextInvoiceNumber($invoice, $prefix = '') public function getNextInvoiceNumber($invoice)
{ {
if ($this->hasNumberPattern($invoice->is_quote)) { if ($this->hasNumberPattern($invoice->is_quote)) {
return $this->getNumberPattern($invoice); return $this->getNumberPattern($invoice);
} }
$counter = $this->getCounter($invoice->is_quote); $counter = $this->getCounter($invoice->is_quote);
$prefix .= $invoice->is_quote ? $this->quote_number_prefix : $this->invoice_number_prefix; $prefix = $invoice->is_quote ? $this->quote_number_prefix : $this->invoice_number_prefix;
$counterOffset = 0; $counterOffset = 0;
// confirm the invoice number isn't already taken // confirm the invoice number isn't already taken

View File

@ -272,7 +272,7 @@ class InvoiceRepository
$account->save(); $account->save();
} }
if (isset($data['invoice_number'])) { if (isset($data['invoice_number']) && !$invoice->is_recurring) {
$invoice->invoice_number = trim($data['invoice_number']); $invoice->invoice_number = trim($data['invoice_number']);
} }
@ -625,7 +625,7 @@ class InvoiceRepository
$invoice = Invoice::createNew($recurInvoice); $invoice = Invoice::createNew($recurInvoice);
$invoice->client_id = $recurInvoice->client_id; $invoice->client_id = $recurInvoice->client_id;
$invoice->recurring_invoice_id = $recurInvoice->id; $invoice->recurring_invoice_id = $recurInvoice->id;
$invoice->invoice_number = $recurInvoice->account->getNextInvoiceNumber($recurInvoice, 'R'); $invoice->invoice_number = 'R' . $recurInvoice->account->getNextInvoiceNumber($recurInvoice);
$invoice->amount = $recurInvoice->amount; $invoice->amount = $recurInvoice->amount;
$invoice->balance = $recurInvoice->amount; $invoice->balance = $recurInvoice->amount;
$invoice->invoice_date = date_create()->format('Y-m-d'); $invoice->invoice_date = date_create()->format('Y-m-d');

View File

@ -413,18 +413,20 @@
{!! Former::text('website')->data_bind("value: website, valueUpdate: 'afterkeydown'") !!} {!! Former::text('website')->data_bind("value: website, valueUpdate: 'afterkeydown'") !!}
{!! Former::text('work_phone')->data_bind("value: work_phone, valueUpdate: 'afterkeydown'") !!} {!! Former::text('work_phone')->data_bind("value: work_phone, valueUpdate: 'afterkeydown'") !!}
</span>
@if (Auth::user()->isPro()) @if (Auth::user()->isPro())
@if ($account->custom_client_label1) @if ($account->custom_client_label1)
{!! Former::text('custom_value1')->label($account->custom_client_label1) {!! Former::text('custom_value1')->label($account->custom_client_label1)
->data_bind("value: custom_value1, valueUpdate: 'afterkeydown'") !!} ->data_bind("value: custom_value1, valueUpdate: 'afterkeydown'") !!}
@endif
@if ($account->custom_client_label2)
{!! Former::text('custom_value2')->label($account->custom_client_label2)
->data_bind("value: custom_value2, valueUpdate: 'afterkeydown'") !!}
@endif
@endif @endif
@if ($account->custom_client_label2)
{!! Former::text('custom_value2')->label($account->custom_client_label2)
->data_bind("value: custom_value2, valueUpdate: 'afterkeydown'") !!}
@endif
@endif
<span data-bind="visible: $root.showMore">
&nbsp; &nbsp;
{!! Former::text('address1')->data_bind("value: address1, valueUpdate: 'afterkeydown'") !!} {!! Former::text('address1')->data_bind("value: address1, valueUpdate: 'afterkeydown'") !!}