Skip to content

Commit

Permalink
Fix cash_adjustment NULL exception
Browse files Browse the repository at this point in the history
  • Loading branch information
daN4cat committed Nov 5, 2023
1 parent f006775 commit 676e090
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions application/models/Sale.php
Expand Up @@ -633,6 +633,11 @@ public function save($sale_id, &$sale_status, &$items, $customer_id, $employee_i
$total_amount_used = floatval($total_amount_used) + floatval($payment['payment_amount']);
}

if($payment['cash_adjustment'] == NULL)

This comment has been minimized.

Copy link
@jekkos

jekkos Nov 6, 2023

Member

@daN4cat for my info, what was the issue here exactly?

This comment has been minimized.

Copy link
@daN4cat

daN4cat Nov 6, 2023

Author Collaborator

Doing a return of a POS receipt where there was a returned and a sold item, with negative cash value as result, when you click "Complete" it resulted in $payment['cash_adjustment'] to be NULL throwing an exception.
I couldn't really pin it down to the root cause of that but felt that NULL wouldn't be a valid value in any case and it should be CASH_AJUDTMENT_FALSE by default as per function signature.
I didn't have much time to debug this because I can't remember why CASH_ADJUSTMENT was added. Was that something @SteveIreland added by any chance?

{
$payment['cash_adjustment'] = CASH_ADJUSTMENT_FALSE;
}

$sales_payments_data = array(
'sale_id' => $sale_id,
'payment_type' => $payment['payment_type'],
Expand Down

0 comments on commit 676e090

Please sign in to comment.