Skip to content

Commit

Permalink
Fix placement of call to simplifyURL() function
Browse files Browse the repository at this point in the history
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 civicrm#10720 bb80d2f
  • Loading branch information
seancolsen committed Jul 25, 2017
1 parent c1a6fb1 commit b28ddfe
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions CRM/Contribute/BAO/ManagePremiums.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,18 @@ public static function setIsActive($id, $is_active) {
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);
Expand Down

0 comments on commit b28ddfe

Please sign in to comment.