Bug dans les stock : insert_stock
This commit is contained in:
parent
fca15b2a8e
commit
4395b539b7
3 changed files with 8 additions and 6 deletions
|
|
@ -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" )
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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" )
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue