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:
parent
17f853f907
commit
971e538d0e
@ -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');
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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) }}';
|
||||
|
@ -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');
|
||||
|
Loading…
Reference in New Issue
Block a user