diff --git a/include/class_acc_ledger_purchase.php b/include/class_acc_ledger_purchase.php index 4cfecd7e8..212bcc8b4 100644 --- a/include/class_acc_ledger_purchase.php +++ b/include/class_acc_ledger_purchase.php @@ -473,7 +473,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger // always save quantity but in withStock we can find // what card need a stock management if ( $g_parameter->MY_STOCK='Y'&& isset ($repo)) - Stock_Goods::insert_goods(array('db'=>$this->db,'j_id'=>$j_id,'goods'=>${'e_march'.$i},'quant'=>$nNeg*${'e_quant'.$i},'dir'=>'d','repo'=>$repo)) ; + Stock_Goods::insert_goods($this->db,array('j_id'=>$j_id,'goods'=>${'e_march'.$i},'quant'=>$nNeg*${'e_quant'.$i},'dir'=>'d','repo'=>$repo)) ; if ( $g_parameter->MY_ANALYTIC != "nu" ) { diff --git a/include/class_acc_ledger_sold.php b/include/class_acc_ledger_sold.php index 07fb32886..0e666e601 100644 --- a/include/class_acc_ledger_sold.php +++ b/include/class_acc_ledger_sold.php @@ -39,6 +39,7 @@ require_once('ac_common.php'); require_once('class_own.php'); require_once('class_itva_popup.php'); require_once('class_acc_ledger_fin.php'); +require_once 'class_stock_goods.php'; /*!\brief Handle the ledger of sold, * @@ -354,7 +355,7 @@ class Acc_Ledger_Sold extends Acc_Ledger // always save quantity but in withStock we can find // what card need a stock management if ( $g_parameter->MY_STOCK='Y' && isset ($repo)) - Stock_Goods::insert_goods(array('db'=>$this->db,'j_id'=>$j_id,'goods'=>${'e_march'.$i},'quant'=>$nNeg*${'e_quant'.$i},'dir'=>'c','repo'=>$repo)) ; + Stock_Goods::insert_goods($this->db,array('j_id'=>$j_id,'goods'=>${'e_march'.$i},'quant'=>$nNeg*${'e_quant'.$i},'dir'=>'c','repo'=>$repo)) ; if ( $g_parameter->MY_ANALYTIC != "nu" ) diff --git a/include/class_stock_goods.php b/include/class_stock_goods.php index 7178a7dee..d56235768 100644 --- a/include/class_stock_goods.php +++ b/include/class_stock_goods.php @@ -75,7 +75,7 @@ class Stock_Goods extends Stock_Goods_Sql $sg_code[$e]->setReadOnly($p_readonly); $sg_quantity[$e]->setReadOnly($p_readonly); } -// require_once 'template/stock_inv.php'; + require_once 'template/stock_inv.php'; } function save($p_array) @@ -123,19 +123,20 @@ class Stock_Goods extends Stock_Goods_Sql } /** * Insert into stock_goods from ACH and VEN - * @param type $p_array KEY : db => database conx, j_id => jrnx.j_id,goods=> f_id of the goods + * @param type $p_array KEY : db => database conx, j_id => jrnx.j_id,goods=> f_id of the goods * 'quant' => quantity ,'dir'=> d or c (c for sales OUT and d for purchase IN),'repo'=>r_id of the * repository (stock_repository.r_id */ static function insert_goods(&$p_cn,$p_array) { global $g_user; - if ($g_user->can_write_repo($p_depot) == false) + extract ($p_array); + if ($g_user->can_write_repo($repo) == false) return false; // Retrieve the good account for stock $code = new Fiche($p_cn); - $code->get_by_qcode($p_good); + $code->get_by_qcode($goods); $code_marchandise = $code->strAttribut(ATTR_DEF_STOCK); if ($code_marchandise == NOTFOUND || $code_marchandise=='') return false;