Esempio n. 1
0
 /**	Function used to save the Inventory product details for the passed entity
  *	@param object reference $focus - object reference to which we want to save the product details from REQUEST values where as the entity will be out,in
  *	@param string $module - module name
  *	@param $update_prod_stock - true or false (default), if true we have to update the stock for PO only
  *	@return void
  */
 function saveProductDetails($update_prod_stock = false)
 {
     global $log;
     $log->debug("Entering into function saveProductDetails().");
     global $app_strings;
     $approveProcess = getApproveStatus($this->id);
     if ($approveProcess == $app_strings['CONSTANTS_APPIN']) {
         return;
     }
     if ($this->mode == 'edit') {
         $query = "delete from ec_inventoryproductrel where id='" . $this->id . "'";
         $this->db->query($query);
     }
     $tot_no_prod = $_REQUEST['totalProductCount'];
     $prod_seq = 1;
     for ($i = 1; $i <= $tot_no_prod; $i++) {
         $prod_id = $_REQUEST['hdnProductId' . $i];
         $qty = $_REQUEST['qty' . $i];
         $listprice = $_REQUEST['listPrice' . $i];
         $comment = addslashes($_REQUEST['comment' . $i]);
         //if the product is deleted then we should avoid saving the deleted products
         if (isset($_REQUEST["deleted" . $i]) && $_REQUEST["deleted" . $i] == 1) {
             continue;
         }
         $query = "insert into ec_inventoryproductrel(id, productid, sequence_no, quantity,listprice,comment) values({$this->id}, {$prod_id} , {$prod_seq}, {$qty},{$listprice},'{$comment}')";
         $prod_seq++;
         $this->db->query($query);
         if ($update_prod_stock) {
             $qtyinstock = getPrdQtyInStck($prod_id);
             $lates_qty = $qtyinstock + $qty;
             updateProductQty($prod_id, $lates_qty);
         }
     }
     $query = "update ec_relsettings set total='" . $_REQUEST['total'] . "' where relsettingsid='" . $this->id . "'";
     $this->db->query($query);
     $log->debug("Exit from function saveProductDetails().");
 }
Esempio n. 2
0
$smarty = new CRMSmarty();
if (isset($module_enable_product) && $module_enable_product) {
    $smarty->assign("MODULE_ENABLE_PRODUCT", "true");
}
if (isset($_REQUEST['record']) && $_REQUEST['record'] != '') {
    $focus->id = $_REQUEST['record'];
    $focus->mode = 'edit';
    $focus->retrieve_entity_info($_REQUEST['record'], "Memdays");
    $focus->name = $focus->column_fields['memdayname'];
    if (isset($module_enable_product) && $module_enable_product) {
        $associated_prod = $focus->getAssociatedProducts();
        $smarty->assign("ASSOCIATEDPRODUCTS", $associated_prod);
        $smarty->assign("AVAILABLE_PRODUCTS", 'true');
    }
    if (isset($module_enable_approve) && $module_enable_approve) {
        $approveProcess = getApproveStatus($focus->id);
        if ($approveProcess == $app_strings['CONSTANTS_APPIN']) {
            $smarty->assign("APPIN_PROCESS", $approveProcess);
        }
    }
}
$old_id = '';
if (isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
    $old_id = $_REQUEST['record'];
    $focus->id = "";
    $focus->mode = '';
}
/*
if(empty($focus->column_fields['memdayname'])) {
	$focus->column_fields['memdayname'] = "GD".date("Ymd")."-".$focus->get_next_id();
}