[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Noalyss-commit] [noalyss] 11/12: Clean code : dead code, improve debug
From: |
Dany De Bontridder |
Subject: |
[Noalyss-commit] [noalyss] 11/12: Clean code : dead code, improve debug, comments |
Date: |
Wed, 16 Nov 2022 14:39:19 -0500 (EST) |
sparkyx pushed a commit to branch master
in repository noalyss.
commit a2dcdec1b52b10f647f0d2c45fa5f68f8b312985
Author: sparkyx <danydb@noalyss.eu>
AuthorDate: Mon Nov 14 22:35:10 2022 +0100
Clean code : dead code, improve debug,comments
---
html/do.php | 3 +++
html/js/noalyss_script.js | 34 +++++++---------------------------
include/class/anc_operation.class.php | 3 ++-
include/template/detail-action.php | 5 ++++-
4 files changed, 16 insertions(+), 29 deletions(-)
diff --git a/html/do.php b/html/do.php
index 67b115ada..d24e5bf0d 100644
--- a/html/do.php
+++ b/html/do.php
@@ -58,6 +58,9 @@ $g_user = new Noalyss_user($cn);
$http=new HttpInput();
IDate::set_firstDate($g_user->get_first_week_day());
+// check that the current user is saved into PostgreSQL setting in order to
use it in PLPGSQL
+\Noalyss\Dbg::echo_var(1,sprintf("current user is [%s]",$cn->get_value("select
current_setting('noalyss.user_login')")));
+
/*
* check that the database is not empty
*/
diff --git a/html/js/noalyss_script.js b/html/js/noalyss_script.js
index 08f2ee20e..3ab255ba2 100644
--- a/html/js/noalyss_script.js
+++ b/html/js/noalyss_script.js
@@ -3058,7 +3058,7 @@ function unselect_other_tab(p_tab)
}
} catch (e) {
if (console)
- console.log(e.message);
+ console.error(e.message);
alert_box('unselect_other_tab ' + e.message);
}
}
@@ -3870,26 +3870,7 @@ function json_concat(p_json1,p_json2)
}
-/**
- * return a json object which is the merge of the 2 json objects
- * from 2015 : Object.assign(obj1, obj2);
- * @param p_json1 object 1 to merge
- * @param p_json2 object 2 to merge
- * @returns new json object
- */
-function json_concat(p_json1,p_json2)
-{
-
- var result = {};
- for (var key in p_json1) {
- result[key] = p_json1[key];
- }
- for (var key in p_json2) {
- result[key] = p_json2[key];
- }
- return result;
-}
/**
* this function unchecks other checkbox , it mimics the way a radio behaves
* @param string p_click is the DOM id of the checkbox you clicked
@@ -3912,7 +3893,6 @@ function uncheck_other(p_click,p_name)
var operation_tag = function (p_div)
{
this.ctl = p_div;
- console.log("ctl "+p_div);
/**
* Show a list of tag which can be added to the current followup document
* @param {type} p_dossier
@@ -3976,7 +3956,6 @@ var operation_tag = function (p_div)
onFailure: ajax_misc_failure,
onSuccess: function (req, j) {
var answer = req.responseXML;
- console.log("1-ctl "+ctl);
var html = answer.getElementsByTagName('code');
if (html.length === 0)
{
@@ -4004,7 +3983,6 @@ var operation_tag = function (p_div)
this.remove = function (p_dossier, p_jrn_id, t_id)
{
var ctl=this.ctl;
- console.log("remove-1.ctl "+ctl);
confirm_box(null, content[50], function () {
try {
waiting_box();
@@ -4026,7 +4004,6 @@ var operation_tag = function (p_div)
var code_html = getNodeText(html[0]);
code_html = unescape_xml(code_html);
remove_waiting_box();
- console.log("remove-2.ctl "+ctl);
$('operation_tag_td'+ctl).innerHTML =
code_html;
}
@@ -4050,11 +4027,14 @@ function check_file_size(p_object,p_max_size)
var sum_file=0;
for(var i=0;i<p_object.elements.length;i++) {
var a=p_object.elements[i];
+
if ( p_object.elements[i].getAttribute('type')=="file" )
{
- if( p_object.elements[i].files[0]){
+ for (let x = 0; x < p_object.elements[i].files.length ; x++) {
+ if( p_object.elements[i].files[x]){
- sum_file+=p_object.elements[i].files[0].size;
+ sum_file+=p_object.elements[i].files[x].size;
+ }
}
}
}
@@ -4165,4 +4145,4 @@ function enlarge_text(p_domid,p_size) {
}
-}
\ No newline at end of file
+}
diff --git a/include/class/anc_operation.class.php
b/include/class/anc_operation.class.php
index 17ee50737..48d574ba1 100644
--- a/include/class/anc_operation.class.php
+++ b/include/class/anc_operation.class.php
@@ -504,7 +504,8 @@ class Anc_Operation
record_log($e);
}
}
- /*!\brief display the form for PA
+ /*!
+ * \brief display the form for PA
*\param $p_array contains POST (or GET) data (val[] hplan[][] op[])
* \param $p_null = 1 if PA optional otherwise 0 mandatory
* \param $p_mode == form 1 ==> read/write otherwise 0==>readonly
diff --git a/include/template/detail-action.php
b/include/template/detail-action.php
index 595d370ea..8bcab2cfb 100644
--- a/include/template/detail-action.php
+++ b/include/template/detail-action.php
@@ -1,9 +1,12 @@
<?php
-if ( DEBUGNOALYSS > 1 ){ echo __DIR__."/".__FILE__;}
+
//This file is part of NOALYSS and is under GPL
//see licence.txt
$uniq=uniqid("tab",TRUE);
?><div>
+ <?php
+ \Noalyss\Dbg::echo_file(__FILE__);
+ ?>
<div style="float:left;">
- [Noalyss-commit] [noalyss] branch master updated (7749f97eb -> 1a1bcd567), Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 02/12: code cleaning : rename search_poste to search_accounting, Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 03/12: TVA javascript : add callback function, Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 08/12: Set current user in PostGresql session (config) so it can be directly used directly by triggers and pgplsql to track user's changes, Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 09/12: Fix typo due to code cleaning, Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 06/12: Add function __toString, Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 04/12: INUM , IText and ITVAPopup add the attribute (for javascript), Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 01/12: WYSIWYG Editor integration and improve of waiting_box, Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 05/12: set require to falser and add function __toString, Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 10/12: useless file, Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 11/12: Clean code : dead code, improve debug, comments,
Dany De Bontridder <=
- [Noalyss-commit] [noalyss] 12/12: Save the current user in a PostgreSQL session variable noalyss.user_login, Dany De Bontridder, 2022/11/16
- [Noalyss-commit] [noalyss] 07/12: Tag : add color when selected, Dany De Bontridder, 2022/11/16