CRM-17123 - Include Transaction ID in membership bulk entry profile
authoreileen <emcnaughton@wikimedia.org>
Thu, 19 May 2016 05:11:06 +0000 (17:11 +1200)
committerdeb.monish <monish.deb@webaccessglobal.com>
Thu, 19 May 2016 11:01:33 +0000 (16:31 +0530)
CRM/Batch/Form/Entry.php
CRM/Core/BAO/UFField.php
templates/CRM/Batch/Form/Entry.tpl

index 1eeed172b608cbb6eb017b80b0de9901dee57d21..b9047c230aaa5d6a942b180145ff1f102c26a3c7 100644 (file)
@@ -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));
index ad86d2de9f12ffbdf5bce05906a50ba1e1279521..fe3c5c9d6030f670f18a504ebb2b7a8b1d98b4a7 100644 (file)
@@ -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;
index 0e7b83691350cae28e614cc9d0e088853cf34f33..46718ba2edca0276eb10bfbc6c7a707843fc6366 100644 (file)
@@ -66,7 +66,7 @@
       {/if}
       {foreach from=$fields item=field key=fieldName}
         <div class="crm-grid-cell">
-          {if $field.name|substr:0:11 ne 'soft_credit'}
+          {if $field.name|substr:0:11 ne 'soft_credit' and $field.name ne 'trxn_id'}
           <img src="{$config->resourceBase}i/copy.png"
                alt="{ts 1=$field.title}Click to copy %1 from row one to all rows.{/ts}"
                fname="{$field.name}" class="action-icon"