jenkins-bot has submitted this change and it was merged. (
https://gerrit.wikimedia.org/r/394226 )
Change subject: Use api to insert address
......................................................................
Use api to insert address
Change-Id: I9e84208407e88b1cf00364f639e3e9439ffdd7e9
---
M civicrm
M sites/all/modules/wmf_civicrm/wmf_civicrm.module
2 files changed, 11 insertions(+), 11 deletions(-)
Approvals:
jenkins-bot: Verified
Eileen: Looks good to me, approved
diff --git a/civicrm b/civicrm
index ece6660..7940fc7 160000
--- a/civicrm
+++ b/civicrm
@@ -1 +1 @@
-Subproject commit ece6660f6df4bd10dedc2cc097a64e9bb6281ef3
+Subproject commit 7940fc71718d147382f56f706d95b1f49107da23
diff --git a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
index af0ed20..0f1961e 100644
--- a/sites/all/modules/wmf_civicrm/wmf_civicrm.module
+++ b/sites/all/modules/wmf_civicrm/wmf_civicrm.module
@@ -1631,6 +1631,7 @@
'postal_code' => $msg['postal_code'],
'country_id' => $country_id,
'country' => $msg[ 'country' ],
+ 'fix_address' => isset($msg['fix_address']) ? $msg['fix_address'] :
FALSE,
'is_billing' => 1,
'version' => 3,
);
@@ -1643,17 +1644,16 @@
if (!wmf_civicrm_is_address_valid($address_params)) {
return;
}
- // FIXME: api does not offer control over fixAddress flag
- // UPDATE - the fixAddress function mostly backs out early based on params
- // checks so as long as things like 'country_id' are set it doesn't seem
very
- // expensive (& those checks would be an easy fix). Bypassing the api
- // probably does not gain us much.
- //$result = civicrm_api( "Address", "Create", $address_params );
- //if ( array_key_exists( 'is_error', $result ) && $result['is_error'] != 0
) {
- $result = CRM_Core_BAO_Address::add( $address_params, false );
- if ( !$result ) {
- throw new WmfException( 'IMPORT_CONTACT', "Couldn't store address for
the contact.");
+ try {
+ civicrm_api3('Address', 'Create', $address_params);
+ }
+ catch(CiviCRM_API3_Exception $ex ) {
+ throw new WmfException(
+ 'IMPORT_CONTACT',
+ 'Couldn\'t store address for the contact: ' .
+ $ex->getMessage()
+ );
}
}
--
To view, visit https://gerrit.wikimedia.org/r/394226
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I9e84208407e88b1cf00364f639e3e9439ffdd7e9
Gerrit-PatchSet: 1
Gerrit-Project: wikimedia/fundraising/crm
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Eileen <[email protected]>
Gerrit-Reviewer: jenkins-bot <>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits