From a226d83657815d5509428b37767dd750914dcb1d Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 5 Oct 2021 09:03:21 +1100 Subject: [PATCH 1/3] Quote services --- app/Factory/CloneQuoteToInvoiceFactory.php | 6 +++--- app/Services/Quote/ConvertQuote.php | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/app/Factory/CloneQuoteToInvoiceFactory.php b/app/Factory/CloneQuoteToInvoiceFactory.php index b04b8104253d..0c17ed9de216 100644 --- a/app/Factory/CloneQuoteToInvoiceFactory.php +++ b/app/Factory/CloneQuoteToInvoiceFactory.php @@ -28,9 +28,9 @@ class CloneQuoteToInvoiceFactory unset($quote_array['invoice_id']); unset($quote_array['id']); unset($quote_array['invitations']); - unset($quote_array['terms']); - // unset($quote_array['public_notes']); - unset($quote_array['footer']); + //unset($quote_array['terms']); + //unset($quote_array['public_notes']); + //unset($quote_array['footer']); unset($quote_array['design_id']); foreach ($quote_array as $key => $value) { diff --git a/app/Services/Quote/ConvertQuote.php b/app/Services/Quote/ConvertQuote.php index 97f389b48484..fdccf632ed85 100644 --- a/app/Services/Quote/ConvertQuote.php +++ b/app/Services/Quote/ConvertQuote.php @@ -41,6 +41,7 @@ class ConvertQuote $invoice->design_id = $this->decodePrimaryKey($this->client->getSetting('invoice_design_id')); $invoice = $this->invoice_repo->save([], $invoice); + nlog($invoice->toArray()); $invoice->fresh(); $invoice->service() From 2b956ceb38aca92b8d24dd9eafbcba0309aaac13 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 5 Oct 2021 09:47:40 +1100 Subject: [PATCH 2/3] Fixes for passing default quote terms into converted invoice --- app/Services/Quote/ConvertQuote.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/app/Services/Quote/ConvertQuote.php b/app/Services/Quote/ConvertQuote.php index fdccf632ed85..23631b5baa01 100644 --- a/app/Services/Quote/ConvertQuote.php +++ b/app/Services/Quote/ConvertQuote.php @@ -39,9 +39,8 @@ class ConvertQuote { $invoice = CloneQuoteToInvoiceFactory::create($quote, $quote->user_id); $invoice->design_id = $this->decodePrimaryKey($this->client->getSetting('invoice_design_id')); - $invoice = $this->invoice_repo->save([], $invoice); + $invoice = $this->invoice_repo->save($invoice->toArray(), $invoice); - nlog($invoice->toArray()); $invoice->fresh(); $invoice->service() From c30a06bd70cbe8019b226adea3ded017e5746007 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 5 Oct 2021 11:41:05 +1100 Subject: [PATCH 3/3] Fixes for auto bill --- app/Services/Invoice/AutoBillInvoice.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index 01d2d7526773..e3d2f15181fc 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -312,7 +312,7 @@ class AutoBillInvoice extends AbstractService $company_gateway = $gateway_token->gateway; //check if fees and limits are set - if (isset($company_gateway->fees_and_limits) && property_exists($company_gateway->fees_and_limits, $gateway_token->gateway_type_id)) + if (isset($company_gateway->fees_and_limits) && !is_array($company_gateway->fees_and_limits) && property_exists($company_gateway->fees_and_limits, $gateway_token->gateway_type_id)) { //if valid we keep this gateway_token if ($this->invoice->client->validGatewayForAmount($company_gateway->fees_and_limits->{$gateway_token->gateway_type_id}, $amount))