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() { 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}"); } } } }
function addShippingToDataBase($data) { $OID = dbUpdate("orders", formatForDataBase($data), "OID", $data["OID"]); return $OID; }
function addCustomerToDataBase($data) { $CID = dbInsertNewCustomer(formatForDataBase($data)); return $CID; }