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;
}
return $mask;
}
- function get_order_state_string($mask) {
+ function get_order_state_query_string($mask) {
global $states;
$selected = array();
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) {
foreach ($contacts as $contact) {
option("requester_id", $contact->getId(), $contact->getDisplayname(), $order->getRequesterId());
}
- echo "</select></td>\n";
+ echo "</select>";
+ $contact = get_contact_by_id($order->getRequesterId(), false);
+ if ($contact) echo " " . get_small_link($contact->getDisplayname(), $contact->getURL());
+ echo "</td>\n";
echo "</tr>\n";
/* Beneficiary. */
option("beneficiary_id", $contact->getId(), $contact->getDisplayname(), $order->getBeneficiaryId());
}
}
- echo "</select></td>\n";
+ echo "</select>";
+ $contact = get_contact_by_id($order->getBeneficiaryId(), false);
+ if ($contact) echo " " . get_small_link($contact->getDisplayname(), $contact->getURL());
+ echo "</td>\n";
echo "</tr>\n";
/* Hub. */
foreach ($hubs as $hub) {
option("hub_id", $hub->getId(), $hub->getDisplayname(), $order->getHubId());
}
- echo "</select></td>\n";
+ echo "</select>";
+ $hub = get_hub_by_id($order->getHubId(), false);
+ if ($hub) echo " " . get_small_link($hub->getDisplayname(), $hub->getURL());
+ echo "</td>\n";
echo "</tr>\n";
/* Parcel type. */
echo "</td>\n";
echo "</tr>\n";
+ /* Notes. */
+ echo "<tr>\n";
+ echo " <td>Notes</td>\n";
+ echo " <td>"; textarea("notes", $order->getNotes()); echo "</td>\n";
+ echo "</tr>\n";
+
/* Driver. */
echo "<tr>\n";
echo " <td>Driver</td>\n";
foreach ($contacts as $contact) {
option("driver_id", $contact->getId(), $contact->getDisplayname(), $driver_id);
}
- echo "</select></td>\n";
+ echo "</select>";
+ $contact = get_contact_by_id($driver_id, false);
+ if ($contact) echo " " . get_small_link($contact->getDisplayname(), $contact->getURL());
+ echo "</td>\n";
}
else echo " <td>No drivers!</td>\n";
echo "</tr>\n";
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);
$order->setBeneficiaryId($beneficiary_id);
$order->setHubId($hub_id);
$order->setParcel($parcel);
+ $order->setNotes($notes);
/* XXX: begin/commit */
try {
if (! count($order_states)) return;
echo "<h3>Order history</h3>\n";
+ echo "<p class=\"history\">\n";
foreach ($order_states as $order_state) {
$date = $order_state->getUpdated();
}
}
#$state = $states[$order_state->getState()];
- echo "<p><strong>$username</strong> changed order to state <strong>$state</strong>";
+ echo "<strong>$username</strong> changed order to state <strong>$state</strong>";
if ($driver) echo " for driver " . $driver->getDisplayname();
- echo " on $date.</p>\n";
+ echo " on $date.<br>\n";
}
+ echo "</p>\n";
}
function show_order(&$id = null) {