/** Function to handle the module specific save operations */ function save_module($module) { //in ajax save we should not call this function, because this will delete all the existing product values if (isset($_REQUEST)) { //SalesPlatform.ru begin fix empty updating line items from handlers if ($_REQUEST['action'] != 'ConsignmentAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates' && $this->isLineItemUpdate != false) { //if($_REQUEST['action'] != 'ConsignmentAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' // && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') //{ //SalesPlatform.ru end //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'Consignment'); } } // Update the currency id and the conversion rate for the Consignment $update_query = "update vtiger_sp_consignment set currency_id=?, conversion_rate=? where consignmentid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $this->db->pquery($update_query, $update_params); // Auto-generation for goods consignment no if ($this->column_fields['has_goods_consignment'] == 'on' && (empty($this->column_fields['goods_consignment_no']) || $this->column_fields['goods_consignment_no'] == 0)) { $res = $this->db->query('select max(goods_consignment_no) as max_no from vtiger_sp_consignment join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_sp_consignment.consignmentid where vtiger_crmentity.deleted=0'); if ($this->db->num_rows($res) > 0) { $this->column_fields['goods_consignment_no'] = $this->db->query_result($res, 0, 'max_no') + 1; $update_query = "update vtiger_sp_consignment set goods_consignment_no=? where consignmentid=?"; $update_params = array($this->db->query_result($res, 0, 'max_no') + 1, $this->id); } else { $this->column_fields['goods_consignment_no'] = 1; $update_query = "update vtiger_sp_consignment set goods_consignment_no=? where consignmentid=?"; $update_params = array($this->column_fields['goods_consignment_no'] = 1, $this->id); } $this->db->pquery($update_query, $update_params); } }
/** Function to handle the module specific save operations */ function save_module($module) { global $updateInventoryProductRel_deduct_stock; $updateInventoryProductRel_deduct_stock = true; //in ajax save we should not call this function, because this will delete all the existing product values if (isset($this->_recurring_mode) && $this->_recurring_mode == 'recurringinvoice_from_so' && isset($this->_salesorderid) && $this->_salesorderid != '') { // We are getting called from the RecurringInvoice cron service! $this->createRecurringInvoiceFromSO(); } else { if (isset($_REQUEST)) { if ($_REQUEST['action'] != 'InvoiceAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates' && $_REQUEST['action'] != 'SaveAjax' && $this->isLineItemUpdate != false && $_REQUEST['action'] != 'FROM_WS') { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'Invoice'); } else { if ($_REQUEST['action'] == 'InvoiceAjax' || $_REQUEST['action'] == 'MassEditSave' || $_REQUEST['action'] == 'FROM_WS') { $updateInventoryProductRel_deduct_stock = false; } } } } // Update the currency id and the conversion rate for the invoice $update_query = "update vtiger_invoice set currency_id=?, conversion_rate=? where invoiceid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $this->db->pquery($update_query, $update_params); }
function save_module() { global $adb; //in ajax save we should not call this function, because this will delete all the existing product values if ($_REQUEST['action'] != 'QuotesAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates' && $_REQUEST['action'] != 'SaveAjax' && $this->isLineItemUpdate != false) { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'Quotes'); } // Update the currency id and the conversion rate for the quotes $update_query = "update vtiger_quotes set currency_id=?, conversion_rate=? where quoteid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $adb->pquery($update_query, $update_params); $tot_no_prod = $_REQUEST['totalProductCount']; $calculationList = array(); for ($i = 1; $i <= $tot_no_prod; $i++) { $calculationsid = vtlib_purify($_REQUEST['calculationId' . $i]); $calculationsid_old = vtlib_purify($_REQUEST['old_calculationId' . $i]); if ($calculationsid_old != '' && !in_array($calculationsid_old, $calculationList) && $calculationsid != $calculationsid_old) { $this->delete_related_module('Quotes', $this->id, 'Calculations', $calculationsid_old); } if ($calculationsid != '') { $calculationList[] = $calculationsid; $this->save_related_module('Quotes', $this->id, 'Calculations', $calculationsid); } } }
function save_module($module) { global $adb; //in ajax save we should not call this function, because this will delete all the existing product values if ($_REQUEST['action'] != 'PurchaseOrderAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'PurchaseOrder', $this->update_prod_stock); } //In Ajax edit, if the status changed to Received Shipment then we have to update the product stock if ($_REQUEST['action'] == 'PurchaseOrderAjax' && $this->update_prod_stock == 'true') { $inventory_res = $this->db->pquery("select productid, quantity from vtiger_inventoryproductrel where id=?", array($this->id)); $noofproducts = $this->db->num_rows($inventory_res); //We have to update the stock for all the products in this PO for ($prod_count = 0; $prod_count < $noofproducts; $prod_count++) { $productid = $this->db->query_result($inventory_res, $prod_count, 'productid'); $quantity = $this->db->query_result($inventory_res, $prod_count, 'quantity'); $this->db->println("Stock is going to be updated for the productid - {$productid} with quantity - {$quantity}"); addToProductStock($productid, $quantity); } } // Update the currency id and the conversion rate for the purchase order $update_query = "update vtiger_purchaseorder set currency_id=?, conversion_rate=? where purchaseorderid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $adb->pquery($update_query, $update_params); }
function save_module($module) { global $updateInventoryProductRel_deduct_stock; if ($this->HasDirectImageField) { $this->insertIntoAttachment($this->id, $module); } $updateInventoryProductRel_deduct_stock = true; //Checking if quote_id is present and updating the quote status if ($this->column_fields['quote_id'] != '') { $newStatus = GlobalVariable::getVariable('QuoteStatusOnSalesOrderSave', 'Accepted'); if ($newStatus != 'DoNotChange') { $qt_id = $this->column_fields['quote_id']; $query1 = 'update vtiger_quotes set quotestage=? where quoteid=?'; $this->db->pquery($query1, array($newStatus, $qt_id)); } } //in ajax save we should not call this function, because this will delete all the existing product values if ($_REQUEST['action'] != 'SalesOrderAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'SalesOrder'); if (vtlib_isModuleActive("InventoryDetails")) { InventoryDetails::createInventoryDetails($this, 'SalesOrder'); } } else { if ($_REQUEST['action'] == 'SalesOrderAjax' || $_REQUEST['action'] == 'MassEditSave') { $updateInventoryProductRel_deduct_stock = false; } } // Update the currency id and the conversion rate for the sales order $update_query = "update vtiger_salesorder set currency_id=?, conversion_rate=? where salesorderid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $this->db->pquery($update_query, $update_params); }
function save_module() { global $adb; //in ajax save we should not call this function, because this will delete all the existing product values if ($_REQUEST['action'] != 'QuotesAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave') { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'Quotes'); } // Update the currency id and the conversion rate for the quotes $update_query = "update vtiger_quotes set currency_id=?, conversion_rate=? where quoteid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $adb->pquery($update_query, $update_params); }
function save_module($module) { //Checking if quote_id is present and updating the quote status if ($this->column_fields["quote_id"] != '') { $qt_id = $this->column_fields["quote_id"]; $query1 = "update vtiger_quotes set quotestage='Accepted' where quoteid=?"; $this->db->pquery($query1, array($qt_id)); } //in ajax save we should not call this function, because this will delete all the existing product values if ($_REQUEST['action'] != 'SalesOrderAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'SalesOrder'); } // Update the currency id and the conversion rate for the sales order $update_query = "update vtiger_salesorder set currency_id=?, conversion_rate=? where salesorderid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $this->db->pquery($update_query, $update_params); }
function save_module($module) { global $adb; if ($this->HasDirectImageField) { $this->insertIntoAttachment($this->id, $module); } //in ajax save we should not call this function, because this will delete all the existing product values if (inventoryCanSaveProductLines($_REQUEST)) { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'PurchaseOrder'); if (vtlib_isModuleActive("InventoryDetails")) { InventoryDetails::createInventoryDetails($this, 'PurchaseOrder'); } } // Update the currency id and the conversion rate for the purchase order $update_query = "update vtiger_purchaseorder set currency_id=?, conversion_rate=? where purchaseorderid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $adb->pquery($update_query, $update_params); }
function save_module($module) { global $adb; if ($this->HasDirectImageField) { $this->insertIntoAttachment($this->id, $module); } //in ajax save we should not call this function, because this will delete all the existing product values if ($_REQUEST['action'] != 'QuotesAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'Quotes'); if (vtlib_isModuleActive("InventoryDetails")) { InventoryDetails::createInventoryDetails($this, 'Quotes'); } } // Update the currency id and the conversion rate for the quotes $update_query = "update vtiger_quotes set currency_id=?, conversion_rate=? where quoteid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $adb->pquery($update_query, $update_params); }
/** Function to handle the module specific save operations */ function save_module($module) { //in ajax save we should not call this function, because this will delete all the existing product values if (isset($_REQUEST)) { //SalesPlatform.ru begin if ($_REQUEST['action'] != 'SaveAjax' && $_REQUEST['action'] != 'ActAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') { //if($_REQUEST['action'] != 'ActAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' // && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') //{ //SalesPlatform.ru end //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'Act'); } } // Update the currency id and the conversion rate for the act $update_query = "update vtiger_sp_act set currency_id=?, conversion_rate=? where actid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $this->db->pquery($update_query, $update_params); // Update Invoice Act id field if ($_REQUEST['sourceModule'] == 'Invoice' && $_REQUEST['sourceRecord'] != null) { $this->db->pquery("update vtiger_invoice set sp_act_id = ? where invoiceid = ?", array($this->id, $_REQUEST['sourceRecord'])); } }
function save_module($module) { global $adb, $updateInventoryProductRel_deduct_stock; $updateInventoryProductRel_deduct_stock = false; //in ajax save we should not call this function, because this will delete all the existing product values if ($_REQUEST['action'] != $module . 'Ajax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates' && $_REQUEST['action'] != 'SaveAjax' && $this->isLineItemUpdate != false) { $requestProductIdsList = $requestQuantitiesList = array(); $totalNoOfProducts = $_REQUEST['totalProductCount']; for ($i = 1; $i <= $totalNoOfProducts; $i++) { $productId = $_REQUEST['hdnProductId' . $i]; $requestProductIdsList[$productId] = $productId; $requestQuantitiesList[$productId] = $_REQUEST['qty' . $i]; } saveInventoryProductDetails($this, $module, $this->update_prod_stock); if ($this->mode != '') { $updateInventoryProductRel_deduct_stock = true; } // Update the currency id and the conversion rate for the invoice $update_query = "update vtiger_osscosts set currency_id=?,conversion_rate=? where osscostsid=?"; $update_params = array($_REQUEST['currency_id'], $_REQUEST['conversion_rate'], $this->id); $this->db->pquery($update_query, $update_params); } }
/** Function to handle the module specific save operations */ function save_module($module) { //Checking if vtiger_salesorderid is present and updating the quote status if ($this->column_fields["salesorder_id"] != '') { $so_id = $this->column_fields["salesorder_id"]; $query1 = "update vtiger_salesorder set sostatus='Approved' where salesorderid=?"; $this->db->pquery($query1, array($so_id)); } //in ajax save we should not call this function, because this will delete all the existing product values if (isset($_REQUEST)) { if ($_REQUEST['action'] != 'InvoiceAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave') { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails(&$this, 'Invoice'); } } if (isset($this->_recurring_mode) && $this->_recurring_mode == 'recurringinvoice_from_so' && isset($this->_salesorderid) && $this->_salesorderid != '') { $this->createRecurringInvoiceFromSO(); } // Update the currency id and the conversion rate for the invoice $update_query = "update vtiger_invoice set currency_id=?, conversion_rate=? where invoiceid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $this->db->pquery($update_query, $update_params); }
function save_module($module) { global $updateInventoryProductRel_deduct_stock; if ($this->HasDirectImageField) { $this->insertIntoAttachment($this->id, $module); } $updateInventoryProductRel_deduct_stock = true; //in ajax save we should not call this function, because this will delete all the existing product values if (inventoryCanSaveProductLines($_REQUEST, 'Issuecards')) { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'Issuecards'); if (vtlib_isModuleActive("InventoryDetails")) { InventoryDetails::createInventoryDetails($this, 'Issuecards'); } } else { if ($_REQUEST['action'] == 'IssuecardsAjax' || $_REQUEST['action'] == 'MassEditSave') { $updateInventoryProductRel_deduct_stock = false; } } // Update the currency id and the conversion rate for the invoice $update_query = "update vtiger_issuecards set currency_id=?, conversion_rate=? where issuecardid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $this->db->pquery($update_query, $update_params); }
public function save() { $adb = PearDatabase::getInstance(); if (!empty($this->_id)) { $this->_changedProducts = true; if ($this->_listitems === false) { $this->_loadProducts(); } } parent::save(); if (!empty($this->_currencyID)) { $currency_id = $this->_currencyID; } else { $currency_id = false; } #$internalObject = $this->getInternalObject(); $this->clearData(); if ($this->_changedProducts === true) { $taxtype = $this->get("hdnTaxType"); $adjustment = 0; $shipping_handling_charge = 0; $availTaxes = getAllTaxes(); $counter = 1; $_REQUEST['totalProductCount'] = count($this->_listitems); $_REQUEST['taxtype'] = $taxtype; $_REQUEST['subtotal'] = 0; foreach ($this->_listitems as $product) { $_REQUEST["deleted" . $counter] = 0; $_REQUEST["hdnProductId" . $counter] = $product["productid"]; $_REQUEST["productDescription" . $counter] = $product["description"]; $_REQUEST["qty" . $counter] = $product["quantity"]; $_REQUEST["listPrice" . $counter] = $product["unitprice"]; $_REQUEST["comment" . $counter] = $product["comment"]; if (!empty($product["discount_percent"])) { $_REQUEST["discount_type" . $counter] = "percentage"; $product["discount_amount"] = 0; } elseif (!empty($product["discount_amount"])) { $_REQUEST["discount_type" . $counter] = "amount"; $product["discount_percent"] = 0; } $_REQUEST["discount_percentage" . $counter] = $product["discount_percent"]; $_REQUEST["discount_amount" . $counter] = $product["discount_amount"]; $productTotal = 0; $taxValue = 0; $productTotal += $_REQUEST["qty" . $counter] * $_REQUEST["listPrice" . $counter] - $_REQUEST["discount_amount" . $counter]; if ($product["discount_percent"] > 0) { $productTotal = $productTotal * (1 - $product["discount_percent"] / 100); } foreach ($availTaxes as $tax) { if (isset($product["tax" . $tax["taxid"]]) && !empty($product["tax" . $tax["taxid"]])) { if ($taxtype == "group") { # $tax_name = $tax['taxname']; # $request_tax_name = $tax_name."_group_percentage"; # $_REQUEST[$request_tax_name] = $product["tax".$tax["taxid"]]; } else { $tax_name = $tax['taxname']; $request_tax_name = $tax_name . "_percentage" . $counter; $_REQUEST[$request_tax_name] = $product["tax" . $tax["taxid"]]; $tmpTaxValue = $productTotal * ($product["tax" . $tax["taxid"]] / 100); $taxValue += $tmpTaxValue; $productTotal += $tmpTaxValue; } } else { $tax_name = $tax['taxname']; $request_tax_name = $tax_name . "_percentage" . $counter; $_REQUEST[$request_tax_name] = 0; } } $_REQUEST['subtotal'] += $productTotal; $counter++; } $_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); } $globalTaxValue = 0; if ($taxtype == "group") { foreach ($availTaxes as $tax) { $tax_name = $tax['taxname']; $request_tax_name = $tax_name . "_group_percentage"; $_REQUEST[$request_tax_name] = isset($this->_groupTax[$request_tax_name]) ? $this->_groupTax[$request_tax_name] : 0; $tmpTaxValue = $_REQUEST['total'] * ($_REQUEST[$request_tax_name] / 100); $globalTaxValue += $tmpTaxValue; } $_REQUEST['total'] += $globalTaxValue; } $_REQUEST['shipping_handling_charge'] = $this->_shippingCost; $shipTaxValue = 0; foreach ($availTaxes as $tax) { $tax_name = $tax['taxname']; $request_tax_name = $tax_name . "_sh_percent"; $_REQUEST["sh" . $request_tax_name] = isset($this->_shipTaxes[$request_tax_name]) ? $this->_shipTaxes[$request_tax_name] : 0; $tmpTaxValue = $_REQUEST['shipping_handling_charge'] * ($_REQUEST["sh" . $request_tax_name] / 100); $shipTaxValue += $tmpTaxValue; } $_REQUEST['total'] += $shipTaxValue + $_REQUEST['shipping_handling_charge']; $_REQUEST['adjustment'] = floatval($this->get("txtAdjustment")); $_REQUEST['total'] += $_REQUEST['adjustment']; $intObject = $this->getInternalObject(); $intObject->mode = "edit"; ob_start(); saveInventoryProductDetails($intObject, $this->getModuleName()); ob_end_clean(); } if (!empty($currency_id)) { if (strpos($currency_id, "x") !== false) { $parts = explode("x", $currency_id); $currency_id = $parts[1]; } else { $currency_id = $currency_id; } $cur_sym_rate = getCurrencySymbolandCRate($currency_id); $conversion_rate = $cur_sym_rate['rate']; $intObject = $this->getInternalObject(); $update_query = "update " . $intObject->table_name . " set currency_id = ?, conversion_rate = ? WHERE " . $intObject->table_index . " = ?"; $update_params = array($currency_id, $conversion_rate, $this->_id); #var_dump($update_query, $update_params); $adb->pquery($update_query, $update_params); } // Update the currency id and the conversion rate for the sales order }
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; }
function save_module($module) { global $updateInventoryProductRel_deduct_stock; $updateInventoryProductRel_deduct_stock = true; //Checking if salesorderid is present and updating the SO status if (!empty($this->column_fields['salesorder_id'])) { $newStatus = GlobalVariable::getVariable('SalesOrderStatusOnInvoiceSave', 'Approved'); if ($newStatus != 'DoNotChange') { $so_id = $this->column_fields['salesorder_id']; $query1 = 'update vtiger_salesorder set sostatus=? where salesorderid=?'; $this->db->pquery($query1, array($newStatus, $so_id)); } } //in ajax save we should not call this function, because this will delete all the existing product values if (isset($this->_recurring_mode) && $this->_recurring_mode == 'recurringinvoice_from_so' && isset($this->_salesorderid) && $this->_salesorderid != '') { // We are getting called from the RecurringInvoice cron service! $this->createRecurringInvoiceFromSO(); if (vtlib_isModuleActive("InventoryDetails")) { InventoryDetails::createInventoryDetails($this, 'Invoice'); } } else { if (isset($_REQUEST)) { if ($_REQUEST['action'] != 'InvoiceAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates') { //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'Invoice'); if (vtlib_isModuleActive("InventoryDetails")) { InventoryDetails::createInventoryDetails($this, 'Invoice'); } } else { if ($_REQUEST['action'] == 'InvoiceAjax' || $_REQUEST['action'] == 'MassEditSave') { $updateInventoryProductRel_deduct_stock = false; } } } } // Update the currency id and the conversion rate for the invoice $update_query = "update vtiger_invoice set currency_id=?, conversion_rate=? where invoiceid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $this->db->pquery($update_query, $update_params); }
function save_module($module) { global $adb, $updateInventoryProductRel_deduct_stock; $updateInventoryProductRel_deduct_stock = false; //in ajax save we should not call this function, because this will delete all the existing product values if ($_REQUEST['action'] != 'PurchaseOrderAjax' && $_REQUEST['ajxaction'] != 'DETAILVIEW' && $_REQUEST['action'] != 'MassEditSave' && $_REQUEST['action'] != 'ProcessDuplicates' && $_REQUEST['action'] != 'SaveAjax' && $this->isLineItemUpdate != false && $_REQUEST['action'] != 'FROM_WS') { $requestProductIdsList = $requestQuantitiesList = array(); $totalNoOfProducts = $_REQUEST['totalProductCount']; for ($i = 1; $i <= $totalNoOfProducts; $i++) { $productId = $_REQUEST['hdnProductId' . $i]; $requestProductIdsList[$productId] = $productId; if (array_key_exists($productId, $requestQuantitiesList)) { $requestQuantitiesList[$productId] = $requestQuantitiesList[$productId] + $_REQUEST['qty' . $i]; continue; } $requestQuantitiesList[$productId] = $_REQUEST['qty' . $i]; } if ($this->mode == '' && $this->column_fields['postatus'] === 'Received Shipment') { //Updating Product stock quantity during create mode foreach ($requestProductIdsList as $productId) { addToProductStock($productId, $requestQuantitiesList[$productId]); } } else { if ($this->column_fields['postatus'] === 'Received Shipment' && $this->mode != '') { //Updating Product stock quantity during edit mode $recordId = $this->id; $result = $adb->pquery("SELECT productid, quantity FROM vtiger_inventoryproductrel WHERE id = ?", array($recordId)); $numOfRows = $adb->num_rows($result); for ($i = 0; $i < $numOfRows; $i++) { $productId = $adb->query_result($result, $i, 'productid'); $productIdsList[$productId] = $productId; $quantitiesList[$productId] = $adb->query_result($result, $i, 'quantity'); } $newProductIds = array_diff($requestProductIdsList, $productIdsList); if ($newProductIds) { foreach ($newProductIds as $productId) { addToProductStock($productId, $requestQuantitiesList[$productId]); } } $deletedProductIds = array_diff($productIdsList, $requestProductIdsList); if ($deletedProductIds) { foreach ($deletedProductIds as $productId) { $productStock = getPrdQtyInStck($productId); $quantity = $productStock - $quantitiesList[$productId]; updateProductQty($productId, $quantity); } } $updatedProductIds = array_intersect($productIdsList, $requestProductIdsList); if ($updatedProductIds) { foreach ($updatedProductIds as $productId) { $quantityDiff = $quantitiesList[$productId] - $requestQuantitiesList[$productId]; if ($quantityDiff < 0) { $quantityDiff = -$quantityDiff; addToProductStock($productId, $quantityDiff); } elseif ($quantityDiff > 0) { $productStock = getPrdQtyInStck($productId); $quantity = $productStock - $quantityDiff; updateProductQty($productId, $quantity); } } } } } //Based on the total Number of rows we will save the product relationship with this entity saveInventoryProductDetails($this, 'PurchaseOrder', $this->update_prod_stock); if ($this->mode != '') { $updateInventoryProductRel_deduct_stock = true; } } // Update the currency id and the conversion rate for the purchase order $update_query = "update vtiger_purchaseorder set currency_id=?, conversion_rate=? where purchaseorderid=?"; $update_params = array($this->column_fields['currency_id'], $this->column_fields['conversion_rate'], $this->id); $adb->pquery($update_query, $update_params); }
$_REQUEST['listPrice1'] = $listprice = 4300; $_REQUEST['comment1'] = "This is test comment for product of Invoice"; $_REQUEST['deleted1'] = 0; $_REQUEST['discount_type1'] = 'amount'; $_REQUEST['discount_amount1'] = $discount_amount = '300'; $_REQUEST['taxtype'] = $taxtype = 'individual'; $_REQUEST['subtotal'] = $subtotal = $qty * $listprice - $discount_amount; $_REQUEST['discount_type_final'] = 'amount'; $_REQUEST['discount_amount_final'] = $discount_amount_final = '100'; $_REQUEST['shipping_handling_charge'] = $shipping_handling_charge = '50'; $_REQUEST['adjustmenttype'] = '+'; $_REQUEST['adjustment'] = $adjustment = '100'; $_REQUEST['total'] = $subtotal - $discount_amount_final + $shipping_handling_charge + $adjustment; //Upto this added to set the request values which will be used to save the inventory product details //Now call the saveInventoryProductDetails function saveInventoryProductDetails($invoice, 'Invoice'); } //Populate Email Data $esubj_array = array("Vtiger 5.0.3 Released", "Try vtigercrm!", "Hi There!!!", "Welcome to Open Source", "Help needed in customization of Vtiger"); $startdate_array = array("2007-07-27", "2007-05-09", "2007-04-05", "2007-11-01", "2007-08-18"); $filename_array = array("vtiger5alpha.tar.gz", "zohowriter.zip", "hi.doc", "welcome.pps", "sos.doc"); $to_array = array("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**"); $cc_array = array("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**"); $bcc_array = array("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**"); $from_array = array("*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**", "*****@*****.**"); $body_array = array("This release has close to 500 fixes in it and has gone through almost 7 rounds of validation. We think it is a stable product that you can directly use in deployment! ", "Nice to have you visit us, very nice of you. Stay for sometime and have a look at our product. I am sure you will like it", "This will take some time to fix. Can you provide me more details please?", "What a cool tool! I wish I had found it earlier. Oh it has a lot of my friends name in it too! I too can contribute. But how?", "Urgent. I need this done last week! Guys, you are the ones I am depending on. Do something!"); for ($i = 0; $i < 5; $i++) { $email = new Emails(); $email->column_fields["assigned_user_id"] = $assigned_user_id; $rand = array_rand($num_array); $email->column_fields["subject"] = $esubj_array[$i];