Cast value to int before performing math
authorBradley Taylor <hello@brad-taylor.co.uk>
Sun, 6 Feb 2022 17:20:19 +0000 (17:20 +0000)
committerBradley Taylor <hello@brad-taylor.co.uk>
Mon, 7 Feb 2022 19:15:42 +0000 (19:15 +0000)
CRM/Batch/Form/Entry.php

index 2818626e9573a72637bdedc469fa558a85c8641a..c523454cc60bd5585acc0f57f32de2799e791f06 100644 (file)
@@ -425,7 +425,7 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form {
 
     $batchTotal = 0;
     foreach ($params['field'] as $key => $value) {
-      $batchTotal += $value['total_amount'];
+      $batchTotal += ($value['total_amount'] ?: 0);
 
       //validate for soft credit fields
       if (!empty($params['soft_credit_contact_id'][$key]) && empty($params['soft_credit_amount'][$key])) {