Merge pull request #4644 from turbo124/v5-develop

Fixes for types
This commit is contained in:
David Bomba 2021-01-07 20:53:19 +11:00 committed by GitHub
commit 7d8f445f51
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View File

@ -167,7 +167,13 @@ class PaymentController extends Controller
/*Iterate through invoices and add gateway fees and other payment metadata*/ /*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']); $payable_invoice['amount'] = Number::parseFloat($payable_invoice['amount']);
$invoice = $invoices->first(function ($inv) use ($payable_invoice) { $invoice = $invoices->first(function ($inv) use ($payable_invoice) {
@ -190,8 +196,9 @@ class PaymentController extends Controller
$payable_invoice['additional_info'] = $additional_info; $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)) { if (request()->has('signature') && !is_null(request()->signature) && !empty(request()->signature)) {
$invoices->each(function ($invoice) use ($request) { $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'); $payment_method_id = $request->input('payment_method_id');
$invoice_totals = $payable_invoices->sum('amount'); $invoice_totals = $payable_invoices->sum('amount');
$first_invoice = $invoices->first(); $first_invoice = $invoices->first();
$credit_totals = $first_invoice->client->getSetting('use_credits_payment') == 'off' ? 0 : $first_invoice->client->service()->getCreditBalance(); $credit_totals = $first_invoice->client->getSetting('use_credits_payment') == 'off' ? 0 : $first_invoice->client->service()->getCreditBalance();
$starting_invoice_amount = $first_invoice->amount; $starting_invoice_amount = $first_invoice->amount;
nlog($credit_totals);
nlog($first_invoice->client->getSetting('use_credits_payment'));
if ($gateway) { if ($gateway) {
$first_invoice->service()->addGatewayFee($gateway, $payment_method_id, $invoice_totals)->save(); $first_invoice->service()->addGatewayFee($gateway, $payment_method_id, $invoice_totals)->save();
} }

View File

@ -88,7 +88,7 @@ trait PdfMakerUtilities
return $processed; return $processed;
} }
public function updateElementProperty($element, string $attribute, string $value) public function updateElementProperty($element, string $attribute, ?string $value)
{ {
// We have exception for "hidden" property. // We have exception for "hidden" property.
// hidden="true" or hidden="false" will both hide the element, // hidden="true" or hidden="false" will both hide the element,

View File

@ -41,8 +41,8 @@ class InvoiceFactory extends Factory
'tax_rate2' => 17.5, 'tax_rate2' => 17.5,
//'tax_name3' => 'THIRDTAX', //'tax_name3' => 'THIRDTAX',
//'tax_rate3' => 5, //'tax_rate3' => 5,
'custom_value1' => $this->faker->date, // 'custom_value1' => $this->faker->date,
'custom_value2' => rand(0, 1) ? 'yes' : 'no', //'custom_value2' => rand(0, 1) ? 'yes' : 'no',
// 'custom_value3' => $this->faker->numberBetween(1,4), // 'custom_value3' => $this->faker->numberBetween(1,4),
// 'custom_value4' => $this->faker->numberBetween(1,4), // 'custom_value4' => $this->faker->numberBetween(1,4),
'is_deleted' => false, 'is_deleted' => false,