Suggest parcel from contact details.
[readifood.git] / lib / order.php
index 20e5719..928ca67 100644 (file)
     echo "</select></td>\n";
     echo "</tr>\n";
 
-    /* Quantity. */
-    echo "<tr>\n";
-    echo "  <td>Quantity (kg)</td>\n";
-    echo "  <td>"; input("quantity", sprintf("%0.2f", $order->getQuantity() / 1000)); echo "</td>\n";
-    echo "</tr>\n";
-
     /* Parcel type. */
     echo "<tr>\n";
     echo "  <td>Parcel size</td>\n";
     $order->setBeneficiaryId($contact->getId());
 
     echo "<form method=\"POST\" action=\"" . $_SERVER['REQUEST_URI'] . "\">\n";
-    echo "<p>Place an order:</p>\n";
+    echo "<p>Placing order for " . $contact->getStrongLink() . ".";
+    $parcel = $contact->getParcel();
+    if ($parcel) {
+      echo "  Suggested parcel type is <span class=\"strong\">" .  get_contact_parcel_string($contact) . "</span>";
+      $order->setParcel($parcel);
+    }
+    echo "</p>\n";
 
     echo "<table>\n";
     show_order_form($order, $area_id);
       $order->setRequesterId($requester_id);
       $order->setBeneficiaryId($beneficiary_id);
       $order->setHubId($hub_id);
-      $order->setQuantity($quantity * 1000);
       $order->setParcel($parcel);
 
       /* XXX: begin/commit */