X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;ds=sidebyside;f=lib%2Forder.php;h=cb40f6314a63e055ef204d87169bedab7a06eaaa;hb=5f50c624101d671ec4147b3ad974c15178c6ebe5;hp=a392f6eaeed46b1cd101098aa7781db14e5906b8;hpb=b42536fa2409ee96fd3abc3c781174393e649e9c;p=readifood.git
diff --git a/lib/order.php b/lib/order.php
index a392f6e..cb40f63 100644
--- a/lib/order.php
+++ b/lib/order.php
@@ -230,7 +230,7 @@
}
function show_order_form($order = null, $area_id = null) {
- global $states;
+ global $states, $parcel_sizes, $parcel_contents;
if ($order) {
$q = new OrderStateQuery;
@@ -299,6 +299,29 @@
echo "
"; input("quantity", sprintf("%0.2f", $order->getQuantity() / 1000)); echo " | \n";
echo "\n";
+ /* Parcel type. */
+ echo "\n";
+ echo " Parcel size | \n";
+ echo " | \n";
+ echo "
\n";
+
+ /* Parcel contents. */
+ echo "\n";
+ 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";
+
/* Driver. */
echo "\n";
echo " Driver | \n";
@@ -371,7 +394,7 @@
}
function update_order(&$order, $new = false) {
- global $user_id;
+ global $user_id, $parcel_sizes, $parcel_contents;
#$date = ymd_to_iso8601("date");
$date = $_POST['date'];
@@ -383,6 +406,10 @@
if (! $driver_id) $driver_id = null;
$state = $_POST['state'];
if (! $state) $state = $GLOBALS['STATE_PLACED'];
+ $parcel = $_POST['parcel_size'];
+ for ($i = count($parcel_sizes); $i < count($parcel_contents); $i++) {
+ if ($_POST['parcel_' . $i] == "on") $parcel |= (1 << $i);
+ }
if ($date) {
list($y, $m, $d) = explode('-', $date);
@@ -432,6 +459,7 @@
$order->setBeneficiaryId($beneficiary_id);
$order->setHubId($hub_id);
$order->setQuantity($quantity * 1000);
+ $order->setParcel($parcel);
/* XXX: begin/commit */
try {