X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=lib%2Forder.php;h=ac3cdfe01c125791f788b77d9cc80b7cd8d63dc2;hb=7e79094af6491632cec5287d4a0471ab4d227726;hp=2eae9e0ff0933e400aeb8ace76f43dc082ab05ea;hpb=de1ba4081f13f6c953780055aee9c4aa562a626d;p=readifood.git diff --git a/lib/order.php b/lib/order.php index 2eae9e0..ac3cdfe 100644 --- a/lib/order.php +++ b/lib/order.php @@ -1,10 +1,12 @@ Order placed.

\n"; @@ -26,12 +28,14 @@ } } else if ($_POST['show_in_area']) { + set_last_selected("area_id", $_POST['area_id']); $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_query_uri(get_order_state_mask()))); exit; } else if ($_POST['show_in_city']) { + set_last_selected("city_id", $_POST['city_id']); $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_query_uri(get_order_state_mask()))); @@ -111,9 +115,9 @@ echo "

Restrict to order states:\n"; for ($i = 0; $i < count($states); $i++) { - echo " $states[$i]\n"; + echo ">\n"; } echo "

\n"; } @@ -167,9 +171,16 @@ return; } + $candidates = array(); + foreach ($areas as $area) { + if (! count(get_area_contacts($area->getId()))) continue; + $candidates[] = $area; + } + if (! count($candidates)) return; + echo "

Show orders in area\n"; echo "\n"; @@ -185,9 +196,16 @@ return; } + $candidates = array(); + foreach ($cities as $city) { + if (! count(get_city_contacts($city->getId()))) continue; + $candidates[] = $city; + } + if (! count($candidates)) return; + echo "

Show orders in city\n"; echo "\n"; @@ -295,9 +313,9 @@ echo " Parcel contents\n"; echo " "; for ($i = count($parcel_sizes); $i < count($parcel_contents); $i++) { - echo " getParcel() & (1 << $i)) echo " checked"; - echo ">$parcel_contents[$i]\n"; + echo ">\n"; } echo "\n"; echo "\n"; @@ -332,7 +350,7 @@ echo " State\n"; echo " \n"; echo "\n"; @@ -508,6 +526,16 @@ return $order->getId(); } + function confirm_delete_order($id = null) { + if (! check_admin(1, "delete an order")) return; + + if (isset($id)) $order = get_order_by_id($id); + if (! $order) return false; + + echo "

Confirm deletion

\n"; + echo "

You must confirm deletion of order $id: " . $order->getDeleteLink(true) . "

\n"; + } + function delete_order($id = null) { if (! check_admin(1, "delete an order")) return; @@ -655,6 +683,10 @@ if (count($args)) { switch ($args[0]) { case "delete": + confirm_delete_order($id); + break; + + case "confirmdelete": delete_order($id); break; }