From: Iain Patterson Date: Mon, 13 May 2013 09:58:49 +0000 (-0400) Subject: Use get_order_state*() functions. X-Git-Tag: 2013-05-13~6 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=de1ba4081f13f6c953780055aee9c4aa562a626d;p=readifood.git Use get_order_state*() functions. Use the new functions get_order_state() and get_order_state_string() where we were previously accessing the state directly. --- diff --git a/lib/order.php b/lib/order.php index 4b1c42e..2eae9e0 100644 --- a/lib/order.php +++ b/lib/order.php @@ -206,8 +206,7 @@ global $states, $parcel_sizes, $parcel_contents; if ($order) { - $q = new OrderStateQuery; - $order_state = $q->filterByOrderId($order->getId())->orderByUpdated('desc')->limit(1)->findOne(); + $order_state = get_order_state($order); if ($order_state) { $state = $order_state->getState(); $driver_id = $order_state->getDriverId(); @@ -215,7 +214,6 @@ } else $order = new Order; - /* Date. */ echo "\n"; echo " Delivery\n"; @@ -552,16 +550,7 @@ if ($driver_id) $driver = get_contact_by_id($driver_id); else $driver = null; - /* XXX */ - $state = $order_state->getState(); - for ($i = 0; $i < count($states); $i++) { - if ((1 << $i) == $state) { - $state = $states[$i]; - break; - } - } - #$state = $states[$order_state->getState()]; - echo "$username changed order to state $state"; + echo "$username changed order to state " . get_order_state_string($order_state) . ""; if ($driver) echo " for driver " . $driver->getDisplayname(); echo " on $date.
\n"; }