phpcompta-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Phpcompta-dev] r4549 - phpcompta/trunk/include


From: phpcompta-dev
Subject: [Phpcompta-dev] r4549 - phpcompta/trunk/include
Date: Sat, 3 Dec 2011 21:25:31 +0100 (CET)

Author: danydb
Date: 2011-12-03 21:25:30 +0100 (Sat, 03 Dec 2011)
New Revision: 4549

Modified:
   phpcompta/trunk/include/class_acc_ledger.php
   phpcompta/trunk/include/search.inc.php
Log:
0480 recherche ne fonctionne plus
0481 recherche dans recocile ne fonctionne plus



Modified: phpcompta/trunk/include/class_acc_ledger.php
===================================================================
--- phpcompta/trunk/include/class_acc_ledger.php        2011-12-03 20:23:10 UTC 
(rev 4548)
+++ phpcompta/trunk/include/class_acc_ledger.php        2011-12-03 20:25:30 UTC 
(rev 4549)
@@ -600,7 +600,7 @@
                // Count
         $count=$this->db->count_sql($sql);
         // Add the limit
-        $sql.=$limit;
+        $sql.=" order by jr_date asc ".$limit;
 
         // Execute SQL stmt
         $Res=$this->db->exec_sql($sql);
@@ -665,7 +665,7 @@
             if ( $this->type=='') $r.=td($row['jrn_def_name']);
             // date
             $r.="<TD>";
-            $r.=$row['jr_date'];
+            $r.=$row['str_jr_date'];
             $r.="</TD>";
 
             // pj
@@ -794,7 +794,6 @@
         $count=$this->db->count_sql($sql);
         // Add the limit
         $sql.=$order.$limit.$offset;
-
         // Execute SQL stmt
         $Res=$this->db->exec_sql($sql);
 
@@ -859,11 +858,11 @@
             if ( $this->type=='') $r.=td($row['jrn_def_name']);
             // date
             $r.="<TD>";
-            $r.=$row['jr_date'];
+            $r.=$row['str_jr_date'];
             $r.="</TD>";
             // echeance
             $r.="<TD>";
-            $r.=$row['jr_ech'];
+            $r.=$row['str_jr_ech'];
             $r.="</TD>";
 
             // pj
@@ -2398,8 +2397,8 @@
         $sql="select jr_id     ,
              jr_montant,
              substr(jr_comment,1,60) as jr_comment,
-             to_char(jr_ech,'DD.MM.YYYY') as jr_ech,
-             to_char(jr_date,'DD.MM.YYYY') as jr_date,
+             to_char(jr_ech,'DD.MM.YYYY') as str_jr_ech,
+             to_char(jr_date,'DD.MM.YYYY') as str_jr_date,
              jr_date as jr_date_order,
              jr_grpt_id,
              jr_rapt,
@@ -2442,8 +2441,8 @@
              join jrn_def on jrn_def_id=jr_def_id
              join parm_periode on p_id=jr_tech_per";
 
-        if ( $p_array != null )
-            extract($p_array);
+        if ( ! empty($p_array))            extract($p_array);
+               
         $r_jrn=(isset($r_jrn))?$r_jrn:-1;
 
         /* if no variable are set then give them a default
@@ -2558,26 +2557,26 @@
             $and=" and ";
         }
         // date
-        if ( isDate($date_start) != null )
+        if (isset ($date_start) && isDate($date_start) != null )
         {
             $fil_date=$and." jr_date >= 
to_date('".$date_start."','DD.MM.YYYY')";
             $and=" and ";
         }
-        if ( isDate($date_end) != null )
+        if (isset ($date_end) &&  isDate($date_end) != null )
         {
             $fil_date.=$and." jr_date <= 
to_date('".$date_end."','DD.MM.YYYY')";
             $and=" and ";
         }
         // comment
-        $desc=sql_string($desc);
-        if ( $desc != null )
+        if (isset ($desc) &&  $desc != null )
         {
+                       $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."%') )";
             $and=" and ";
         }
         //    Poste
-        if ( $accounting != null )
+        if ( isset ($accounting) && $accounting != null )
         {
             $fil_account=$and."  jr_grpt_id in (select j_grpt
                          from jrnx where j_poste::text like '$accounting%' )  
";
@@ -2585,7 +2584,7 @@
         }
         // Quick Code
                if ( isset ($qcodesearch_op)) $qcode=$qcodesearch_op;
-        if ( $qcode != null )
+        if ( isset ($qcode)  && $qcode != null )
         {
             $fil_qcode=$and."  jr_grpt_id in ( select j_grpt from
                        jrnx where trim(j_qcode) = upper(trim('$qcode')))";

Modified: phpcompta/trunk/include/search.inc.php
===================================================================
--- phpcompta/trunk/include/search.inc.php      2011-12-03 20:23:10 UTC (rev 
4548)
+++ phpcompta/trunk/include/search.inc.php      2011-12-03 20:25:30 UTC (rev 
4549)
@@ -80,12 +80,7 @@
        put_global(
                        array
                                (
-                               array('key'=>'ledger_type','value'=>'ALL'),
-                               array('key'=>'date_start','value'=>'ALL'),
-                               array('key'=>'date_end','value'=>'ALL'),
-                               array('key'=>'desc','value'=>''),
-                               array('key'=>'qcode','value'=>''),
-                               array('key'=>'accounting','value'=>'')
+                               array('key'=>'ledger_type','value'=>'ALL')
                                )
 
                        );
@@ -106,6 +101,12 @@
     else
         $array=$_GET;
     $array['p_action']='ALL';
+       if ( ! isset ($array['date_start']) || ! isset ($array['date_end']))
+       {
+               // get first date of current exercice
+               
list($array['date_start'],$array['date_end'])=$User->get_limit_current_exercice();
+       }
+
     list($sql,$where)=$ledger->build_search_sql($array);
     // Count nb of line
     $max_line=$cn->count_sql($sql);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]