Eileen has uploaded a new change for review. (
https://gerrit.wikimedia.org/r/351128 )
Change subject: Further removal of class_api3 call in favour of civicrm_api3.
......................................................................
Further removal of class_api3 call in favour of civicrm_api3.
In this case fix the initial option value creation routine
This should only really affect dev instances as this is all 'done' on live.
Change-Id: If4e0c50705c4ea8da9db0d6eeb2f3daf88ea96f0
---
M sites/all/modules/wmf_civicrm/bootstrap.inc
1 file changed, 12 insertions(+), 22 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/wikimedia/fundraising/crm
refs/changes/28/351128/1
diff --git a/sites/all/modules/wmf_civicrm/bootstrap.inc
b/sites/all/modules/wmf_civicrm/bootstrap.inc
index 4bba64b..7e93088 100644
--- a/sites/all/modules/wmf_civicrm/bootstrap.inc
+++ b/sites/all/modules/wmf_civicrm/bootstrap.inc
@@ -93,32 +93,22 @@
*/
function wmf_civicrm_create_option_values_detailed($group_name, $values)
{
- $api = wmf_civicrm_bootstrap_civi();
-
- $api->OptionGroup->Get(array(
- 'name' => $group_name,
- ));
- $result = $api->values();
- $option_group = array_pop($result);
+ civicrm_initialize();
foreach ($values as $key => $value)
{
- $params = array_merge(array(
- 'option_group_id' => $option_group->id,
+ $params = array(
+ 'option_group_id' => $group_name,
'name' => $key,
- 'label' => $key,
- 'is_active' => 1,
- ), $value);
+ 'debug' => 1,
+ 'values' => array(array_merge(array(
+ 'option_group_id' => $group_name,
+ 'name' => $key,
+ 'label' => $key,
+ 'is_active' => 1,
+ ), $value))
+ );
- $api->OptionValue->Get(array(
- 'option_group_id' => $option_group->id,
- 'name' => $params['name'],
- ));
-
- $result = $api->values();
- if (empty($result))
- {
- $api->OptionValue->Create($params);
- }
+ civicrm_api3('OptionValue', 'replace', $params);
}
}
--
To view, visit https://gerrit.wikimedia.org/r/351128
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: If4e0c50705c4ea8da9db0d6eeb2f3daf88ea96f0
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Eileen <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits