remove last bug

This commit is contained in:
Dany De Bontridder 2013-05-22 17:29:57 +00:00
parent d3a21e6a41
commit 5920200396

View file

@ -492,10 +492,10 @@ class Acc_Operation
$ledger_id=$this->get_ledger();
if ( $ledger_id=='') throw new Exception('Journal non trouvé');
$oledger=new Acc_Ledger($this->db,$ledger_id);
// retrieve info from jrn_info
switch($oledger->get_type())
{
case 'VEN':
@ -508,7 +508,8 @@ class Acc_Operation
$ret=new Acc_Fin($this->db,$this->jr_id);
break;
default:
return $this->get();
$ret=new Acc_Misc($this->db,$this->jr_id);
break;
}
$ret->get();
if ( empty($ret->det->array))
@ -530,16 +531,16 @@ class Acc_Operation
// other info
$array=$this->db->get_value("select ji_value from jrn_info where
jr_id=$1 and id_type=$2",array($this->jr_id,'OTHER'));
$this->info->other= $array['ji_value'];
$this->info->other= $array;
// Bon de commande
$array=$this->db->get_value("select * from jrn_info where
$array=$this->db->get_value("select ji_value from jrn_info where
jr_id=$1 and id_type=$2",array($this->jr_id,'BON_COMMANDE'));
$this->info->command= $array['ji_value'];
$this->info->command= $array;
}
/**
* Save into jrn_info
* Save into jrn_info
* @param $p_info msg to save
* @param $p_type is OTHER or BON_COMMAND
*/
@ -547,17 +548,17 @@ class Acc_Operation
{
if ( ! in_array($p_type,array('OTHER','BON_COMMANDE'))) return;
if (trim($p_info)=="") {
$this->db->exec_sql('delete from jrn_info where jr_id=$1 and id_type=$2',array($this->jr_id,$p_TYPE));
$this->db->exec_sql('delete from jrn_info where jr_id=$1 and id_type=$2',array($this->jr_id,$p_type));
return;
}
$exist=$this->db->get_value('select count(ji_id) from jrn_info where jr_id=$1 and id_type=$2',array($this->jr_id,$p_TYPE));
$exist=$this->db->get_value('select count(ji_id) from jrn_info where jr_id=$1 and id_type=$2',array($this->jr_id,$p_type));
if ( $exist == "0" ) {
//insert into jrn_info
$this->db->exec_sql('insert into jrn_info(jr_id,id_type,ji_value) values ($1,$2,$3)',
array($this->jr_id,$p_type,$p_info));
} elseif ( $exist == 1) {
//update
$this->db->exec_sql('update jrn_info set id_type=$2,ji_value=$3 where jr_id=$1',
$this->db->exec_sql('update jrn_info set ji_value=$3 where jr_id=$1 and id_type=$2',
array($this->jr_id,$p_type,$p_info));
}
}