コード例 #1
0
 public function save()
 {
     ${"GLOBALS"}["ducixeik"] = "additionalProductFields";
     ${${"GLOBALS"}["wtrcwdueuts"]} = PearDatabase::getInstance();
     ${${"GLOBALS"}["ducixeik"]} = $this->getAdditionalProductFields();
     ${"GLOBALS"}["molcrpc"] = "manualUpdateFields";
     ${"GLOBALS"}["gbmhcqh"] = "tmp";
     ${"GLOBALS"}["ewjsruuy"] = "fieldName";
     ${${"GLOBALS"}["molcrpc"]} = array();
     foreach (${${"GLOBALS"}["vptmrj"]} as ${${"GLOBALS"}["ewjsruuy"]} => ${${"GLOBALS"}["gbmhcqh"]}) {
         if (${${"GLOBALS"}["ykppheofobwk"]}["implemented"] == false) {
             $jpmxewcq = "relData";
             ${"GLOBALS"}["fkfnvsuaox"] = "manualUpdateFields";
             ${${"GLOBALS"}["fkfnvsuaox"]}[] = ${${"GLOBALS"}["thpgoyrlu"]};
             ${$jpmxewcq} = $this->_getProductRelData();
         }
     }
     require_once "modules/Emails/mail.php";
     if (!empty($this->_id) && $this->_changed == true) {
         $this->_changedProducts = $this->_changed;
         if ($this->_listitems === null) {
             $this->_loadProducts();
         }
     }
     parent::save();
     $this->prepareTransfer();
     if (!empty($this->_currencyID)) {
         ${${"GLOBALS"}["xkutivbm"]} = $this->_currencyID;
     } else {
         $ogqhrcro = "currency_id";
         ${$ogqhrcro} = false;
     }
     $this->clearData();
     if ($this->_changedProducts === true) {
         ${"GLOBALS"}["tgkrfb"] = "shipping_handling_charge";
         ${"GLOBALS"}["negltbro"] = "field";
         ${${"GLOBALS"}["amsupsflnmf"]} = $this->get("hdnTaxType");
         ${"GLOBALS"}["hxnewftfdqn"] = "i";
         ${"GLOBALS"}["etqhqirsnh"] = "taxtype";
         $agoclef = "adjustment";
         ${$agoclef} = 0;
         ${${"GLOBALS"}["tgkrfb"]} = 0;
         $qwpblm = "i";
         ${"GLOBALS"}["krxwtxw"] = "fields";
         ${${"GLOBALS"}["whqnrjvsw"]} = getAllTaxes();
         $nxxrnbh = "intObject";
         $mdwcbjhvim = "availTaxes";
         $vaqwwrr = "value";
         $_REQUEST["totalProductCount"] = count($this->_listitems);
         $_REQUEST["taxtype"] = ${${"GLOBALS"}["etqhqirsnh"]};
         $_REQUEST["subtotal"] = 0;
         ${${"GLOBALS"}["pponynktout"]} = $this->getProductFields();
         foreach (${${"GLOBALS"}["krxwtxw"]} as ${${"GLOBALS"}["negltbro"]} => ${$vaqwwrr}) {
             $_REQUEST[${${"GLOBALS"}["mlsoidilfq"]}] = ${${"GLOBALS"}["cqlhrtj"]};
         }
         for (${${"GLOBALS"}["hxnewftfdqn"]} = 1; ${${"GLOBALS"}["jsntgvnqkf"]} <= count($this->_listitems); ${${"GLOBALS"}["jsntgvnqkf"]}++) {
             ${"GLOBALS"}["zepdlqparq"] = "i";
             $_REQUEST["subtotal"] += ${${"GLOBALS"}["pponynktout"]}["productTotal" . ${${"GLOBALS"}["zepdlqparq"]}];
         }
         $klivirms = "intObject";
         $cnavotvg = "globalTaxValue";
         ${"GLOBALS"}["ouawiowlgku"] = "shipTaxValue";
         $_REQUEST["discount_percentage_final"] = $this->get("hdnDiscountPercent");
         $_REQUEST["discount_percentage_final"] = floatval($_REQUEST["discount_percentage_final"]);
         $_REQUEST["discount_amount_final"] = $this->get("hdnDiscountAmount");
         $_REQUEST["discount_amount_final"] = floatval($_REQUEST["discount_amount_final"]);
         $_REQUEST["discount_type_final"] = !empty($_REQUEST["discount_percentage_final"]) ? "percentage" : "amount";
         $_REQUEST["total"] = $_REQUEST["subtotal"];
         if ($_REQUEST["discount_type_final"] == "amount") {
             $_REQUEST["total"] -= $_REQUEST["discount_amount_final"];
         } elseif ($_REQUEST["discount_type_final"] == "percentage") {
             $_REQUEST["total"] -= $_REQUEST["total"] * ($_REQUEST["discount_percentage_final"] / 100);
         }
         ${$cnavotvg} = 0;
         if (${${"GLOBALS"}["amsupsflnmf"]} == "group") {
             ${"GLOBALS"}["yirabwmnwgyp"] = "globalTaxValue";
             $oplkjyxi = "availTaxes";
             foreach (${$oplkjyxi} as ${${"GLOBALS"}["wfuwxbmiwytq"]}) {
                 $psuluqnb = "request_tax_name";
                 $enefpgduf = "tax";
                 ${"GLOBALS"}["wxlvsgkcw"] = "request_tax_name";
                 ${${"GLOBALS"}["hvjpdk"]} = ${$enefpgduf}["taxname"];
                 ${${"GLOBALS"}["wxlvsgkcw"]} = ${${"GLOBALS"}["hvjpdk"]} . "_group_percentage";
                 $lifliipv = "request_tax_name";
                 $_REQUEST[${${"GLOBALS"}["hwivgkl"]}] = isset($this->_groupTax[${${"GLOBALS"}["hwivgkl"]}]) ? $this->_groupTax[${$psuluqnb}] : 0;
                 $bltbxkcxbjyp = "tmpTaxValue";
                 ${${"GLOBALS"}["fvbuscvwjf"]} = $_REQUEST["total"] * ($_REQUEST[${$lifliipv}] / 100);
                 ${${"GLOBALS"}["zjswudci"]} += ${$bltbxkcxbjyp};
             }
             $_REQUEST["total"] += ${${"GLOBALS"}["yirabwmnwgyp"]};
         }
         $_REQUEST["shipping_handling_charge"] = $this->_shippingCost;
         ${${"GLOBALS"}["cxnjuagap"]} = 0;
         $bbluqvmmcrl = "tax";
         foreach (${$mdwcbjhvim} as ${$bbluqvmmcrl}) {
             $rbwcrso = "request_tax_name";
             ${"GLOBALS"}["woxvppdlct"] = "tmpTaxValue";
             $xeqhidsvg = "shipTaxValue";
             ${"GLOBALS"}["rihoezbjibn"] = "tax_name";
             ${${"GLOBALS"}["rihoezbjibn"]} = ${${"GLOBALS"}["wfuwxbmiwytq"]}["taxname"];
             ${$rbwcrso} = ${${"GLOBALS"}["hvjpdk"]} . "_sh_percent";
             $uaabpfjmwc = "request_tax_name";
             $_REQUEST["sh" . ${${"GLOBALS"}["hwivgkl"]}] = isset($this->_shipTaxes[${${"GLOBALS"}["hwivgkl"]}]) ? $this->_shipTaxes[${${"GLOBALS"}["hwivgkl"]}] : 0;
             ${${"GLOBALS"}["fvbuscvwjf"]} = $_REQUEST["shipping_handling_charge"] * ($_REQUEST["sh" . ${$uaabpfjmwc}] / 100);
             ${$xeqhidsvg} += ${${"GLOBALS"}["woxvppdlct"]};
         }
         $_REQUEST["total"] += ${${"GLOBALS"}["ouawiowlgku"]} + $_REQUEST["shipping_handling_charge"];
         $_REQUEST["adjustment"] = floatval($this->get("txtAdjustment"));
         $_REQUEST["total"] += $_REQUEST["adjustment"];
         ${$nxxrnbh} = $this->getInternalObject();
         $intObject->mode = "edit";
         $intObject->isLineItemUpdate = true;
         @saveInventoryProductDetails(${$klivirms}, $this->getModuleName());
         for (${${"GLOBALS"}["jsntgvnqkf"]} = 1; ${${"GLOBALS"}["jsntgvnqkf"]} <= count($this->_listitems); ${$qwpblm}++) {
             ${"GLOBALS"}["xzgznik"] = "values";
             ${${"GLOBALS"}["xzgznik"]} = array();
             $dqnotemwlbq = "params";
             ${$dqnotemwlbq} = array();
             foreach (${${"GLOBALS"}["ogvkpmc"]} as ${${"GLOBALS"}["nctgtuliixp"]}) {
                 ${"GLOBALS"}["fjordnwx"] = "values";
                 ${${"GLOBALS"}["fjordnwx"]}[] = "`" . ${${"GLOBALS"}["nctgtuliixp"]} . "` = ?";
                 ${${"GLOBALS"}["tjyzhfdvth"]}[] = $this->_listitems[${${"GLOBALS"}["jsntgvnqkf"]} - 1][${${"GLOBALS"}["nctgtuliixp"]}];
             }
             if (count(${${"GLOBALS"}["ibmlnecaubpt"]}) > 0) {
                 $nvtwyqcc = "params";
                 $wbzhsv = "i";
                 $glpeqaibe = "params";
                 ${${"GLOBALS"}["tjyzhfdvth"]}[] = $this->getId();
                 $mjhhtobppu = "sql";
                 ${$nvtwyqcc}[] = ${$wbzhsv};
                 ${${"GLOBALS"}["hdblop"]} = "UPDATE vtiger_inventoryproductrel SET " . implode(",", ${${"GLOBALS"}["ibmlnecaubpt"]}) . " WHERE id = ? AND sequence_no = ?";
                 $adb->pquery(${$mjhhtobppu}, ${$glpeqaibe});
             }
         }
     }
     if (!empty(${${"GLOBALS"}["xkutivbm"]})) {
         $wrqjvjvs = "update_query";
         ${"GLOBALS"}["ryhoienvnsn"] = "cur_sym_rate";
         $xepbzcbhw = "update_params";
         ${"GLOBALS"}["ohiigcodbwo"] = "conversion_rate";
         $pcrolhc = "currency_id";
         ${"GLOBALS"}["udferc"] = "conversion_rate";
         $fkgwwhoop = "intObject";
         ${"GLOBALS"}["nglnmk"] = "update_query";
         ${"GLOBALS"}["nvezfxsotm"] = "currency_id";
         if (strpos(${${"GLOBALS"}["nvezfxsotm"]}, "x") !== false) {
             ${"GLOBALS"}["twtpeleg"] = "parts";
             ${${"GLOBALS"}["bbeqpsqwehf"]} = explode("x", ${${"GLOBALS"}["xkutivbm"]});
             ${${"GLOBALS"}["xkutivbm"]} = ${${"GLOBALS"}["twtpeleg"]}[1];
         } else {
             ${"GLOBALS"}["kuscdvfpt"] = "currency_id";
             ${${"GLOBALS"}["kuscdvfpt"]} = ${${"GLOBALS"}["xkutivbm"]};
         }
         $ksoimju = "cur_sym_rate";
         ${$ksoimju} = getCurrencySymbolandCRate(${${"GLOBALS"}["xkutivbm"]});
         ${${"GLOBALS"}["ohiigcodbwo"]} = ${${"GLOBALS"}["ryhoienvnsn"]}["rate"];
         ${"GLOBALS"}["epcnplti"] = "update_params";
         ${$fkgwwhoop} = $this->getInternalObject();
         ${$wrqjvjvs} = "update " . $intObject->table_name . " set currency_id = ?, conversion_rate = ? WHERE " . $intObject->table_index . " = ?";
         ${$xepbzcbhw} = array(${$pcrolhc}, ${${"GLOBALS"}["udferc"]}, $this->_id);
         $adb->pquery(${${"GLOBALS"}["nglnmk"]}, ${${"GLOBALS"}["epcnplti"]});
     }
     if (file_exists(vglobal("root_directory") . DIRECTORY_SEPARATOR . "modules" . DIRECTORY_SEPARATOR . "Invoice" . DIRECTORY_SEPARATOR . "InvoiceHandler.php")) {
         ${"GLOBALS"}["hebripdxg"] = "entityData";
         ${"GLOBALS"}["llplslhg"] = "adb";
         require_once "modules/Invoice/InvoiceHandler.php";
         require_once "include/events/VTEventHandler.inc";
         require_once "data/VTEntityDelta.php";
         ${${"GLOBALS"}["hebripdxg"]} = \VTEntityData::fromEntityId(${${"GLOBALS"}["llplslhg"]}, $this->getId(), $this->getModuleName());
         $omsgxnkjeni = "handler";
         ${$omsgxnkjeni} = new \InvoiceHandler();
         $handler->handleEvent("vtiger.entity.aftersave", ${${"GLOBALS"}["xxguhqgid"]});
     }
     $this->afterTransfer();
     $this->_data = false;
 }