noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 105/119: Follow-Up Cosmetic, form before crea


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 105/119: Follow-Up Cosmetic, form before creating a new follow-up action
Date: Mon, 26 Oct 2020 18:27:38 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit f48a95e74d3d7846fd9ef9d81c12b34f7520d9e5
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Wed Oct 14 15:53:53 2020 +0200

    Follow-Up Cosmetic, form before creating a new follow-up action
---
 include/action.common.inc.php                 | 29 +++--------
 include/class/follow_up.class.php             | 13 ++++-
 include/template/action_button.php            | 19 +-------
 include/template/followup-show-action-add.php | 69 +++++++++++++++++++++++++++
 4 files changed, 88 insertions(+), 42 deletions(-)

diff --git a/include/action.common.inc.php b/include/action.common.inc.php
index 48b16e7..cd75424 100644
--- a/include/action.common.inc.php
+++ b/include/action.common.inc.php
@@ -30,7 +30,7 @@
  *
  */
 if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
-require_once NOALYSS_INCLUDE."/lib/select_box.class.php";
+require_once NOALYSS_INCLUDE."/lib/select_dialog.class.php";
 $http=new HttpInput();
 $supl_hidden = '';
 if (isset($_REQUEST['sc']))
@@ -205,7 +205,6 @@ if ($sub_action == "update")
                echo '<input type="hidden" name="ac" value="' . 
$http->request('ac') . '">';
                echo '<input type="hidden" name="sa" value="save_action_st2">';
                echo '<input type="submit" class="button" 
name="save_action_st2" value="' . _('Enregistrer') . '">';
-               echo '<input type="submit" class="button" name="generate" 
value="' . _('Génère le document') . '"></p>';
                echo $supl_hidden;
                echo '</form>';
                echo '</div>';
@@ -237,27 +236,9 @@ if ($sub_action == 'detail')
             echo '<input type="hidden" name="sa" value="update">';
             echo '<input type="hidden" id="delete" name="delete" value="0">';
             echo HtmlInput::submit("save", "Sauve",' 
onclick="$(\'delete\').value=0"');
-            
-            // Create select box for new Action
-            $selbox=new Select_Box("action_add_action2", _("Ajout action"));
-            $selbox->set_position("in-absolute");
-            $selbox->set_filter("y");
-            $aDocumentType=$cn->get_array("select dt_id,dt_value from 
document_type order by 2");
-            $nbDocumentType=count($aDocumentType);
-            $ac=$http->request("ac");
-            $dossier_id=Dossier::id();
-            
$sup_parameter=HtmlInput::array_to_string(["sc","sb","f_id","qcode"], 
$_REQUEST,"&amp;");
-            for ($i=0;$i<$nbDocumentType;$i++) {
-                $selbox->add_url($aDocumentType[$i]['dt_value'], 
-                                "do.php?".http_build_query([ "ac"=>$ac,
-                                "gDossier"=>$dossier_id,
-                                "sa"=>"update",
-                                "add_action_here"=>"yes",
-                                "ag_id"=>$ag_id,
-                                
"action_type"=>$aDocumentType[$i]["dt_id"]]).$sup_parameter);
-    
-            }
-            echo $selbox->input();
+           
+
+           
             
             // 
             if ($g_user->can_delete_action($ag_id))
@@ -267,6 +248,8 @@ if ($sub_action == 'detail')
             }
             echo $retour;
             echo '</form>';
+             // Create select box for new Action
+            
Follow_Up::show_action_add(["sa"=>"update","add_action_here"=>1,"ag_id"=>$ag_id]);
        }
        else if ($g_user->can_read_action($ag_id) == true || $act->ag_dest == 
-1)
        {
diff --git a/include/class/follow_up.class.php 
b/include/class/follow_up.class.php
index 0a738ee..dfc1ec8 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -1193,6 +1193,15 @@ class Follow_Up
         echo $act->myList($p_base, "", $query);
         echo '</form>';
     }
+    /**
+     * Show a button for adding follow-up action, display the FORM 
+     * @param array $pa_param , will be converted in a HIDDEN input type in 
the form
+     */
+    static function show_action_add($pa_param)
+    {
+        require_once NOALYSS_TEMPLATE.'/followup-show-action-add.php';
+
+    }
 
     /**
      * Create a subquery to filter thanks the selected tag
@@ -1843,8 +1852,8 @@ class Follow_Up
          */
         $parent=$this->get_parent();
 
-        $base=HtmlInput::request_to_string(array("gDossier", "ac", "sa", "sb", 
"sc",
-                    "f_id"));
+        $base=HtmlInput::request_to_string(array("gDossier", "ac",  "sb", "sc",
+                    "f_id"))."&amp;sa=detail";
         $parent=$this->get_parent();
         if ($parent==-1)
         {
diff --git a/include/template/action_button.php 
b/include/template/action_button.php
index 1aa348b..a38ca1f 100644
--- a/include/template/action_button.php
+++ b/include/template/action_button.php
@@ -1,5 +1,4 @@
 <?php
-
 /*
  *   This file is part of NOALYSS.
  *
@@ -29,25 +28,11 @@
 require_once NOALYSS_INCLUDE."/lib/select_box.class.php";
 $http=new HttpInput();
 // Create select box for new Action
-$selbox=new Select_Box(uniqid(), _("Ajout action"));
-$selbox->set_position("normal");
-$selbox->set_filter("yes");
-$aDocumentType=$cn->get_array("select dt_id,dt_value from document_type order 
by 2");
-$nbDocumentType=count($aDocumentType);
-$ac=$http->request("ac");
-$dossier_id=Dossier::id();
-$sup_parameter=HtmlInput::array_to_string(["sc","sb","f_id","qcode"], 
$_REQUEST,"&amp;");
-for ($i=0;$i<$nbDocumentType;$i++) {
-    $selbox->add_url($aDocumentType[$i]['dt_value'], 
-            "do.php?".http_build_query([ 
"ac"=>$ac,"gDossier"=>$dossier_id,"sa"=>"add_action"
-                    
,"action_type"=>$aDocumentType[$i]["dt_id"]]).$sup_parameter);
-    
-}
+Follow_Up::show_action_add(array("sa"=>"add_action"));
 ?>
 <div class="content" style="display:inline" >
        <div style="display:inline">
             <input id="bt_search" type="button" class="smallbutton" 
onclick="$('search_action').style.display='block'" value="<?php echo 
_('Recherche') ?>">
-            <?=$selbox->input();?>
          
        </div>
-</div>    
\ No newline at end of file
+</div>  
\ No newline at end of file
diff --git a/include/template/followup-show-action-add.php 
b/include/template/followup-show-action-add.php
new file mode 100644
index 0000000..ebfb7c3
--- /dev/null
+++ b/include/template/followup-show-action-add.php
@@ -0,0 +1,69 @@
+<?php
+
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   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
+ */
+// Copyright (2002-2020) Author Dany De Bontridder <danydb@noalyss.eu>
+
+if (!defined('ALLOWED'))
+    die('Appel direct ne sont pas permis');
+$sup_parameter=HtmlInput::array_to_string(["sc","sb","f_id","qcode"], 
$_REQUEST,"&amp;");
+$cn=Dossier::connect();
+/**
+ * @file
+ * @brief display a button for adding an followup action
+ */
+echo HtmlInput::button(uniqid(), _("Ajout action"),
+        
'onclick="document.getElementById(\'action_add_d\').style.display=\'block\';"');
+?>
+<div id="action_add_d" class="inner_box" 
style="width:25rem;display:none;top:10rem;">
+    <?php echo HtmlInput::title_box(_("Choississez une action"), 
"action_add_d"); ?>
+    <div style="text-align: center">
+
+        <form method="get" >
+
+            <?php
+            echo HtmlInput::array_to_hidden(["ac", "sc", "sb", "f_id", 
"qcode", "gDossier"], $_REQUEST);
+            if ( ! empty ($pa_param)) {
+                foreach ($pa_param as $key=> $value)
+                {
+                    echo HtmlInput::hidden($key,$value);
+
+                }
+            }
+            ?>
+            
+            <?php
+            $action=new ISelect("action_type");
+            $action->style='style="width:95%"';
+            $action->value=$cn->make_array("select dt_id,dt_value from 
document_type order by 2");
+            $action->selected=$action->value[0]['value'];
+            $action->rowsize=10;
+            echo $action->input();
+            ?>
+            <ul class="aligned-block">
+
+                <li>
+                    <?php echo HtmlInput::submit("add_action", _("Ajout")); ?>
+                </li>
+                <li>
+                    <?php echo HtmlInput::button_hide("action_add_d") ?>
+                </li>
+            </ul>
+        </form>
+    </div>
+</div>



reply via email to

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