From 2397d3aaa5ac0a8bafa81286cc9d3b60e19080a3 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 19 Jan 2020 11:31:18 +0100 Subject: [PATCH 01/20] Record exception --- include/class/periode.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/include/class/periode.class.php b/include/class/periode.class.php index 734cdba41..16ca96d80 100644 --- a/include/class/periode.class.php +++ b/include/class/periode.class.php @@ -272,6 +272,7 @@ class Periode } catch (Exception $e) { + record_log($e->getMessage()." - ".$e->getCode()); record_log($e->getTraceAsString()); $this->cn->rollback(); throw $e; From 61bef0f2cffde83e40c78f08e2333a1a0187ee16 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 2 Feb 2020 10:26:45 +0100 Subject: [PATCH 02/20] Comptability PHP7.2 --- include/class/document_type.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/class/document_type.class.php b/include/class/document_type.class.php index 1a8357e20..92ffc823b 100644 --- a/include/class/document_type.class.php +++ b/include/class/document_type.class.php @@ -48,7 +48,7 @@ class Document_type { $sql = "select * from document_type where dt_id=$1"; $R = $this->db->exec_sql($sql, array($this->dt_id)); - if (count($R) == 0) return 1; + if ($this->db->count($R) == 0) return 1; $r = Database::fetch_array($R, 0); $this->dt_id = $r['dt_id']; $this->dt_value = $r['dt_value']; From 877ad79c8d8c03c55d40eef2c8b7751a011a05d7 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 9 Feb 2020 13:13:26 +0100 Subject: [PATCH 03/20] Documentation --- include/class/dossier.class.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/include/class/dossier.class.php b/include/class/dossier.class.php index 23705b168..3d2cde9aa 100644 --- a/include/class/dossier.class.php +++ b/include/class/dossier.class.php @@ -405,5 +405,16 @@ class Dossier } } } + + /** + * Set the current dossier to $p_dossier + * @param numeric $p_dossier + */ + static function set_current($p_dossier) { + + put_global(["gDossier"=>$p_dossier]); + self::check(); + + } } From 3fc8a14961c41f5ceaae2b11a13193a35d4076b4 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 9 Feb 2020 13:13:58 +0100 Subject: [PATCH 04/20] Documentation --- include/lib/html_input.class.php | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php index 15156277d..987a89b11 100755 --- a/include/lib/html_input.class.php +++ b/include/lib/html_input.class.php @@ -950,7 +950,16 @@ class HtmlInput return $sel; } } - + /** + * + * * filter the rows in a table and keep the colored row in alternance + * @param dom_id $p_table_id table + * @param string $p_col , column to search example 0,1,2 + * @param int $start_row row to always keep (header) + * @param string $p_name name of the input field + * @param string $p_old_value search value sent by $_GET (or $_REQUEST) + * @return string HTML + */ static function filter_table_form($p_table_id, $p_col, $start_row, $p_name, $p_old_value) { @@ -963,7 +972,13 @@ class HtmlInput $r.=' '; return $r; } - + /** + * filter the rows in a table and keep the colored row in alternance + * @param dom_id $p_table_id table + * @param string $p_col , column to search example 0,1,2 + * @param int $start_row row to always keep (header) + * @return string HTML + */ static function filter_table($p_table_id, $p_col, $start_row) { $r=" From b9fd0bbe8786f06afb9e06d399b252be363f8d00 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 9 Feb 2020 13:14:36 +0100 Subject: [PATCH 05/20] phpunit : use plain text for restoring test database --- unit-test/create-dossier-test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unit-test/create-dossier-test.sh b/unit-test/create-dossier-test.sh index 74eb39ac5..d14b5d570 100755 --- a/unit-test/create-dossier-test.sh +++ b/unit-test/create-dossier-test.sh @@ -5,5 +5,5 @@ FILE_TEST=dossiertest191124-2109.bin dropdb $DOSSIER_TEST createdb $DOSSIER_TEST -pg_restore -Fc --no-owner --no-privilege --verbose -d $DOSSIER_TEST db/$FILE_TEST +pg_restore -Fp --no-owner --no-privilege --verbose -d $DOSSIER_TEST db/$FILE_TEST From 4bf4a2826a8a8ba4dfc9ffcde9c2810365172ca2 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sun, 9 Feb 2020 19:08:42 +0100 Subject: [PATCH 06/20] Bug : filter_list does not filter simple list --- html/js/scripts.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/html/js/scripts.js b/html/js/scripts.js index 734d0554a..abfd5f869 100644 --- a/html/js/scripts.js +++ b/html/js/scripts.js @@ -2181,6 +2181,9 @@ function filter_list(phrase, _id) { for (var r = 0; r < l_list.childNodes.length; r++) { var found = 0; + if (l_list.childNodes[r].nodeType != 1 ){ + continue; + } if (l_list.childNodes[r].childElementCount == 0) { ele = l_list.childNodes[r].innerHTML; From 1ff9d19c1af2ecdad1aeef20a718c42e0b87d62a Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 11 Feb 2020 08:20:21 +0100 Subject: [PATCH 07/20] search : add placeholder --- include/lib/html_input.class.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/include/lib/html_input.class.php b/include/lib/html_input.class.php index 987a89b11..f79048b58 100755 --- a/include/lib/html_input.class.php +++ b/include/lib/html_input.class.php @@ -965,7 +965,8 @@ class HtmlInput { $r=" - + + "; @@ -983,7 +984,9 @@ class HtmlInput { $r=" - + + + "; @@ -999,8 +1002,8 @@ class HtmlInput { $r=""; $r.=''; - $r.=sprintf('', - $p_list_id,$p_list_id,$p_list_id); + $r.=sprintf('', + $p_list_id,$p_list_id,_("Recherche"),$p_list_id); $r.=sprintf('',$p_list_id,$p_list_id,$p_list_id); $r.=''; From 47136443451e05b54fcef8a22b5acfce9b6789cd Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 14 Feb 2020 10:56:56 +0100 Subject: [PATCH 08/20] Bug : customer.inc.php with http_input::request Correct : Contact.inc.php remove direct use of $_GET --- include/contact.inc.php | 4 ++-- include/customer.inc.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/contact.inc.php b/include/contact.inc.php index 06f76b540..f22661800 100644 --- a/include/contact.inc.php +++ b/include/contact.inc.php @@ -73,8 +73,8 @@ if ($low_action == "list")
get("query","string",""); + echo _("Cherche ").HtmlInput::filter_table_form("contact_tb", '0,1,2,3,4,5,6', 1,"query",$a); $sel_card = new ISelect('cat'); $sel_card->value = $cn->make_array('select fd_id, fd_label from fiche_def ' . diff --git a/include/customer.inc.php b/include/customer.inc.php index 0bbc7c5c1..d42e835bf 100644 --- a/include/customer.inc.php +++ b/include/customer.inc.php @@ -77,7 +77,7 @@ if ($low_action == "list") $a=$http->get("query","string",""); echo _("Cherche ").HtmlInput::filter_table_form("tiers_tb", '0,1,2', 1,"query",$a); - $choice_cat=$http->request("choice_cat", "",1); + $choice_cat=$http->request("choice_cat", "string",1); if ( $choice_cat == 1 ) { From 813ea086e77e75d9ac69a72e78d2d5c400870ffd Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Fri, 14 Feb 2020 10:57:32 +0100 Subject: [PATCH 09/20] New : Icon_Action::icon_onoff : display on or off --- include/lib/icon_action.class.php | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/lib/icon_action.class.php b/include/lib/icon_action.class.php index 90cca74b5..9e4dedece 100644 --- a/include/lib/icon_action.class.php +++ b/include/lib/icon_action.class.php @@ -342,4 +342,18 @@ class Icon_Action $lock_cur); return $r; } + + /** + * Display a icon ON is $p_value == 1 otherwise OFF + * @param string $p_div id of element + * @param string $p_javascript + * @param string $p_style optionnal HTML code + * @param integer 0 or 1 , 0 means OFF and 1 means ON + * @return html string + */ + static function icon_onoff($p_id,$p_javascript,$p_style,$p_value) + { + if ( $p_value == 1 ) { return \Icon_Action::iconon($p_id, $p_javascript,$p_style);} + if ( $p_value == 0 ) { return \Icon_Action::iconoff($p_id, $p_javascript,$p_style);} + } } From 284fc2ebef08a0bcc102c42f5e5808e8ac8da51b Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 21 Mar 2020 18:22:20 +0100 Subject: [PATCH 10/20] Create test folder for phpunit --- unit-test/create-dossier-test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/unit-test/create-dossier-test.sh b/unit-test/create-dossier-test.sh index d14b5d570..372e87440 100755 --- a/unit-test/create-dossier-test.sh +++ b/unit-test/create-dossier-test.sh @@ -1,9 +1,9 @@ #!/bin/bash DOSSIER_TEST=rel70dossier25 -FILE_TEST=dossiertest191124-2109.bin +FILE_TEST=dossiertest200318-1402.sql dropdb $DOSSIER_TEST createdb $DOSSIER_TEST -pg_restore -Fp --no-owner --no-privilege --verbose -d $DOSSIER_TEST db/$FILE_TEST +psql -X $DOSSIER_TEST < db/$FILE_TEST From a115102fdf0eb6f8f7233697252bf3c6a6717794 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 24 Mar 2020 14:21:48 +0100 Subject: [PATCH 11/20] Task #0001793: Installation mot de passe --- html/install.php | 10 ++++++---- include/lib/config_file.php | 9 +++++++++ include/template/template_config_form.php | 9 +++++++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/html/install.php b/html/install.php index c8b188dcd..180c3cdb4 100644 --- a/html/install.php +++ b/html/install.php @@ -194,6 +194,7 @@ $ctmp=$http->request("ctmp","string", "/tmp"); $cpath=$http->request("cpath","string", "/usr/bin"); $db_name=$http->request("cdbname", "string",""); $cadmin=$http->request("cadmin","string", "admin"); +$icpassword_admin=$http->request("icpassword_admin","string", "phpcompta"); $cadmin=strtolower($cadmin); //------------------------------------------------------------------------- // warn only if we can not write in include @@ -224,11 +225,12 @@ if (isset($_POST['save_config'])) { // ----- if ( $cnx !== false ) { echo '

'._('Important').'

'; - echo '

',_("Voici l'utilisateur et mot de passe de l'utilisateur administrateur de Noalyss , il a tous les droits et a accès à tout." + echo '

',_("Voici l'utilisateur et mot de passe de l'utilisateur administrateur de Noalyss , " + . " il a tous les droits et a accès à tout." . " Connectez-vous avec ses identifiants et changer le mot de passe dans préférence (en haut à droit)"), "

"; echo '

'._('Utilisateur administrateur'),' ',' ',$cadmin,'','

'; - echo '

',_('Mot de passe'),' phpcompta ','

'; + echo '

',_('Mot de passe'),' '.$icpassword_admin.' ','

'; // Create the db if (is_writable(NOALYSS_INCLUDE)) { $url=config_file_create($_POST,1,$os); @@ -522,8 +524,8 @@ if ($account == 0 ) { $cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/constraint.sql"); /* update name administrator */ $cadmin=NOALYSS_ADMINISTRATOR; - $cn->exec_sql("update ac_users set use_login=$1,use_active=1 where use_id=1", - array(strtolower($cadmin))); + $cn->exec_sql("update ac_users set use_login=$1,use_password=md5($2),use_active=1 where use_id=1", + array(strtolower($cadmin,$icpassword_admin))); $cn->commit($cn); diff --git a/include/lib/config_file.php b/include/lib/config_file.php index fcdb6021d..f9c89ee45 100644 --- a/include/lib/config_file.php +++ b/include/lib/config_file.php @@ -105,6 +105,9 @@ function config_file_form($p_array=null) } $icdbname=new IText('cdbname'); $icdbname->value=$cdbname; + + $icpassword_admin=new IText('icpassword_admin'); + require NOALYSS_TEMPLATE.'/template_config_form.php'; } /** @@ -156,6 +159,12 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ("\r\n"); print ( 'define ("NOALYSS_ADMINISTRATOR","'.$cadmin.'");'); print ("\r\n"); + print ("// For changing the password of admin, go to preference or update in db"); + print ("\r\n"); + print ("// this password is only used when installing "); + print ("\r\n"); + print ( 'define ("NOALYSS_PASSWORD","'.$icpassword_admin.'");'); + print ("\r\n"); print ( 'define ("LOCALE",'.$clocale.');'); print ("\r\n"); diff --git a/include/template/template_config_form.php b/include/template/template_config_form.php index 2e98740f9..39f2f1975 100644 --- a/include/template/template_config_form.php +++ b/include/template/template_config_form.php @@ -26,6 +26,7 @@ * @brief * */ + ?>
@@ -59,6 +60,14 @@ input();?> + + + + From 6dcbd862fd22ef38638b2ffb0f570c601baf2b4a Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 24 Mar 2020 14:21:48 +0100 Subject: [PATCH 12/20] Task #0001793: Installation mot de passe --- html/install.php | 2 +- include/constant.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/html/install.php b/html/install.php index 180c3cdb4..a83e7e1b2 100644 --- a/html/install.php +++ b/html/install.php @@ -525,7 +525,7 @@ if ($account == 0 ) { /* update name administrator */ $cadmin=NOALYSS_ADMINISTRATOR; $cn->exec_sql("update ac_users set use_login=$1,use_password=md5($2),use_active=1 where use_id=1", - array(strtolower($cadmin,$icpassword_admin))); + array(strtolower($cadmin),$icpassword_admin)); $cn->commit($cn); diff --git a/include/constant.php b/include/constant.php index e0330010b..04b6388cf 100644 --- a/include/constant.php +++ b/include/constant.php @@ -85,7 +85,7 @@ $g_succeed=""; define ('SMALLX','ⵝ'); define ('BUTTONADD',"✚"); - + define("NOALYSS_VERSION",9999); define ('SVNINFO',NOALYSS_VERSION); if ( ! defined ('DEBUG')) { define ("DEBUG",false); From adc343758237aac5f4277985ccd66cb3e019a518 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 24 Mar 2020 14:21:48 +0100 Subject: [PATCH 13/20] Task #0001793: Installation mot de passe remove debug info --- include/constant.php | 1 - 1 file changed, 1 deletion(-) diff --git a/include/constant.php b/include/constant.php index 04b6388cf..1625f70c4 100644 --- a/include/constant.php +++ b/include/constant.php @@ -85,7 +85,6 @@ $g_succeed=""; define ('SMALLX','ⵝ'); define ('BUTTONADD',"✚"); - define("NOALYSS_VERSION",9999); define ('SVNINFO',NOALYSS_VERSION); if ( ! defined ('DEBUG')) { define ("DEBUG",false); From 4dcae09efe8a718c3fedf7e66b827aeee4d33a7a Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 24 Mar 2020 14:21:48 +0100 Subject: [PATCH 14/20] Task #0001793: Installation mot de passe for password , use NOALYSS_ADMIN_PASSWORD --- html/install.php | 16 ++++++++++------ include/lib/config_file.php | 4 ++-- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/html/install.php b/html/install.php index a83e7e1b2..ca76438a3 100644 --- a/html/install.php +++ b/html/install.php @@ -272,6 +272,7 @@ if (isset($_POST['save_config'])) { // //------------------------------------------------------------------------ if ( ! file_exists(NOALYSS_INCLUDE.'/config.inc.php')) { + echo '

'._('Entrez les informations nécessaires à noalyss').'

'; echo ''; require_once NOALYSS_INCLUDE.'/lib/config_file.php'; @@ -524,7 +525,7 @@ if ($account == 0 ) { $cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/constraint.sql"); /* update name administrator */ $cadmin=NOALYSS_ADMINISTRATOR; - $cn->exec_sql("update ac_users set use_login=$1,use_password=md5($2),use_active=1 where use_id=1", + $cn->exec_sql("update ac_users set use_login=$1,use_pass=md5($2),use_active=1 where use_id=1", array(strtolower($cadmin),$icpassword_admin)); $cn->commit($cn); @@ -619,11 +620,11 @@ if (defined("MULTI") && MULTI == 0) } } - $db->exec_sql("update ac_users set use_login=$1 where use_id=1", - array(strtolower(NOALYSS_ADMINISTRATOR))); + $db->exec_sql("update ac_users set use_login=$1,use_pass=2 where use_id=1", + array(strtolower(NOALYSS_ADMINISTRATOR),NOALYSS_ADMIN_PASSWORD)); echo '

'._('Important').'

'; echo '

'._('Utilisateur administrateur'),' ',NOALYSS_ADMINISTRATOR,'

'; - echo '

',_('Mot de passe par défaut à l\'installation'),' phpcompta','

'; + echo "

"; printf (" VOUS DEVEZ EFFACER CE FICHIER %s",__FILE__); echo "

"; @@ -642,9 +643,12 @@ define ('ALLOWED',1); define ('ALLOWED_ADMIN',1); $rep=new Database(); -if (defined(NOALYSS_ADMINISTRATOR)) +if (defined(NOALYSS_ADMINISTRATOR) && defined (NOALYSS_ADMIN_PASSWORD)) { - $rep->exec_sql("update ac_users set use_login=$1 where use_id=1", array(strtolower(NOALYSS_ADMINISTRATOR))); + $rep->exec_sql("update ac_users set use_login=$1 ,use_pass=md5(2) + where use_id=1", + array(strtolower(NOALYSS_ADMINISTRATOR), + NOALYSS_ADMIN_PASSWORD)); } Dossier::upgrade(); echo '

'._('Important').'

'; diff --git a/include/lib/config_file.php b/include/lib/config_file.php index f9c89ee45..3f9f7228f 100644 --- a/include/lib/config_file.php +++ b/include/lib/config_file.php @@ -161,9 +161,9 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ("\r\n"); print ("// For changing the password of admin, go to preference or update in db"); print ("\r\n"); - print ("// this password is only used when installing "); + print ("// this password is only used when executing install.php "); print ("\r\n"); - print ( 'define ("NOALYSS_PASSWORD","'.$icpassword_admin.'");'); + print ( 'define ("NOALYSS_ADMIN_PASSWORD","'.$icpassword_admin.'");'); print ("\r\n"); print ( 'define ("LOCALE",'.$clocale.');'); From cc2c9e714c1b1f8471e3b5d9794810a462bc1e56 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 24 Mar 2020 14:21:48 +0100 Subject: [PATCH 15/20] Task #0001793: Installation mot de passe Password cannot be empty --- html/install.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/html/install.php b/html/install.php index ca76438a3..699ef28e7 100644 --- a/html/install.php +++ b/html/install.php @@ -264,7 +264,12 @@ if (isset($_POST['save_config'])) { echo ''; } } +if ( strlen(trim($icpassword_admin))== 0 ) { + echo '

'; + echo _('Le mot de passe du super admin ne peut être vide'); + echo '

'; +} //------------------------------------------------------------------------ // Check that the file config.inc.php exists , if not then propose to @@ -297,6 +302,7 @@ if ( ! file_exists(NOALYSS_INCLUDE.'/config.inc.php')) { // magic_quotes_runtime = Off // magic_quotes_sybase = Off // include_path +require_once NOALYSS_INCLUDE.'/config.inc.php'; require_once NOALYSS_INCLUDE.'/lib/config_file.php'; require_once NOALYSS_INCLUDE.'/class/database.class.php'; @@ -525,6 +531,7 @@ if ($account == 0 ) { $cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/constraint.sql"); /* update name administrator */ $cadmin=NOALYSS_ADMINISTRATOR; + $icpassword_admin=NOALYSS_ADMIN_PASSWORD; $cn->exec_sql("update ac_users set use_login=$1,use_pass=md5($2),use_active=1 where use_id=1", array(strtolower($cadmin),$icpassword_admin)); @@ -643,7 +650,7 @@ define ('ALLOWED',1); define ('ALLOWED_ADMIN',1); $rep=new Database(); -if (defined(NOALYSS_ADMINISTRATOR) && defined (NOALYSS_ADMIN_PASSWORD)) +if (defined("NOALYSS_ADMINISTRATOR") && defined ("NOALYSS_ADMIN_PASSWORD")) { $rep->exec_sql("update ac_users set use_login=$1 ,use_pass=md5(2) where use_id=1", From a9d977d82b58687916aa2e7ee6cc39a9647b21d8 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 24 Mar 2020 14:21:48 +0100 Subject: [PATCH 16/20] Task #0001793: Installation mot de passe Adapt comment --- include/lib/config_file.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/include/lib/config_file.php b/include/lib/config_file.php index 3f9f7228f..c6e93ee73 100644 --- a/include/lib/config_file.php +++ b/include/lib/config_file.php @@ -153,9 +153,8 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ( 'define ("noalyss_psql_host","'.$chost.'");'); print ("\r\n"); print ("\r\n"); - print ("// If you change the NOALYSS_ADMINISTRATOR , you will need to rerun http://..../noalyss/html/install.php"); - print ("\r\n"); - print ("// But it doesn't change the password"); + print ("// If you change the NOALYSS_ADMINISTRATOR or NOALYSS_ADMIN_PASSWORD, " + . "you will need to rerun http://..../noalyss/html/install.php"); print ("\r\n"); print ( 'define ("NOALYSS_ADMINISTRATOR","'.$cadmin.'");'); print ("\r\n"); From c4b44d135a1941c633d784a72f8123745cecff27 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Tue, 24 Mar 2020 14:21:48 +0100 Subject: [PATCH 17/20] =?UTF-8?q?Task=20#0001793:=20Installation=20mot=20d?= =?UTF-8?q?e=20passe=20Emp=C3=AAche=20@mobile=20,=20doc?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html/install.php | 55 +++++++++++++++++------ include/lib/config_file.php | 10 +++-- include/template/template_config_form.php | 3 +- 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/html/install.php b/html/install.php index 699ef28e7..513c8b982 100644 --- a/html/install.php +++ b/html/install.php @@ -161,6 +161,8 @@ content[205]=""; content[206]=""; content[207]=""; content[208]=""; +content[209]=""; +content[210]=""; @@ -181,7 +183,7 @@ if ( strpos($inc_path,";") != 0 ) { $new_path=$inc_path.':../../include:addon'; $os=1; /* $os is 1 for unix */ } -// Retrieve informations from the very screen +// Retrieve informations from the screen // $http=new HttpInput(); $db_user=$http->request("cuser","string", ""); @@ -194,7 +196,7 @@ $ctmp=$http->request("ctmp","string", "/tmp"); $cpath=$http->request("cpath","string", "/usr/bin"); $db_name=$http->request("cdbname", "string",""); $cadmin=$http->request("cadmin","string", "admin"); -$icpassword_admin=$http->request("icpassword_admin","string", "phpcompta"); +$cpassword_admin=$http->request("cpassword_admin","string", "phpcompta"); $cadmin=strtolower($cadmin); //------------------------------------------------------------------------- // warn only if we can not write in include @@ -214,6 +216,36 @@ if ( is_writable ('install.php') == false ) { if (isset($_POST['save_config'])) { require_once NOALYSS_INCLUDE.'/lib/config_file.php'; + $err=0; + // check password and admin not empty + // + if ( strlen(trim($cpassword_admin))== 0 || + strlen(trim($cadmin))== 0 + ) { + echo '

'; + echo _('Le mot de passe du super admin et le login ne peuvent être vides'); + echo '

'; + $err++; + + } + + // check password and admin not containing quote or double quote + // + if ( strpos($cpassword_admin,'"') !== false + || strpos($cadmin,'"') !== false + || strpos($cpassword_admin,"'") !== false + || strpos($cadmin,"'") !== false + || strpos($cpassword_admin," ") !== false + || strpos($cadmin," ") !== false + || strpos($cadmin,"@mobile") !== false + ) { + echo '

'; + echo _('Le mot de passe du super admin et le superadmin ne peut pas contenir des guillemets ou espaces, ni @mobile'); + echo '

'; + $err++; + + } + // Try to connect , if it doesn't work that do not create the config file if ($multi=="N") { $cnx = new DatabaseCore($db_user, $db_password,'template1', $db_host, $db_port); @@ -223,14 +255,14 @@ if (isset($_POST['save_config'])) { // ----- // If conx successfull save the file or display it // ----- - if ( $cnx !== false ) { + if ( $err == 0 && $cnx !== false ) { echo '

'._('Important').'

'; echo '

',_("Voici l'utilisateur et mot de passe de l'utilisateur administrateur de Noalyss , " . " il a tous les droits et a accès à tout." . " Connectez-vous avec ses identifiants et changer le mot de passe dans préférence (en haut à droit)"), "

"; echo '

'._('Utilisateur administrateur'),' ',' ',$cadmin,'','

'; - echo '

',_('Mot de passe'),' '.$icpassword_admin.' ','

'; + echo '

',_('Mot de passe'),' '.$cpassword_admin.' ','

'; // Create the db if (is_writable(NOALYSS_INCLUDE)) { $url=config_file_create($_POST,1,$os); @@ -258,18 +290,13 @@ if (isset($_POST['save_config'])) { echo ''; return; } - } else { + } elseif ($err == 0 && $cnx == false) { echo '

'; echo _('Impossible de se connecter à Postgresql, vérifiez les informations de connection'); echo '

'; } } -if ( strlen(trim($icpassword_admin))== 0 ) { - echo '

'; - echo _('Le mot de passe du super admin ne peut être vide'); - echo '

'; -} //------------------------------------------------------------------------ // Check that the file config.inc.php exists , if not then propose to @@ -374,7 +401,7 @@ for ($m=0;$m<$nb_need_module;$m++) if ( ini_get("max_execution_time") < 60 ) { echo "
  • "; echo _('Avertissement').' : '.$failed; - echo ' ', + echo ' ', _("max_execution_time devrait être de 60 minimum"), ''; echo "
  • "; @@ -531,9 +558,9 @@ if ($account == 0 ) { $cn->execute_script(NOALYSS_INCLUDE."/sql/account_repository/constraint.sql"); /* update name administrator */ $cadmin=NOALYSS_ADMINISTRATOR; - $icpassword_admin=NOALYSS_ADMIN_PASSWORD; + $cpassword_admin=NOALYSS_ADMIN_PASSWORD; $cn->exec_sql("update ac_users set use_login=$1,use_pass=md5($2),use_active=1 where use_id=1", - array(strtolower($cadmin),$icpassword_admin)); + array(strtolower($cadmin),$cpassword_admin)); $cn->commit($cn); @@ -652,7 +679,7 @@ define ('ALLOWED_ADMIN',1); $rep=new Database(); if (defined("NOALYSS_ADMINISTRATOR") && defined ("NOALYSS_ADMIN_PASSWORD")) { - $rep->exec_sql("update ac_users set use_login=$1 ,use_pass=md5(2) + $rep->exec_sql("update ac_users set use_login=$1 ,use_pass=md5($2) where use_id=1", array(strtolower(NOALYSS_ADMINISTRATOR), NOALYSS_ADMIN_PASSWORD)); diff --git a/include/lib/config_file.php b/include/lib/config_file.php index c6e93ee73..42587f287 100644 --- a/include/lib/config_file.php +++ b/include/lib/config_file.php @@ -106,7 +106,8 @@ function config_file_form($p_array=null) $icdbname=new IText('cdbname'); $icdbname->value=$cdbname; - $icpassword_admin=new IText('icpassword_admin'); + $icpassword_admin=new IText('cpassword_admin'); + $icpassword_admin->value=$cpassword_admin; require NOALYSS_TEMPLATE.'/template_config_form.php'; } @@ -153,8 +154,9 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ( 'define ("noalyss_psql_host","'.$chost.'");'); print ("\r\n"); print ("\r\n"); - print ("// If you change the NOALYSS_ADMINISTRATOR or NOALYSS_ADMIN_PASSWORD, " - . "you will need to rerun http://..../noalyss/html/install.php"); + print ("// If you change the NOALYSS_ADMINISTRATOR , you will need to rerun http://..../noalyss/html/install.php"); + print ("\r\n"); + print ("// But it doesn't change the password"); print ("\r\n"); print ( 'define ("NOALYSS_ADMINISTRATOR","'.$cadmin.'");'); print ("\r\n"); @@ -162,7 +164,7 @@ function display_file_config($p_array,$from_setup=1,$p_os=1) print ("\r\n"); print ("// this password is only used when executing install.php "); print ("\r\n"); - print ( 'define ("NOALYSS_ADMIN_PASSWORD","'.$icpassword_admin.'");'); + print ( 'define ("NOALYSS_ADMIN_PASSWORD","'.$cpassword_admin.'");'); print ("\r\n"); print ( 'define ("LOCALE",'.$clocale.');'); diff --git a/include/template/template_config_form.php b/include/template/template_config_form.php index 39f2f1975..455e9ff7f 100644 --- a/include/template/template_config_form.php +++ b/include/template/template_config_form.php @@ -57,7 +57,7 @@
    @@ -66,6 +66,7 @@ From 8f95aeed5d690d4907c6a4ba903d6eafcdfe936c Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 4 Apr 2020 01:21:56 +0200 Subject: [PATCH 18/20] Task #1277 : RTF conversion char accentuated --- include/class/acc_bilan.class.php | 15 ++++-- include/impress_bilan.inc.php | 82 ++++++++++++++++--------------- include/lib/ac_common.php | 20 +++++++- 3 files changed, 72 insertions(+), 45 deletions(-) diff --git a/include/class/acc_bilan.class.php b/include/class/acc_bilan.class.php index 76ec7b8bf..398a3eb81 100644 --- a/include/class/acc_bilan.class.php +++ b/include/class/acc_bilan.class.php @@ -258,9 +258,10 @@ class Acc_Bilan */ function get_request_get() { - $this->b_id=(isset($_GET['b_id']))?$_GET['b_id']:""; - $this->from=( isset ($_GET['from_periode']))?$_GET['from_periode']:-1; - $this->to=( isset ($_GET['to_periode']))?$_GET['to_periode']:-1; + $http=new \HttpInput(); + $this->b_id=$http->get("b_id","number",""); + $this->from=$http->get("from_periode","number",-1); + $this->to=$http->get("to_periode","number",-1); } /*!\brief load from the database the document data */ function load() @@ -501,7 +502,10 @@ class Acc_Bilan } $header_txt=header_txt($this->db); - + + if ($this->b_type == "rtf") { + $header_txt=convert_to_rtf($header_txt); + } while ( !feof($p_file) ) { $line_rtf=fgets($p_file); @@ -537,7 +541,8 @@ class Acc_Bilan if($ret[0]['acct_name']) { /* for rtf we have the string to put it in latin1 */ - $a = utf8_decode($ret[0]['acct_name']); + if ( $this->b_type != "rtf") { $a = utf8_decode($ret[0]['acct_name']);} + if ( $this->b_type == "rtf") { $a =convert_to_rtf($ret[0]['acct_name']);} } } } diff --git a/include/impress_bilan.inc.php b/include/impress_bilan.inc.php index bde62b64b..89cca0051 100644 --- a/include/impress_bilan.inc.php +++ b/include/impress_bilan.inc.php @@ -36,51 +36,55 @@ global $g_user; //----------------------------------------------------- // Form //----------------------------------------------------- - +$http=new \HttpInput(); $bilan=new Acc_Bilan($cn); $bilan->get_request_get(); echo '
    '; -$exercice=(isset($_GET['exercice']))?$_GET['exercice']:$g_user->get_exercice(); +$exercice=$http->get("exercice","number",$g_user->get_exercice()); +//---------------------------------------------------------------- +// Verification +//---------------------------------------------------------------- if ( ! isset ($_GET['verif'])) { -/* - * Let you change the exercice - */ -echo '
    '._('Exercice').'';; -echo ''; -echo _('Choisissez un autre exercice'); -$ex=new Exercice($cn); -$wex=$ex->select('exercice',$exercice,' onchange="submit(this)"'); -echo $wex->input(); -echo dossier::hidden(); -echo HtmlInput::get_to_hidden(array('ac','type')); -echo ''; -echo '
    '; + /* + * Let you change the exercice + */ + echo '
    '._('Exercice').'';; + echo '
    '; + echo _('Choisissez un autre exercice'); + $ex=new Exercice($cn); + $wex=$ex->select('exercice',$exercice,' onchange="submit(this)"'); + echo $wex->input(); + echo dossier::hidden(); + echo HtmlInput::get_to_hidden(array('ac','type')); + echo ''; + echo '
    '; -$filter_year=" where p_exercice='".sql_string($exercice)."'"; -echo '
    '; -echo HtmlInput::hidden('type','bilan'); -echo dossier::hidden(); + $filter_year=" where p_exercice='".sql_string($exercice)."'"; + echo ''; + echo HtmlInput::hidden('type','bilan'); + echo dossier::hidden(); -// By default , show last day of exercice -if ($bilan->to == -1 ){ - $t_periode=new Periode($cn); - list($per_max,$per_min)=$t_periode->get_limit($exercice); - $bilan->to=$per_min->p_id; + // By default , show last day of exercice + if ($bilan->to == -1 ){ + $t_periode=new Periode($cn); + list($per_max,$per_min)=$t_periode->get_limit($exercice); + $bilan->to=$per_min->p_id; + } + echo $bilan->display_form ($filter_year); + echo ' '._('Attention : si le bilan n\'est pas équilibré.
    Vérifiez
      +
    • L\'affectation du résultat est fait
    • +
    • Vos comptes actifs ont un solde débiteur (sauf les comptes dit inversés)
    • +
    • les comptes passifs ont un solde créditeur (sauf les comptes dit inversés)
    • +
    + Utilisez la balance des comptes pour vérifier.').'
    '; + echo HtmlInput::submit('verif',_('Verification comptabilite')); + echo HtmlInput::get_to_hidden(array('ac','exercice')); + echo ''; } -echo $bilan->display_form ($filter_year); -echo ' '._('Attention : si le bilan n\'est pas équilibré.
    Vérifiez
      -
    • L\'affectation du résultat est fait
    • -
    • Vos comptes actifs ont un solde débiteur (sauf les comptes dit inversés)
    • -
    • les comptes passifs ont un solde créditeur (sauf les comptes dit inversés)
    • -
    - Utilisez la balance des comptes pour vérifier.').'
    '; -echo HtmlInput::submit('verif',_('Verification comptabilite')); -echo HtmlInput::get_to_hidden(array('ac','exercice')); -echo ''; -} - - +//---------------------------------------------------------------- +// Print +//---------------------------------------------------------------- if ( isset($_GET['verif'])) { $periode=new Periode($cn); @@ -95,7 +99,7 @@ if ( isset($_GET['verif'])) echo '
    '; echo dossier::hidden(); echo HtmlInput::get_to_hidden(array('exercice')); - echo HtmlInput::hidden('b_id',$_GET['b_id']); + echo HtmlInput::hidden('b_id',$bilan->b_id); echo HtmlInput::hidden('act','OTH:Bilan'); echo HtmlInput::hidden('from_periode',$bilan->from); @@ -107,4 +111,4 @@ if ( isset($_GET['verif'])) echo '
    '; echo '
    '; -?> + diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index d93463fc7..df4ae72e8 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -1347,4 +1347,22 @@ if(!function_exists('tracedebug')) { file_put_contents($tmp_file, $output, FILE_APPEND); } } -?> +/** + * encode the string for RTF, return a stringu + * @param $p_string string to convert + * @return string + */ +function convert_to_rtf($p_string) +{ + $result=""; + $p_string2=utf8_decode($p_string); + $nb_result=strlen($p_string2); + for ($i = 0 ; $i < $nb_result ; $i++ ){ + if (ord($p_string[$i]) < 127 ) { + $result.=$p_string[$i]; + } else { + $result.='\u'.ord($p_string[$i]).chr(92).chr(39).'3f'; + } + } + return $result; +} \ No newline at end of file From 0b55332b02a9a0122fd031ac06ab3909e02e3b74 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 4 Apr 2020 13:48:36 +0200 Subject: [PATCH 19/20] =?UTF-8?q?Bug=20#0001245:=20Type=20actif=20-=20pass?= =?UTF-8?q?if=20pour=20nouvelle=20fiche=20=C3=A0=20partir=20de=20fiche=20E?= =?UTF-8?q?rreur=20dans=20PARM=5FPOSTE=20pour=20la=20compta=20fran=C3=A7ai?= =?UTF-8?q?se?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/class/database.class.php | 18 +++++++++--- include/class/dossier.class.php | 8 +++++- include/constant.php | 2 +- include/sql/patch/upgrade141.BE.sql | 3 ++ include/sql/patch/upgrade141.FR.sql | 5 ++++ include/sql/patch/upgrade141.sql | 0 include/sql/patch/upgrade142.sql | 43 +++++++++++++++++++++++++++++ 7 files changed, 73 insertions(+), 6 deletions(-) create mode 100644 include/sql/patch/upgrade141.BE.sql create mode 100644 include/sql/patch/upgrade141.FR.sql create mode 100644 include/sql/patch/upgrade141.sql create mode 100644 include/sql/patch/upgrade142.sql diff --git a/include/class/database.class.php b/include/class/database.class.php index 71dce9ccc..216d3f400 100644 --- a/include/class/database.class.php +++ b/include/class/database.class.php @@ -113,8 +113,11 @@ class Database extends DatabaseCore } /** - * \brief loop to apply all the path to a folder or - * a template + * \brief loop to apply all the path to a folder or a template + * Upgrade check if the folder $p_name needs to be upgrade thanks the variable DBVERSION + * and run all the SQL script named upgradeX.sql from the folder noalyss/include/sql/patch + * until X equal DBVERSION-1 + * * \param $p_name database name * */ @@ -142,8 +145,7 @@ class Database extends DatabaseCore echo "
  • Patching " . $p_name . " from the version " . $this->get_version() . " to $to "; - $this->execute_script(NOALYSS_INCLUDE . '/sql/patch/upgrade' . $i . '.sql'); - echo $succeed; + if (!DEBUG) ob_start(); @@ -214,9 +216,17 @@ class Database extends DatabaseCore $country = $this->get_value("select pr_value from parameter where pr_id='MY_COUNTRY'"); $this->execute_script(NOALYSS_INCLUDE . "/sql/patch/upgrade61." . $country . ".sql"); } + /** + * Bug in parm_code for FRANCE + */ + if ($i == 141 ) { + $country = $this->get_value("select pr_value from parameter where pr_id='MY_COUNTRY'"); + $this->execute_script(NOALYSS_INCLUDE . "/sql/patch/upgrade141." . $country . ".sql"); + } if (!DEBUG) ob_end_clean(); + } } echo ''; diff --git a/include/class/dossier.class.php b/include/class/dossier.class.php index 3d2cde9aa..ecd439e1a 100644 --- a/include/class/dossier.class.php +++ b/include/class/dossier.class.php @@ -330,7 +330,13 @@ class Dossier $cn->rollback(); } } - + /** + * Upgrade check if the folder ACCOUNT_REPOSITORY needs to be upgrade thanks the variable DBVERSIONREPO + * and run all the SQL script named ac-upgradeX.sql from the folder noalyss/include/sql/patch + * until X equal DBVERSIONREPO-1 + * After it will call the function apply_patch, remove_inexistant_user and clean_orphan_log for each folder + * + */ static function upgrade() { $rep=new Database(); diff --git a/include/constant.php b/include/constant.php index 1625f70c4..a10f5bb39 100644 --- a/include/constant.php +++ b/include/constant.php @@ -107,7 +107,7 @@ if ( !defined ("NOALYSS_PACKAGE_REPOSITORY")) { if ( ! defined ("SYSINFO_DISPLAY")) { define ("SYSINFO_DISPLAY",TRUE); } -define ("DBVERSION",141); +define ("DBVERSION",143); define ("MONO_DATABASE",25); define ("DBVERSIONREPO",18); define ('NOTFOUND','--not found--'); diff --git a/include/sql/patch/upgrade141.BE.sql b/include/sql/patch/upgrade141.BE.sql new file mode 100644 index 000000000..34478623e --- /dev/null +++ b/include/sql/patch/upgrade141.BE.sql @@ -0,0 +1,3 @@ +begin; +insert into version (val,v_description) values (142,'Bug dans PARM_POSTE'); +commit ; diff --git a/include/sql/patch/upgrade141.FR.sql b/include/sql/patch/upgrade141.FR.sql new file mode 100644 index 000000000..1e7c566eb --- /dev/null +++ b/include/sql/patch/upgrade141.FR.sql @@ -0,0 +1,5 @@ +begin; +update parm_poste set p_type='PAS' where p_value='40'; + +insert into version (val,v_description) values (142,'Bug dans PARM_POSTE'); +commit ; diff --git a/include/sql/patch/upgrade141.sql b/include/sql/patch/upgrade141.sql new file mode 100644 index 000000000..e69de29bb diff --git a/include/sql/patch/upgrade142.sql b/include/sql/patch/upgrade142.sql new file mode 100644 index 000000000..3afaed6c0 --- /dev/null +++ b/include/sql/patch/upgrade142.sql @@ -0,0 +1,43 @@ +begin; + +CREATE OR REPLACE FUNCTION comptaproc.find_pcm_type(pp_value account_type) + RETURNS text +AS $function$ +declare + str_type parm_poste.p_type%TYPE; + str_value parm_poste.p_type%TYPE; + nLength integer; +begin + str_value:=pp_value; + nLength:=length(str_value::text); + + while nLength > 0 loop + select p_type into str_type from parm_poste where p_value=str_value; + if FOUND then + raise info 'Type of %s is %s',str_value,str_type; + return str_type; + end if; + nLength:=nLength-1; + str_value:=substring(str_value::text from 1 for nLength)::account_type; + end loop; +-- Si non trouvé dans PARM_POSTE, prend le type du premier parent trouvé +-- + str_value := pp_value; + nLength:=length(str_value::text); + str_value:=substring(str_value::text from 1 for nLength)::account_type; + while nLength > 0 loop + select pcm_type into str_type from tmp_pcmn tp where pcm_val=str_value; + if FOUND then + raise info 'Type of %s is %s',str_value,str_type; + return str_type; + end if; + nLength:=nLength-1; + str_value:=substring(str_value::text from 1 for nLength)::account_type; + end loop; +-- si ni parent ou parm_poste alors return CON +return 'CON'; +end; +$function$ + LANGUAGE plpgsql; +insert into version (val,v_description) values (143,'Corrige function find_pcm_type'); +commit ; From 1280c19ff3f1e8cb9bee9786ff158225c57a2433 Mon Sep 17 00:00:00 2001 From: Dany De Bontridder Date: Sat, 4 Apr 2020 13:48:36 +0200 Subject: [PATCH 20/20] =?UTF-8?q?Bug=20#0001245:=20Type=20actif=20-=20pass?= =?UTF-8?q?if=20pour=20nouvelle=20fiche=20=C3=A0=20partir=20de=20fiche=20E?= =?UTF-8?q?rreur=20dans=20PARM=5FPOSTE=20pour=20la=20compta=20fran=C3=A7ai?= =?UTF-8?q?se?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/sql/patch/upgrade141.FR.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/sql/patch/upgrade141.FR.sql b/include/sql/patch/upgrade141.FR.sql index 1e7c566eb..54ad59f50 100644 --- a/include/sql/patch/upgrade141.FR.sql +++ b/include/sql/patch/upgrade141.FR.sql @@ -1,5 +1,5 @@ begin; update parm_poste set p_type='PAS' where p_value='40'; - +update tmp_pcmn set pcm_type='PAS' where pcm_val like '40%'; insert into version (val,v_description) values (142,'Bug dans PARM_POSTE'); commit ;
  • + + + input();?> +
    input();echo Icon_Action::infobulle(208)?> - input();?> + input();echo Icon_Action::infobulle(210)?>
    input();?> +