global $contact_roles, $parcel_sizes, $parcel_contents;
if (! $contact) $contact = new Contact;
+ else if ($contact->getRole() & $GLOBALS['ROLE_BENEFICIARY']) {
+ $state_mask = $GLOBALS['STATE_ANY'];
+ $state_mask &= ~$GLOBALS['STATE_DELIVERED'];
+ $state_mask &= ~$GLOBALS['STATE_CANCELLED'];
+
+ $orders = get_contact_orders($contact, $state_mask);
+
+ if (count($orders)) {
+ echo "<tr>\n";
+ echo " <td colspan=2><strong>Outstanding orders:</strong></td>\n";
+ echo "</tr>\n";
+
+ echo "<tr>\n";
+ echo " <td colspan=2>\n";
+ foreach ($orders as $order) {
+ echo " Order " . $order->getStrongLink($order->getId()) . ": " . get_order_displayname($order) . "<br>\n";
+ }
+ echo " </td>\n";
+ echo "</tr>\n";
+ }
+ }
/* Role. */
echo "<tr>\n";
return $order_ids;
}
+ function get_contact_orders($contact, $state_mask = null) {
+ $q = new OrderQuery;
+ $q->filterByBeneficiaryId($contact->getId());
+ if ($state_mask) $q->filterById(get_order_ids_by_state($state_mask));
+ return $q->orderByDate()->find();
+ }
+
function get_user_by_contact_id($id, $verbose = true) {
$q = new UserQuery;
$user = $q->findOneByContactId($id);