mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-06-03 06:54:34 -04:00
Change 'Quote' & 'Invoice' service implementation (#3327)
* Change '__invoke' to 'run' for Invoice services * Change '__invoke' to 'run' for Quote services
This commit is contained in:
parent
4a3d37a42b
commit
7dd6f814ac
@ -31,9 +31,8 @@ class ApplyNumber
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
public function __invoke($invoice)
|
||||
public function run($invoice)
|
||||
{
|
||||
|
||||
if ($invoice->number != '')
|
||||
return $invoice;
|
||||
|
||||
|
@ -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);
|
||||
|
@ -21,9 +21,10 @@ class CreateInvitations
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
// ..
|
||||
}
|
||||
|
||||
public function __invoke($invoice)
|
||||
public function run($invoice)
|
||||
{
|
||||
|
||||
$contacts = $invoice->client->contacts;
|
||||
|
@ -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)
|
||||
|
@ -46,7 +46,7 @@ class InvoiceService
|
||||
{
|
||||
$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);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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)
|
||||
|
@ -25,7 +25,7 @@ class MarkSent
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
public function __invoke($invoice)
|
||||
public function run($invoice)
|
||||
{
|
||||
|
||||
/* Return immediately if status is not draft */
|
||||
|
@ -24,7 +24,7 @@ class UpdateBalance
|
||||
}
|
||||
|
||||
|
||||
public function __invoke($balance_adjustment)
|
||||
public function run($balance_adjustment)
|
||||
{
|
||||
|
||||
if ($this->invoice->is_deleted) {
|
||||
|
@ -15,7 +15,7 @@ class ApplyNumber
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
public function __invoke($quote)
|
||||
public function run($quote)
|
||||
{
|
||||
|
||||
if ($quote->number != '')
|
||||
|
@ -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);
|
||||
|
@ -11,7 +11,7 @@ class CreateInvitations
|
||||
{
|
||||
}
|
||||
|
||||
public function __invoke($quote)
|
||||
public function run($quote)
|
||||
{
|
||||
|
||||
$contacts = $quote->client->contacts;
|
||||
|
@ -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) {
|
||||
|
@ -14,7 +14,7 @@ class MarkSent
|
||||
$this->client = $client;
|
||||
}
|
||||
|
||||
public function __invoke($quote)
|
||||
public function run($quote)
|
||||
{
|
||||
|
||||
/* Return immediately if status is not draft */
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user