function main() { if (array_key_exists("PKID", $_GET)) { $PKID = $_GET["PKID"]; } else { print_r("ERROR: PKID NOT FOUND"); $PKID = 1; } if (!array_key_exists("packageForm", $_GET)) { $data = takePackageFromDataBase($PKID); showPackageForm($data, "", array()); // sends an empty array as the badFields } else { $badFields = packageValidate($_GET); // checks to make sure the info given is complete if (count($badFields) != 0) { showPackageForm($_GET, "", $badFields); } else { $package = formatForDataBase($_GET); // dbUpdate("packages", $package, "PKID", $_GET["PKID"]); // $PKID = dbInsertNewPackage($package); $i = 1; while (array_key_exists("PID{$i}", $_GET)) { $PIDs[] = $_GET["PID{$i}"]; $i++; } // dbInsertNewPVPs($PKID, $PIDs); // get the configuration information from the Wordpress page so we know where // our target "return to" pages are $config = getConfigData(); $backToPackage = getSpecialVariable("backToPackage", $config); // backToWPPage($backToPackage,"pkid=$PKID"); } } }
function main($OID) { if (!array_key_exists("shippingForm", $_GET)) { $data = takeShippingFromDataBase($OID); showShippingForm($data, ""); } else { $badFields = shippingValidate($_GET); if (count($badFields) != 0) { showShippingForm($_GET, "", $badFields); print_r($badFields); } else { $OID = addShippingToDataBase($_GET); // go back to the order page $config = getConfigData(); $backToOrder = getSpecialVariable("backToOrder", $config); backToWPPage($backToOrder, "oid={$OID}"); } } }
function main() { if (array_key_exists("CID", $_GET)) { $CID = $_GET["CID"]; } else { print_r("ERROR: CID NOT FOUND"); $CID = 1; } if (!array_key_exists("customerForm", $_GET)) { $data = takeCustomerFromDataBase($CID); showCustomerForm($data, "", array()); // sends an empty array as the badFields } else { $badFields = customerValidate($_GET); // checks to make sure the info given is complete if (count($badFields) != 0) { showCustomerForm($_GET, "", $badFields); } else { // at this point we have good data, and just need to get it into the // database. Before we do it, get the OID from the form data so we // know whether we need to go back to the orders page or customer page $OID = NULL; if (array_key_exists("OID", $_GET)) { $OID = $_GET["OID"]; } $customer = formatForDataBase($_GET); $CID = dbUpdate("customers", $customer, "CID", $CID); // get the configuration information from the Wordpress page so we know where // our target "return to" pages are $config = getConfigData(); $backToOrder = getSpecialVariable("backToOrder", $config); $backToCustomer = getSpecialVariable("backToCustomer", $config); if ($OID) { // came from order backToWPPage($backToOrder, "oid={$OID}"); } else { // otherwise from a customer edit backToWPPage($backToCustomer, "CID={$CID}"); } } } }
if (array_key_exists("message", $_GET)) { $message = $_GET["message"]; } $errorMessage = ""; if (array_key_exists("errorMessage", $_GET)) { $errorMessage = $_GET["errorMessage"]; } // grab all of the different links which link to the editing // pages for order editing. They will be blank if not specified, // which will cause get_page_link() to got to perma-link zero. $config = getConfigData(); $editOrderLink = getSpecialVariable("editOrderLink", $config); $shipOrderLink = getSpecialVariable("shipOrderLink", $config); $editCustomerLink = getSpecialVariable("editCustomerLink", $config); $orderListLink = getSpecialVariable("orderListLink", $config); $packingListLink = getSpecialVariable("packingListLink", $config); //echo "to edit the order part, I'll call " . get_page_link("$editOrderLink"). "<P>"; //echo "to edit the customer part, I'll call " . get_page_link("$editCustomerLink"). "<P>"; //echo "to ship the order part, I'll call " . get_page_link("$shipOrderLink"). "<P>"; //echo "to go back to order list, I'll call " . get_page_link("$orderListLink"). "<P>"; // // HERE'S WHERE THE ACTUAL GOOD STUFF IS! Up to this point we have // be doing a lot of setup. // // The plan is to paint a screen describing the order, in a non // editable format. Buttons will be available for working with // the orders. // first, retrieve the order, which has the side effect of validating it $order = dbGetOrder($oid); $customer = dbGetOrderCustomer($oid); if ($message || $errorMessage) {
// getting confirmation. $request = ""; if (array_key_exists("request", $_GET)) { $request = $_GET["request"]; } $confirmed = false; if (array_key_exists("confirmed", $_GET)) { $confirmed = true; } // grab all of the different links which link to the editing // pages for customer editing. They will be blank if not specified, // which will cause get_page_link() to got to perma-link zero. $config = getConfigData(); $editCustomerLink = getSpecialVariable("editCustomerLink", $config); $deleteCustomerLink = getSpecialVariable("deleteCustomerLink", $config); $releaseCustomerLink = getSpecialVariable("releaseCustomerLink", $config); // // HERE'S WHERE THE ACTUAL GOOD STUFF IS! Up to this point we have // be doing a lot of setup. // // The plan is to paint a screen describing the customer, in a non // editable format. Buttons will be available for working with // the customers. // first, retrieve the customer, which has the side effect of validating it $customer = dbGetCustomer($cid); echo "<H1>Customer: {$cid}</h1>\n"; echo "<HR>"; // here's where it gets interesting... // - if a previous button has been pressed, then we process a bit differently // - otherwise, the customer is presented if ($request) {
function main($OID) { global $repeatTimes; if (!array_key_exists("orderForm", $_GET)) { $data = takeOrderFromDataBase($OID); showOrderForm($data, ""); } else { $badFields = orderValidate($_GET); if (count($badFields) != 0) { showOrderForm($_GET, "", $badFields); } else { dbUpdate("orders", formatNonItemFields($_GET), "OID", $OID); for ($i = 1; $i < $repeatTimes; $i++) { $item = selectItem($_GET, $i); if (!empty($item)) { // checks to be sure the item actually has info if ($item["Quantity"] != 0) { if ($_GET["iid{$i}"] != "") { dbUpdate("items", $item, "OID", $OID, "IID", $_GET["iid{$i}"]); } else { // if the item does not yet exist in the database dbInsertNewItem($OID, $item); } } else { // if the quantity of an item is set to zero dbDeleteItem($_GET["iid{$i}"]); } } } // go back to the order page $config = getConfigData(); $backToOrder = getSpecialVariable("backToOrder", $config); backToWPPage($backToOrder, "oid={$OID}"); } } }