mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 10:54:41 -04:00
Fixes for applying invoice numbers to subscriptions where invoice number is set to When Sent
This commit is contained in:
parent
c989aaad87
commit
cb47c9d40e
@ -36,6 +36,7 @@ class ApplyNumber extends AbstractService
|
|||||||
|
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
|
|
||||||
if ($this->invoice->number != '') {
|
if ($this->invoice->number != '') {
|
||||||
return $this->invoice;
|
return $this->invoice;
|
||||||
}
|
}
|
||||||
@ -45,7 +46,7 @@ class ApplyNumber extends AbstractService
|
|||||||
$this->trySaving();
|
$this->trySaving();
|
||||||
break;
|
break;
|
||||||
case 'when_sent':
|
case 'when_sent':
|
||||||
if ($this->invoice->status_id == Invoice::STATUS_SENT) {
|
if ($this->invoice->status_id >= Invoice::STATUS_SENT) {
|
||||||
$this->trySaving();
|
$this->trySaving();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -85,7 +85,11 @@ class UpdateInvoicePayment
|
|||||||
|
|
||||||
if($invoice->is_proforma)
|
if($invoice->is_proforma)
|
||||||
{
|
{
|
||||||
$invoice->number = '';
|
|
||||||
|
if(strlen($invoice->number) > 1 && str_starts_with($invoice->number,"####"))
|
||||||
|
$invoice->number = '';
|
||||||
|
|
||||||
|
|
||||||
$invoice->is_proforma = false;
|
$invoice->is_proforma = false;
|
||||||
|
|
||||||
$invoice->service()
|
$invoice->service()
|
||||||
|
@ -958,7 +958,7 @@ class SubscriptionService
|
|||||||
$invoice->subscription_id = $this->subscription->id;
|
$invoice->subscription_id = $this->subscription->id;
|
||||||
$invoice->client_id = $client_id;
|
$invoice->client_id = $client_id;
|
||||||
$invoice->is_proforma = true;
|
$invoice->is_proforma = true;
|
||||||
$invoice->number = ctrans('texts.subscription') . "_" . now()->format('Y-m-d') . "_" . rand(0,100000);
|
$invoice->number = "####" . ctrans('texts.subscription') . "_" . now()->format('Y-m-d') . "_" . rand(0,100000);
|
||||||
$line_items = $bundle->map(function ($item){
|
$line_items = $bundle->map(function ($item){
|
||||||
|
|
||||||
$line_item = new InvoiceItem;
|
$line_item = new InvoiceItem;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user