public function addressCorrection()
 {
     $address = new addressCorrection();
     $address->name = "John";
     $address->address1 = "PO Box 100729";
     $address->city = "Arlington";
     $address->state = "VA";
     $address->zip = "22210";
     $addresses = new addresses();
     $addresses->addAddress($address);
     $addresses_result = $this->addressCorrectionXml($addresses);
     print $addresses_result;
 }
Exemple #2
0
 function insertRecord($variables, $createdby = NULL, $overrideID = false, $replace = false, $useUuid = false)
 {
     if ($variables["existingaddressid"]) {
         $this->createAddressToRecord($variables, $variables["existingaddressid"], $createdby);
         $newAtrID = $variables["existingaddressid"];
     } else {
         $newid = parent::insertRecord($variables, $createdby, $overrideID, $replace, $useUuid);
         //create the addresstorecord
         if (!isset($variables["uuid"])) {
             $variables["uuid"] = "";
         }
         $newAtrID = $this->createAddressToRecord($variables, $variables["uuid"], $createdby);
     }
     //endif - existingaddressid
     return $newAtrID;
 }
Exemple #3
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
 }