phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r5421 - in phpcompta/trunk: html html/js include include


From: phpcompta-dev
Subject: [Phpcompta-dev] r5421 - in phpcompta/trunk: html html/js include include/template
Date: Mon, 23 Sep 2013 23:00:47 +0200 (CEST)

Author: danydb
Date: 2013-09-23 23:00:47 +0200 (Mon, 23 Sep 2013)
New Revision: 5421

Added:
   phpcompta/trunk/include/ajax_tag_choose.php
   phpcompta/trunk/include/template/tag_choose.php
Modified:
   phpcompta/trunk/html/ajax_misc.php
   phpcompta/trunk/html/js/scripts.js
   phpcompta/trunk/include/action.common.inc.php
   phpcompta/trunk/include/class_follow_up.php
   phpcompta/trunk/include/class_tag.php
   phpcompta/trunk/include/template/action_search.php
   phpcompta/trunk/include/template/tag_select.php
Log:
Seach tag

Modified: phpcompta/trunk/html/ajax_misc.php
===================================================================
--- phpcompta/trunk/html/ajax_misc.php  2013-09-23 20:04:59 UTC (rev 5420)
+++ phpcompta/trunk/html/ajax_misc.php  2013-09-23 21:00:47 UTC (rev 5421)
@@ -600,6 +600,9 @@
         case 'tag_remove':
             require_once 'ajax_tag_remove_action.php';
             break;
+        case 'tag_choose':
+            require_once 'ajax_tag_choose.php';
+            break;
        default:
                var_dump($_GET);
 }

Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js  2013-09-23 20:04:59 UTC (rev 5420)
+++ phpcompta/trunk/html/js/scripts.js  2013-09-23 21:00:47 UTC (rev 5421)
@@ -2164,4 +2164,38 @@
     } catch (e) {
         error_message(e.getMessage);
     }
+}
+function choose_tag(p_dossier)
+{
+    try {
+        waiting_box();
+        var queryString="op=tag_choose&gDossier="+p_dossier;
+        var action = new Ajax.Request(
+                                      "ajax_misc.php" ,
+                                      {
+                                          method:'get', parameters:queryString,
+                                          onFailure:ajax_misc_failure,
+                                          onSuccess:function(req,j){
+                                                  var answer=req.responseXML;
+                                                    var 
html=answer.getElementsByTagName('code');
+                                                    if ( html.length == 0 )
+                                                    {
+                                                        var 
rec=unescape_xml(req.responseText);
+                                                        error_message ('erreur 
:'+rec);
+                                                    }
+                                                    var 
code_html=getNodeText(html[0]);
+                                                    
code_html=unescape_xml(code_html);
+                                                    remove_waiting_box();
+                                                    
add_div({id:'tag_div',cssclass:'inner_box',drag:1});
+                                                    
$('tag_div').style.top=posY-70;
+                                                    
$('tag_div').style.left=posX-70;
+                                                    remove_waiting_box();
+                                                    
$('tag_div').innerHTML=code_html;
+
+                                          }
+                                      }
+                                      );
+    } catch (e) {
+        error_message(e.getMessage);
+    }
 }
\ No newline at end of file

Modified: phpcompta/trunk/include/action.common.inc.php
===================================================================
--- phpcompta/trunk/include/action.common.inc.php       2013-09-23 20:04:59 UTC 
(rev 5420)
+++ phpcompta/trunk/include/action.common.inc.php       2013-09-23 21:00:47 UTC 
(rev 5421)
@@ -192,7 +192,7 @@
        // Add a button to export to Csv
        echo '<form method="GET" ACTION="export.php">';
        echo 
HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref",
 "remind_date","only_internal", "state", "gDossier", "qcode", "start_date", 
"end_date", "ag_id", "ag_dest_query",
-               "tdoc",   "query"));
+               "tdoc",   "query","date_start","date_end"));
        echo HtmlInput::hidden("act", "CSV:ActionGestion");
        echo HtmlInput::submit("follow_up_csv", "Export CSV");
        echo "</form>";

Added: phpcompta/trunk/include/ajax_tag_choose.php
===================================================================
--- phpcompta/trunk/include/ajax_tag_choose.php                         (rev 0)
+++ phpcompta/trunk/include/ajax_tag_choose.php 2013-09-23 21:00:47 UTC (rev 
5421)
@@ -0,0 +1,42 @@
+<?php
+/*
+ *   This file is part of PhpCompta.
+ *
+ *   PhpCompta is free software; you can redistribute it and/or modify
+ *   it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or
+ *   (at your option) any later version.
+ *
+ *   PhpCompta is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with PhpCompta; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+/* $Revision$ */
+// Copyright Author Dany De Bontridder address@hidden
+if ( !defined ('ALLOWED') )  die('Appel direct ne sont pas permis');
+
+require_once 'class_tag.php';
+ob_start();
+$tag=new Tag($cn);
+$tag->select();
+
+$response=  ob_get_clean();
+ob_end_clean();
+$html=escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<ctl></ctl>
+<code>$html</code>
+</data>
+EOF;
+exit();
+
+
+?>

Modified: phpcompta/trunk/include/class_follow_up.php
===================================================================
--- phpcompta/trunk/include/class_follow_up.php 2013-09-23 20:04:59 UTC (rev 
5420)
+++ phpcompta/trunk/include/class_follow_up.php 2013-09-23 21:00:47 UTC (rev 
5421)
@@ -1182,6 +1182,8 @@
                
$remind_date->value=(isset($_GET['remind_date']))?$_GET['remind_date']:"";
                $remind_date_end=new IDate('remind_date_end');
                
$remind_date_end->value=(isset($_GET['remind_date_end']))?$_GET['remind_date_end']:"";
+                $tag=new Tag($cn);
+                
                // show the  action in
                require_once 'template/action_search.php';
        }
@@ -1362,8 +1364,8 @@
                        to_char(ag_timestamp,'DD.MM.YYYY') as my_date,
                         to_char(ag_remind_date,'DD.MM.YYYY') as my_remind,
                          to_char(coalesce((select max(agc_date) from 
action_gestion_comment as agc where agc.ag_id=ag_id),ag_timestamp),'DD.MM.YY') 
as last_comment,
-                        array_to_string((select array_agg(t1.t_tag) from 
action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag_id 
),',') as tags,
-                               (select ad_value from fiche_Detail where 
f_id=action_gestion.f_id_dest and ad_id=1) as name,
+                        array_to_string((select array_agg(t1.t_tag) from 
action_tags as a1 join tags as t1 on (a1.t_id=t1.t_id) where a1.ag_id=ag.ag_id 
),',') as tags,
+                               (select ad_value from fiche_Detail where 
f_id=ag.f_id_dest and ad_id=1) as name,
              ag_title,
                        dt_value,
                        ag_ref,
@@ -1371,10 +1373,10 @@
                        ag_state,
                          
                        coalesce((select p_name from profile where 
p_id=ag_dest),'Aucun groupe') as dest
-             from action_gestion 
-             join document_type on (ag_type=dt_id)
-                        join document_state on(ag_state=s_id)
-             where  true  $p_search order by ag_timestamp,ag_id";
+             from action_gestion as ag
+             join document_type on (ag.ag_type=dt_id)
+                        join document_state on(ag.ag_state=s_id)
+             where  true  $p_search order by ag.ag_timestamp,ag.ag_id";
                $ret=$this->db->exec_sql($sql);
 
                if ( Database::num_row($ret)==0)exit();

Modified: phpcompta/trunk/include/class_tag.php
===================================================================
--- phpcompta/trunk/include/class_tag.php       2013-09-23 20:04:59 UTC (rev 
5420)
+++ phpcompta/trunk/include/class_tag.php       2013-09-23 21:00:47 UTC (rev 
5421)
@@ -75,6 +75,24 @@
         $this->data->t_id=$p_array['t_id'];
         $this->data->delete();
     }
+    /**
+     * Show a button to select tag for Search
+     * @return HTML
+     */
+    function choose()
+    {
+        $r="";
+        $r.=HtmlInput::button("choose_tag", "Tag", 
'onclick="choose_tag('.Dossier::id().')"', "smallbutton");
+        return $r;
+    }
+    /**
+     * let select a tag to add to the search
+     */
+    function select_search()
+    {
+        $ret=$this->data->seek(' order by t_tag');
+        require_once 'template/tag_select.php';
+    }
 }
 
 ?>

Modified: phpcompta/trunk/include/template/action_search.php
===================================================================
--- phpcompta/trunk/include/template/action_search.php  2013-09-23 20:04:59 UTC 
(rev 5420)
+++ phpcompta/trunk/include/template/action_search.php  2013-09-23 21:00:47 UTC 
(rev 5421)
@@ -52,33 +52,41 @@
                                <td>
                                        <?php echo $remind_date->input();?>
                                </td>
+                       </tr>
                        <tr>
-                       <tr>
                                <td style="width:180px;text-align:right"> Date 
de rappel avant</td>
                                <td>
                                        <?php echo $remind_date_end->input();?>
                                </td>
+                       </tr>
                        <tr>
-                       <tr>
                                <td style="width:180px;text-align:right"> 
Affiche aussi les actions fermées</td>
                                <td><?php echo $closed_action->input();?></td>
                        </tr>
+                        <tr>
+                       <td style="width:180px;text-align:right"> Tag</td>
+                               <td id="tag_choose_td">
+                                    <?php echo $tag->choose(); ?>
+                               </td>
+                       </tr>
+                        <tr>
                        <td style="width:180px;text-align:right"> Référence</td>
                                <td>
                                        <?php echo $osag_ref->input();?>
                                </td>
+                       </tr>
                        <tr>
-                       <tr>
                                <td style="width:180px;text-align:right"> 
Numéro document</td>
                                <td>
                                        <?php $num=new INum('ag_id');echo 
$num->input();?>
                                </td>
+                       </tr>
                        <tr>
                                <td style="width:180px;text-align:right"><?php 
echo _('Destinataire')?></td>
                                <?php $label=$w->id."_label";?>
                                <td ><?php echo  $w->input() . 
$w->search()?><span id="<?php echo $label?>"></span></td>
+                       </tr>
                        <tr>
-                       <tr>
                                <td style="text-align:right" ><?php echo  
_("Profil")?></td>
                                <td><?php echo  $str_ag_dest?></td>
                        </tr>

Added: phpcompta/trunk/include/template/tag_choose.php
===================================================================
--- phpcompta/trunk/include/template/tag_choose.php                             
(rev 0)
+++ phpcompta/trunk/include/template/tag_choose.php     2013-09-23 21:00:47 UTC 
(rev 5421)
@@ -0,0 +1,44 @@
+<?php
+echo HtmlInput::title_box('Tag', 'tag_div');
+$max=$this->cn->count($ret);
+if ( $max == 0 ) {
+    echo h2("Aucun tag disponible",' class="notice"');
+    return;
+}
+?>
+<table>
+    <tr>
+        <th>
+            Tag
+        </th>
+        <th>
+            Description
+        </th>
+    </tr>
+<?php
+$gDossier=Dossier::id();
+if (isNumber($_REQUEST['ag_id']) == 0 ) die ('ERROR : parameters invalid');
+    for ($i=0;$i<$max;$i++):
+        $row=Database::fetch_array($ret, $i);
+?>
+    <tr class="<?php echo (($i%2==0)?'even':'odd');?>">
+        <td>
+            <?php
+            
$js=sprintf("action_tag_add('%s','%s','%s')",$gDossier,$_REQUEST['ag_id'],$row['t_id']);
+            echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
+            ?>
+        </td>
+        <td>
+            <?php
+            echo $row['t_description'];
+            ?>
+        </td>
+    </tr>
+<?php
+ endfor;
+ ?>
+</table>
+<?php
+   
$js=sprintf("onclick=\"show_tag('%s','%s','%s','j')\"",Dossier::id(),"none",'-1');
+    echo HtmlInput::button("tag_add", "Ajout d'un tag", $js);
+?>
\ No newline at end of file

Modified: phpcompta/trunk/include/template/tag_select.php
===================================================================
--- phpcompta/trunk/include/template/tag_select.php     2013-09-23 20:04:59 UTC 
(rev 5420)
+++ phpcompta/trunk/include/template/tag_select.php     2013-09-23 21:00:47 UTC 
(rev 5421)
@@ -24,7 +24,7 @@
     <tr class="<?php echo (($i%2==0)?'even':'odd');?>">
         <td>
             <?php
-            
$js=sprintf("action_tag_add('%s','%s','%s')",$gDossier,$_REQUEST['ag_id'],$row['t_id']);
+            $js=sprintf("search_tag_add('%s','%s')",$gDossier,$row['t_id']);
             echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
             ?>
         </td>
@@ -37,8 +37,4 @@
 <?php
  endfor;
  ?>
-</table>
-<?php
-   
$js=sprintf("onclick=\"show_tag('%s','%s','%s','j')\"",Dossier::id(),"none",'-1');
-    echo HtmlInput::button("tag_add", "Ajout d'un tag", $js);
-?>
\ No newline at end of file
+</table>
\ No newline at end of file



---
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]