noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 54/119: Contact option , allow to use option


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 54/119: Contact option , allow to use option for contact
Date: Mon, 26 Oct 2020 18:27:19 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 4e363895e6a1b048ef401923c869f36353510333
Author: Dany De Bontridder <danydb@noalyss.eu>
AuthorDate: Tue Oct 6 19:02:57 2020 +0200

    Contact option , allow to use option for contact
---
 html/js/card.js                               | 120 +++++++++++++++++++++++---
 include/ajax/ajax_action_remove_concerned.php |   9 +-
 include/ajax/ajax_action_save_concerned.php   |  29 ++++++-
 include/ajax/ajax_add_concerned_card.php      |  56 ++++++++++--
 include/ajax/ajax_card.php                    |  21 ++++-
 include/ajax/ajax_display_card_option.php     |  44 ++++++++++
 include/class/card_multiple.class.php         | 102 ++++++++++++++++++++++
 include/class/follow_up.class.php             |  12 +--
 include/template/card_multiple_result.php     |  46 ++++++++++
 sql/upgrade.sql                               |  42 ++++++---
 10 files changed, 435 insertions(+), 46 deletions(-)

diff --git a/html/js/card.js b/html/js/card.js
index 6212658..1eeedfd 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -33,7 +33,7 @@ function boxsearch_card(p_dossier)
        {
        waiting_box();
        removeDiv('boxsearch_card_div');
-       var 
queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+encodeURI($(card_search).value);
+       var 
queryString="gDossier="+p_dossier+"&op=cardsearch"+"&card="+encodeURI($("card_search").value);
        var action = new Ajax.Request(
                                  "ajax_misc.php" ,
                                  {
@@ -57,14 +57,15 @@ function boxsearch_card(p_dossier)
 /**
  * show the ipopup with the form to search a card
  * the properties
- *  - jrn for the ledger
- *  - fs for the action
- *  - price for the price of the card (field to update)
- *  - tvaid for the tvaid of the card (field to update)
- *  - inp input text to update with the quickcode
- *  - label field to update with the name
- *  - ctl the id to fill with the HTML answer (ending with _content)
- *  - acc 1 if accounting are visible
+ * @param obj
+ * @param {int} obj.jrn for the ledger
+ * @param {int} obj.fs route to the action
+ * @param {string} obj.price for the price of the card (field to update)
+ * @param {string} obj.tvaid for the tvaid of the card (field to update)
+ * @param {string} obj.inp input text to update with the quickcode
+ * @param {string} obj.label field to update with the name
+ * @param {string} obj.ctl the id to fill with the HTML answer (ending with 
_content)
+ * @param {int} obj.acc 1 if accounting are visible
  */
 function search_card(obj)
 {
@@ -122,10 +123,54 @@ function search_card(obj)
     }
 }
 /**
- * Display form for select card to add to action : other_concerned
- *action_add_concerned_card
+ * Display found card and let you select several to link them to an 
action-followup
+ * @param {obj} obj form object
+ * @param {obj} obj form object
  */
-function action_add_concerned_card(obj)
+function action_concerned_save_card(obj)
+{
+    try {
+        waiting_box();
+        // get all data from FORM
+        var query = obj.serialize();
+        new Ajax.Request("ajax_misc.php", {
+            method: "POST",
+            parameters: query,
+            onSuccess: function (req) {
+                remove_waiting_box();
+                var answer = req.responseXML;
+                var a = answer.getElementsByTagName('ctl');
+                if (a.length == 0)
+                {
+                    var rec = req.responseText;
+                    alert_box('erreur :' + rec);
+                }
+                var html = answer.getElementsByTagName('code');
+                var namectl = a[0].firstChild.nodeValue;
+                var nodeXml = html[0];
+                var code_html = getNodeText(nodeXml);
+                code_html = unescape_xml(code_html);
+                $(namectl).update(code_html);
+                removeDiv('search_card');
+            }
+        });
+    } catch (e)
+    {
+
+        alert_box('action_concerned_save_card' + e.message);
+        return false;
+    }
+    return false;
+}
+/**
+ * Display form for searching cards to add to action-follow-up
+ *@see ajax_add_concerned_card.php
+ *@param {object} obj form object 
+ *@param obj.elements.ag_id id of the action (elements)
+ *@param obj.elements.gDossier folder id
+ *@param obj.elements.query
+ */
+function action_concerned_search_card(obj)
 {
     try
     {
@@ -204,7 +249,7 @@ function action_add_concerned_card(obj)
                         {
                             sx = document.body.scrollTop + 60;
                         }
-                        var div_style = "top:" + sx + "px;height:80%";
+                        var div_style = "top:" + sx + "px;height:52rem";
                         if ( ! $('search_card')) { add_div({id: 'search_card', 
cssclass: 'inner_box', html: "", style: div_style, drag: true}); }
                         $('search_card').innerHTML = code_html;
                         $('query').focus();
@@ -951,7 +996,7 @@ try {
  * @param {type} p_action_id action_gestion.ag_id
  * @returns {undefined} nothing
  */
-function action_save_concerned(p_dossier, p_fiche_id, p_action_id) {
+function action_save_concerned(p_form_id) {
     var query = encodeJSON({'gDossier': p_dossier, 'f_id': p_fiche_id, 
'ag_id': p_action_id,'op':'card','op2':'action_save_concerned','ctl':'unused'});
     var a=new Ajax.Request('ajax_misc.php',
             {
@@ -1220,4 +1265,51 @@ function card_update_row(obj)
         alert_box(e.message);
         return false;
     }
+}
+/**
+ * Display the option of a contact linked in a action-followup
+ * @param {int} p_action_person_id action_person.ap_id
+ * @param {int} p_dossier current folder
+ */
+function linked_card_option(p_action_person_id,p_dossier) {
+    try {
+        waiting_box();
+        new Ajax.Request("ajax_misc.php",{
+            method:"get",
+            parameters: {
+                ap_id:p_action_person_id,
+                gDossier:p_dossier,
+                op:"card",
+                op2:"display_card_option",
+                ctl:"notused"
+            },
+            onSuccess:function(req) {
+                remove_waiting_box();
+                add_div({ 
"id":"d_linked_card_option",cssclass:"inner_box",style:"position:fixed;top:30%;min-width:20rem;width:auto;",drag:0});
+                $("d_linked_card_option").update(req.responseText);
+                
+            }
+        });
+    } catch (e) {
+        console.error(e.message);
+    }
+}
+/**
+ * Save option for the contact 
+ * @param {object} obj form 
+ * @see card_multiple_display_option.php
+ * @returns {undefined}
+ */
+function save_linked_card_option(obj)
+{
+    waiting_box();
+    new Ajax.Request("ajax_misc.php",{
+        method:"post",
+        parameters:obj.serialize(),
+        onSuccess:function(req) {
+            remove_waiting_box();
+            removeDiv("d_linked_card_option");
+        }
+    });
+    return false;
 }
\ No newline at end of file
diff --git a/include/ajax/ajax_action_remove_concerned.php 
b/include/ajax/ajax_action_remove_concerned.php
index 31112df..00d3894 100644
--- a/include/ajax/ajax_action_remove_concerned.php
+++ b/include/ajax/ajax_action_remove_concerned.php
@@ -37,6 +37,13 @@ catch (Exception $exc)
     error_log($exc->getTraceAsString());
     return;
 }
+/*
+ * security Who can do it ?
+ */
+if ( ! $g_user->can_read_action($ag_id)  ) {
+    record_log(__FILE__."security : access refused");
+    return;
+}
 
 require_once 'class/follow_up.class.php';
 $follow=new Follow_Up($cn,$ag_id);
@@ -44,7 +51,7 @@ $follow=new Follow_Up($cn,$ag_id);
 ob_start();
 $follow->remove_linked_card($f_id);
 echo $follow->display_linked();
-HtmlInput::button_action_add_concerned_card( $follow->ag_id);
+echo HtmlInput::button_action_add_concerned_card( $follow->ag_id);
 
 $response = ob_get_clean();
 
diff --git a/include/ajax/ajax_action_save_concerned.php 
b/include/ajax/ajax_action_save_concerned.php
index e799b09..25baf30 100644
--- a/include/ajax/ajax_action_save_concerned.php
+++ b/include/ajax/ajax_action_save_concerned.php
@@ -28,9 +28,34 @@ if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas 
permis');
 /**
  * Insert into follow-up the card (f_id) for the action_gestion (ag_id)
  */
+$http=new HttpInput();
+try {
+    // follow_up id
+    $ag_id=$http->request("ag_id","number");
+    $ctl=$http->request("ctl");
+    $selected_card=$http->request("selected_card","array",[]);
+} catch (Exception $ex) {
+     record_log(__FILE__.$ex->getMessage().$ex->getTraceAsString());
+     return;
+}
+/*
+ * security Who can do it ?
+ */
+if ( ! $g_user->can_write_action($ag_id)  ) {
+    record_log(__FILE__."security : access refused");
+    return;
+}
+
 require_once 'class/follow_up.class.php';
 $follow=new Follow_Up($cn,$ag_id);
-$follow->insert_linked_card($f_id);
+$nb_card=count($selected_card);
+for ($i=0;$i< $nb_card;$i++)
+{
+    $elt=$selected_card[$i];
+    if (isNumber($elt)) {
+        $follow->insert_linked_card($elt); 
+    }
+}
 /**
  * Display all the linked card
  */
@@ -44,7 +69,7 @@ header('Content-type: text/xml; charset=UTF-8');
 echo <<<EOF
 <?xml version="1.0" encoding="UTF-8"?>
 <data>
-<ctl>unused</ctl>
+<ctl>$ctl</ctl>
 <code>$html</code>
 </data>
 EOF;
diff --git a/include/ajax/ajax_add_concerned_card.php 
b/include/ajax/ajax_add_concerned_card.php
index 4322b13..90f3281 100644
--- a/include/ajax/ajax_add_concerned_card.php
+++ b/include/ajax/ajax_add_concerned_card.php
@@ -29,6 +29,7 @@ if (!defined('ALLOWED'))
     die('Appel direct ne sont pas permis');
 
 require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
+require_once NOALYSS_INCLUDE.'/class/card_multiple.class.php';
 $http=new HttpInput();
 
 ob_start();
@@ -42,49 +43,86 @@ catch (Exception $exc)
     error_log($exc->getTraceAsString());
     return;
 }
+/*
+ * security Who can do it ?
+ */
+if ( ! $g_user->can_write_action($ag_id)  ) {
+    record_log(__FILE__."security : access refused");
+    return;
+}
 
 require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php';
 
 $r=HtmlInput::title_box(_("Détail fiche"), 'search_card');
-
-$r.='<form id="search_card1_frm" method="GET" 
onsubmit="action_add_concerned_card(this);return false;">';
+//--------------------------------------------------------------------------------------------------------------------
+// Form search
+//--------------------------------------------------------------------------------------------------------------------
+$r.='<form id="search_card1_frm" method="GET" 
onsubmit="action_concerned_search_card(this);return false;">';
 $q=new IText('query');
 $q->value=(isset($query))?$query:'';
 $r.='<span style="margin-left:50px">';
 $r.=_('Fiche contenant').Icon_Action::infobulle(19);
 $r.=$q->input();
+// where to search
+$select=new ISelect("search_in");
+$select->value=$cn->make_array("select ad_id, ad_text from attr_def order by 2 
",1);
+$select->selected=$http->get("search_in","string","");
+$r.=_("limité aux champs ").$select->input();
 $r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton");
 $r.='</span>';
-$r.=dossier::hidden().HtmlInput::hidden('op', 'add_concerned_card');
+$r.=dossier::hidden().HtmlInput::hidden('op2', 'add_concerned_card');
 $r.=HtmlInput::request_to_hidden(array('ag_id'));
 $r.='</form>';
+
+
 $query=$http->get("query", "string","");
 $sql_array['query']=$query;
 $sql_array['typecard']='all';
 
-$fiche=new Fiche($cn);
+$fiche=new Card_Multiple($cn);
 /* Build the SQL and show result */
 $sql=$fiche->build_sql($sql_array);
+$count_card=$fiche->count_sql($sql_array);
 
+//--------------------------------------------------------------------------------------------------------------------
+// Result
+//--------------------------------------------------------------------------------------------------------------------
 
 /* We limit the search to MAX_SEARCH_CARD records */
-$sql=$sql.' order by vw_name limit '.MAX_SEARCH_CARD;
 $a=$cn->get_array($sql);
+$r.='<form id="search_card2_frm" method="POST" 
onsubmit="action_concerned_save_card(this);return false;" '
+        . ' style="height:45rem">';
+$r.=HtmlInput::request_to_hidden(array('ag_id'));
+$r.=dossier::hidden().HtmlInput::hidden('op2', 
'link_concerned_card').HtmlInput::hidden("op","card");
+// element to update with the answer
+$r.=HtmlInput::hidden("ctl","concerned_card_td");
 for ($i=0; $i<count($a); $i++)
 {
+    $ic=new ICheckBox("selected_card[]");
+    $ic->value=$a[$i]['f_id'];
+    $array[$i]['checkbox']=$ic->input();
     $array[$i]['quick_code']=$a[$i]['quick_code'];
     $array[$i]['name']=h($a[$i]['vw_name']);
     $array[$i]['accounting']=$a[$i]['accounting'];
     $array[$i]['first_name']=h($a[$i]['vw_first_name']);
     $array[$i]['description']=h($a[$i]['vw_description']);
-    
$array[$i]['javascript']=sprintf("action_save_concerned(%d,'%s','%s')",$gDossier,$a[$i]['f_id'],$ag_id);
 }//foreach
 
-
-echo $r;
 // No accountancy history
 $accvis=0; 
-require_once(NOALYSS_TEMPLATE.'/card_result.php');
+echo $r;
+require_once(NOALYSS_TEMPLATE.'/card_multiple_result.php');
+echo '<ul class="aligned-block">';
+echo '<li>';
+echo HtmlInput::submit("add_concerned_card",_("Ajouter"));
+echo '</li>';
+echo '<li>';
+echo HtmlInput::button_close("search_card");
+echo '</li>';
+echo '</ul>';
+echo '</form>';
+
+
 $response=ob_get_contents();
 ob_end_clean();
 
diff --git a/include/ajax/ajax_card.php b/include/ajax/ajax_card.php
index 74a3d5b..e493da2 100644
--- a/include/ajax/ajax_card.php
+++ b/include/ajax/ajax_card.php
@@ -518,9 +518,11 @@ case 'fs':
         require_once NOALYSS_INCLUDE.'/ajax/ajax_add_concerned_card.php';
         return;
     break;
-    case 'action_save_concerned':
+// add several card to an action follow⁻up
+    case 'link_concerned_card':
         require NOALYSS_INCLUDE.'/ajax/ajax_action_save_concerned.php';
         return;
+// remove card from an action follow⁻up
     case 'action_remove_concerned':
         require NOALYSS_INCLUDE.'/ajax/ajax_action_remove_concerned.php';
         return;
@@ -744,6 +746,23 @@ case 'upr':
        }
       }
       break;
+ 
//---------------------------------------------------------------------------------------------------------------
+ // Display option of a contact in an action-followup       
+ 
//---------------------------------------------------------------------------------------------------------------
       
+        case 'display_card_option':
+            
+            require_once NOALYSS_INCLUDE.'/ajax/ajax_display_card_option.php';
+            return;
+            break;
+            
+ 
//---------------------------------------------------------------------------------------------------------------
+ // Save option of a contact in an action-followup       
+ 
//---------------------------------------------------------------------------------------------------------------
       
+        case 'save_card_option':
+            require_once NOALYSS_INCLUDE.'/ajax/ajax_save_card_option.php';
+            return;
+
+            break;
             
 } // switch
 $xml=escape_xml($html);
diff --git a/include/ajax/ajax_display_card_option.php 
b/include/ajax/ajax_display_card_option.php
new file mode 100644
index 0000000..464c2b5
--- /dev/null
+++ b/include/ajax/ajax_display_card_option.php
@@ -0,0 +1,44 @@
+<?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');
+
+/**
+ * @file
+ * @brief  display the options of a card
+ */
+require_once NOALYSS_INCLUDE."/class/card_multiple.class.php";
+
+$card_multiple=new Card_Multiple();
+try
+{
+    $ap_id=$http->get("ap_id");
+}
+catch (Exception $exc)
+{
+    echo $exc->getMessage();
+    record_log($exc->getMessage().$exc->getTraceAsString());
+}
+
+echo HtmlInput::title_box(_("Options contact"), 
"d_linked_card_option","close","","y");
+// display existing option
+$card_multiple->display_option($ap_id);
diff --git a/include/class/card_multiple.class.php 
b/include/class/card_multiple.class.php
new file mode 100644
index 0000000..2296d80
--- /dev/null
+++ b/include/class/card_multiple.class.php
@@ -0,0 +1,102 @@
+<?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>
+
+/**
+ * @file
+ * @brief in follow-up , add multiple cards to an event, an action
+ */
+class Card_Multiple
+{
+
+    function __construct()
+    {
+        
+    }
+
+    function build_sql($sql_array)
+    {
+        $cn=Dossier::connect();
+        $query=sql_string($sql_array['query']);
+
+        $string_sql="select * 
+              from vw_fiche_attr  
+              where 
+              vw_name ilike '%$query%' 
+              or quick_code ilike '%$query%'
+              order by vw_name 
+              limit 
+              ".MAX_CARD_SEARCH;
+        return $string_sql;
+    }
+
+    function count_sql($sql_array)
+    {
+        $cn=Dossier::connect();
+        $query=sql_string($sql_array['query']);
+
+        $string_sql="select count(*) 
+              from vw_fiche_attr  
+              where 
+              vw_name ilike '%$query%' 
+              or quick_code ilike '%$query%'";
+
+
+        return $cn->get_value($string_sql); ;
+    }
+    /**
+     * 
+     * @global type $g_user
+     * @param type $ap_id
+     * @return type
+     */
+    function display_option($p_action_person_id)
+    {
+        global $g_user;
+        $cn=Dossier::connect();
+        // retrieve card id (fiche.f_id) and the ag_id (action_gestion.ag_id)
+        $tmp=$cn->get_row("select f_id,ag_id from action_person where ap_id=$1 
", [$p_action_person_id]);
+        if ($tmp==NULL)
+        {
+            record_log("CMDO.01nothing found ".var_export($_REQUEST, true));
+            return;
+        }
+        $fiche_id=$tmp['f_id'];
+        $ag_id=$tmp['ag_id'];
+        if ( ! $g_user->can_read_action($ag_id)) {
+            throw new Exception (_("CMCDO01"."Security"));
+        }
+        $sql="select
+       cor.cor_id,
+       cor.cor_label,
+       cor.cor_type,
+       coalesce (apo.ap_id,-1) as ap_id,
+        ap_value,
+        cor_value_select
+from
+contact_option_ref cor
+left join action_person_option apo on (cor.cor_id=apo.contact_option_ref_id)
+where action_person_id is null or action_person_id=$1";
+        $a_option=$cn->get_array($sql,[$p_action_person_id]);
+        require NOALYSS_TEMPLATE."/card_multiple_display_option.php";
+        
+    }
+
+}
diff --git a/include/class/follow_up.class.php 
b/include/class/follow_up.class.php
index 6734dd2..11b5f3c 100644
--- a/include/class/follow_up.class.php
+++ b/include/class/follow_up.class.php
@@ -1493,7 +1493,7 @@ class Follow_Up
         $c=count($a_tag);
         for ($e=0; $e<$c; $e++)
         {
-            echo '<span style="border-radius:3px;border:1px 
solid;padding:3px;margin:1px">';
+            echo '<span class="tagcell">';
             echo $a_tag[$e]['t_tag'];
             if ($g_user->can_write_action($this->ag_id)==true)
             {
@@ -1670,14 +1670,16 @@ class Follow_Up
         $a_linked=$this->db->get_array('select ap_id,f_id from action_person 
where ag_id=$1', array($this->ag_id));
         if (count($a_linked)==0)
             return "";
+        $dossier_id=Dossier::id();
         for ($i=0; $i<count($a_linked); $i++)
         {
             $fiche=new Fiche($this->db, $a_linked[$i]['f_id']);
             $qc=$fiche->get_quick_code();
-            
$js_remove=sprintf("onclick=\"action_remove_concerned('%s','%s','%s')\"", 
dossier::id(), $a_linked[$i]['f_id'], $this->ag_id);
-            echo '<span style="border:1px solid black;margin-right:5px;">';
-            echo $qc;
-            echo HtmlInput::anchor(SMALLX, "javascript:void(0)", $js_remove, ' 
class="smallbutton" style="padding:0px;display:inline" ');
+            $js_remove=sprintf("action_remove_concerned('%s','%s','%s')", 
dossier::id(), $a_linked[$i]['f_id'], $this->ag_id);
+            echo '<span class="tagcell">';
+            echo HtmlInput::anchor($qc,"", 
sprintf("onclick=\"linked_card_option('%s','%s')\"",
+                    $a_linked[$i]['ap_id'],$dossier_id));
+            echo Icon_Action::trash(uniqid(), $js_remove);
             echo '</span>';
             echo '&nbsp;';
             echo '&nbsp;';
diff --git a/include/template/card_multiple_result.php 
b/include/template/card_multiple_result.php
new file mode 100644
index 0000000..cef4de1
--- /dev/null
+++ b/include/template/card_multiple_result.php
@@ -0,0 +1,46 @@
+<?php
+//This file is part of NOALYSS and is under GPL 
+//see licence.txt
+$nb_array=count($array);
+?>
+<fieldset id="asearch" style="height:41rem">
+    <legend><?php echo _('Résultats'); ?></legend>
+    <div style="height:100%;overflow:auto;">
+        <?php if ($nb_array > 10) :
+                echo _("recherche rapide");
+                echo HtmlInput::filter_table("card_list", '1,2,3', 0);
+             endif;
+             ?>
+        <?php printf (_("Nombre de fiches trouvées %d montrées 
%d"),$count_card,$nb_array);?>
+        <table id="card_list" class="result" >
+            <?php for ($i=0; $i<$nb_array; $i++) : ?>
+                <?php $class=($i%2==0)?'odd':'even'; ?>
+                <tr class="<?php echo $class; ?>">
+                    <td style="padding-right:55px">
+                        <?php echo $array[$i]['checkbox'] ?>
+                    </td>
+                    <td style="padding-right:55px">
+                        <?php echo $array[$i]['quick_code'] ?>
+                    </td>
+
+                    <td>
+                        <?php echo $array[$i]['name'] ?>
+                    </td>
+                    <td>
+                        <?php echo $array[$i]['first_name'] ?>
+                    </td>
+                    <td>
+                        <?php echo $array[$i]['description'] ?>
+                    </td>
+
+                </tr>
+
+
+            <?php endfor; ?>
+        </table>
+        <span style="font-style: italic;">
+            <?php echo _("Nombre d'enregistrements:$i"); ?>
+        </span>
+        <br>
+    </div>
+</fieldset>
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index 1b20b77..e664d79 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -96,20 +96,7 @@ COMMENT ON COLUMN public.contact_option_ref.cor_value_json 
IS 'json object if co
 COMMENT ON COLUMN public.contact_option_ref.document_option_id IS 'FK to 
document_option';
 
 
-CREATE TABLE public.action_person_option (
-       ap_id bigserial NOT NULL,
-       ap_value varchar NULL, -- Value of the option
-       contact_option_ref_id int8 NOT NULL,
-       action_person_id int8 NOT NULL,
-       CONSTRAINT action_person_option_pk PRIMARY KEY (ap_id),
-       CONSTRAINT action_person_option_fk FOREIGN KEY (action_person_id) 
REFERENCES action_person(ap_id) ON UPDATE CASCADE ON DELETE CASCADE,
-       CONSTRAINT contact_option_ref_fk FOREIGN KEY (contact_option_ref_id) 
REFERENCES contact_option_ref(cor_id) ON UPDATE CASCADE ON DELETE CASCADE
-);
-COMMENT ON TABLE public.action_person_option IS 'option for each contact';
 
--- Column comments
-
-COMMENT ON COLUMN public.action_person_option.ap_value IS 'Value of the 
option';
 
 -- renomme le menu
 update menu_ref set me_description = 'Configuration des documents dans le 
suivi' ,me_file='cfg_action.inc.php' ,
@@ -175,4 +162,31 @@ ALTER TABLE public.jnt_tag_group_tag ADD CONSTRAINT 
jnt_tag_group_tag_fk FOREIGN
 ALTER TABLE public.jnt_tag_group_tag ADD CONSTRAINT jnt_tag_group_tag_fk_1 
FOREIGN KEY (tag_group_id) REFERENCES tag_group(tg_id) ON UPDATE CASCADE ON 
DELETE CASCADE;
 
 
-insert into action values (1025,'Ajout d''étiquette','followup','TAGADD');
\ No newline at end of file
+insert into action values (1025,'Ajout d''étiquette','followup','TAGADD');
+
+-- public.action_person_option definition
+
+-- Drop table
+
+-- DROP TABLE public.action_person_option;
+
+CREATE TABLE public.action_person_option (
+       ap_id bigserial NOT NULL,
+       ap_value varchar NULL, -- Value of the option
+       contact_option_ref_id int8 NOT NULL, -- FK to contact_option
+       action_person_id int8 NOT NULL, -- FK to action_person
+       CONSTRAINT action_person_option_pk PRIMARY KEY (ap_id)
+);
+COMMENT ON TABLE public.action_person_option IS 'option for each contact';
+
+-- Column comments
+
+COMMENT ON COLUMN public.action_person_option.ap_value IS 'Value of the 
option';
+COMMENT ON COLUMN public.action_person_option.contact_option_ref_id IS 'FK to 
contact_option';
+COMMENT ON COLUMN public.action_person_option.action_person_id IS 'FK to 
action_person';
+
+
+-- public.action_person_option foreign keys
+
+ALTER TABLE public.action_person_option ADD CONSTRAINT action_person_option_fk 
FOREIGN KEY (action_person_id) REFERENCES action_person(ap_id) ON UPDATE 
CASCADE ON DELETE CASCADE;
+ALTER TABLE public.action_person_option ADD CONSTRAINT contact_option_ref_fk 
FOREIGN KEY (contact_option_ref_id) REFERENCES contact_option_ref(cor_id) ON 
UPDATE CASCADE ON DELETE CASCADE;



reply via email to

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