Drivers were being correctly recorded but not always correctly displayed
when viewing existing orders.
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;
$driver_id = $order_state->getDriverId();
if ($driver_id) $driver = get_contact_by_id($driver_id);
+ else $driver = null;
/* XXX */
$state = $order_state->getState();