diff --git a/html/ajax_ledger.php b/html/ajax_ledger.php index 8296f25cc..d0ee730ac 100644 --- a/html/ajax_ledger.php +++ b/html/ajax_ledger.php @@ -470,6 +470,12 @@ case 'save': $op=new Anc_Operation($cn); $op->save_update_form($_POST); } + ////////////////////////////////////////////////////////////////// + //Save other info + ////////////////////////////////////////////////////////////////// + $op->save_info($_POST['OTHER'],'OTHER'); + $op->save_info($_POST['BON_COMMANDE'],'BON_COMMANDE'); + } echo _('Opération sauvée'); $cn->commit(); diff --git a/html/js/acc_ledger.js b/html/js/acc_ledger.js index e8884ab6a..7bf3a33d5 100644 --- a/html/js/acc_ledger.js +++ b/html/js/acc_ledger.js @@ -141,7 +141,7 @@ function update_bank() } /** - *ask the name, quick_code of the bank for the ledger + * Update the number of rows when changing of ledger */ function update_row(ctl) { diff --git a/html/js/infobulle.js b/html/js/infobulle.js index 8c93e39b4..8770142fa 100644 --- a/html/js/infobulle.js +++ b/html/js/infobulle.js @@ -57,6 +57,9 @@ content[26]="Donnez une partie du quickcode, nom, description... pour filtrer"; content[27]="Attention, SI la fiche a changé de poste comptable, c'est seulement le dernier qui est affiché"; content[28]="Attention Différence entre TVA calculée et donnée"; content[29]="Si vous ne donnez pas de nom, ce sera le nom du fichier qui sera utilisé"; +content[30]="Peut contenir une information telle que le message structuré sur le virement"; +content[31]="Peut contenir un numéro de bon de commande"; + function showBulle(p_ctl) { d=document.getElementById('bulle'); diff --git a/html/js/scripts.js b/html/js/scripts.js index cc1bc21b0..5cee7cd07 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -1040,7 +1040,7 @@ function mod_predf_op(dossier_id,od_id) removeDiv(target); var sx='20%'; var sy='20%'; - var str_style="top:"+sx+";left:"+sy; + var str_style="top:"+sx+";left:"+sy+'width:60%;'; var div={id:target, cssclass:'inner_box',style:str_style,html:loading(),drag:1}; diff --git a/include/class_acc_ledger.php b/include/class_acc_ledger.php index eadb4707a..7b9b4cd73 100644 --- a/include/class_acc_ledger.php +++ b/include/class_acc_ledger.php @@ -2713,7 +2713,9 @@ class Acc_Ledger extends jrn_def_sql $desc = sql_string($desc); $fil_desc = $and . " ( upper(jr_comment) like upper('%" . $desc . "%') or upper(jr_pj_number) like upper('%" . $desc . "%') " . " or upper(jr_internal) like upper('%" . $desc . "%') - or jr_grpt_id in (select j_grpt from jrnx where j_text ~* '" . $desc . "'))"; + or jr_grpt_id in (select j_grpt from jrnx where j_text ~* '" . $desc . "') + or jr_id in (select jr_id from jrn_info where ji_value is not null and ji_value ~* '$desc') + )"; $and = " and "; } // Poste diff --git a/include/class_acc_operation.php b/include/class_acc_operation.php index 356af537a..b7f906552 100644 --- a/include/class_acc_operation.php +++ b/include/class_acc_operation.php @@ -492,7 +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': @@ -513,8 +516,51 @@ class Acc_Operation $ret=new Acc_Misc($this->db,$this->jr_id); $ret->get(); } + $ret->get_info(); return $ret; } + /** + * @brief retrieve info from the jrn_info, create 2 new arrays + * obj->info->command and obj->info->other + * the columns are the idx + */ + function get_info() + { + $this->info=new stdClass(); + // 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']; + + // Bon de commande + $array=$this->db->get_value("select * from jrn_info where + jr_id=$1 and id_type=$2",array($this->jr_id,'BON_COMMANDE')); + $this->info->command= $array['ji_value']; + + } + /** + * Save into jrn_info + * @param $p_info msg to save + * @param $p_type is OTHER or BON_COMMAND + */ + function save_info($p_info,$p_type) + { + 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)); + 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)); + 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', + array($this->jr_id,$p_type,$p_info)); + } + } static function test_me() { $_SESSION['g_user']='phpcompta'; diff --git a/include/template/ledger_detail_bottom.php b/include/template/ledger_detail_bottom.php index abb958a5b..240010cad 100644 --- a/include/template/ledger_detail_bottom.php +++ b/include/template/ledger_detail_bottom.php @@ -1,5 +1,19 @@ +info->command); + $other=new IText('OTHER',$obj->info->other); +?> +
| Bon de commande : | input(); ?> | +
| Autre information : | input();?> | +