diff --git a/html/jrn_search.php b/html/jrn_search.php
index ca4e63cb9..e5f3aacb4 100644
--- a/html/jrn_search.php
+++ b/html/jrn_search.php
@@ -50,6 +50,7 @@ $l_Db=sprintf("dossier%d",$g_dossier);
$condition="";
$part=" where ";
$cn=DbConnect($l_Db);
+// if search then build the condition
if ( isset ($_POST["search"]) ) {
$c1=0;
foreach( $HTTP_POST_VARS as $key=>$element){
@@ -58,7 +59,7 @@ if ( isset ($_POST["search"]) ) {
}
if ( strlen(trim($p_comment)) != 0 ) {
- $c_comment=" $part pcm_lib like '%$p_comment%'";
+ $c_comment=" $part upper(jr_comment) like upper('%$p_comment%')";
$part=" and ";
}
if ( strlen($p_montant) != 0 && (ereg ("^[0-9]*\.[0-9]*$",$p_montant) ||
@@ -100,7 +101,7 @@ echo '
| ';
echo ' Montant | ';
echo ' | ';
echo ' | ';
-
+echo '';
echo '| Commentaire | ';
echo ' contient | ';
echo ' | ';
@@ -110,27 +111,29 @@ echo '';
echo '';
echo '';
-$Res=ExecSql($cn,"select j_id,to_char(j_date,'DD.MM.YYYY') as j_date,
+// if a search is asked otherwise don't show all the rows
+if ( isset ($_POST["search"]) ) {
+ $Res=ExecSql($cn,"select j_id,to_char(j_date,'DD.MM.YYYY') as j_date,
j_montant,j_poste,j_debit,j_tech_per,jr_id,jr_comment,j_grpt,pcm_lib,jr_internal from jrnx inner join
jrn on jr_grpt_id=j_grpt inner join tmp_pcmn on j_poste=pcm_val ".
- " inner join user_sec_jrn on uj_jrn_id=j_jrn_def".
- $condition." order by j_id");
+ " inner join user_sec_jrn on uj_jrn_id=j_jrn_def".
+ $condition." order by j_id");
-$MaxLine=pg_NumRows($Res);
-if ( $MaxLine==0) {
- html_page_stop();
- return;
-}
-$col_vide=" | ";
-echo '';
-$l_id="";
-if ( $MaxLine > 250 ) {
- echo "Trop de lignes redéfinir la recherche";
- html_page_stop();
- return;
-}
-for ( $i=0; $i < $MaxLine; $i++) {
- $l_line=pg_fetch_array($Res,$i);
+ $MaxLine=pg_NumRows($Res);
+ if ( $MaxLine==0) {
+ html_page_stop();
+ return;
+ }
+ $col_vide=" | ";
+ echo '';
+ $l_id="";
+ if ( $MaxLine > 250 ) {
+ echo "Trop de lignes redéfinir la recherche";
+ html_page_stop();
+ return;
+ }
+ for ( $i=0; $i < $MaxLine; $i++) {
+ $l_line=pg_fetch_array($Res,$i);
if ( $l_id == $l_line['j_grpt'] ) {
echo $col_vide.$col_vide;
} else {
@@ -148,13 +151,13 @@ for ( $i=0; $i < $MaxLine; $i++) {
$l_id=$l_line['j_grpt'];
echo '| '.$l_line['jr_comment'].' | ';
}
- if ( $l_line['j_debit'] == 't' ) {
- echo '';
- }
- else {
- echo '
';
- }
- echo $col_vide;
+ if ( $l_line['j_debit'] == 't' ) {
+ echo '
';
+ }
+ else {
+ echo '
';
+ }
+ echo $col_vide;
if ( $l_line['j_debit']=='f')
echo $col_vide;
@@ -178,9 +181,9 @@ for ( $i=0; $i < $MaxLine; $i++) {
echo "
";
-}
+ }
echo '
';
-
+}// if $_POST [search]
html_page_stop();
?>