noalyss-commit
[Top][All Lists]
Advanced

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

[Noalyss-commit] [noalyss] 11/12: Mantis #0001442: CA - facilité de man


From: Dany De Bontridder
Subject: [Noalyss-commit] [noalyss] 11/12: Mantis #0001442: CA - facilité de manipulation - effacement Button for cleaning detail analytique in operation
Date: Thu, 12 Sep 2019 16:01:25 -0400 (EDT)

sparkyx pushed a commit to branch master
in repository noalyss.

commit 1c6b9737ad7ae30216474e564eecc872d08b14c6
Author: Dany De Bontridder <address@hidden>
Date:   Thu Sep 12 21:42:50 2019 +0200

    Mantis #0001442: CA - facilité de manipulation - effacement
    Button for cleaning detail analytique in operation
---
 html/ajax_misc.php                    |  2 +
 html/js/anc_script.js                 | 49 ++++++++++++++++++++++
 include/ajax/ajax_anc_key_clean.php   | 76 +++++++++++++++++++++++++++++++++++
 include/class/anc_operation.class.php | 16 ++++++++
 4 files changed, 143 insertions(+)

diff --git a/html/ajax_misc.php b/html/ajax_misc.php
index c209d9d..ef7ac14 100644
--- a/html/ajax_misc.php
+++ b/html/ajax_misc.php
@@ -191,6 +191,8 @@ $path = array(
     "ledger_show"=>"ajax_ledger_show",
   //Show the available distribution keys for analytic 
     "anc_key_choice"=>"ajax_anc_key_choice" ,
+  //Clean the detail for analytic 
+    "anc_key_clean"=>"ajax_anc_key_clean" ,
   // Show the activities computed with the selected distribution key 
     "anc_key_compute"=>"ajax_anc_key_compute" ,
   //From admin, revoke the access to a folder from an user
diff --git a/html/js/anc_script.js b/html/js/anc_script.js
index d18e81a..ce7cc58 100644
--- a/html/js/anc_script.js
+++ b/html/js/anc_script.js
@@ -491,6 +491,55 @@ function anc_key_choice(p_dossier, p_table, 
p_amount,p_ledger)
         error_message(e.message);
     }
 }
+
+/**
+ *  reset all the details of a row
+ * @param p_dossier is the dossier
+ * @param p_table the table id of the target
+ * @param p_amount amount to distribute
+ * @param p_ledger ledger id
+ * @param p_jrnx_id jrnx.id
+ */
+function anc_key_clean(p_dossier, p_table, 
p_amount,p_ledger,p_jrnx_id,p_sequence)
+{
+    waiting_box();
+    var op = 'op=anc_key_clean';
+    var queryString = op + "&gDossier=" + p_dossier + "&t=" + p_table + 
"&amount=" + p_amount+"&jrnx_id="+p_jrnx_id+'&p_seq='+p_sequence;
+    try {
+        queryString+='&led='+p_ledger;
+        var action = new Ajax.Request(
+                "ajax_misc.php",
+                {
+                    method: 'get',
+                    parameters: queryString,
+                    onFailure: error_box,
+                    onSuccess: function(req, json) {
+                        try
+                        {
+                            var answer = req.responseXML;
+                            remove_waiting_box();
+                            var html = answer.getElementsByTagName('code');
+                            if (html.length == 0) {
+                                var rec = req.responseText;
+                                alert_box('erreur :' + rec);
+                            }
+
+                            var code_html = getNodeText(html[0]); // Firefox 
ne prend que les 4096 car.
+                            code_html = unescape_xml(code_html);
+                            $(p_table+"t"+p_sequence).innerHTML=code_html;
+                        } catch (e)
+                        {
+                            error_message(e.message);
+                        }
+                    }
+                }
+
+        );
+
+    } catch (e) {
+        error_message(e.message);
+    }
+}
 /**
  * Add a row for distribution key.
  * This function add a row in the table key distribution
diff --git a/include/ajax/ajax_anc_key_clean.php 
b/include/ajax/ajax_anc_key_clean.php
new file mode 100644
index 0000000..6944c92
--- /dev/null
+++ b/include/ajax/ajax_anc_key_clean.php
@@ -0,0 +1,76 @@
+<?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
+*/
+/**
+ * @file
+ * @brief show the available distribution keys for analytic activities. 
Expected
+ * parameter are 
+ *  - t for the table id
+ *  - amount is the amount to distributed
+ *
+ */
+// Copyright (2014) Author Dany De Bontridder address@hidden
+if ( ! defined ('ALLOWED') ) die('Appel direct ne sont pas permis');
+
+require_once NOALYSS_INCLUDE.'/lib/http_input.class.php';
+$http=new HttpInput();
+
+try
+{
+    $amount=$http->get("amount", "number");
+    $table_id=$http->get("t");
+    $ledger=$http->get('led',"number");
+    $jrnx_id=$http->get("jrnx_id","string","");
+    $sequence=$http->get("p_seq","number");
+}
+catch (Exception $exc)
+{
+    error_log($exc->getTraceAsString());
+    return;
+}
+
+
+require_once 'class/anc_operation.class.php';
+global $g_user;
+
+if ($g_user->get_ledger_access($ledger)=='W')
+{
+    ob_start();
+    $anc_op = new Anc_Operation($cn);
+    $anc_op->j_id = $jrnx_id;
+    $anc_op->in_div= $t ;
+
+    /* compute total price */
+    bcscale(2);
+//    echo $anc_op->display_table(1, $amount, $t);
+    echo 
$anc_op->display_form_plan(NULL,1,1,$sequence,$amount,$table_id,FALSE);
+
+    $response = ob_get_clean();
+} else {
+    $response = _("Interdit");
+}
+$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;
+?>        
\ No newline at end of file
diff --git a/include/class/anc_operation.class.php 
b/include/class/anc_operation.class.php
index 9726ac3..d6f7b59 100644
--- a/include/class/anc_operation.class.php
+++ b/include/class/anc_operation.class.php
@@ -642,6 +642,22 @@ class Anc_Operation
             $button_key->name="js".$p_id.$p_seq;
             $button_key->label=_("Clef");
             $result .= $button_key->input();
+            /**
+             * Add a button to clean the detail
+             */
+            $button_clean=new IButton();
+            
$button_clean->javascript=sprintf("anc_key_clean('%s','%s','%s','%s','%s','%s');",
+                    $gDossier,
+                    $p_id,
+                    $p_amount,
+                    $ledger,
+                    $this->j_id,
+                    $p_seq
+                    );
+            $button_clean->name=uniqid();
+            $button_clean->label=_("Efface détail");
+            $result.=$button_clean->input();
+                    
 
         }
 



reply via email to

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