X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=lib%2Forder.php;h=4b1c42ee58e3a144c94d753aff0dc0b548b6854a;hb=7840fb6e5f99fcc6c9b25e05c6f40d73137f6d79;hp=e9aaedad511d203c35dd04910997cc7aac1d7cd4;hpb=c5fb790a7fa53100d2c3373603c82812265c7a6a;p=readifood.git diff --git a/lib/order.php b/lib/order.php index e9aaeda..4b1c42e 100644 --- a/lib/order.php +++ b/lib/order.php @@ -28,13 +28,13 @@ else if ($_POST['show_in_area']) { $q = new AreaQuery; $area = $q->findOneById($_POST['area_id']); - header(sprintf("Location: http%s://%s/%s/in/area/%s/%d%s", ($_SERVER['HTTPS']) ? "s" : "", $_SERVER['HTTP_HOST'], $module, urlencode($area->getName()), $_POST['area_id'], get_order_state_uri(get_order_state_mask()))); + header(sprintf("Location: http%s://%s/%s/in/area/%s/%d%s", ($_SERVER['HTTPS']) ? "s" : "", $_SERVER['HTTP_HOST'], $module, urlencode($area->getName()), $_POST['area_id'], get_order_state_query_uri(get_order_state_mask()))); exit; } else if ($_POST['show_in_city']) { $q = new CityQuery; $city = $q->findOneById($_POST['city_id']); - header(sprintf("Location: http%s://%s/%s/in/city/%s/%d%s", ($_SERVER['HTTPS']) ? "s" : "", $_SERVER['HTTP_HOST'], $module, urlencode($city->getName()), $_POST['city_id'], get_order_state_uri(get_order_state_mask()))); + header(sprintf("Location: http%s://%s/%s/in/city/%s/%d%s", ($_SERVER['HTTPS']) ? "s" : "", $_SERVER['HTTP_HOST'], $module, urlencode($city->getName()), $_POST['city_id'], get_order_state_query_uri(get_order_state_mask()))); exit; } @@ -139,7 +139,7 @@ return $mask; } - function get_order_state_string($mask) { + function get_order_state_query_string($mask) { global $states; $selected = array(); @@ -151,13 +151,13 @@ return implode("+", $selected); } - function get_order_state_uri($mask) { + function get_order_state_query_uri($mask) { global $all_states; if (is_null($mask)) return ""; if ($mask == $all_states) return ""; - return "/state/" . get_order_state_string($mask); + return "/state/" . get_order_state_query_string($mask); } function show_order_areas_form($city_id = null) { @@ -304,6 +304,12 @@ echo "\n"; echo "\n"; + /* Notes. */ + echo "\n"; + echo " Notes\n"; + echo " "; textarea("notes", $order->getNotes()); echo "\n"; + echo "\n"; + /* Driver. */ echo "\n"; echo " Driver\n"; @@ -425,6 +431,7 @@ for ($i = count($parcel_sizes); $i < count($parcel_contents); $i++) { if ($_POST['parcel_' . $i] == "on") $parcel |= (1 << $i); } + $notes = $_POST['notes']; if ($date) { list($y, $m, $d) = explode('-', $date); @@ -469,6 +476,7 @@ $order->setBeneficiaryId($beneficiary_id); $order->setHubId($hub_id); $order->setParcel($parcel); + $order->setNotes($notes); /* XXX: begin/commit */ try { @@ -532,6 +540,7 @@ if (! count($order_states)) return; echo "

Order history

\n"; + echo "

\n"; foreach ($order_states as $order_state) { $date = $order_state->getUpdated(); @@ -552,10 +561,11 @@ } } #$state = $states[$order_state->getState()]; - echo "

$username changed order to state $state"; + echo "$username changed order to state $state"; if ($driver) echo " for driver " . $driver->getDisplayname(); - echo " on $date.

\n"; + echo " on $date.
\n"; } + echo "

\n"; } function show_order(&$id = null) {