Пример #1
0
 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);
         if (vtlib_isModuleActive("InventoryDetails")) {
             InventoryDetails::createInventoryDetails($this, 'PurchaseOrder');
         }
     }
     //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);
 }
Пример #2
0
 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') {
         //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);
 }
Пример #3
0
 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);
 }
Пример #4
0
 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);
 }
Пример #5
0
 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);
 }
Пример #6
0
 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);
 }
Пример #7
0
 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');
         if (vtlib_isModuleActive("InventoryDetails")) {
             InventoryDetails::createInventoryDetails($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);
 }