Ejegg has uploaded a new change for review.
https://gerrit.wikimedia.org/r/171851
Change subject: Add 'Do not solicit' custom field
......................................................................
Add 'Do not solicit' custom field
New custom field group 'WMF Donor', stored in the wmf_donor table.
'Do not solicit' field is the first in this group, stored in the
do_not_solicit column.
Change-Id: I2a91116fff0f6a48f0bc7a7e96c5ef73e4cc89a3
---
M sites/all/modules/wmf_civicrm/wmf_civicrm.install
1 file changed, 43 insertions(+), 0 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm
refs/changes/51/171851/1
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
index 2a343af..af9492a 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.install
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.install
@@ -24,6 +24,7 @@
wmf_civicrm_update_7017();
wmf_civicrm_update_7018();
wmf_civicrm_update_7019();
+ wmf_civicrm_update_7023();
}
/**
@@ -940,3 +941,45 @@
// TODO: define option groups in another migration if necessary
}
+
+/**
+ * Add custom donor data group.
+ */
+function wmf_civicrm_update_7023() {
+ $api = wmf_civicrm_bootstrap_civi();
+ $api->CustomGroup->get(array(
+ 'name' => 'WMF_Donor',
+ ));
+ $result = $api->values();
+ if ($result) {
+ return;
+ }
+
+ $success = $api->CustomGroup->create(array(
+ 'extends' => 'Contact',
+ 'name' => 'wmf_donor',
+ 'table_name' => 'wmf_donor',
+ 'title' => ts('WMF Donor'),
+ 'is_active' => 1,
+ ));
+ if (!$success) {
+ throw new Exception('Could not create custom group');
+ }
+ $values = $api->values();
+ $custom_group = array_pop($values);
+
+ $success = $api->CustomField->create(array(
+ 'custom_group_id' => $custom_group->id,
+ 'name' => 'do_not_solicit',
+ 'column_name' => 'do_not_solicit',
+ 'label' => ts('Do not solicit'),
+ 'data_type' => 'Boolean',
+ 'html_type' => 'Radio',
+ 'is_active' => 1,
+ 'is_required' => 1,
+ 'is_searchable' => 1,
+ ));
+ if (!$success) {
+ throw new Exception('Failed to create custom field.');
+ }
+}
--
To view, visit https://gerrit.wikimedia.org/r/171851
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a91116fff0f6a48f0bc7a7e96c5ef73e4cc89a3
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