Beispiel #1
0
 +-------------------------------------------------------------------------+
*/
include "../../include/session.php";
include "include/tables.php";
include "include/fields.php";
include "include/addresses.php";
if (!isset($_GET["backurl"])) {
    $thetable = new addresses($db, "tbld:27b99bda-7bec-b152-8397-a3b09c74cb23");
    $pageTitle = "Address";
} else {
    include "include/addresstorecord.php";
    $backurl = $_GET["backurl"];
    if (isset($_GET["refid"])) {
        $backurl .= "?refid=" . $_GET["refid"];
    }
    $thetable = new addresstorecord($db, "tbld:27b99bda-7bec-b152-8397-a3b09c74cb23", $backurl);
    $pageTitle = "Client Address";
}
//end if
$therecord = $thetable->processAddEditPage();
if (isset($therecord["phpbmsStatus"])) {
    $statusmessage = $therecord["phpbmsStatus"];
}
$phpbms->cssIncludes[] = "pages/bms/addresses.css";
$phpbms->jsIncludes[] = "modules/bms/javascript/addresstorecord.js";
//Form Elements
//==============================================================
$theform = new phpbmsForm();
$theinput = new inputField("title", $therecord["title"], NULL, false, NULL, 71, 128);
$theinput->setAttribute("class", "important");
$theform->addField($theinput);
Beispiel #2
0
 function addressUpdate($variables, $invoiceid, $modifiedby, $method)
 {
     // Updates/Inserts address records (billing or shipping )for the sales order's corresponding client
     switch ($method) {
         case "shipping":
             $varprefix = "shipto";
             $idprefix = "shipto";
             break;
         case "billing":
             $varprefix = "";
             $idprefix = "billing";
             break;
     }
     //endswitch
     switch ($variables[$idprefix . "saveoptions"]) {
         case "updateAddress":
             if ($variables[$idprefix . "addressid"]) {
                 $address = new addresses($this->db, "tbld:27b99bda-7bec-b152-8397-a3b09c74cb23");
                 $querystatment = "\n\t\t\t\t\t\t\tSELECT\n\t\t\t\t\t\t\t\t`id`\n\t\t\t\t\t\t\tFROM\n\t\t\t\t\t\t\t\t`addresses`\n\t\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\t\t`uuid` = '" . mysql_real_escape_string($variables[$idprefix . "addressid"]) . "'\n\t\t\t\t\t\t";
                 $queryresult = $this->db->query($querystatment);
                 $arecord = $this->db->fetchArray($queryresult);
                 $addressRecord = $address->getRecord($arecord["id"]);
                 if ($varprefix == "shipto") {
                     $addressRecord["shiptoname"] = $variables["shiptoname"];
                 }
                 $addressRecord["address1"] = $variables[$varprefix . "address1"];
                 $addressRecord["address2"] = $variables[$varprefix . "address2"];
                 $addressRecord["city"] = $variables[$varprefix . "city"];
                 $addressRecord["state"] = $variables[$varprefix . "state"];
                 $addressRecord["postalcode"] = $variables[$varprefix . "postalcode"];
                 $addressRecord["country"] = $variables[$varprefix . "country"];
                 $address->updateRecord($addressRecord, $modifiedby);
             }
             //endif
             break;
         case "createAddress":
             $addresstorecord = new addresstorecord($this->db, "tbld:27b99bda-7bec-b152-8397-a3b09c74cb23");
             if ($varprefix == "shipto") {
                 $addressRecord["shiptoname"] = $variables["shiptoname"];
             }
             $atrRecord["uuid"] = uuid($addresstorecord->prefix . ":");
             $atrRecord["address1"] = $variables[$varprefix . "address1"];
             $atrRecord["address2"] = $variables[$varprefix . "address2"];
             $atrRecord["city"] = $variables[$varprefix . "city"];
             $atrRecord["state"] = $variables[$varprefix . "state"];
             $atrRecord["postalcode"] = $variables[$varprefix . "postalcode"];
             $atrRecord["country"] = $variables[$varprefix . "country"];
             $atrRecord["recordid"] = $variables["clientid"];
             $atrRecord["tabledefid"] = "tbld:6d290174-8b73-e199-fe6c-bcf3d4b61083";
             $atrRecord["primary"] = 0;
             $atrRecord["defaultshipto"] = 0;
             $atrRecord["existingaddressid"] = 0;
             $atrRecord["notes"] = "Created from sales order #" . $invoiceid;
             $newAtrID = $addresstorecord->insertRecord($atrRecord, $modifiedby);
             $atrRecord = $addresstorecord->getRecord($newAtrID);
             //Need to connect the sales order to the new address record
             $updatestatement = "\n\t\t\t\t\t\tUPDATE\n\t\t\t\t\t\t\tinvoices\n\t\t\t\t\t\tSET\n\t\t\t\t\t\t\t" . $idprefix . "addressid = '" . $atrRecord["uuid"] . "'\n\t\t\t\t\t\tWHERE\n\t\t\t\t\t\t\tuuid = '" . $invoiceid . "'\n\t\t\t\t\t";
             $this->db->query($updatestatement);
             break;
     }
     //endswitch - saveoptions
 }