phpcompta-dev
[Top][All Lists]
Advanced

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

[Phpcompta-dev] r5426 - in phpcompta/trunk: . html html/js include inclu


From: phpcompta-dev
Subject: [Phpcompta-dev] r5426 - in phpcompta/trunk: . html html/js include include/template
Date: Thu, 26 Sep 2013 23:43:34 +0200 (CEST)

Author: danydb
Date: 2013-09-26 23:43:34 +0200 (Thu, 26 Sep 2013)
New Revision: 5426

Added:
   phpcompta/trunk/include/ajax_search_add_tag.php
   phpcompta/trunk/include/ajax_search_clear_tag.php
   phpcompta/trunk/include/ajax_search_display_tag.php
   phpcompta/trunk/include/ajax_tag_select_search.php
   phpcompta/trunk/include/template/tag_search_select.php
Removed:
   phpcompta/trunk/include/ajax_tag_choose.php
Modified:
   phpcompta/trunk/html/ajax_misc.php
   phpcompta/trunk/html/do.php
   phpcompta/trunk/html/js/scripts.js
   phpcompta/trunk/include/action.common.inc.php
   phpcompta/trunk/include/action.inc.php
   phpcompta/trunk/include/category_followup.inc.php
   phpcompta/trunk/include/class_follow_up.php
   phpcompta/trunk/include/class_html_input.php
   phpcompta/trunk/include/class_tag.php
   phpcompta/trunk/include/template/action_search.php
   phpcompta/trunk/include/template/tag_select.php
   phpcompta/trunk/release-note
Log:
Visible dans la recherche apr?\195?\168s une recherche
Tag repris dans le bouton retour


Modified: phpcompta/trunk/html/ajax_misc.php
===================================================================
--- phpcompta/trunk/html/ajax_misc.php  2013-09-26 18:48:19 UTC (rev 5425)
+++ phpcompta/trunk/html/ajax_misc.php  2013-09-26 21:43:34 UTC (rev 5426)
@@ -603,6 +603,18 @@
         case 'tag_choose':
             require_once 'ajax_tag_choose.php';
             break;
+        case 'tag_choose':
+            require_once 'ajax_tag_choose.php';
+            break;
+       case 'search_display_tag':
+            require_once 'ajax_search_display_tag.php';
+            break;
+        case 'search_add_tag':
+            require_once 'ajax_search_add_tag.php';
+            break;
+        case 'search_clear_tag':
+            require_once 'ajax_search_clear_tag.php';
+            break;
        default:
                var_dump($_GET);
 }

Modified: phpcompta/trunk/html/do.php
===================================================================
--- phpcompta/trunk/html/do.php 2013-09-26 18:48:19 UTC (rev 5425)
+++ phpcompta/trunk/html/do.php 2013-09-26 21:43:34 UTC (rev 5426)
@@ -21,6 +21,7 @@
 
 // Copyright Author Dany De Bontridder address@hidden
 define('ALLOWED',1);
+
 /**\file
  * \brief Main file
  */
@@ -149,7 +150,6 @@
     $_SESSION['g_pagesize']=$p_size;
     $_SESSION['g_lang']=$lang;
 }
-
 /*
  * if an action is requested
  */

Modified: phpcompta/trunk/html/js/scripts.js
===================================================================
--- phpcompta/trunk/html/js/scripts.js  2013-09-26 18:48:19 UTC (rev 5425)
+++ phpcompta/trunk/html/js/scripts.js  2013-09-26 21:43:34 UTC (rev 5426)
@@ -23,8 +23,9 @@
  * \brief javascript script, always added to every page
  *
  */
+var ask_reload=0;
+var tag_choose='';
 
-var ask_reload=0;
 /**
 * callback function when we just need to update a hidden div with an info
 * message
@@ -2165,11 +2166,19 @@
         error_message(e.getMessage);
     }
 }
-function choose_tag(p_dossier)
+
+
+/**
+ * Display a div with available tags, this div can update the cell
+ * tag_choose_td
+ * @param {type} p_dossier
+ * @returns {undefined}
+ */
+function search_display_tag(p_dossier)
 {
     try {
         waiting_box();
-        var queryString="op=tag_choose&gDossier="+p_dossier;
+        var queryString="op=search_display_tag&gDossier="+p_dossier;
         var action = new Ajax.Request(
                                       "ajax_misc.php" ,
                                       {
@@ -2187,8 +2196,8 @@
                                                     
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;
+                                                    
$('tag_div').style.top=posY-80;
+                                                    
$('tag_div').style.left=posX+102;
                                                     remove_waiting_box();
                                                     
$('tag_div').innerHTML=code_html;
 
@@ -2198,4 +2207,77 @@
     } catch (e) {
         error_message(e.getMessage);
     }
+}
+/**
+ * @brief Add the selected tag (p_tag_id) to the cell of tag_choose_td in the 
search screen
+ * in the search screen
+ * @param {type} p_dossier
+ * @param {type} p_tag_id
+ */
+function search_add_tag(p_dossier,p_tag_id)
+{
+    try {
+        var clear_button=0;
+        if (  tag_choose == '') {
+            tag_choose=$('tag_choose_td').innerHTML ;
+            clear_button=1;
+        }
+        waiting_box();
+        var 
queryString="op=search_add_tag&gDossier="+p_dossier+"&id="+p_tag_id+"&clear="+clear_button;
+        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('html');
+                                                    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();
+                                                    
$('tag_choose_td').innerHTML=$('tag_choose_td').innerHTML+code_html;
+                                                    removeDiv('tag_div');
+                                          }
+                                      }
+                                      );
+    }catch (e) {
+         error_message(e.getMessage);
+    }
+}
+/**
+ * Clear the tags in the cell tag_choose_td of the search screen
+ * @returns {undefined}
+ */
+function search_clear_tag(p_dossier)
+{
+    try {
+        var queryString="op=search_clear_tag&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('html');
+                                                    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);
+                                                    
$('tag_choose_td').innerHTML=code_html;
+                                                    tag_choose="";
+                                          }
+                                      }
+                                      );
+    }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-26 18:48:19 UTC 
(rev 5425)
+++ phpcompta/trunk/include/action.common.inc.php       2013-09-26 21:43:34 UTC 
(rev 5426)
@@ -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","date_start","date_end"));
+               "tdoc",   "query","date_start","date_end","tag"));
        echo HtmlInput::hidden("act", "CSV:ActionGestion");
        echo HtmlInput::submit("follow_up_csv", "Export CSV");
        echo "</form>";

Modified: phpcompta/trunk/include/action.inc.php
===================================================================
--- phpcompta/trunk/include/action.inc.php      2013-09-26 18:48:19 UTC (rev 
5425)
+++ phpcompta/trunk/include/action.inc.php      2013-09-26 21:43:34 UTC (rev 
5426)
@@ -25,7 +25,7 @@
 require_once('class_ipopup.php');
 global $g_user;
 $retour=HtmlInput::button_anchor(_('Retour liste'),
-               
HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","hsstate")));
+       
HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","ac","gDossier","qcode","ag_dest_query","query","tdoc","date_start","date_end","hsstate","tag")));
 //-----------------------------------------------------
 // Follow_Up
 //-----------------------------------------------------

Added: phpcompta/trunk/include/ajax_search_add_tag.php
===================================================================
--- phpcompta/trunk/include/ajax_search_add_tag.php                             
(rev 0)
+++ phpcompta/trunk/include/ajax_search_add_tag.php     2013-09-26 21:43:34 UTC 
(rev 5426)
@@ -0,0 +1,47 @@
+<?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();
+if ($_GET['clear']==1) {
+    /* Add a clear button */
+    echo Tag::add_clear_button();
+}
+$tag=new Tag($cn,$_GET['id']);
+$tag->update_search_cell();
+
+$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>
+<html>$html</html>
+</data>
+EOF;
+exit();
+
+
+?>
+

Added: phpcompta/trunk/include/ajax_search_clear_tag.php
===================================================================
--- phpcompta/trunk/include/ajax_search_clear_tag.php                           
(rev 0)
+++ phpcompta/trunk/include/ajax_search_clear_tag.php   2013-09-26 21:43:34 UTC 
(rev 5426)
@@ -0,0 +1,40 @@
+<?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();
+echo Tag::button_search();
+$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>
+<html>$html</html>
+</data>
+EOF;
+exit();
+
+
+?>

Copied: phpcompta/trunk/include/ajax_search_display_tag.php (from rev 5425, 
phpcompta/trunk/include/ajax_tag_choose.php)
===================================================================
--- phpcompta/trunk/include/ajax_search_display_tag.php                         
(rev 0)
+++ phpcompta/trunk/include/ajax_search_display_tag.php 2013-09-26 21:43:34 UTC 
(rev 5426)
@@ -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_search();
+
+$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();
+
+
+?>

Deleted: phpcompta/trunk/include/ajax_tag_choose.php
===================================================================
--- phpcompta/trunk/include/ajax_tag_choose.php 2013-09-26 18:48:19 UTC (rev 
5425)
+++ phpcompta/trunk/include/ajax_tag_choose.php 2013-09-26 21:43:34 UTC (rev 
5426)
@@ -1,42 +0,0 @@
-<?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();
-
-
-?>

Added: phpcompta/trunk/include/ajax_tag_select_search.php
===================================================================
--- phpcompta/trunk/include/ajax_tag_select_search.php                          
(rev 0)
+++ phpcompta/trunk/include/ajax_tag_select_search.php  2013-09-26 21:43:34 UTC 
(rev 5426)
@@ -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_search();
+
+$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/category_followup.inc.php
===================================================================
--- phpcompta/trunk/include/category_followup.inc.php   2013-09-26 18:48:19 UTC 
(rev 5425)
+++ phpcompta/trunk/include/category_followup.inc.php   2013-09-26 21:43:34 UTC 
(rev 5426)
@@ -40,7 +40,7 @@
 if (! isset($_GET['submit_query'])) 
{$_REQUEST['closed_action']=1;$_GET['closed_action']=1;}
 
 $p_action=$_REQUEST['ac'];
-$base="ac=$p_action&sc=sv&sb=detail&f_id=".$_REQUEST['f_id']."&".HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier","qcode","ag_dest","query","tdoc","date_start","date_end","hsstate","sb","sc"),"");
+$base="ac=$p_action&sc=sv&sb=detail&f_id=".$_REQUEST['f_id']."&".HtmlInput::request_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier","qcode","ag_dest","query","tdoc","date_start","date_end","hsstate","tag","sb","sc"),"");
 $retour=HtmlInput::button_anchor('Retour','?'.dossier::get().'&'.$base);
 $fiche=new Fiche($cn,$_REQUEST['f_id']);
 

Modified: phpcompta/trunk/include/class_follow_up.php
===================================================================
--- phpcompta/trunk/include/class_follow_up.php 2013-09-26 18:48:19 UTC (rev 
5425)
+++ phpcompta/trunk/include/class_follow_up.php 2013-09-26 21:43:34 UTC (rev 
5426)
@@ -108,7 +108,8 @@
                }
                return $sql;
        }
-       //----------------------------------------------------------------------
+     
+        
//----------------------------------------------------------------------
        /**
         * \brief Display the object, the tags for the FORM
         *        are in the caller. It will be used for adding and updating
@@ -503,7 +504,7 @@
                /* add the number of item */
                $Hid = new IHidden();
                $r.=$Hid->input("nb_item", MAX_ARTICLE);
-               
$r.=HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate"));
+               
$r.=HtmlInput::request_to_hidden(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate","tag"));
                 $a_tag=$this->tag_get();
                /* get template */
                ob_start();
@@ -673,7 +674,7 @@
        function myList($p_base, $p_filter = "", $p_search = "")
        {
                // for the sort
-               $url = 
HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate")) . '&' 
. $p_base;
+               $url = 
HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","qcode",
 "ag_dest_query", "query", "tdoc", "date_start", "date_end", "hsstate","tag")) 
. '&' . $p_base;
 
                $table = new Sort_Table();
                $table->add('Date Doc.', $url, 'order by ag_timestamp asc', 
'order by ag_timestamp desc', 'da', 'dd');
@@ -749,7 +750,7 @@
                //show the sub_action
                foreach ($a_row as $row)
                {
-                       $href = '<A class="document" HREF="do.php?'  . $p_base 
.HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier",
 "qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", 
"hsstate", "ac"),"&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">';
+                       $href = '<A class="document" HREF="do.php?'  . $p_base 
.HtmlInput::get_to_string(array("closed_action","remind_date_end","remind_date","sag_ref","only_internal","state","gDossier",
 "qcode", "ag_dest_query", "query", "tdoc", "date_start", "date_end", 
"hsstate", "tag","ac"),"&") . '&sa=detail&ag_id=' . $row['ag_id'] . '">';
                        $i++;
                        $tr = ($i % 2 == 0) ? 'even' : 'odd';
                        if ($row['ag_priority'] < 2)
@@ -1182,8 +1183,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);
-                
+                $otag=new Tag($cn);
+               
                // show the  action in
                require_once 'template/action_search.php';
        }
@@ -1208,7 +1209,26 @@
                $r = $act->myList($p_base, "", $query);
                echo $r;
        }
+        /**
+         * Create a subquery to filter thanks the selected tag
+         * @param  $cn db connx
+         * @param $p_array
+         * @return SQL 
+         */
+        static  function filter_by_tag ($cn, $p_array = null)
+       {
+            if ($p_array == null)
+               $p_array = $_GET;
 
+            extract($p_array);
+            $query = ""; 
+            if ( count($tag) == 0 )return "";
+            for ($i=0;$i<count($tag);$i++) {
+                if (isNumber($tag[$i])==1)
+                    $query .= ' and ag_id in (select ag_id from action_tags 
where t_id= '.  sql_string($tag[$i]).')';
+            }
+            return $query;
+        }
        /**
         * Get date from $_GET and create the sql stmt for the query
         * @note the query is taken in $_REQUEST
@@ -1303,6 +1323,9 @@
                if ( ! isset ($closed_action)) {
                        $query.=" and s_status is null ";
                }
+                if ( isset ($tag)) {
+                    $query .= Follow_Up::filter_by_tag($cn,$p_array);
+                }
                return $query . $str;
        }
 
@@ -1460,7 +1483,7 @@
             for ($e=0;$e<$c;$e++) {
                 
$js_remove=sprintf("onclick=\"action_tag_remove('%s','%s','%s')\"",dossier::id(),$this->ag_id,
                         $a_tag[$e]['t_id']);
-                echo '<span style="border:1px solid black">';
+                echo '<span style="border:1px solid black;margin-right:5px;">';
                 echo $a_tag[$e]['t_tag'];
                 echo '</span>';
                 echo '<span 
style="background-color:red;text-align:center;border-top:1px solid black; 
border-right:1px solid black;border-bottom:1px solid black;">';

Modified: phpcompta/trunk/include/class_html_input.php
===================================================================
--- phpcompta/trunk/include/class_html_input.php        2013-09-26 18:48:19 UTC 
(rev 5425)
+++ phpcompta/trunk/include/class_html_input.php        2013-09-26 21:43:34 UTC 
(rev 5426)
@@ -478,7 +478,14 @@
       if ( count($global_array )==0) return '';
       foreach ($array  as $a)
        {
-         if (isset($global_array [$a])) $r.=HtmlInput::hidden($a,$global_array 
[$a]);
+         if (isset($global_array [$a])) 
+          if (is_array($global_array[$a]) == false ) {
+                $r.=HtmlInput::hidden($a,$global_array [$a]);
+              } else {
+                  for ($i=0;$i<count($global_array[$a]);$i++) {
+                      $r.=HtmlInput::hidden($a."[]",$global_array [$a][$i]);
+                  }
+              }
        }
 
       return $r;
@@ -535,7 +542,16 @@
       foreach ($array  as $a)
        {
          if (isset($global_array [$a]))
-            $r.=$and."$a=".$global_array [$a];
+          {
+              if (is_array($global_array[$a]) == false ) {
+                $r.=$and."$a=".$global_array [$a];
+              } else {
+                  for ($i=0;$i<count($global_array[$a]);$i++) {
+                      $r.=$and."$a"."[]=".$global_array[$a][$i];
+                      $and="&amp;";
+                  }
+              }
+          }
          $and="&amp;";
        }
 

Modified: phpcompta/trunk/include/class_tag.php
===================================================================
--- phpcompta/trunk/include/class_tag.php       2013-09-26 18:48:19 UTC (rev 
5425)
+++ phpcompta/trunk/include/class_tag.php       2013-09-26 21:43:34 UTC (rev 
5426)
@@ -22,10 +22,10 @@
 
 class Tag
 {
-    function __construct($p_cn)
+    function __construct($p_cn,$id=-1)
     {
         $this->cn=$p_cn;
-        $this->data=new Tag_SQL($p_cn);
+        $this->data=new Tag_SQL($p_cn,$id);
     }
     /**
      * Show the list of available tag
@@ -79,10 +79,10 @@
      * Show a button to select tag for Search
      * @return HTML
      */
-    function choose()
+    static  function button_search()
     {
         $r="";
-        $r.=HtmlInput::button("choose_tag", "Etiquette", 
'onclick="choose_tag('.Dossier::id().')"', "smallbutton");
+        $r.=HtmlInput::button("choose_tag", "Etiquette", 
'onclick="search_display_tag('.Dossier::id().')"', "smallbutton");
         return $r;
     }
     /**
@@ -91,8 +91,28 @@
     function select_search()
     {
         $ret=$this->data->seek(' order by t_tag');
-        require_once 'template/tag_select.php';
+        require_once 'template/tag_search_select.php';
     }
+    /**
+     * In the screen search add this data to the cell
+     */
+    function update_search_cell() {
+        echo '<span id="sp_'.$this->data->t_id.'" style="border:1px solid 
black;margin-right:5px;">';
+        echo h($this->data->t_tag);
+        echo HtmlInput::hidden('tag[]', $this->data->t_id);
+        $js=sprintf("$('sp_".$this->data->t_id."').remove()='';");
+        echo '<span 
style="background-color:red;text-align:center;border-top:1px solid black; 
border-right:1px solid black;border-bottom:1px solid black;">';
+        echo HtmlInput::anchor('X', "javascript:void(0)", "onclick=\"$js\"");
+        echo '</span>';
+        echo '</span>';
+    }
+    /**
+     * clear the search cell
+     */
+    static function add_clear_button() {
+        $clear=HtmlInput::button('clear', 'X', 
'onclick="search_clear_tag('.Dossier::id().');"', 'smallbutton');
+        return $clear;
+    }
 }
 
 ?>

Modified: phpcompta/trunk/include/template/action_search.php
===================================================================
--- phpcompta/trunk/include/template/action_search.php  2013-09-26 18:48:19 UTC 
(rev 5425)
+++ phpcompta/trunk/include/template/action_search.php  2013-09-26 21:43:34 UTC 
(rev 5426)
@@ -66,7 +66,16 @@
                         <tr>
                        <td style="width:180px;text-align:right"><?php echo 
_('Etiquette'); ?></td>
                                <td id="tag_choose_td">
-                                    <?php echo $tag->choose(); ?>
+                                    <?php echo Tag::button_search(); ?>
+                                    <?php
+                                        if ( isset($_GET['tag'])) {
+                                            echo Tag::add_clear_button();
+                                            for 
($i=0;$i<count($_GET['tag']);$i++) {
+                                                $t=new Tag($cn, 
$_GET['tag'][$i]);
+                                                echo $t->update_search_cell();
+                                            }
+                                        }
+                                    ?>
                                </td>
                        </tr>
                         <tr>

Added: phpcompta/trunk/include/template/tag_search_select.php
===================================================================
--- phpcompta/trunk/include/template/tag_search_select.php                      
        (rev 0)
+++ phpcompta/trunk/include/template/tag_search_select.php      2013-09-26 
21:43:34 UTC (rev 5426)
@@ -0,0 +1,40 @@
+<?php
+echo HtmlInput::title_box('Tag', 'tag_div');
+$max=$this->cn->count($ret);
+if ( $max == 0 ) {
+    echo h2("Aucune étiquette disponible",' class="notice"');
+    return;
+}
+?>
+Filtrer = <?php echo HtmlInput::filter_table('tag_tb_id', '0,1', 1); ?>
+<table id="tag_tb_id">
+    <tr>
+        <th>
+            Tag
+        </th>
+        <th>
+            Description
+        </th>
+    </tr>
+<?php
+$gDossier=Dossier::id();
+    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("search_add_tag('%s','%s')",$gDossier,$row['t_id']);
+            echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
+            ?>
+        </td>
+        <td>
+            <?php
+            echo $row['t_description'];
+            ?>
+        </td>
+    </tr>
+<?php
+ endfor;
+ ?>
+</table>
\ No newline at end of file

Modified: phpcompta/trunk/include/template/tag_select.php
===================================================================
--- phpcompta/trunk/include/template/tag_select.php     2013-09-26 18:48:19 UTC 
(rev 5425)
+++ phpcompta/trunk/include/template/tag_select.php     2013-09-26 21:43:34 UTC 
(rev 5426)
@@ -6,7 +6,8 @@
     return;
 }
 ?>
-<table>
+Filtrer = <?php echo HtmlInput::filter_table('tag_tb_id', '0,1', 1); ?>
+<table id="tag_tb_id">
     <tr>
         <th>
             Tag
@@ -24,7 +25,7 @@
     <tr class="<?php echo (($i%2==0)?'even':'odd');?>">
         <td>
             <?php
-            $js=sprintf("search_tag_add('%s','%s')",$gDossier,$row['t_id']);
+            
$js=sprintf("action_tag_add('%s','%s','%s')",$gDossier,$_REQUEST['ag_id'],$row['t_id']);
             echo HtmlInput::anchor($row['t_tag'], "", "onclick=\"$js\"");
             ?>
         </td>

Modified: phpcompta/trunk/release-note
===================================================================
--- phpcompta/trunk/release-note        2013-09-26 18:48:19 UTC (rev 5425)
+++ phpcompta/trunk/release-note        2013-09-26 21:43:34 UTC (rev 5426)
@@ -49,13 +49,19 @@
 code php 
 fiche_def.inc.php
 
+Action - Suivi
+===============
+Recherche par tag
+L'avoir dans les changements de page
+Tag repris dans le bouton retour
+Visible dans la recherche après une recherche
+
+
+
 ===================================================================
 || A faire
 ===================================================================
 
-Action - Suivi
-===============
-Recherche par tag
 
 Document à générer
 =================



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