From: Iain Patterson Date: Wed, 10 Apr 2013 21:39:37 +0000 (-0400) Subject: Fix driver display in order form. X-Git-Tag: 2013-04-10~1 X-Git-Url: http://git.iain.cx/?a=commitdiff_plain;h=b42536fa2409ee96fd3abc3c781174393e649e9c;p=readifood.git Fix driver display in order form. Drivers were being correctly recorded but not always correctly displayed when viewing existing orders. --- diff --git a/lib/order.php b/lib/order.php index 12a34aa..a392f6e 100644 --- a/lib/order.php +++ b/lib/order.php @@ -235,7 +235,10 @@ if ($order) { $q = new OrderStateQuery; $order_state = $q->filterByOrderId($order->getId())->orderByUpdated('desc')->limit(1)->findOne(); - if ($order_state) $state = $order_state->getState(); + if ($order_state) { + $state = $order_state->getState(); + $driver_id = $order_state->getDriverId(); + } } else $order = new Order; @@ -501,6 +504,7 @@ $driver_id = $order_state->getDriverId(); if ($driver_id) $driver = get_contact_by_id($driver_id); + else $driver = null; /* XXX */ $state = $order_state->getState();