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

Working on custom invoice numbers

This commit is contained in:
Hillel Coren 2015-10-23 15:54:07 +03:00
parent 17f853f907
commit 971e538d0e
4 changed files with 5 additions and 9 deletions

View File

@ -251,7 +251,7 @@ class Account extends Eloquent
public function hasClientNumberPattern($invoice)
{
$pattern = $invoice->is_quote ? $this->quote_number_pattern : $this->invoice_number_pattern;
return strstr($pattern, '$custom');
}

View File

@ -31,8 +31,6 @@ class Invoice extends EntityModel
$this->invoice_date = Utils::today();
$this->start_date = Utils::today();
$this->invoice_design_id = $account->invoice_design_id;
$this->terms = $account->invoice_terms;
$this->invoice_footer = $account->invoice_footer;
if (!$this->invoice_number) {
if ($this->is_recurring) {

View File

@ -644,9 +644,7 @@
// we enable searching by contact but the selection must be the client
$('.client-input').val(getClientDisplayName(selected));
// if there's an invoice number pattern we'll apply it now
@if ($account->hasClientNumberPattern($invoice))
setInvoiceNumber(selected);
@endif
setInvoiceNumber(selected);
} else {
model.loadClient($.parseJSON(ko.toJSON(new ClientModel())));
model.invoice().client().country = false;
@ -1030,7 +1028,7 @@
}
function setInvoiceNumber(client) {
@if ($invoice->id)
@if ($invoice->id || !$account->hasClientNumberPattern($invoice))
return;
@endif
var number = '{{ $account->getNumberPattern($invoice) }}';

View File

@ -16,7 +16,7 @@ class InvoiceCest
$this->faker = Factory::create();
}
/*
public function createInvoice(AcceptanceTester $I)
{
$clientEmail = $this->faker->safeEmail;
@ -75,7 +75,7 @@ class InvoiceCest
$I->click('#lastSent');
$I->see($invoiceNumber);
}
*/
public function editInvoice(AcceptanceTester $I)
{
$I->wantTo('edit an invoice');