Merge pull request #1000 from studiokiwik/sk-ps15x-011

"---<br />" string is now removed correctly from the end of customization data text
This commit is contained in:
Jérôme Nadaud
2013-11-21 00:14:28 -08:00
3 changed files with 18 additions and 3 deletions
+2 -1
View File
@@ -369,7 +369,8 @@ abstract class PaymentModuleCore extends Module
$customization_text .= sprintf(Tools::displayError('%d image(s)'), count($customization['datas'][Product::CUSTOMIZE_FILE])).'<br />'; $customization_text .= sprintf(Tools::displayError('%d image(s)'), count($customization['datas'][Product::CUSTOMIZE_FILE])).'<br />';
$customization_text .= '---<br />'; $customization_text .= '---<br />';
} }
$customization_text = rtrim($customization_text, '---<br />');
$customization_text = Tools::rtrimString($customization_text, '---<br />');
$customization_quantity = (int)$product['customization_quantity']; $customization_quantity = (int)$product['customization_quantity'];
$products_list .= $products_list .=
+15 -1
View File
@@ -2739,6 +2739,20 @@ exit;
} }
return $fileAttachment; return $fileAttachment;
} }
/**
* Delete a substring from another one starting from the right
* @param string $str
* @param string $str_search
* @return string
*/
public static function rtrimString($str, $str_search)
{
$length_str = strlen($str_search);
if (strlen($str) >= $length_str && substr($str, -$length_str) == $str_search)
$str = substr($str, 0, -$length_str);
return $str;
}
} }
/** /**
@@ -2765,4 +2779,4 @@ function cmpPriceDesc($a, $b)
elseif ((float)$a['price_tmp'] > (float)$b['price_tmp']) elseif ((float)$a['price_tmp'] > (float)$b['price_tmp'])
return -1; return -1;
return 0; return 0;
} }
+1 -1
View File
@@ -318,7 +318,7 @@ class MailAlerts extends Module
$customization_text .= '---<br />'; $customization_text .= '---<br />';
} }
$customization_text = rtrim($customization_text, '---<br />'); $customization_text = Tools::rtrimString($customization_text, '---<br />');
} }
$items_table .= $items_table .=