phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r4839 - in phpcompta/trunk: include sql


From: phpcompta-dev
Subject: [Phpcompta-dev] r4839 - in phpcompta/trunk: include sql
Date: Thu, 17 May 2012 00:11:37 +0200 (CEST)

Author: danydb
Date: 2012-05-17 00:11:37 +0200 (Thu, 17 May 2012)
New Revision: 4839

Modified:
   phpcompta/trunk/include/action.common.inc.php
   phpcompta/trunk/include/class_follow_up.php
   phpcompta/trunk/sql/upgrade.sql
Log:
#574: Filtre par date dans suivi

Modified: phpcompta/trunk/include/action.common.inc.php
===================================================================
--- phpcompta/trunk/include/action.common.inc.php       2012-05-16 22:11:08 UTC 
(rev 4838)
+++ phpcompta/trunk/include/action.common.inc.php       2012-05-16 22:11:37 UTC 
(rev 4839)
@@ -235,12 +235,12 @@
 {
   // show the search menu
   ?>
-  <div id="search_action" 
style="width:50%;text-align:right;clear:both;display:block;">
-    <fieldset>
-    <legend>
+  <div id="search_action" 
style="position:absolute;display:none;margin-left:120px;width:70%;clear:both;background-color:
 inherit;z-index:2;border:1px #000080 solid">
+        <? echo 
HtmlInput::anchor_hide('Fermer','$(\'search_action\').style.display=\'none\';');
 ?>
+    <h2 class="info">
     <?=_('Recherche avancée')?>
-    </legend>
-    <form method="get" action="do.php">
+    </h2>
+    <form method="get" action="do.php" style="padding:10px">
     <?php
     echo dossier::hidden();
   $a=(isset($_GET['query']))?$_GET['query']:"";
@@ -268,35 +268,88 @@
   $w->table=0;
   $list=$cn->make_list("select fd_id from fiche_def where frd_id in 
(4,8,9,14,15,16,25)");
   $w->extra=$list;
-  echo _('Fiche').' :'.$w->input().$w->search().'<br/>';
-  printf (_('Titre ou référence').': <input class="input_text" type="text" 
name="query" value="%s">',
-         $a);
-  echo '<br/>';
 
+
   /* type of documents */
   $type_doc=new ISelect ('tdoc');
   $aTDoc=$cn->make_array('select dt_id,dt_value from document_type order by 
dt_value');
   $aTDoc[]=array('value'=>'-1','label'=>_('Tous les types'));
   $type_doc->value=$aTDoc;
   $type_doc->selected=(isset ($_GET['tdoc']))?$_GET['tdoc']:-1;
-  echo 'Type de document';
-  echo $type_doc->input();
-  echo '<br>';
 
+       // date
+  $start=new IDate('date_start');
+  $start->value=(isset($_GET['date_start']))?$_GET['date_start']:"";
+  $end=new IDate('date_end');
+  $end->value=(isset($_GET['date_end']))?$_GET['date_end']:"";
+
   $see_all=new ICheckBox('see_all');
+  $see_all->selected=(isset($_GET['see_all']))?true:false;
   $my_action=new ICheckBox('all_action');
+  $my_action->selected=(isset($_GET['all_action']))?true:false;
+  // select profile
+   $aAg_dest=$cn->make_array("select  p_id as value, ".
+                                    "p_name as label ".
+                                    " from profile order by 2");
+$ag_dest=new ISelect();
+$ag_dest->name="ag_dest";
+$aAg_dest[]=array('value'=>0,'label'=>'Public');
+$ag_dest->value=$aAg_dest;
+$ag_dest->selected=(isset($_GET["ag_dest"]))?$_GET["ag_dest"]:0;
+$str_ag_dest=$ag_dest->input();
 
-  echo _('les actions fermées aussi:').$see_all->input().'<br/>';
-
-  echo _('affecté à d\'autre:').$my_action->input().'<br/>';
   ?>
+               <table style="width:100%">
+                       <tr>
+                       <td style="width:180px;text-align:right"><? echo 
_('Destinataire') ?></td>
+                       <td ><?=$w->input().$w->search()?></td>
+                       <tr>
+                       <tr>
+                               <td style="text-align:right" 
><?=_("Profile")?></td>
+                               <td><?=$str_ag_dest?></td>
+                       </tr>
+                       <td style="text-align:right"><? printf (_('contenant le 
mot'))?></td>
+                       <td ><input class="input_text" style="width:100%" 
type="text" name="query" value="<?=$a?>"></td>
+                       </tr>
+                       <tr>
+                                       <td style="text-align:right"><?=_('Type 
de document')?></td>
+                                       <td><? echo $type_doc->input();?></td>
+                       </tr>
+                       <tr>
+                               <td style="text-align:right">
+                                       <? printf (_("Après le "))?>
+                               </td>
+                               <td >
+                                       <?=$start->input()?>
+                               </td>
+                       </tr>
+                       <tr>
+                               <td style="text-align:right"><?=_('Avant 
le')?></td>
+                               <td>
+                                       <?=$end->input()?>
+                               </td>
+                               </tr>
+                       </tr>
+                       <tr>
+                       <td style="text-align:right">
+                               <?=_('inclure les actions fermées ')?>
+                       </td>
+                       <td>
+                               <?=$see_all->input()?>
+                       </td>
+                       </tr>
+                       <tr>
+                               <td style="text-align:right"><?=_('les actions  
affectées à d\'autres')?></td>
+                               <td><?=$my_action->input()?>
+                               </td>
+                       </tr>
+  </table>
     <input type="submit" class="button" name="submit_query" 
value="<?=_('recherche')?>">
        <input type="hidden" name="sa" value="list">
 
        <?=$supl_hidden?>
+<?  echo 
HtmlInput::button_anchor(_('Fermer'),'javascript:void(0)','fsearch_form','onclick="$(\'search_action\').style.display=\'none\';"');
 ?>
        </form>
-
-       </fieldset>
        </div>
 
        <div class="content" >
@@ -308,53 +361,10 @@
          <input type="hidden" name="ac" value="<?=$_REQUEST['ac']?>">
          <input type="hidden" name="sa" value="add_action">
          <?=$supl_hidden?>
-         <input id="bt_search" type="button" class="button" 
onclick="toggleShow(this,'<?=_('Afficher Recherche')?>','<?=_('Cache 
Recherche')?>','search_action')" value="">
+         <input id="bt_search" type="button" class="button" 
onclick="$('search_action').style.display='block'" value="<?=_('Recherche')?>">
 
-         <script language="JavaScript">
-         <?php
-         /* if criteria then show the search otherwise hide it */
-         if ( (isset($_GET['qcode']) && trim($_GET['qcode']) != '') ||
-              (isset($_GET['query']) && trim($_GET['query']) != '') ||
-              $see_all->selected==true ||
-              $my_action->selected==true ||
-              (isset ($_GET['tdoc']) && trim($_GET['tdoc']) !='-1'))
-           {
-             /*  nothing */
-           }
-         else
-           {
-             ?>
-             toggleShow($('bt_search'),'<?=_('Afficher 
Recherche')?>','<?=_('Cache Recherche')?>','search_action')
-               <?php
-               }
-  ?>
-         function toggleShow(p_but,p_msg_show,p_msg_hide,p_div)
-         {
-           try
-             {
-               var detail=g(p_div);
-               if (detail.style.display=='block' )
-                 {
-                   $(p_but).value=p_msg_show;
-                   detail.style.display='none';
-                 }
-               else
-                 {
-                   $(p_but).value=p_msg_hide;
-                   detail.style.display='block';
-                 }
 
-             }
-           catch (error)
-           {
-             alert(error);
-           }
 
-         }
-
-         </script>
-
-
              </form>
              </div>
 
@@ -397,7 +407,24 @@
              $query .= ' and dt_id = '.Formatstring($_GET['tdoc']);
            }
          if ( ! $see_all->selected )      $query .= ' and ag_state in (2,3) ';
-         if ( ! $my_action->selected )      $query .= " and 
(ag_owner='".$_SESSION['g_user']."' or ag_dest='".$_SESSION['g_user']."')";
+         if ( ! $my_action->selected )     {
+                 $query .=" and (ag_owner='".$_SESSION['g_user']."' or ag_dest 
in (select p_id from profile_user where user_name='".$_SESSION['g_user']."') )";
+         }
+         if (isset ($_GET['date_start']) && isDate($_GET['date_start'])!= null 
) {
+                 $date_start=$_GET['date_start'];
+                 $query.=" and ag_timestamp >= 
to_date('$date_start','DD.MM.YYYY')";
+         }
+         if (isset ($_GET['date_end']) && isDate($_GET['date_end'])!= null ) {
+                 $date_end=$_GET['date_end'];
+                 $query.=" and ag_timestamp <= 
to_date('$date_end','DD.MM.YYYY')";
+         }
+         if ( isset($_GET['ag_dest']))
+         {
+                 if ( $_GET['ag_dest']==0)
+                       $query .= "and ag_dest is null ";
+                 else
+                       $query.= " and ag_dest = ".sql_string($_GET['ag_dest']);
+         }
          $r=$act->myList($p_base,"",$query.$str);
          echo $r;
 }

Modified: phpcompta/trunk/include/class_follow_up.php
===================================================================
--- phpcompta/trunk/include/class_follow_up.php 2012-05-16 22:11:08 UTC (rev 
4838)
+++ phpcompta/trunk/include/class_follow_up.php 2012-05-16 22:11:37 UTC (rev 
4839)
@@ -232,7 +232,7 @@
         $ag_hour->javascript=" onblur=check_hour('ag_hour');";
         $str_ag_hour=$ag_hour->input();
 
-        // Person in charged of the action
+        // Profile in charged of the action
         $ag_dest=new ISelect();
         $ag_dest->readonly=$readonly;
         $ag_dest->name="ag_dest";
@@ -624,6 +624,7 @@
              " values 
($1,to_date($2,'DD.MM.YYYY'),$3,$4,$5,$6,$7,$8,$9,$10,$11,$12,$13,$14,$15,$16)";
 
                }
+               if ( $this->ag_dest==0) {$this->ag_dest=null;}
         $this->db->exec_sql($sql,array($this->ag_id, /* 1 */
                                        $this->ag_timestamp, /* 2 */
                                        $this->dt_id,   /* 3 */
@@ -667,15 +668,14 @@
     {
         $str_dossier=dossier::get();
         // for the sort
-        $url="?".$str_dossier.'&'.$p_base;
+        
$url="?".$str_dossier.'&'.$p_base."&".HtmlInput::get_to_string(array("qcode","ag_dest","query","tdoc","date_start","date_end","see_all","all_action"));
 
-
                $table=new Sort_Table();
                $table->add('Date',$url,'order by ag_timestamp asc','order by 
ag_timestamp desc','da','dd');
                $table->add('Date Limite',$url,'order by ag_remind_date 
asc','order by ag_remind_date  desc','ra','rd');
                $table->add('Réf.',$url,'order by ag_ref asc','order by ag_ref 
desc','ra','rd');
-               $table->add('Groupe',$url,"order by coalesce((select p_name 
from profile where p_id=ag_dest::numeric),'Aucun groupe')",
-                                       "order by coalesce((select p_name from 
profile where p_id=ag_dest::numeric),'Aucun groupe') desc",'dea','ded');
+               $table->add('Groupe',$url,"order by coalesce((select p_name 
from profile where p_id=ag_dest),'Aucun groupe')",
+                                       "order by coalesce((select p_name from 
profile where p_id=ag_dest),'Aucun groupe') desc",'dea','ded');
                $table->add('Expéditeur',$url,'order by name asc','order by 
name desc','ea','ed');
                $table->add('Titre',$url,'order by ag_title asc','order by 
ag_title desc','ta','td');
                $table->add('Concerne',$url,'order by ag_ref_ag_id asc','order 
by ag_ref_ag_id desc','ca','cd');
@@ -694,7 +694,7 @@
                         ag_ref_ag_id,
                         f_id_dest,
              ag_title,dt_value,ag_ref, ag_priority,ag_state,
-                       coalesce((select p_name from profile where 
p_id=ag_dest::numeric),'Aucun groupe') as dest,
+                       coalesce((select p_name from profile where 
p_id=ag_dest),'Aucun groupe') as dest,
                                (select ad_value from fiche_Detail where 
f_id=action_gestion.f_id_dest and ad_id=1) as name
              from action_gestion
              join document_type on (ag_type=dt_id)
@@ -883,6 +883,7 @@
         if ( $this->ag_cal == 'on') $ag_cal='C';
         else $ag_cal='I';
         $this->ag_ref=$ref;
+               if ( $this->ag_dest==0) {$this->ag_dest=null;}
                if ( $this->ag_remind_date != null )
                {
                        $this->db->exec_sql("update action_gestion set 
ag_comment=$1,".

Modified: phpcompta/trunk/sql/upgrade.sql
===================================================================
--- phpcompta/trunk/sql/upgrade.sql     2012-05-16 22:11:08 UTC (rev 4838)
+++ phpcompta/trunk/sql/upgrade.sql     2012-05-16 22:11:37 UTC (rev 4839)
@@ -38,6 +38,8 @@
 
 update op_predef set od_direct='t' where od_jrn_type='ODS';
 
+
+
 INSERT INTO menu_ref(
             me_code, me_menu, me_file, me_url, me_description, me_parameter,
             me_javascript, me_type)
@@ -55,3 +57,14 @@
 alter table action_gestion add ag_remind_date date;
 
 drop table jrn_action;
+
+update action_gestion set ag_dest=null;
+ alter table action_gestion alter ag_dest type bigint using ag_dest::numeric;
+ alter table action_gestion alter ag_dest set default null;
+COMMENT ON COLUMN action_gestion.ag_dest IS ' is the profile which has to take 
care of this action ';
+ALTER TABLE action_gestion
+  ADD CONSTRAINT profile_fkey FOREIGN KEY (ag_dest)
+      REFERENCES profile (p_id) MATCH SIMPLE
+      ON UPDATE SET NULL ON DELETE SET NULL;
+
+



---
PhpCompta est un logiciel de comptabilité libre en ligne (full web)
Projet opensource http://www.phpcompta.eu



reply via email to

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