1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-08 20:22:42 +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

@ -251,7 +251,7 @@ class Account extends Eloquent
$invoice->start_date = Utils::today();
$invoice->invoice_design_id = $this->invoice_design_id;
$invoice->client_id = $clientId;
if ($entityType === ENTITY_RECURRING_INVOICE) {
$invoice->invoice_number = microtime(true);
$invoice->is_recurring = true;
@ -346,13 +346,13 @@ class Account extends Eloquent
// 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
public function getDefaultInvoiceNumber($invoice = false, $prefix = '')
public function getDefaultInvoiceNumber($invoice = false)
{
if ($this->hasClientNumberPattern($invoice)) {
return false;
}
return $this->getNextInvoiceNumber($invoice, $prefix = '');
return $this->getNextInvoiceNumber($invoice);
}
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;
}
public function getNextInvoiceNumber($invoice, $prefix = '')
public function getNextInvoiceNumber($invoice)
{
if ($this->hasNumberPattern($invoice->is_quote)) {
return $this->getNumberPattern($invoice);
}
$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;
// confirm the invoice number isn't already taken

View File

@ -272,7 +272,7 @@ class InvoiceRepository
$account->save();
}
if (isset($data['invoice_number'])) {
if (isset($data['invoice_number']) && !$invoice->is_recurring) {
$invoice->invoice_number = trim($data['invoice_number']);
}
@ -625,7 +625,7 @@ class InvoiceRepository
$invoice = Invoice::createNew($recurInvoice);
$invoice->client_id = $recurInvoice->client_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->balance = $recurInvoice->amount;
$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('work_phone')->data_bind("value: work_phone, valueUpdate: 'afterkeydown'") !!}
</span>
@if (Auth::user()->isPro())
@if ($account->custom_client_label1)
{!! Former::text('custom_value1')->label($account->custom_client_label1)
->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
@if (Auth::user()->isPro())
@if ($account->custom_client_label1)
{!! Former::text('custom_value1')->label($account->custom_client_label1)
->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
<span data-bind="visible: $root.showMore">
&nbsp;
{!! Former::text('address1')->data_bind("value: address1, valueUpdate: 'afterkeydown'") !!}
@ -459,7 +461,7 @@
</div>
</div>
<span data-bind="visible: $root.showMore">
<span data-bind="visible: $root.showMore">
&nbsp;
</span>