From 59202003969a0cf7ed20198da17cbf9bfa175699 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Wed, 22 May 2013 17:29:57 +0000 Subject: [PATCH] remove last bug --- include/class_acc_operation.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/include/class_acc_operation.php b/include/class_acc_operation.php index b7f906552..0ee087afd 100644 --- a/include/class_acc_operation.php +++ b/include/class_acc_operation.php @@ -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)); } }