function processRequest($page_id, $cid, $request)
{
    global $editCustomerLink;
    switch ($request) {
        case "delete":
            echo "<table><tr><td width=\"50%\">";
            echo "<h3 style=\"color:red;text-align:center\">WARNING</h3>\n";
            echo "Deleting customers is BAD!  When you delete an customer, all of the\n";
            echo "history about the customer goes away.  It should only be used\n";
            echo "in extreme circumstances.  Normally, you should do <strong>CANCEL</strong>\n";
            echo "for customers instead of deleting them.\n";
            echo "<P>\n";
            echo "DELETING AN CUSTOMER CANNOT BE UNDONE!";
            echo "<P>\n";
            echo "One more thing, for the current version of this system, deleting\n";
            echo "an customer will also delete the associated customer record.\n";
            echo "</td><td>\n";
            echo prettyButton($page_id, $cid, "CONFIRM DELETE", "delete", "confirm");
            echo "<P>\n";
            echo prettyButton($page_id, $cid, "Go Back");
            echo "</td></tr></table>\n";
            break;
        case "edit":
            $magicLink = get_page_link($editCustomerLink) . "&CID={$cid}";
            echo "<script> window.location.href = \"{$magicLink}\"; </script>";
            break;
        default:
            echo "Dude.  Somehow there was a bad request.\n";
    }
}
function processRequest($order, $page_id, $oid, $request, $deleteLink = "", $packingListLink = "", $shippingLink = "")
{
    switch ($request) {
        case "delete":
            if (current_user_can("can_delete_orders")) {
                echo "<table><tr><td width=\"50%\">";
                echo "<h3 style=\"color:red;text-align:center\">WARNING</h3>\n";
                echo "Deleting orders is BAD!  When you delete an order, all of the\n";
                echo "history about the order goes away.  It should only be used\n";
                echo "in extreme circumstances.  Normally, you should do <strong>CANCEL</strong>\n";
                echo "for orders instead of deleting them.\n";
                echo "<P>\n";
                echo "DELETING AN ORDER CANNOT BE UNDONE!";
                echo "<P>\n";
                echo "One more thing, for the current version of this system, deleting\n";
                echo "an order will NOT delete the associated customer record.\n";
                echo "</td><td>\n";
                echo prettyButton($page_id, $oid, "CONFIRM DELETE", "delete", "confirm");
                echo "<P>\n";
                echo prettyButton($page_id, $oid, "Go Back");
                echo "</td></tr></table>\n";
            }
            break;
        case "shipit":
        case "unshipit":
            if (current_user_can("can_ship")) {
                processRequestConfirmed($order, $page_id, $oid, $request, $deleteLink, $packingListLink, $shippingLink);
            }
            break;
        case "uncancel":
            if (current_user_can("can_cancel_orders")) {
                echo "<table><tr><td width=\"50%\">";
                echo "You can UN-cancel this order if you want.  This means";
                echo " that this order will be re-instated with all of the data";
                echo " that it had before it was canceled - EXCEPT the following:";
                echo "<UL>";
                echo "<LI>A new different order number</LI>\n";
                echo "<LI>The SAME customer information and number</LI>\n";
                echo "<LI>It will be marked UNPAID</LI>\n";
                echo "<LI>It will be marked as NOT having sent payment request.</LI>\n";
                echo "<LI>It will be marked as NOT released to shipping.</LI>\n";
                echo "<LI>It will be marked as NOT shipped</LI>\n";
                echo "<LI>A note will be added to Order Notes referencing the old order.</LI>\n";
                echo "</UL>\n";
                echo "</td><td>\n";
                echo prettyButton($page_id, $oid, "CONFIRM UN-CANCEL", "uncancel", "confirm");
                echo "<P>\n";
                echo prettyButton($page_id, $oid, "Go Back");
                echo "</td></tr></table>\n";
            }
            break;
            if (current_user_can("can_cancel_orders")) {
                // this goes straight to uncancel, with no confirm
                processRequestConfirmed($order, $page_id, $oid, $request, $deleteLink, $packingListLink);
            }
            break;
        case "dup":
            if (current_user_can("can_duplicate_orders")) {
                echo "<table><tr><td width=\"50%\">";
                echo "The most common reason for duplicating an order is that you want ";
                echo "to ship something else to an existing customer.  This can happen when ";
                echo "a return/warranty shipment is needed.";
                echo "<P>\n";
                echo "Duplicating CAN NOT be \"reversed\", though the duplicate order ";
                echo "can simply be deleted - leaving no trace. ";
                echo "<P>\n";
                echo "<strong>IMPORTANT NOTES:</strong><P><UL><LI>";
                echo "Duplicating an order only copies the customer information and the ";
                echo "items for the order.  </LI><LI>Order notes are NOT copied.  </LI><LI>Dates are not copied. ";
                echo "</LI><LI>Payment information is not copied. </LI><LI>An \"Admin Note\" is added to the ";
                echo "new copy pointing back to the original order.</LI>";
                echo "<LI>After you confirm the duplication, you will be transported to the new duplicate order.</LI></UL></P>";
                echo "</td><td>\n";
                echo prettyButton($page_id, $oid, "CONFIRM DUPLICATE", "dup", "confirm");
                echo "<P>\n";
                echo prettyButton($page_id, $oid, "Go Back");
                echo "</td></tr></table>\n";
            }
            break;
        case "cancel":
            if (current_user_can("can_cancel_orders")) {
                echo "<table><tr><td width=\"50%\">";
                echo "Canceling an order is the correct way to say \"this order";
                echo " is no longer valid.\"  This can happen when a customer says";
                echo " \"no thanks\" when asked for payment, or after awhile when";
                echo " a customer doesn't reply.";
                echo "<P>\n";
                echo "Canceling CAN be reversed.  However, this means that a new order";
                echo " will be created with all of the same information.";
                echo "<P>\n";
                echo "Canceling will cause any outstanding invoices with Paypal";
                echo " to be canceled too.";
                echo "<P>\n";
                echo "Canceling doesn't affect the associated customer record.\n";
                echo "</td><td>\n";
                echo prettyButton($page_id, $oid, "CONFIRM CANCEL", "cancel", "confirm");
                echo "<P>\n";
                echo prettyButton($page_id, $oid, "Go Back");
                echo "</td></tr></table>\n";
            }
            break;
        case "cancelpayment":
            if (current_user_can("can_cancel_payment")) {
                // this goes straight to release/unrelease, with no confirm
                processRequestConfirmed($order, $page_id, $oid, $request, $deleteLink, $packingListLink);
            }
            break;
        case "repayment":
            if (current_user_can("can_request_repayment")) {
                // this goes straight to release/unrelease, with no confirm
                processRequestConfirmed($order, $page_id, $oid, $request, $deleteLink, $packingListLink);
            }
            break;
        case "payment":
            if (current_user_can("can_request_payment")) {
                // this goes straight to release/unrelease, with no confirm
                processRequestConfirmed($order, $page_id, $oid, $request, $deleteLink, $packingListLink);
            }
            break;
        case 'release':
        case 'unrelease':
            if (current_user_can("can_release_to_shipping")) {
                // this goes straight to release/unrelease, with no confirm
                processRequestConfirmed($order, $page_id, $oid, $request, $deleteLink, $packingListLink);
            }
            break;
        case 'paid':
        case 'unpaid':
            if (current_user_can("can_mark_paid")) {
                // this goes straight to release/unrelease, with no confirm
                processRequestConfirmed($order, $page_id, $oid, $request, $deleteLink, $packingListLink);
            }
            break;
        case 'charity':
        case 'uncharity':
            if (current_user_can("can_mark_charity")) {
                // this goes straight to release/unrelease, with no confirm
                processRequestConfirmed($order, $page_id, $oid, $request, $deleteLink, $packingListLink);
            }
            break;
        case 'packing':
            processRequestConfirmed($order, $page_id, $oid, $request, $deleteLink, $packingListLink);
            break;
        default:
            echo "Dude.  Somehow there was a bad request.\n";
    }
}