noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 09/09: Task #988 - FOLLOWUP : plusieurs inter


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 09/09: Task #988 - FOLLOWUP : plusieurs intervenants Plusieurs intervenants pour les actions de gestion * ajax pour ajouter, enlever * dans la recherche
Date: Sun, 23 Nov 2014 19:26:40 +0000

sparkyx pushed a commit to branch master
in repository noalyss.

commit 92ca5ceebe260bfe2d7ab58862753c39b685e648
Author: Dany De Bontridder <address@hidden>
Date:   Sun Nov 23 20:25:30 2014 +0100

    Task #988 - FOLLOWUP : plusieurs intervenants
    Plusieurs intervenants pour les actions de gestion
    * ajax pour ajouter, enlever
    * dans la recherche
---
 html/ajax_card.php                              |   10 ++
 html/js/card.js                                 |  193 ++++++++++++++++++++++-
 include/ajax_action_remove_concerned.php        |   46 ++++++
 include/ajax_action_save_concerned.php          |   47 ++++++
 include/ajax_add_concerned_card.php             |   83 ++++++++++
 include/class_follow_up.php                     |   81 +++++++++-
 include/class_html_input.php                    |   11 ++-
 include/template/card_result.php                |    2 +-
 include/template/detail-action.php              |  156 ++++++++++--------
 sql/upgrade.sql                                 |   33 ++++-
 unit-test/include/class_acc_ledger_soldTest.php |   24 +--
 11 files changed, 588 insertions(+), 98 deletions(-)

diff --git a/html/ajax_card.php b/html/ajax_card.php
index 3906c6e..aabc267 100644
--- a/html/ajax_card.php
+++ b/html/ajax_card.php
@@ -431,6 +431,16 @@ case 'fs':
     $ctl=$ctl.'_content';
     $html=$r;
     break;
+    case 'action_add_concerned_card':
+        require_once 'ajax_add_concerned_card.php';
+        return;
+    break;
+    case 'action_save_concerned':
+        require 'ajax_action_save_concerned.php';
+        return;
+    case 'action_remove_concerned':
+        require 'ajax_action_remove_concerned.php';
+        return;
 case 'ac':
     if ( $g_user->check_action(FICCAT)==1 )
     {
diff --git a/html/js/card.js b/html/js/card.js
index 166dabd..10eb78d 100644
--- a/html/js/card.js
+++ b/html/js/card.js
@@ -114,6 +114,115 @@ function search_card(obj)
     }
 }
 /**
+ address@hidden Display form for select card to add to action : other_concerned
+ *action_add_concerned_card
+ */
+function action_add_concerned_card(obj)
+{
+    try
+    {
+        var dossier = 0;
+        var inp="";
+        var ag_id=0;
+        
+        if (obj.dossier) {
+            dossier = obj.dossier; /* From the button */
+        } 
+        if (obj.ag_id) {
+            ag_id=obj.ag_id;
+        }
+        /* from the form */
+        if (obj.elements) {
+            if (obj.elements['gDossier']) 
+            {
+                dossier = obj.elements['gDossier'].value;
+            }
+
+            if (obj.elements['query']) {
+                inp = obj.elements['query'].value;
+            }
+
+            if (obj.elements['ag_id']) {
+                ag_id = obj.elements['ag_id'].value;
+            }
+        }
+        if (dossier == 0) {
+            throw "obj.dossier not found";
+        }
+        if (ag_id == 0) {
+            throw "obj.ag_id not found";
+        }
+        var query = encodeJSON({
+            'gDossier': dossier,
+            'op': 'action_add_concerned_card',
+            'query' : inp,
+            'ctl' : 'unused',
+            'ag_id' : ag_id
+        });
+
+        waiting_box();
+
+
+        var action = new Ajax.Request('ajax_card.php',
+                {
+                    method: 'get',
+                    parameters: query,
+                    onFailure: errorFid,
+                    onSuccess: function (req, txt)
+                    {
+                        try {
+                        console.log(1);
+                        remove_waiting_box();
+                        var answer = req.responseXML;
+                        var a = answer.getElementsByTagName('ctl');
+                        if (a.length == 0)
+                        {
+                            var rec = req.responseText;
+                            alert('erreur :' + rec);
+                        }
+                        console.log(2);
+                        var html = answer.getElementsByTagName('code');
+                        console.log(3);
+                        var namectl = a[0].firstChild.nodeValue;
+                        console.log(31);
+                        var nodeXml = html[0];
+                        console.log(32);
+                        var code_html = getNodeText(nodeXml);
+                        console.log(33);
+                        code_html = unescape_xml(code_html);
+                        console.log(34);
+
+                        var sx = 0;
+                        if (window.scrollY)
+                        {
+                            sx = window.scrollY + 40;
+                        }
+                        else
+                        {
+                            sx = document.body.scrollTop + 60;
+                        }
+                        console.log(4);
+                        var div_style = "top:" + sx + "px;height:80%";
+                        if ( ! $('search_card')) { add_div({id: 'search_card', 
cssclass: 'inner_box', html: "", style: div_style, drag: true}); }
+                        $('search_card').innerHTML = code_html;
+                        $('query').focus();
+                        console.log(5);
+                        }catch (e) {
+                            console.log('Erreur ')+e.message;
+                        }
+                    }
+                }
+        );
+    }
+    catch (e)
+    {
+        alert('search_card failed' + e.message);
+        return false;
+    }
+    return false;
+}
+
+/**
  address@hidden when you submit the form for searching a card
  address@hidden obj form
  address@hidden the same as search_card, except it answer to a FORM and not
@@ -176,6 +285,7 @@ function result_card_search(req)
 {
     try
     {
+        
         remove_waiting_box();
         var answer=req.responseXML;
         var a=answer.getElementsByTagName('ctl');
@@ -204,6 +314,7 @@ function result_card_search(req)
         var div_style="top:"+sx+"px;height:80%";
         
add_div({id:'search_card',cssclass:'inner_box',html:"",style:div_style,drag:true,effect:'blinddown'});
         $('search_card').innerHTML=code_html;
+        $('query').focus();
     }
     catch (e)
     {
@@ -483,7 +594,11 @@ function select_card_type(obj)
                                   method:'get',
                                   parameters:queryString,
                                   onFailure:errorFid,
-                                  onSuccess:fill_box
+                                  onSuccess:function(req) { 
+                                   
+                                      fill_box(req);
+                                       $('lk_cat_card_table').focus();
+                                    }
                                   }
                                 );
 }
@@ -724,3 +839,79 @@ try {
        return false;
     }
 }
+/***
+ * In Follow-up, update, it is possible to add several card as concerned 
person or company
+ * this function save it into the database, display the result and remove the 
search_card div
+ * @param {type} p_dossier dossier
+ * @param {type} p_fiche_id fiche.f_id
+ * @param {type} p_action_id action_gestion.ag_id
+ * @returns {undefined} nothing
+ */
+function action_save_concerned(p_dossier, p_fiche_id, p_action_id) {
+    var query = encodeJSON({'gDossier': p_dossier, 'f_id': p_fiche_id, 
'ag_id': p_action_id,'op':'action_save_concerned','ctl':'unused'});
+    var a=new Ajax.Request('ajax_card.php',
+            {
+                method: 'get',
+                parameters: query,
+                onFailure: errorFid,
+                onSuccess: function (req, txt)
+                {
+                    try {
+                        console.log(1);
+                        remove_waiting_box();
+                        var answer = req.responseXML;
+                        var a = answer.getElementsByTagName('ctl');
+                        if (a.length == 0)
+                        {
+                            var rec = req.responseText;
+                            alert('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);
+                        removeDiv('search_card');
+                        $('concerned_card_td').innerHTML = code_html;
+                    } catch (e) {
+                        console.log('Erreur ') + e.message;
+                    }
+                }
+            }
+    );
+    }
+function action_remove_concerned(p_dossier,p_fiche_id,p_action_id)
+{
+ var query = encodeJSON({'gDossier': p_dossier, 'f_id': p_fiche_id, 'ag_id': 
p_action_id,'op':'action_remove_concerned','ctl':'unused'});
+    var a=new Ajax.Request('ajax_card.php',
+            {
+                method: 'get',
+                parameters: query,
+                onFailure: errorFid,
+                onSuccess: function (req, txt)
+                {
+                    try {
+                        console.log(1);
+                        remove_waiting_box();
+                        var answer = req.responseXML;
+                        var a = answer.getElementsByTagName('ctl');
+                        if (a.length == 0)
+                        {
+                            var rec = req.responseText;
+                            alert('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);
+                        removeDiv('search_card');
+                        $('concerned_card_td').innerHTML = code_html;
+                    } catch (e) {
+                        console.log('Erreur ') + e.message;
+                    }
+                }
+            }
+    );
+    }
+    
\ No newline at end of file
diff --git a/include/ajax_action_remove_concerned.php 
b/include/ajax_action_remove_concerned.php
new file mode 100644
index 0000000..15a4120
--- /dev/null
+++ b/include/ajax_action_remove_concerned.php
@@ -0,0 +1,46 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS 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.
+ *
+ *   NOALYSS 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 NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+// Copyright 2014 Author Dany De Bontridder address@hidden
+
+// require_once '.php';
+if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
+$ag_id=HtmlInput::default_value_get("ag_id", "0");
+$f_id=HtmlInput::default_value_get("f_id", "0");
+if ( $ag_id == 0 || $f_id == 0 ) throw new Exception ("Invalid values", 0);
+require_once 'class_follow_up.php';
+$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);
+
+$response = ob_get_clean();
+
+$html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<ctl>unused</ctl>
+<code>$html</code>
+</data>
+EOF;
+?>        
\ No newline at end of file
diff --git a/include/ajax_action_save_concerned.php 
b/include/ajax_action_save_concerned.php
new file mode 100644
index 0000000..b8b780e
--- /dev/null
+++ b/include/ajax_action_save_concerned.php
@@ -0,0 +1,47 @@
+<?php
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS 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.
+ *
+ *   NOALYSS 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 NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*/
+
+// Copyright 2014 Author Dany De Bontridder address@hidden
+
+// require_once '.php';
+if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
+/**
+ * Insert into follow-up the card (f_id) for the action_gestion (ag_id)
+ */
+require_once 'class_follow_up.php';
+$follow=new Follow_Up($cn,$ag_id);
+$follow->insert_linked_card($f_id);
+/**
+ * Display all the linked card
+ */
+
+ob_start();
+$follow->display_linked();
+echo HtmlInput::button_action_add_concerned_card( $ag_id);
+$response = ob_get_clean();
+$html = escape_xml($response);
+header('Content-type: text/xml; charset=UTF-8');
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<ctl>unused</ctl>
+<code>$html</code>
+</data>
+EOF;
+?>        
\ No newline at end of file
diff --git a/include/ajax_add_concerned_card.php 
b/include/ajax_add_concerned_card.php
new file mode 100644
index 0000000..da09c71
--- /dev/null
+++ b/include/ajax_add_concerned_card.php
@@ -0,0 +1,83 @@
+<?php
+
+/*
+ *   This file is part of NOALYSS.
+ *
+ *   NOALYSS 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.
+ *
+ *   NOALYSS 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 NOALYSS; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+// Copyright 2014 Author Dany De Bontridder address@hidden
+// require_once '.php';
+if (!defined('ALLOWED'))
+    die('Appel direct ne sont pas permis');
+ob_start();
+
+$ag_id=HtmlInput::default_value_get("ag_id", "0");
+
+if ($ag_id == 0 )    throw new Exception('ag_id is null');
+
+require_once('class_acc_ledger.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;">';
+$q=new IText('query');
+$q->value=(isset($query))?$query:'';
+$r.='<span style="margin-left:50px">';
+$r.=_('Fiche contenant').HtmlInput::infobulle(19);
+$r.=$q->input();
+$r.=HtmlInput::submit('fs', _('Recherche'), "", "smallbutton");
+$r.='</span>';
+$r.=dossier::hidden().HtmlInput::hidden('op', 'add_concerned_card');
+$r.=HtmlInput::request_to_hidden(array('ag_id'));
+$r.='</form>';
+$query=HtmlInput::default_value_get("query", "");
+$sql_array['query']=$query;
+$sql_array['typecard']='all';
+
+$fiche=new Fiche($cn);
+/* Build the SQL and show result */
+$sql=$fiche->build_sql($sql_array);
+
+
+/* We limit the search to MAX_SEARCH_CARD records */
+$sql=$sql.' order by vw_name limit '.MAX_SEARCH_CARD;
+$a=$cn->get_array($sql);
+for ($i=0; $i<count($a); $i++)
+{
+    $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;
+require_once('template/card_result.php');
+$response=ob_get_contents();
+ob_end_clean();
+
+
+$html=escape_xml($response);
+if ( !headers_sent() ) { header('Content-type: text/xml; charset=UTF-8');} 
else {echo $response;echo $html;}
+echo <<<EOF
+<?xml version="1.0" encoding="UTF-8"?>
+<data>
+<ctl>unused</ctl>
+<code>$html</code>
+</data>
+EOF;
+?>
\ No newline at end of file
diff --git a/include/class_follow_up.php b/include/class_follow_up.php
index 69b800d..eb4e83b 100644
--- a/include/class_follow_up.php
+++ b/include/class_follow_up.php
@@ -165,18 +165,20 @@ class Follow_Up
                $date = new IDate();
                $date->readOnly = $readonly;
                $date->name = "ag_timestamp";
+               $date->id= "ag_timestamp";
                $date->value = $this->ag_timestamp;
 
                $remind_date = new IDate();
                $remind_date->readOnly = $readonly;
                $remind_date->name = "ag_remind_date";
+               $remind_date->id = "ag_remind_date";
                $remind_date->value = $this->ag_remind_date;
 
 
                // Doc Type
                $doc_type = new ISelect();
                $doc_type->name = "dt_id";
-               $doc_type->value = $this->db->make_array("select dt_id,dt_value 
from document_type order by dt_value");
+               $doc_type->value = $this->db->make_array("select dt_id,dt_value 
from document_type order by dt_value",1);
                $doc_type->selected = $this->dt_id;
                $doc_type->readOnly = $readonly;
                $str_doc_type = $doc_type->input();
@@ -338,7 +340,8 @@ class Follow_Up
                $sp->name = 'qcode_dest_label';
                $sp->value = $qcode_dest_label;
 
-               // contact
+               // autre - a refaire pour avoir plusieurs fiches
+                // Sur le modèle des tags
                $ag_contact = new ICard();
                $ag_contact->readOnly = $readonly;
                $ag_contact->jrn = 0;
@@ -1012,7 +1015,7 @@ class Follow_Up
        function fromArray($p_array)
        {
                 global $g_user;
-               $this->ag_id = (isset($p_array['ag_id'])) ? $p_array['ag_id'] : 
"";
+               $this->ag_id = (isset($p_array['ag_id'])) ? $p_array['ag_id'] : 
0;
                $this->ag_ref = (isset($p_array['ag_ref'])) ? 
$p_array['ag_ref'] : "";
                $this->qcode_dest = (isset($p_array['qcode_dest'])) ? 
$p_array['qcode_dest'] : "";
                $this->f_id_dest = (isset($p_array['f_id_dest'])) ? 
$p_array['f_id_dest'] : 0;
@@ -1311,7 +1314,7 @@ class Follow_Up
                                if ($fiche->id == 0)
                                        $str = ' and false ';
                                else
-                                       $str = " and (f_id_dest= " . $fiche->id 
. " ) ";
+                                       $str = " and (f_id_dest= " . $fiche->id 
. " or ag_id in (select ag_id from action_person as ap where ap.f_id=". 
$fiche->id .")  )";
                        }
                }
                if (isset($tdoc) && $tdoc != -1)
@@ -1531,7 +1534,7 @@ class Follow_Up
                         $a_tag[$e]['t_id']);
                 echo '<span style="border:1px solid black;margin-right:5px;">';
                 echo $a_tag[$e]['t_tag'];
-                echo HtmlInput::anchor( " &#x2D5D; ", "javascript:void(0)", 
$js_remove, ' class="smallbutton " style="padding:0px;display:inline" ');
+                echo HtmlInput::anchor( " &#x2D5D; ", "javascript:void(0)", 
$js_remove, ' class="smallbutton" style="padding:0px;display:inline" ');
                 echo '</span>';
                 echo '&nbsp;';
                 echo '&nbsp;';
@@ -1623,4 +1626,72 @@ class Follow_Up
                        array($mag_id[$i]));
             }
         }
+        /**
+         * Verify that data are correct
+         * @throws Exception
+         */
+        function verify()
+        {
+            if ( $this->dt_id == -1 ) {
+                throw new Exception (_('Type action invalide'),10);
+            }
+            if ( isDate($this->ag_timestamp) != $this->ag_timestamp )
+                throw new Exception (_('Date invalide'),20);
+            if ( isDate($this->ag_remind_date) != $this->ag_remind_date )
+                throw new Exception (_('Date invalide'),30);
+        }
+        /**
+         *  Add another concerned (tiers, supplier...)
+         * @global type $g_user
+         * @param type $p_fiche_id
+         */
+        function insert_linked_card($p_fiche_id) 
+        {
+            global $g_user;
+            if ( $g_user->can_write_action($this->ag_id))  {
+                /**
+                 * insert into action_person
+                 */
+                $count=$this->db->get_value('select count(*) from 
action_person where f_id=$1 and ag_id=$2',array($p_fiche_id,$this->ag_id));
+                if ( $count == 0 ) 
+                {
+                    $this->db->exec_sql('insert into action_person 
(ag_id,f_id) values ($1,$2)',array($this->ag_id,$p_fiche_id));
+                }
+            }
+        }
+        /**
+         * Remove  another concerned (tiers, supplier...)
+         * @global type $g_user
+         * @param type $p_fiche_id
+         */
+        function remove_linked_card($p_fiche_id)
+        {
+             global $g_user;
+            if ( $g_user->can_write_action($this->ag_id))  {
+                  $this->db->exec_sql('delete from action_person where ag_id = 
$1 and f_id = $2',array($this->ag_id,$p_fiche_id));
+            }
+            
+        }
+        /**
+         * Display the other concerned (tiers, supplier...)
+         * @return string
+         */
+        function display_linked()
+        {
+            $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 "";
+            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( " &#x2D5D; ", "javascript:void(0)", 
$js_remove, ' class="smallbutton" style="padding:0px;display:inline" ');
+                echo '</span>';
+                echo '&nbsp;';
+                echo '&nbsp;';
+            }
+        }
 }
diff --git a/include/class_html_input.php b/include/class_html_input.php
index aa473b3..202846b 100755
--- a/include/class_html_input.php
+++ b/include/class_html_input.php
@@ -878,7 +878,16 @@ class HtmlInput
             $rmOperation=sprintf("javascript:if ( confirm('"._('Voulez-vous 
effacer cette relation ')."')==true ) {remove_operation('%s','%s');}",
                                                        dossier::id(),
                                                        $p_operation);
-            $js= '<a class="smallbutton" style="padding:0px;display:inline" 
style="color:orange" id="acop'.$p_operation.'" 
href="'.$rmOperation.'">'."&#x2D5D;".'</a>';
+            $js= '<a class="tinybutton" id="acop'.$p_operation.'" 
href="'.$rmOperation.'">'."&#x2D5D;".'</a>';
+            return $js;
+        }
+        static function button_action_add_concerned_card($p_agid)
+        {
+            $dossier=Dossier::id();
+            $javascript= <<<EOF
+                    
obj={dossier:$dossier,ag_id:$p_agid};action_add_concerned_card(obj);
+EOF;
+            $js=HtmlInput::button_action(_('Ajout autres'), $javascript);
             return $js;
         }
 }
diff --git a/include/template/card_result.php b/include/template/card_result.php
index c8fefb3..828b0fa 100644
--- a/include/template/card_result.php
+++ b/include/template/card_result.php
@@ -9,7 +9,7 @@
 <?php for ($i=0;$i<sizeof($array);$i++) : ?>
     <?php $class=($i%2==0)?'odd':'even';?>
 <tr class="<?php echo $class;?>">
-<td style="padding-right:55">
+<td style="padding-right:55px">
 <a href="javascript:void(0)" class="one" onclick="<?php echo 
$array[$i]['javascript']?>">
 <?php echo $array[$i]['quick_code']?>
 </a>
diff --git a/include/template/detail-action.php 
b/include/template/detail-action.php
index 461157a..d96c7c3 100644
--- a/include/template/detail-action.php
+++ b/include/template/detail-action.php
@@ -1,24 +1,17 @@
 <?php
 //This file is part of NOALYSS and is under GPL 
 //see licence.txt
-?><fieldset>
-  <legend>
-<?php echo _('Informations générales')?>
-  </legend>
-  <div style="float:right">
-    <?echo $retour;
-    ?>
-  </div>
+?><div>
 <h2 class="gest_name"><?php echo $sp->input();   ?></h2>
-<div style="float:left;width: 45%">
+<div style="width:47%;float:left;">
 
 
-        <table >
+    <table>
                        <tr>
             <TD>
            <?php echo _('N° document')?>
             </TD>
-            <TD style="font-weight: bolder;" >
+            <TD class="highlight">
               <?php echo $this->ag_id;?>
             </TD>
           </TR>
@@ -31,34 +24,16 @@
               ?>
             </TD>
           </TR>
-
-            <TD>
-   <?php echo _('Date')?>
-            </TD>
-            <TD>
-              <?php echo $date->input();
-              ?>
-            </TD>
-          </TR>
-          <TR>
-            <TD>
-           <?php echo _('Heure')?>
-            </TD>
+   <tr>
             <TD>
-              <?php echo $str_ag_hour;
-              ?>
-            </TD>
-          </TR>
-          <tr>
-               <TR>
-            <TD>
-           <?php echo _('Date limite')?>
+           <?php echo _('Type')?>
             </TD>
             <TD>
-              <?php echo $remind_date->input();
+              <?php echo $str_doc_type;
               ?>
             </TD>
-          </TR>
+          </tr>
+        <tr>
 
        <tr>
           <TD>
@@ -83,23 +58,56 @@
              <?php echo $spcontact->input(); ?>
           </td>
           </Tr>
+          <?php if ($this->ag_id > 0 ): ?>
+          <tr>
+              <td>
+                  <?php echo _('Autres concernés')?>
+              </td>
+              <td id="concerned_card_td">
+              <?php 
+                    echo $this->display_linked();
+                    echo HtmlInput::button_action_add_concerned_card( 
$this->ag_id)?>
+              </td>
+              <td>
+
+              </td>
+          </tr>
+          <?php endif; ?>
         </table>
  <?php if ($p_view != 'READ') echo $str_add_button;?>
 
 </div>
-<div style="float:left;width:45%">
+<div style="width:47%;float:left">
         <table>
 
+         
+            <TD>
+   <?php echo _('Date')?>
+            </TD>
+            <TD>
+              <?php echo $date->input();
+              ?>
+            </TD>
+          </TR>
+          <TR>
+            <TD>
+           <?php echo _('Heure')?>
+            </TD>
+            <TD>
+              <?php echo $str_ag_hour;
+              ?>
+            </TD>
+          </TR>
           <tr>
+               <TR>
             <TD>
-           <?php echo _('Type')?>
+           <?php echo _('Date limite')?>
             </TD>
             <TD>
-              <?php echo $str_doc_type;
+              <?php echo $remind_date->input();
               ?>
             </TD>
-          </tr>
-
+          </TR>
           <tr>
             <TD>
            <?php echo _('Etat')?>
@@ -143,9 +151,9 @@
         </table>
 
 </div>
-<div style="float:right;clear:both"></div>
-       <div style="float:left;width:45%">
-               <h4 style="display:inline">Opérations concernées</h4>
+<div style="clear: both"></div>
+       <div style="float:left;width: 47%">
+               <h4 style="display:inline;">Opérations concernées</h4>
                <ol>
 
                <?php
@@ -169,7 +177,7 @@
                <?php if ($p_view != 'READ')   echo '<span 
class="noprint">'.$iconcerned->input().'</span>';?>
        </div>
 
-       <div style="float:left;width:45%">
+        <div style="float:left;width: 47%">
                <h4 style="display:inline"><?php echo _("Actions 
concernées")?></h4>
                <ol>
 
@@ -183,7 +191,7 @@
                                        dossier::id(),
                                        
$action[$o]['ag_id'],$_REQUEST['ag_id']);
                        $showAction='<a class="line" 
href="'.$base."&ag_id=".$action[$o]['ag_id'].'">';
-                       $js= '<a class="mtitle" style="color:orange" 
id="acact'.$action[$o]['ag_id'].'" href="'.$rmAction.'">'._("Effacer").'</a>';
+                       $js= '<a class="tinybutton" 
id="acact'.$action[$o]['ag_id'].'" href="'.$rmAction.'">&#x2D5D;</a>';
                        echo '<li 
id="act'.$action[$o]['ag_id'].'">'.$showAction.$action[$o]['str_date']." 
".$action[$o]['ag_ref']." ".
                                        
h($action[$o]['sub_title']).'('.h($action[$o]['dt_value']).')</a>'." "
                                .$js.'</li>';
@@ -199,8 +207,9 @@
                </ol>
                <?php if ( $p_view != 'READ') echo '<span 
class="noprint">'.$iaction->input().'</span>';?>
        </div>
-</fieldset>
-<div class="myfieldset">
+</div>
+<div style="clear: both"></div>
+<div id="div_action_description">
   <h1 class="legend">
            <?php echo _('Description')?>
   </h1>
@@ -220,23 +229,30 @@ function small(p_id_textarea){
 <?php if  ($p_view != 'NEW') : ?>
 Document créé le <?php echo $this->ag_timestamp ?> par <?php echo 
$this->ag_owner?>
 <?php endif; ?>
-   <h4 class="info"><?php echo _('Titre')?></h4>
-    <p style="margin-left:100">
+  <h4 class="info" style="margin-left:110px"><?php echo _('Titre')?></h4>
+    <p style="margin-left:100px">
     <?php echo $title->input();
     ?>
 </p>
-<h4 class="info">   <?php echo _('Commentaire')?></h4>
     <div style="margin-left:100px">
    <?php
    $style_enl='style="display:inline"';$style_small='style="display:none"';
 
 for( $c=0;$c<count($acomment);$c++){
-       if ( $p_view != 'READ')
+        if ($c == 0) { $m_desc=_('Description');}
+        else
+        if ($c == 1) { $m_desc=_('Commentaire');}
+        else
+         { $m_desc="";}?>
+        <h4 class="info" >   <?php echo $m_desc;?></h4>
+
+       <?php
+        if ( $p_view != 'READ')
        {
                $rmComment=sprintf("javascript:if ( confirm('"._('Voulez-vous 
effacer ce commentaire')." ?')==true ) {remove_comment('%s','%s');}",
                                                dossier::id(),
                                                $acomment[$c]['agc_id']);
-                               $js= '<a class="mtitle" style="color:red" 
id="accom'.$acomment[$c]['agc_id'].'" href="'.$rmComment.'">Effacer</a>';
+                               $js= '<a class="tinybutton" 
id="accom'.$acomment[$c]['agc_id'].'" href="'.$rmComment.'">&#x2D5D;</a>';
                echo 
hb('n°'.$acomment[$c]['agc_id'].'('.$acomment[$c]['tech_user']." 
".$acomment[$c]['str_agc_date'].')').$js.
                                '<pre style="white-space: 
-moz-pre-wrap;white-space: pre-wrap;border:1px solid blue;width:80%;" 
id="com'.$acomment[$c]['agc_id'].'"> '.
                                " ".h($acomment[$c]['agc_comment']).'</pre>'
@@ -265,6 +281,7 @@ echo '</span>';
 </div>
 <?php if ( $p_view !='READ'  ) :?>
 <input type='button' class="button" class="noprint" value='Montrer articles' 
id="toggleButton" onclick='toggleShowDetail()'>
+<input type='button' class="button" class="noprint" value='Générer' 
id="toggleButtonGenerate" onclick="$('div_generate_document').show()">
 <?php endif; ?>
 <?php
 /**
@@ -282,8 +299,8 @@ endfor;
 if ($show_row !=0 ) :
 
        ?>
-<fieldset id="fldDetail" style='display:block;top:2px'>
-   <LEGEND> <?php echo _('Détail des articles')?>
+<div id="fldDetail" class="myfieldset" style='padding-bottom:  
100px;display:block;top:2px'>
+   <LEGEND> <?php echo _('Détail')?>
 </LEGEND>
 <?php // hidden fields
 $show_row=0;
@@ -323,9 +340,10 @@ if ( ($aCard[$i] != 0 && $p_view == 'READ') || $p_view != 
'READ'):
 <?php endif; ?>
 <?php endfor; ?>
 </table>
-    
+    </div>
 <script language="JavaScript">
 if ( $('e_march0') && $('e_march0').value =='') { toggleShowDetail();}
+$('div_generate_document').hide();
 function toggleShowDetail() {
        try {var detail=g('fldDetail');
        var but=g('toggleButton');
@@ -333,25 +351,25 @@ function toggleShowDetail() {
        else { but.value="<?php echo _("Cacher les 
détails")?>";detail.style.display='block';} }
        catch (error)  {alert(error);}
        }
+</script>    
 
-</script>
 <?php if ( $show_row != 0 ): ?>
-<div style="float: right; text-align: right; padding-right: 5px; font-size: 
1.2em; font-weight: bold; color: blue;">
+<div>
   
-    <div style="float: right; text-align: left; font-size: 1.2em; font-weight: 
bold; color: blue;" id="sum">
-    <br><span style="text-align: right" id="htva">0.0</span>
-     <br><span style="text-align: right"  id="tva">0.0</span>
-    <br><span style="text-align: right" id="tvac">0.0</span>
+    <div style=" float:right;margin-right: 2px"" id="sum">
+    <br><span style="text-align: right;" class="highlight" id="htva">0.0</span>
+     <br><span style="text-align: right" class="highlight" id="tva">0.0</span>
+    <br><span style="text-align: right" class="highlight" id="tvac">0.0</span>
  </div>
 
-<div style="float: right; text-align: right; padding-right: 5px; font-size: 
1.2em; font-weight: bold; color: blue;">
+    <div  style="float:right;margin-right: 230px" >
     <br>Total HTVA
     <br>Total TVA
     <br>Total TVAC
  </div>
 
  <?php if ( ! $readonly ) :  ?>
-    <div  style="position:float;float:right">
+    <div style="float:right" >
     <input name="act" id="act_bt" class="smallbutton" value="<?php echo 
_('Actualiser')?>" onclick="compute_all_ledger();" type="button">
      <input type="button" class="smallbutton" onclick="gestion_add_row()" 
value="<?php echo _("Ajouter une ligne")?>">
      </div>
@@ -359,7 +377,7 @@ function toggleShowDetail() {
 <?php endif; ?>         
 </div>
 <?php if ( $this->ag_id != 0 && ! $readonly) : ?>
-     <div  style="position:float;float:left">
+     <div >
          <p>
          <?php
             $query=  
http_build_query(array('gDossier'=>Dossier::id(),'ag_id'=>$this->ag_id,'create_invoice'=>1,'ac'=>$menu->get('code_invoice')));
@@ -369,23 +387,23 @@ function toggleShowDetail() {
       </div>
      <?php endif; ?>
 <?php endif; ?>
-</fieldset>
+</div>
 <?php endif; ?>
 </div>
-    
+<div style="clear:both"></div>    
 <?php if ($p_view != 'READ' && $str_select_doc != '') : ?>
-<fieldset class="noprint" >
+<div id="div_generate_document" class="noprint" style="display:none" >
   <legend>
      <?php echo _('Document à générer')?>
   </legend>
   <?php echo $str_select_doc;
  echo $str_submit_generate;
   ?>
-</fieldset>
+</div>
 <?php endif; ?>
 
 
-<fieldset>
+<div class="myfieldset" id="div_action_attached_doc">
   <legend>
      <?php echo _('Pièces attachées')?>
   </legend>
@@ -464,6 +482,6 @@ catch(exception) { alert('<?php echo j(_('Je ne peux pas 
ajouter de fichier'))?>
   </span>
   </div>
  <?php endif;?>
-</fieldset>
+</div>
 </div>
 <script>compute_all_ledger()</script>
\ No newline at end of file
diff --git a/sql/upgrade.sql b/sql/upgrade.sql
index f236c2f..f32de1e 100644
--- a/sql/upgrade.sql
+++ b/sql/upgrade.sql
@@ -57,9 +57,27 @@ create table key_distribution_activity
 );
 
 comment on table key_distribution is 'Distribution key for analytic';
+comment on table key_distribution_activity is 'activity (account) linked to 
the row';
+comment on column key_distribution.kd_id is 'PK';
+comment on column key_distribution.kd_name is 'Name of the key';
+comment on column key_distribution.kd_description is 'Description of the key';
+
 comment on table key_distribution_ledger is 'Legder where the distribution key 
can be used' ;
+comment on column key_distribution_ledger.kl_id is 'pk';
+comment on column key_distribution_ledger.kd_id is 'fk to key_distribution';
+comment on column key_distribution_ledger.jrn_def_id is 'fk to jrnd_def, 
ledger where this key is available';
+
+
 comment on table key_distribution_detail is 'Row of activity and percent';
-comment on table key_distribution_activity is 'activity (account) linked to 
the row';
+comment on column key_distribution_detail.ke_id is 'pk';
+comment on column key_distribution_detail.kd_id is 'fk to key_distribution';
+comment on column key_distribution_detail.ke_row is 'group order';
+
+comment on table key_distribution_activity is 'Contains the analytic account';
+comment on column key_distribution_activity.ka_id is 'pk';
+comment on column key_distribution_activity.ke_id is 'fk to 
key_distribution_detail';
+comment on column key_distribution_activity.po_id is 'fk to poste_analytique';
+comment on column key_distribution_activity.pa_id is 'fk to plan_analytique';
 
 drop view vw_fiche_attr cascade;
 
@@ -155,9 +173,14 @@ create index jrnx_j_qcode_ix on jrnx (j_qcode);
 CREATE TABLE action_person 
 (
     ap_id  SERIAL NOT NULL, 
-    ag_id int4 NOT NULL, 
-f_id int4, PRIMARY KEY (ap_id));
+    ag_id int4 NOT NULL references action_gestion(ag_id) on update cascade on 
delete cascade,, 
+    f_id int4 not null references fiche(f_id) on update cascade on delete 
cascade, 
+    PRIMARY KEY (ap_id));
+
 COMMENT ON TABLE action_person IS 'Person involved in the action';
+comment on column action_person.ap_id is 'pk';
+comment on column action_person.ag_id is 'fk to action_action';
+comment on column action_person.ag_id is 'fk to fiche';
 
 ALTER TABLE action_person ADD CONSTRAINT action_gestion_ag_id_fk2 FOREIGN KEY 
(ag_id) REFERENCES  action_gestion (ag_id);
 ALTER TABLE action_person ADD CONSTRAINT fiche_f_id_fk2  FOREIGN KEY (f_id) 
REFERENCES fiche(f_id);
@@ -184,4 +207,6 @@ CREATE TRIGGER trg_category_card_before_delete
   BEFORE delete
   ON fiche_def
   FOR EACH ROW
-  EXECUTE PROCEDURE comptaproc.category_card_before_delete();
\ No newline at end of file
+  EXECUTE PROCEDURE comptaproc.category_card_before_delete();
+
+alter table action_gestion add constraint fk_action_gestion_document_type 
foreign key (ag_type) references document_type(dt_id);
diff --git a/unit-test/include/class_acc_ledger_soldTest.php 
b/unit-test/include/class_acc_ledger_soldTest.php
index 66908f9..40ded15 100644
--- a/unit-test/include/class_acc_ledger_soldTest.php
+++ b/unit-test/include/class_acc_ledger_soldTest.php
@@ -19,7 +19,7 @@ class Acc_Ledger_SoldTest extends PHPUnit_Framework_TestCase
     protected function setUp()
     {
         include 'global.php';
-        $this->object=new Acc_Ledger_Sold($g_connection,2);
+        $this->object=new Acc_Ledger_Sold($g_connection, 2);
     }
 
     /**
@@ -38,7 +38,7 @@ class Acc_Ledger_SoldTest extends PHPUnit_Framework_TestCase
      */
     public function testVerify()
     {
-         $this->object->verify(array());
+        $this->object->verify(array());
     }
 
     /**
@@ -69,7 +69,8 @@ class Acc_Ledger_SoldTest extends PHPUnit_Framework_TestCase
     public function testExtra_info()
     {
         $info=$this->object->extra_info();
-        if ( ! is_string($info) ) {
+        if (!is_string($info))
+        {
             $this->assertTrue(FALSE);
         }
     }
@@ -93,8 +94,9 @@ class Acc_Ledger_SoldTest extends PHPUnit_Framework_TestCase
     public function testInput()
     {
         $_REQUEST['ac']='VEN';
-       $info=$this->object->input();
-        if ( ! is_string($info) ) {
+        $info=$this->object->input();
+        if (!is_string($info))
+        {
             $this->assertTrue(FALSE);
         }
     }
@@ -123,16 +125,4 @@ class Acc_Ledger_SoldTest extends 
PHPUnit_Framework_TestCase
         );
     }
 
-    /**
-     * @covers Acc_Ledger_Sold::test_me
-     * @todo   Implement testTest_me().
-     */
-    public function testTest_me()
-    {
-        // Remove the following lines when you implement this test.
-        $this->markTestIncomplete(
-                'This test has not been implemented yet.'
-        );
-    }
-
 }



reply via email to

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