Check(); echo JS_SEARCH_POSTE; require_once('class_dossier.php'); $gDossier=dossier::id(); $c_comment=""; $c_class=""; $condition=""; $cn=DbConnect($gDossier); if ( isset($_GET['search']) ) { $c1=0; foreach( $_GET as $key=>$element){ ${"$key"}=$element; } $condition=""; if ( strlen(trim($p_comment)) != 0 ) { $condition=" where (upper(pcm_lib) like upper('%$p_comment%') or ". " pcm_val::text like '$p_comment%') "; } } $url=""; //-------------------------------------------------- // Filter defined in the ledger's parameter // if ( isset($_GET['filter']) && $_GET['filter'] != 'all') { $url="?filter=1"; // There is a filter, the value of the filter is the journal id, we // have to find what account are available $SqlCred=""; // Load the property $l_line=GetJrnProp($gDossier,$_GET['p_jrn']); if ( strlen(trim ($l_line['jrn_def_class_deb']) ) > 0 ) { $valid_cred=split(" ",$l_line['jrn_def_class_deb']); // Creation query foreach ( $valid_cred as $item_cred) { if ( strlen (trim($item_cred))) { if ( strstr($item_cred,"*") == true ) { $item_cred=strtr($item_cred,"*","%"); $Sql=" pcm_val like '$item_cred' or"; } else { $Sql=" pcm_val = '$item_cred' or"; } $SqlCred=$SqlCred.$Sql; } }//foreach } if ( strlen(trim ($l_line['jrn_def_class_deb']) ) > 0 ) { $valid_deb=split(" ",$l_line['jrn_def_class_deb']); // Creation query foreach ( $valid_deb as $item_deb) { if ( strlen (trim($item_deb))) { echo_debug('poste_search.php',__LINE__,"l_line[jrn_def_class_deb] $l_line[jrn_def_class_deb] item_deb $item_deb"); if ( strstr($item_deb,"*") == true ) { $item_cred=strtr($item_deb,"*","%"); $Sql=" pcm_val like '$item_deb' or"; } else { $Sql=" pcm_val = '$item_deb' or"; } $SqlCred=$SqlCred.$Sql; } }//foreach } if ( $condition=="") { $condition .= ($SqlCred=="")?"":" where ".substr($SqlCred,0,strlen($SqlCred)-2); } else { $condition .= ($SqlCred=="")?"":" and ( ".substr($SqlCred,0,strlen($SqlCred)-2)." ) "; } }// if (isset($_GET['filter'])) // Control to update in the calling doc. if ( isset($_GET['p_ctl'])) { $p_ctl=$_GET['p_ctl']; } echo_debug('poste_search.php',__LINE__,"condition = $condition"); echo '
'; // if request search if ( isset($_GET['search']) or isset($_GET['filter']) ) { $Res=ExecSql($cn,"select pcm_val,pcm_lib from tmp_pcmn $condition order by pcm_val::text"); $MaxLine=pg_NumRows($Res); if ( $MaxLine==0) { html_page_stop(); return; } echo '| '; $slabel=FormatString($l_line['pcm_lib']); echo ''; echo ' | '; } echo ''; echo $l_line['pcm_val']; echo ' | '; echo ''; echo $l_line['pcm_lib']; echo ' | '; echo "