From ceb8637310dfd78dd5536f69757dd2b2a96eccd0 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 7 Jan 2021 17:24:02 +1100 Subject: [PATCH 1/3] fix for type --- app/Services/PdfMaker/PdfMakerUtilities.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/PdfMaker/PdfMakerUtilities.php b/app/Services/PdfMaker/PdfMakerUtilities.php index 5258ffba3b00..9954f0374020 100644 --- a/app/Services/PdfMaker/PdfMakerUtilities.php +++ b/app/Services/PdfMaker/PdfMakerUtilities.php @@ -88,7 +88,7 @@ trait PdfMakerUtilities return $processed; } - public function updateElementProperty($element, string $attribute, string $value) + public function updateElementProperty($element, string $attribute, ?string $value) { // We have exception for "hidden" property. // hidden="true" or hidden="false" will both hide the element, From f84d6d436fc9f5a5d9466da46746836a623dd20e Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 7 Jan 2021 17:27:44 +1100 Subject: [PATCH 2/3] remove custom fields from factories to prevent type clashes" git push " --- database/factories/InvoiceFactory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database/factories/InvoiceFactory.php b/database/factories/InvoiceFactory.php index 0652188117c2..13f5ed689a6f 100644 --- a/database/factories/InvoiceFactory.php +++ b/database/factories/InvoiceFactory.php @@ -41,8 +41,8 @@ class InvoiceFactory extends Factory 'tax_rate2' => 17.5, //'tax_name3' => 'THIRDTAX', //'tax_rate3' => 5, - 'custom_value1' => $this->faker->date, - 'custom_value2' => rand(0, 1) ? 'yes' : 'no', + // 'custom_value1' => $this->faker->date, + //'custom_value2' => rand(0, 1) ? 'yes' : 'no', // 'custom_value3' => $this->faker->numberBetween(1,4), // 'custom_value4' => $this->faker->numberBetween(1,4), 'is_deleted' => false, From 5d302ad4509bc4850dd1713a09cabac00d99f968 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 7 Jan 2021 18:21:49 +1100 Subject: [PATCH 3/3] Fixes for multi payments --- .../ClientPortal/PaymentController.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/app/Http/Controllers/ClientPortal/PaymentController.php b/app/Http/Controllers/ClientPortal/PaymentController.php index 4ac2e8d4ba35..a4db925a042d 100644 --- a/app/Http/Controllers/ClientPortal/PaymentController.php +++ b/app/Http/Controllers/ClientPortal/PaymentController.php @@ -167,7 +167,13 @@ class PaymentController extends Controller /*Iterate through invoices and add gateway fees and other payment metadata*/ - $payable_invoices = $payable_invoices->map(function ($payable_invoice) use ($invoices, $settings) { + //$payable_invoices = $payable_invoices->map(function ($payable_invoice) use ($invoices, $settings) { + $payable_invoice_collection = collect(); + + foreach($payable_invoices as $payable_invoice) + { + nlog($payable_invoice); + $payable_invoice['amount'] = Number::parseFloat($payable_invoice['amount']); $invoice = $invoices->first(function ($inv) use ($payable_invoice) { @@ -190,8 +196,9 @@ class PaymentController extends Controller $payable_invoice['additional_info'] = $additional_info; - return $payable_invoice; - }); + $payable_invoice_collection->push($payable_invoice); + } + //}); if (request()->has('signature') && !is_null(request()->signature) && !empty(request()->signature)) { $invoices->each(function ($invoice) use ($request) { @@ -199,15 +206,14 @@ class PaymentController extends Controller }); } + $payable_invoices = $payable_invoice_collection; + $payment_method_id = $request->input('payment_method_id'); $invoice_totals = $payable_invoices->sum('amount'); $first_invoice = $invoices->first(); $credit_totals = $first_invoice->client->getSetting('use_credits_payment') == 'off' ? 0 : $first_invoice->client->service()->getCreditBalance(); $starting_invoice_amount = $first_invoice->amount; -nlog($credit_totals); -nlog($first_invoice->client->getSetting('use_credits_payment')); - if ($gateway) { $first_invoice->service()->addGatewayFee($gateway, $payment_method_id, $invoice_totals)->save(); }