From: jitendrapurohit Date: Tue, 26 May 2015 07:06:24 +0000 (+0530) Subject: Batch Data Entry screens do not require payment instrument X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dddb4c8c1ae5b2cacfd18e91b9c0d1c2e9c863d9;p=civicrm-core.git Batch Data Entry screens do not require payment instrument --- 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."); + } } }