Ejemplo n.º 1
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 (inventoryCanSaveProductLines($_REQUEST, 'SalesOrder')) {
         //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);
 }
Ejemplo n.º 2
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);
 }
Ejemplo n.º 3
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);
 }
Ejemplo n.º 4
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 (inventoryCanSaveProductLines($_REQUEST)) {
                 //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);
 }