Fix Participant batch update to work with multiple value custom fields
authoreileen <emcnaughton@wikimedia.org>
Sun, 29 Apr 2018 06:17:02 +0000 (18:17 +1200)
committereileen <emcnaughton@wikimedia.org>
Sun, 29 Apr 2018 12:51:32 +0000 (00:51 +1200)
CRM/Activity/Form/Task/Batch.php
CRM/Case/Form/Task/Batch.php
CRM/Contact/Form/Task/Batch.php
CRM/Contribute/Form/Task/Batch.php
CRM/Event/Form/Task/Batch.php
CRM/Member/Form/Task/Batch.php
tests/phpunit/CRM/Event/Form/Task/BatchTest.php

index faeef857005b655366275e14b1818fd051f2e78b..dfb0ae0034519f82f7384db87079d41d30e6d062 100644 (file)
@@ -242,6 +242,9 @@ class CRM_Activity_Form_Task_Batch extends CRM_Activity_Form_Task {
         $activityId = civicrm_api3('activity', 'create', $value);
 
         // @todo this would be done by the api call above if the parames were passed through.
+        // @todo extract submit functions &
+        // extend CRM_Event_Form_Task_BatchTest::testSubmit with a data provider to test
+        // handling of custom data, specifically checkbox fields.
         if (!empty($value['custom']) &&
           is_array($value['custom'])
         ) {
index 9e2f50fcd5a3c1dc12b0b21005c05f6069f55ce3..30af5d38888ec0d5559d48d3e082f8f662174405 100644 (file)
@@ -98,6 +98,9 @@ class CRM_Case_Form_Task_Batch extends CRM_Core_Form_Task_Batch {
         );
       }
       //check for custom data
+      // @todo extract submit functions &
+      // extend CRM_Event_Form_Task_BatchTest::testSubmit with a data provider to test
+      // handling of custom data, specifically checkbox fields.
       $value['custom'] = CRM_Core_BAO_CustomField::postProcess($params['field'][$key],
         $key,
         'Case',
index 6bd963c127e893f3fd8e433d375cfc2a9bbad841..c9d4fdd821686ff96073ca6d82317c25b659374f 100644 (file)
@@ -217,6 +217,9 @@ class CRM_Contact_Form_Task_Batch extends CRM_Contact_Form_Task {
   public function postProcess() {
     $params = $this->exportValues();
 
+    // @todo extract submit functions &
+    // extend CRM_Event_Form_Task_BatchTest::testSubmit with a data provider to test
+    // handling of custom data, specifically checkbox fields.
     $ufGroupId = $this->get('ufGroupId');
     $notify = NULL;
     $inValidSubtypeCnt = 0;
index 0036172d98cf4f01079448bdd43853f46aa3ad84..4563e86e503c18760ddfe4a47c1f5e05b41f524d 100644 (file)
@@ -206,6 +206,9 @@ class CRM_Contribute_Form_Task_Batch extends CRM_Contribute_Form_Task {
    */
   public function postProcess() {
     $params = $this->exportValues();
+    // @todo extract submit functions &
+    // extend CRM_Event_Form_Task_BatchTest::testSubmit with a data provider to test
+    // handling of custom data, specifically checkbox fields.
     if (isset($params['field'])) {
       foreach ($params['field'] as $contributionID => $value) {
 
index 04927e1d09d97f34482e95bbb93fb5bfe0a93627..718212524234b990684d0254cef13f6e2991188b 100644 (file)
@@ -478,6 +478,8 @@ class CRM_Event_Form_Task_Batch extends CRM_Event_Form_Task {
           // Unset the original custom field now that it has been formatting to the 'custom'
           // array as it may not be in the right format for the api as is (notably for
           // multiple checkbox values).
+          // @todo extract submit functions on other Batch update classes &
+          // extend CRM_Event_Form_Task_BatchTest::testSubmit with a data provider to test them.
           if (substr($fieldName, 0, 7) === 'custom_') {
             unset($value[$fieldName]);
           }
index e1454c8c9a6902b03dec093de4213e7cb56ba81d..4e13e6528b542accc69505a6c822e4d6aaa45a0b 100644 (file)
@@ -29,8 +29,6 @@
  *
  * @package CRM
  * @copyright CiviCRM LLC (c) 2004-2018
- * $Id$
- *
  */
 
 /**
@@ -208,6 +206,9 @@ class CRM_Member_Form_Task_Batch extends CRM_Member_Form_Task {
    */
   public function postProcess() {
     $params = $this->exportValues();
+    // @todo extract submit functions &
+    // extend CRM_Event_Form_Task_BatchTest::testSubmit with a data provider to test
+    // handling of custom data, specifically checkbox fields.
     $dates = array(
       'join_date',
       'membership_start_date',
index 812c26ca18e51b8f64d32381074778d0f9e41bae..15f24a48bf0e8860582e58fe4cf747d900bfc813 100644 (file)
@@ -8,6 +8,11 @@
  */
 class CRM_Event_Form_Task_BatchTest extends CiviUnitTestCase {
 
+  /**
+   * Test the the submit function on the event participant submit function.
+   *
+   * @todo extract submit functions on other Batch update classes, use dataprovider to test on all.
+   */
   public function testSubmit() {
     $group = $this->CustomGroupCreate(['extends' => 'Participant', 'title' => 'Participant']);
     $field = $this->customFieldCreate(['custom_group_id' => $group['id'], 'html_type' => 'CheckBox', 'option_values' => ['two' => 'A couple', 'three' => 'A few', 'four' => 'Too Many']]);