From cc703b79a6e9d646b44bdf63df58b48162b80856 Mon Sep 17 00:00:00 2001 From: Iain Patterson Date: Mon, 13 May 2013 04:49:20 -0400 Subject: [PATCH] Formatting in get_order_parcel_string(). Make sure the output of get_order_parcel_string() doesn't include any leading or trailing colons. --- lib/functions.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/functions.php b/lib/functions.php index fe442f8..ecaf2ad 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -219,7 +219,7 @@ function get_order_parcel_string($order) { global $parcel_sizes, $parcel_contents; - $parcel_size = ""; + $parcel_size = null; for ($i = 0 ; $i < count($parcel_sizes); $i++) { if ($order->getParcel() & (1 << $i)) { $parcel_size = $parcel_sizes[$i]; @@ -232,7 +232,11 @@ if ($order->getParcel() & (1 << $i)) $selected[] = $parcel_contents[$i]; } - return implode(": ", array($parcel_size, implode(", ", $selected))); + $ret = implode(": ", array($parcel_size, implode(", ", $selected))); + $ret = preg_replace('/^: /', '', $ret); + $ret = preg_replace('/: $/', '', $ret); + + return $ret; } function get_order_displayname($order) { -- 2.20.1