diff --git a/app/Jobs/Cron/AutoBill.php b/app/Jobs/Cron/AutoBill.php index cb3492c03f0d..22398f69748c 100644 --- a/app/Jobs/Cron/AutoBill.php +++ b/app/Jobs/Cron/AutoBill.php @@ -53,7 +53,7 @@ class AutoBill nlog("autobill {$this->invoice->id}"); - $this->invoice->service()->autoBill()->save(); + $this->invoice->service()->autoBill(); } catch(\Exception $e) { diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index b5cd123ce6ba..46ba3400fc3e 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -145,7 +145,7 @@ class SendRecurring implements ShouldQueue if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $invoice->auto_bill_enabled) { nlog("attempting to autobill {$invoice->number}"); - $invoice->service()->autoBill()->save(); + $invoice->service()->autoBill(); } elseif($invoice->client->getSetting('auto_bill_date') == 'on_due_date' && $invoice->auto_bill_enabled) { @@ -153,7 +153,7 @@ class SendRecurring implements ShouldQueue if($invoice->due_date && Carbon::parse($invoice->due_date)->startOfDay()->lte(now()->startOfDay())) { nlog("attempting to autobill {$invoice->number}"); - $invoice->service()->autoBill()->save(); + $invoice->service()->autoBill(); } diff --git a/app/Services/Credit/TriggeredActions.php b/app/Services/Credit/TriggeredActions.php index bf7ef3c05484..28134972af8d 100644 --- a/app/Services/Credit/TriggeredActions.php +++ b/app/Services/Credit/TriggeredActions.php @@ -36,17 +36,6 @@ class TriggeredActions extends AbstractService public function run() { - // if ($this->request->has('auto_bill') && $this->request->input('auto_bill') == 'true') { - // $this->credit = $this->credit->service()->autoBill()->save(); - // } - - // if ($this->request->has('paid') && $this->request->input('paid') == 'true') { - // $this->credit = $this->credit->service()->markPaid()->save(); - // } - - // if ($this->request->has('amount_paid') && is_numeric($this->request->input('amount_paid')) ) { - // $this->credit = $this->credit->service()->applyPaymentAmount($this->request->input('amount_paid'))->save(); - // } if ($this->request->has('send_email') && $this->request->input('send_email') == 'true') { $this->sendEmail(); diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index f1ea59aefc8d..646bbad5a12d 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -130,7 +130,7 @@ class AutoBillInvoice extends AbstractService info("Auto Bill payment captured for ".$this->invoice->number); } - return $this->invoice->fresh(); + // return $this->invoice->fresh(); } /** diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 981de82ef9bb..2057b46c5166 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -246,7 +246,7 @@ class InvoiceService public function autoBill() { - $this->invoice = (new AutoBillInvoice($this->invoice, $this->invoice->company->db))->run(); + (new AutoBillInvoice($this->invoice, $this->invoice->company->db))->run(); return $this; } diff --git a/app/Services/Invoice/TriggeredActions.php b/app/Services/Invoice/TriggeredActions.php index d439b0c9b149..cc7de3dc3b4e 100644 --- a/app/Services/Invoice/TriggeredActions.php +++ b/app/Services/Invoice/TriggeredActions.php @@ -37,7 +37,7 @@ class TriggeredActions extends AbstractService public function run() { if ($this->request->has('auto_bill') && $this->request->input('auto_bill') == 'true') { - $this->invoice = $this->invoice->service()->autoBill()->save(); + $this->invoice = $this->invoice->service()->autoBill(); } if ($this->request->has('paid') && $this->request->input('paid') == 'true') { diff --git a/tests/Unit/AutoBillInvoiceTest.php b/tests/Unit/AutoBillInvoiceTest.php index b897024aff86..dade531875fc 100644 --- a/tests/Unit/AutoBillInvoiceTest.php +++ b/tests/Unit/AutoBillInvoiceTest.php @@ -38,7 +38,7 @@ class AutoBillInvoiceTest extends TestCase $this->assertEquals($this->client->paid_to_date, 0); $this->assertEquals($this->client->credit_balance, 10); - $this->invoice->service()->markSent()->autoBill()->save(); + $this->invoice->service()->markSent()->autoBill(); $this->assertNotNull($this->invoice->payments()); $this->assertEquals(10, $this->invoice->payments()->sum('payments.amount'));