From: Sean Madsen Date: Tue, 25 Jul 2017 18:25:35 +0000 (-0600) Subject: Fix placement of call to simplifyURL() function X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=b28ddfe8b60c79ce1fbf78dcf08140746dda0f16;p=civicrm-core.git Fix placement of call to simplifyURL() function Before this commit, the URL simplification was performed within the $params array used as the *default* values, so these values got over-written by the submitted values with array_merge(). This is a follow-up to changes made in #10720 bb80d2f --- diff --git a/CRM/Contribute/BAO/ManagePremiums.php b/CRM/Contribute/BAO/ManagePremiums.php index 4b00a93734..8373b29713 100644 --- a/CRM/Contribute/BAO/ManagePremiums.php +++ b/CRM/Contribute/BAO/ManagePremiums.php @@ -98,13 +98,18 @@ class CRM_Contribute_BAO_ManagePremiums extends CRM_Contribute_DAO_Product { public static function add(&$params, &$ids) { $params = array_merge(array( 'id' => CRM_Utils_Array::value('premium', $ids), - 'image' => CRM_Utils_String::simplifyURL(CRM_Utils_Array::value('image', $params, ''), TRUE), - 'thumbnail' => CRM_Utils_String::simplifyURL(CRM_Utils_Array::value('thumbnail', $params, ''), TRUE), + 'image' => '', + 'thumbnail' => '', 'is_active' => 0, 'is_deductible' => FALSE, 'currency' => CRM_Core_Config::singleton()->defaultCurrency, ), $params); + // Modify the submitted values for 'image' and 'thumbnail' so that we use + // local URLs for these images when possible. + $params['image'] = CRM_Utils_String::simplifyURL($params['image'], TRUE); + $params['thumbnail'] = CRM_Utils_String::simplifyURL($params['thumbnail'], TRUE); + // Save and return $premium = new CRM_Contribute_DAO_Product(); $premium->copyValues($params);