mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
Disable auto billing on recurring invoices and generated invoices if disabled in client portal
This commit is contained in:
parent
7c50231c26
commit
a2e94bb27e
@ -12,6 +12,7 @@
|
|||||||
|
|
||||||
namespace App\Http\Livewire\RecurringInvoices;
|
namespace App\Http\Livewire\RecurringInvoices;
|
||||||
|
|
||||||
|
use App\Models\Invoice;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
class UpdateAutoBilling extends Component
|
class UpdateAutoBilling extends Component
|
||||||
@ -24,6 +25,12 @@ class UpdateAutoBilling extends Component
|
|||||||
if ($this->invoice->auto_bill == 'optin' || $this->invoice->auto_bill == 'optout') {
|
if ($this->invoice->auto_bill == 'optin' || $this->invoice->auto_bill == 'optout') {
|
||||||
$this->invoice->auto_bill_enabled = ! $this->invoice->auto_bill_enabled;
|
$this->invoice->auto_bill_enabled = ! $this->invoice->auto_bill_enabled;
|
||||||
$this->invoice->saveQuietly();
|
$this->invoice->saveQuietly();
|
||||||
|
|
||||||
|
Invoice::where('recurring_id', $this->invoice->id)
|
||||||
|
->whereIn('status_id', [2,3])
|
||||||
|
->where('is_deleted',0)
|
||||||
|
->where('balance', '>', 0)
|
||||||
|
->update(['auto_bill_enabled' => $this->invoice->auto_bill_enabled]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user