Ejegg has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/186328

Change subject: Fix html_type on year rollup wmf_donor fields
......................................................................

Fix html_type on year rollup wmf_donor fields

Need to use Radio for a Boolean field, as CheckBox was breaking
advanced search on custom fields.

Bug: T86596
Change-Id: I0ed56323c3daa96b1ae8d26152b223fea8cc5183
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 28 insertions(+), 1 deletion(-)


  git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm 
refs/changes/28/186328/1

diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install 
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 6516c84..cd20281 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -31,6 +31,7 @@
     wmf_civicrm_update_7024();
     wmf_civicrm_update_7025();
     wmf_civicrm_update_7026();
+    wmf_civicrm_update_7027();
 }
 
 /**
@@ -1012,7 +1013,7 @@
                        'column_name' => "is_{$year}_donor",
                        'label' => ts("Is {$year} donor"),
                        'data_type' => 'Boolean',
-                       'html_type' => 'CheckBox',
+                       'html_type' => 'Radio',
                        'default_value' => 0,
                        'is_active' => 1,
                        'is_required' => 0,
@@ -1129,3 +1130,29 @@
 
     return array();
 }
+
+/**
+ * Fix year rollup HTML type
+ */
+function wmf_civicrm_update_7027()
+{
+    $api = wmf_civicrm_bootstrap_civi();
+    $api->CustomGroup->get(array(
+        'name' => 'wmf_donor',
+    ));
+    $result = $api->values();
+    if (!$result) {
+        throw new Exception('Could not find custom group wmf_donor.  Please 
run update 7023 first.');
+    }
+
+    $custom_group = array_pop($result);
+
+       $dbs = wmf_civicrm_get_dbs();
+    $dbs->push('civicrm');
+
+    db_query("UPDATE civicrm_custom_field
+        SET html_type = 'Radio'
+        WHERE custom_group_id = {$custom_group->id}
+        AND column_name LIKE 'is%donor'
+        AND html_type = 'CheckBox'");
+}

-- 
To view, visit https://gerrit.wikimedia.org/r/186328
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0ed56323c3daa96b1ae8d26152b223fea8cc5183
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to