diff --git a/app/Services/Invoice/ApplyNumber.php b/app/Services/Invoice/ApplyNumber.php index cab9a58ef259..c0e1348c677d 100644 --- a/app/Services/Invoice/ApplyNumber.php +++ b/app/Services/Invoice/ApplyNumber.php @@ -31,10 +31,9 @@ class ApplyNumber $this->client = $client; } - public function __invoke($invoice) - { - - if ($invoice->number != '') + public function run($invoice) + { + if ($invoice->number != '') return $invoice; switch ($this->client->getSetting('counter_number_applied')) { @@ -46,12 +45,12 @@ class ApplyNumber $invoice->number = $this->getNextInvoiceNumber($this->client); } break; - + default: # code... break; } - + return $invoice; - } -} \ No newline at end of file + } +} diff --git a/app/Services/Invoice/ApplyPayment.php b/app/Services/Invoice/ApplyPayment.php index 9f3656792a56..f8f07cd191b3 100644 --- a/app/Services/Invoice/ApplyPayment.php +++ b/app/Services/Invoice/ApplyPayment.php @@ -26,7 +26,7 @@ class ApplyPayment $this->invoice = $invoice; } - public function __invoke($payment, $payment_amount) + public function run($payment, $payment_amount) { UpdateCompanyLedgerWithPayment::dispatchNow($payment, ($payment_amount*-1), $payment->company); @@ -55,7 +55,7 @@ class ApplyPayment } elseif($payment_amount < $this->invoice->balance) { //partial invoice payment made $this->invoice->service()->clearPartial()->updateBalance($payment_amount*-1); } - + return $this->invoice; } -} \ No newline at end of file +} diff --git a/app/Services/Invoice/CreateInvitations.php b/app/Services/Invoice/CreateInvitations.php index b1f4731db01c..6a9c164b7fe5 100644 --- a/app/Services/Invoice/CreateInvitations.php +++ b/app/Services/Invoice/CreateInvitations.php @@ -21,9 +21,10 @@ class CreateInvitations public function __construct() { + // .. } - public function __invoke($invoice) + public function run($invoice) { $contacts = $invoice->client->contacts; @@ -46,4 +47,4 @@ class CreateInvitations return $invoice; } -} \ No newline at end of file +} diff --git a/app/Services/Invoice/GetInvoicePdf.php b/app/Services/Invoice/GetInvoicePdf.php index c17f2b2a6579..7c4f6cd703b4 100644 --- a/app/Services/Invoice/GetInvoicePdf.php +++ b/app/Services/Invoice/GetInvoicePdf.php @@ -17,7 +17,7 @@ use Illuminate\Support\Facades\Storage; class GetInvoicePdf { - public function __invoke($invoice, $contact = null) + public function run($invoice, $contact = null) { if(!$contact) @@ -33,7 +33,7 @@ class GetInvoicePdf if(!$file) { - + $file_path = CreateInvoicePdf::dispatchNow($invoice, $invoice->company, $contact); } diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 13cca6b999cf..517f2e374524 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -38,15 +38,15 @@ class InvoiceService } /** - * Marks as invoice as paid + * Marks as invoice as paid * and executes child sub functions * @return $this InvoiceService object */ public function markPaid() { $mark_invoice_paid = new MarkPaid($this->client_service); - - $this->invoice = $mark_invoice_paid($this->invoice); + + $this->invoice = $mark_invoice_paid->run($this->invoice); return $this; } @@ -59,7 +59,7 @@ class InvoiceService { $apply_number = new ApplyNumber($this->invoice->client); - $this->invoice = $apply_number($this->invoice); + $this->invoice = $apply_number->run($this->invoice); return $this; } @@ -74,7 +74,7 @@ class InvoiceService { $apply_payment = new ApplyPayment($this->invoice); - $this->invoice = $apply_payment($payment, $payment_amount); + $this->invoice = $apply_payment->run($payment, $payment_amount); return $this; } @@ -90,7 +90,7 @@ class InvoiceService { $update_balance = new UpdateBalance($this->invoice); - $this->invoice = $update_balance($balance_adjustment); + $this->invoice = $update_balance->run($balance_adjustment); return $this; } @@ -99,7 +99,7 @@ class InvoiceService { $create_invitation = new CreateInvitations(); - $this->invoice = $create_invitation($this->invoice); + $this->invoice = $create_invitation->run($this->invoice); return $this; } @@ -108,7 +108,7 @@ class InvoiceService { $mark_sent = new MarkSent($this->invoice->client); - $this->invoice = $mark_sent($this->invoice); + $this->invoice = $mark_sent->run($this->invoice); return $this; } @@ -117,7 +117,7 @@ class InvoiceService { $get_invoice_pdf = new GetInvoicePdf(); - return $get_invoice_pdf($this->invoice, $contact); + return $get_invoice_pdf->run($this->invoice, $contact); } @@ -178,7 +178,7 @@ class InvoiceService /** * Saves the invoice - * @return Invoice object + * @return Invoice object */ public function save() :?Invoice { diff --git a/app/Services/Invoice/MarkPaid.php b/app/Services/Invoice/MarkPaid.php index 4362b268d26e..0b994b15de4e 100644 --- a/app/Services/Invoice/MarkPaid.php +++ b/app/Services/Invoice/MarkPaid.php @@ -28,7 +28,7 @@ class MarkPaid $this->client_service = $client_service; } - public function __invoke($invoice) + public function run($invoice) { if($invoice->status_id == Invoice::STATUS_DRAFT) @@ -57,7 +57,7 @@ class MarkPaid event(new PaymentWasCreated($payment, $payment->company)); UpdateCompanyLedgerWithPayment::dispatchNow($payment, ($payment->amount*-1), $payment->company); - + $this->client_service ->updateBalance($payment->amount*-1) ->updatePaidToDate($payment->amount) diff --git a/app/Services/Invoice/MarkSent.php b/app/Services/Invoice/MarkSent.php index e39af542dbbe..0f49d87619dc 100644 --- a/app/Services/Invoice/MarkSent.php +++ b/app/Services/Invoice/MarkSent.php @@ -25,7 +25,7 @@ class MarkSent $this->client = $client; } - public function __invoke($invoice) + public function run($invoice) { /* Return immediately if status is not draft */ diff --git a/app/Services/Invoice/UpdateBalance.php b/app/Services/Invoice/UpdateBalance.php index 1c623c4a2339..f80296e30880 100644 --- a/app/Services/Invoice/UpdateBalance.php +++ b/app/Services/Invoice/UpdateBalance.php @@ -24,7 +24,7 @@ class UpdateBalance } - public function __invoke($balance_adjustment) + public function run($balance_adjustment) { if ($this->invoice->is_deleted) { @@ -44,4 +44,4 @@ class UpdateBalance return $this->invoice; } -} \ No newline at end of file +} diff --git a/app/Services/Quote/ApplyNumber.php b/app/Services/Quote/ApplyNumber.php index 0be47f4da2a0..eaba8647a63d 100644 --- a/app/Services/Quote/ApplyNumber.php +++ b/app/Services/Quote/ApplyNumber.php @@ -15,7 +15,7 @@ class ApplyNumber $this->client = $client; } - public function __invoke($quote) + public function run($quote) { if ($quote->number != '') diff --git a/app/Services/Quote/ConvertQuote.php b/app/Services/Quote/ConvertQuote.php index 21ad8ff25b47..6a53e28cc674 100644 --- a/app/Services/Quote/ConvertQuote.php +++ b/app/Services/Quote/ConvertQuote.php @@ -20,7 +20,7 @@ class ConvertQuote * @param $quote * @return mixed */ - public function __invoke($quote) + public function run($quote) { $invoice = CloneQuoteToInvoiceFactory::create($quote, $quote->user_id, $quote->company_id); $this->invoice_repo->save([], $invoice); diff --git a/app/Services/Quote/CreateInvitations.php b/app/Services/Quote/CreateInvitations.php index 24747dfd10c3..918f5fa2c306 100644 --- a/app/Services/Quote/CreateInvitations.php +++ b/app/Services/Quote/CreateInvitations.php @@ -11,7 +11,7 @@ class CreateInvitations { } - public function __invoke($quote) + public function run($quote) { $contacts = $quote->client->contacts; diff --git a/app/Services/Quote/MarkApproved.php b/app/Services/Quote/MarkApproved.php index acd0d43cd680..817fc9352fb5 100644 --- a/app/Services/Quote/MarkApproved.php +++ b/app/Services/Quote/MarkApproved.php @@ -14,7 +14,7 @@ class MarkApproved $this->client = $client; } - public function __invoke($quote) + public function run($quote) { /* Return immediately if status is not draft */ if ($quote->status_id != Quote::STATUS_SENT) { diff --git a/app/Services/Quote/MarkSent.php b/app/Services/Quote/MarkSent.php index d98665da8ed4..de21e3e3c252 100644 --- a/app/Services/Quote/MarkSent.php +++ b/app/Services/Quote/MarkSent.php @@ -14,7 +14,7 @@ class MarkSent $this->client = $client; } - public function __invoke($quote) + public function run($quote) { /* Return immediately if status is not draft */ diff --git a/app/Services/Quote/QuoteService.php b/app/Services/Quote/QuoteService.php index ba9b31adc68c..28f5ed9634f9 100644 --- a/app/Services/Quote/QuoteService.php +++ b/app/Services/Quote/QuoteService.php @@ -16,7 +16,7 @@ class QuoteService { $create_invitation = new CreateInvitations(); - $this->quote = $create_invitation($this->quote); + $this->quote = $create_invitation->run($this->quote); return $this; } @@ -25,11 +25,11 @@ class QuoteService { $mark_approved = new MarkApproved($this->quote->client); - $this->quote = $mark_approved($this->quote); + $this->quote = $mark_approved->run($this->quote); if($this->quote->client->getSetting('auto_convert_quote') === true) { $convert_quote = new ConvertQuote($this->quote->client); - $this->quote = $convert_quote($this->quote); + $this->quote = $convert_quote->run($this->quote); } return $this; @@ -43,7 +43,7 @@ class QuoteService { $apply_number = new ApplyNumber($this->quote->client); - $this->quote = $apply_number($this->quote); + $this->quote = $apply_number->run($this->quote); return $this; } @@ -52,7 +52,7 @@ class QuoteService { $mark_sent = new MarkSent($this->quote->client); - $this->quote = $mark_sent($this->quote); + $this->quote = $mark_sent->run($this->quote); return $this; } diff --git a/resources/views/layouts/master.blade.php b/resources/views/layouts/master.blade.php index 35252cbdfdae..d14cf96bf810 100644 --- a/resources/views/layouts/master.blade.php +++ b/resources/views/layouts/master.blade.php @@ -22,7 +22,7 @@ @else + @endif