From dddb4c8c1ae5b2cacfd18e91b9c0d1c2e9c863d9 Mon Sep 17 00:00:00 2001 From: jitendrapurohit Date: Tue, 26 May 2015 12:36:24 +0530 Subject: [PATCH] Batch Data Entry screens do not require payment instrument --- CRM/Batch/Form/Entry.php | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 13d0534301..334ff90d69 100755 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -280,14 +280,18 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { public static function formRule($params, $files, $self) { $errors = array(); $batchTypes = CRM_Core_Pseudoconstant::get('CRM_Batch_DAO_Batch', 'type_id', array('flip' => 1), 'validate'); + $fields = array( + 'total_amount' => 'Amount', + 'financial_type' => 'Financial Type', + 'payment_instrument' => 'Paid By', + ); //CRM-16480 if contact is selected, validate financial type and amount field. foreach ($params['field'] as $key => $value) { - if (!empty($params['primary_contact_id'][$key]) && empty($value['total_amount'])) { - $errors["field[$key][total_amount]"] = ts('Amount is a required field.'); - } - if (!empty($params['primary_contact_id'][$key]) && empty($value['financial_type'])) { - $errors["field[$key][financial_type]"] = ts('Financial Type is a required field.'); + foreach($fields as $field => $label) { + if (!empty($params['primary_contact_id'][$key]) && empty($value[$field])) { + $errors["field[$key][$field]"] = ts("$label is a required field."); + } } } -- 2.25.1