From: eileen Date: Thu, 19 May 2016 05:11:06 +0000 (+1200) Subject: CRM-17123 - Include Transaction ID in membership bulk entry profile X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=47087bdc458208009a11e74079205ab43dc8c265;p=civicrm-core.git CRM-17123 - Include Transaction ID in membership bulk entry profile --- diff --git a/CRM/Batch/Form/Entry.php b/CRM/Batch/Form/Entry.php index 1eeed172b6..b9047c230a 100644 --- a/CRM/Batch/Form/Entry.php +++ b/CRM/Batch/Form/Entry.php @@ -280,6 +280,11 @@ class CRM_Batch_Form_Entry extends CRM_Core_Form { //CRM-16480 if contact is selected, validate financial type and amount field. foreach ($params['field'] as $key => $value) { + if (isset($value['trxn_id'])) { + if (0 < CRM_Core_DAO::singleValueQuery('SELECT id FROM civicrm_contribution WHERE trxn_id = %1', array(1 => array($value['trxn_id'], 'String')))) { + $errors["field[$key][trxn_id]"] = ts('Transaction ID must be unique within the database'); + } + } foreach ($fields as $field => $label) { if (!empty($params['primary_contact_id'][$key]) && empty($value[$field])) { $errors["field[$key][$field]"] = ts('%1 is a required field.', array(1 => $label)); diff --git a/CRM/Core/BAO/UFField.php b/CRM/Core/BAO/UFField.php index ad86d2de9f..fe3c5c9d60 100644 --- a/CRM/Core/BAO/UFField.php +++ b/CRM/Core/BAO/UFField.php @@ -1125,6 +1125,10 @@ SELECT id 'name' => 'contribution_status_id', 'title' => ts('Contribution Status'), ), + 'trxn_id' => array( + 'name' => 'contribution_trxn_id', + 'title' => ts('Contribution Transaction ID'), + ), ); } return self::$_memberBatchEntryFields; diff --git a/templates/CRM/Batch/Form/Entry.tpl b/templates/CRM/Batch/Form/Entry.tpl index 0e7b836913..46718ba2ed 100644 --- a/templates/CRM/Batch/Form/Entry.tpl +++ b/templates/CRM/Batch/Form/Entry.tpl @@ -66,7 +66,7 @@ {/if} {foreach from=$fields item=field key=fieldName}
- {if $field.name|substr:0:11 ne 'soft_credit'} + {if $field.name|substr:0:11 ne 'soft_credit' and $field.name ne 'trxn_id'}