From d350f8476b347a39e6eb90f960dee38c29cbb309 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 11 May 2013 17:18:19 +0000 Subject: [PATCH] task #0000813: plan comptable - quick code Visible dans le popup quand on remplit les fiches et dans CFGPCMN --- html/ajax_poste.php | 7 ++++--- html/js/accounting_item.js | 2 +- include/param_pcmn.inc.php | 24 +++++++++++++++++++++--- include/template/account_result.php | 16 ++++++++++++++++ 4 files changed, 42 insertions(+), 7 deletions(-) diff --git a/html/ajax_poste.php b/html/ajax_poste.php index cb808da20..524b3551c 100644 --- a/html/ajax_poste.php +++ b/html/ajax_poste.php @@ -99,8 +99,9 @@ case "sf": $r.=''; - $sql="select pcm_val,pcm_lib,pcm_val_parent,pcm_type ". - " from tmp_pcmn "; + $sql=" + select pcm_val,pcm_lib,array_to_string(array_agg(j_qcode) , ',') as acode + from tmp_pcmn left join vw_poste_qcode on (j_poste=pcm_val) "; $sep=" where "; /* build the sql stmt */ if ( isset($j) && $j > 0 && isNumber($j)) @@ -121,7 +122,7 @@ case "sf": $sql.=sprintf(" $sep ( pcm_val::text like '%s%%' or pcm_lib::text ilike '%%%s%%') ", $q,$q); } - $sql.=' order by pcm_val::text limit 50'; + $sql.=' group by pcm_val,pcm_lib,pcm_val_parent, pcm_type order by pcm_val::text limit 50'; if ( isset($q) && strlen(trim($q))> 0 ) { $array=$cn->get_array($sql); diff --git a/html/js/accounting_item.js b/html/js/accounting_item.js index ba8fb29e7..e47ac1355 100644 --- a/html/js/accounting_item.js +++ b/html/js/accounting_item.js @@ -75,7 +75,7 @@ function search_poste(obj) sx=document.body.scrollTop+60; } - var div_style="z-index:15;top:"+sx; + var div_style="top:"+sx; removeDiv('search_account'); add_div({id:'search_account',cssclass:'inner_box',html:loading(),style:div_style,drag:true}); diff --git a/include/param_pcmn.inc.php b/include/param_pcmn.inc.php index 4e63131e7..1f93fa271 100644 --- a/include/param_pcmn.inc.php +++ b/include/param_pcmn.inc.php @@ -239,7 +239,9 @@ if ( isset ( $_POST["Ajout"] ) ) } } -$Ret=$cn->exec_sql("select pcm_val,pcm_lib,pcm_val_parent,pcm_type from tmp_pcmn where substr(pcm_val::text,1,1)='".$_SESSION['g_start']."' order by pcm_val::text"); +$Ret=$cn->exec_sql("select pcm_val,pcm_lib,pcm_val_parent,pcm_type,array_to_string(array_agg(j_qcode) , ',') as acode + from tmp_pcmn left join vw_poste_qcode on (j_poste=pcm_val) where substr(pcm_val::text,1,1)='".$_SESSION['g_start']."'". + " group by pcm_val,pcm_lib,pcm_val_parent, pcm_type order by pcm_val::text"); $MaxRow=Database::num_row($Ret); ?> @@ -256,11 +258,13 @@ echo dossier::hidden(); Libellé Poste comptable Parent Type + Fiche - form(false); ?> + @@ -301,6 +305,20 @@ for ($i=0; $i <$MaxRow; $i++) echo $A['pcm_type']; echo ""; + echo $td; + if ( strlen($A['acode']) >0 ) { + if (strpos($A['acode'], ",") >0 ) { + $det_qcode= split(",", $A['acode']); + echo '