From 69bbda205c39f2a2cbe7fa14fc8ed919b5b315b8 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Wed, 11 Jan 2023 16:35:14 +0100 Subject: [PATCH 01/12] Bug : default accounting override existing one --- include/class/card_property.class.php | 6 +-- unit-test/include/class/card_propertyTest.php | 47 +++++++++++++++++++ 2 files changed, 50 insertions(+), 3 deletions(-) diff --git a/include/class/card_property.class.php b/include/class/card_property.class.php index b01dc73f6..6ee51211c 100644 --- a/include/class/card_property.class.php +++ b/include/class/card_property.class.php @@ -49,11 +49,11 @@ class Card_Property var $cn; //!< cn database connexion protected $display_mode; - //!< display mode determine if there link + //!< display mode values are large , window , display Property depending of this mode. function __construct($cn, $ad_id=0) { $this->cn=$cn; - $this->ad_id=0; + $this->ad_id=$ad_id; $this->display_mode='window'; } public function __toString(): string @@ -188,7 +188,7 @@ class Card_Property $result['msg'] .= " " . _("Rappel: Poste par défaut sera ") . $p_fiche_def->class_base . " ! "; - $result['input']->value = $p_fiche_def->class_base; + $result['input']->value = (empty ($result['input']->value)) ?$p_fiche_def->class_base:$result['input']->value; } } $result['label']=_("Poste comptable"); diff --git a/unit-test/include/class/card_propertyTest.php b/unit-test/include/class/card_propertyTest.php index 48f82bd20..4e8e89898 100644 --- a/unit-test/include/class/card_propertyTest.php +++ b/unit-test/include/class/card_propertyTest.php @@ -217,4 +217,51 @@ class Card_PropertyTest extends TestCase 'count of card properties must be the same than the card category (fiche_def )'); } + /** + * @testdox Build Input for automatic account , for a new card , the account is null + * @return void + */ + public function testBuildInput1() + { + $g_connection=Dossier::connect(); + + + $property=new \Card_Property($g_connection,ATTR_DEF_ACCOUNT); + $g_connection->exec_sql("update fiche_def set fd_create_account=true where fd_id=25"); + $fiche_def=new \Fiche_Def($g_connection,25); + + $result=$property->build_input($fiche_def); + + /* + $file_result=__CLASS__."-".__FUNCTION__.".txt"; + $file_target='target-'.$file_result; + \Noalyss\Facility::save_file(__DIR__."/file",$file_result,var_export($result,true)); + $this->assertFileEquals(__DIR__."/file/$file_target",__DIR__."/file/$file_result","Card_Property::build_input failed"); + */ + $this->assertEquals("",$result["input"]->value," Accounting incorrect "); + + } + /** + * @testdox Build Input for default account , for a new card , the account is the account of the category + * @return void + */ + + public function testBuildInput2() + { + $g_connection=Dossier::connect(); + $g_connection->exec_sql("update fiche_def set fd_create_account=false where fd_id=25"); + + $property=new \Card_Property($g_connection,ATTR_DEF_ACCOUNT); + $fiche_def=new \Fiche_Def($g_connection,25); + $result=$property->build_input($fiche_def); + $g_connection->exec_sql("update fiche_def set fd_create_account=true where fd_id=25"); + /* + $file_result=__CLASS__."-".__FUNCTION__.".txt"; + $file_target='target-'.$file_result; + \Noalyss\Facility::save_file(__DIR__."/file",$file_result,var_export($result,true)); + $this->assertFileEquals(__DIR__."/file/$file_target",__DIR__."/file/$file_result","Card_Property::build_input failed"); + */ + $this->assertEquals("600",$result["input"]->value," Accounting incorrect "); + } + } From 3ea69c31133f662621efc06ce25aa28421344416 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 14 Jan 2023 12:59:26 +0100 Subject: [PATCH 02/12] NEW #0002205 Mode maintenance --- block.html-example | 5 +++++ html/admin-noalyss.php | 3 +++ html/ajax.php | 4 +++- html/compute.php | 3 +++ html/direct.php | 2 ++ html/do.php | 6 ++++-- html/export.php | 3 +++ html/extension.raw.php | 2 ++ html/fid.php | 3 ++- html/fid_card.php | 3 +++ html/index.php | 2 ++ html/login.php | 3 ++- html/mobile.php | 5 ++++- html/recherche.php | 2 ++ html/user_login.php | 2 ++ include/lib/ac_common.php | 12 ++++++++++++ unit-test/global.php | 2 +- 17 files changed, 55 insertions(+), 7 deletions(-) create mode 100644 block.html-example diff --git a/block.html-example b/block.html-example new file mode 100644 index 000000000..886160f1d --- /dev/null +++ b/block.html-example @@ -0,0 +1,5 @@ +

Nous sommes en maintenance

+

+ Le site est actuellement en maintenance. +

+ diff --git a/html/admin-noalyss.php b/html/admin-noalyss.php index c6d273783..bafab207b 100644 --- a/html/admin-noalyss.php +++ b/html/admin-noalyss.php @@ -31,6 +31,7 @@ if (file_exists("../include/config.inc.php") ) { define ('ALLOWED',1); define ('ALLOWED_ADMIN',1); require_once '../include/constant.php'; + require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; \Noalyss\Dbg::echo_file(__FILE__); if ( DEBUGNOALYSS > 1 ) { @@ -41,6 +42,8 @@ if (file_exists("../include/config.inc.php") ) { \Noalyss\Dbg::display_request(); \Noalyss\Dbg::display_global(); } //<--- if DEBUG + + MaintenanceMode("block.html"); require_once NOALYSS_INCLUDE.'/admin_repo.inc.php'; } else { // Redirect to install file , if this file exists then diff --git a/html/ajax.php b/html/ajax.php index ecac8dc10..2d32d7521 100644 --- a/html/ajax.php +++ b/html/ajax.php @@ -14,12 +14,13 @@ */ if ( ! defined ('ALLOWED') ) define ('ALLOWED',1); require_once '../include/constant.php'; +require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; require_once NOALYSS_INCLUDE.'/class/database.class.php'; require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php'; require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php'; require_once NOALYSS_INCLUDE.'/class/extension.class.php'; if ( !isset ($_REQUEST['gDossier'])) exit(); - +MaintenanceMode("block.html"); require_once NOALYSS_INCLUDE.'/class/noalyss_parameter_folder.class.php'; mb_internal_encoding("UTF-8"); /** @@ -29,6 +30,7 @@ if ( ! isset($_SESSION[SESSION_KEY."g_user"])) { echo "NOCONX"; die(); } + global $g_user,$cn,$g_parameter; $cn=Dossier::connect(); $g_parameter=new Noalyss_Parameter_Folder($cn); diff --git a/html/compute.php b/html/compute.php index 8f4ad674e..7d70e99dd 100644 --- a/html/compute.php +++ b/html/compute.php @@ -37,6 +37,9 @@ require_once NOALYSS_INCLUDE.'/class/dossier.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_tva.class.php'; require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php'; +require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; +MaintenanceMode("block.html"); + // Check if the needed field does exist extract ($_GET, EXTR_SKIP ); foreach (array('t','c','p','q','n','gDossier') as $a) diff --git a/html/direct.php b/html/direct.php index 3148e2226..1f10466a4 100644 --- a/html/direct.php +++ b/html/direct.php @@ -24,6 +24,8 @@ require_once '../include/constant.php'; require_once NOALYSS_INCLUDE.'/class/database.class.php'; require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php'; +require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; +MaintenanceMode("block.html"); $cn=Dossier::connect(); global $g_user; diff --git a/html/do.php b/html/do.php index d24e5bf0d..68e9b21c2 100644 --- a/html/do.php +++ b/html/do.php @@ -23,13 +23,15 @@ define('ALLOWED',1); * \brief Main file */ require_once '../include/constant.php'; +require_once NOALYSS_INCLUDE.'/constant.security.php'; +require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; + +MaintenanceMode("block.html"); require_once NOALYSS_INCLUDE.'/class/database.class.php'; require_once NOALYSS_INCLUDE.'/class/dossier.class.php'; require_once NOALYSS_INCLUDE.'/lib/user_common.php'; -require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; require_once NOALYSS_INCLUDE.'/lib/function_javascript.php'; -require_once NOALYSS_INCLUDE.'/constant.security.php'; require_once NOALYSS_INCLUDE.'/lib/html_input.class.php'; require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php'; diff --git a/html/export.php b/html/export.php index e56a3423e..dda4479b4 100644 --- a/html/export.php +++ b/html/export.php @@ -26,6 +26,9 @@ */ define ('ALLOWED',1); require_once '../include/constant.php'; +require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; +MaintenanceMode("block.html"); + global $g_user,$cn,$g_parameter; require_once NOALYSS_INCLUDE.'/class/database.class.php'; require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php'; diff --git a/html/extension.raw.php b/html/extension.raw.php index b484ff547..2b639dc90 100644 --- a/html/extension.raw.php +++ b/html/extension.raw.php @@ -33,6 +33,8 @@ require_once NOALYSS_INCLUDE.'/lib/html_input.class.php'; require_once NOALYSS_INCLUDE.'/lib/iselect.class.php'; require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php'; +MaintenanceMode("block.html"); + global $g_user,$cn,$g_parameter; $http=new HttpInput(); $cn=Dossier::connect(); diff --git a/html/fid.php b/html/fid.php index 1f18cfa29..854b6a512 100644 --- a/html/fid.php +++ b/html/fid.php @@ -33,7 +33,8 @@ *\note if the j is -1 then all the card are shown */ require_once '../include/constant.php'; - +require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; +MaintenanceMode("block.html"); /** * if not connected, session is expired then exit with a message NOCONX */ diff --git a/html/fid_card.php b/html/fid_card.php index 27bfc71a3..fa8a98694 100644 --- a/html/fid_card.php +++ b/html/fid_card.php @@ -40,6 +40,9 @@ require_once '../include/constant.php'; require_once NOALYSS_INCLUDE.'/class/database.class.php'; require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; require_once NOALYSS_INCLUDE.'/class/dossier.class.php'; +require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; +MaintenanceMode("block.html"); + /** * if not connected, session is expired then exit with a message NOCONX */ diff --git a/html/index.php b/html/index.php index 501e843c6..81d11a029 100644 --- a/html/index.php +++ b/html/index.php @@ -158,6 +158,8 @@ $my_domain=""; require_once '../include/constant.php'; require_once '../include/config.inc.php'; require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; +MaintenanceMode("block.html"); + if ( file_exists("install.php")&& DEBUGNOALYSS == 0 ) { // At the end of the installation procedure , the install file must be removed diff --git a/html/login.php b/html/login.php index 7fb03441a..d3588d023 100644 --- a/html/login.php +++ b/html/login.php @@ -19,7 +19,8 @@ // Copyright Author Dany De Bontridder danydb@aevalys.eu require_once '../include/constant.php'; -include_once NOALYSS_INCLUDE.'/lib/ac_common.php'; +require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; +MaintenanceMode("block.html"); /*! \file * \brief Login page diff --git a/html/mobile.php b/html/mobile.php index 5c19d8ef3..a62d688a6 100644 --- a/html/mobile.php +++ b/html/mobile.php @@ -23,8 +23,11 @@ * @file * @brief only for mobile device */ - + require_once '../include/constant.php'; +require_once NOALYSS_INCLUDE.'/lib/ac_common.php'; +MaintenanceMode("block.html"); + global $g_user; $cn=new Database(); diff --git a/html/recherche.php b/html/recherche.php index c914bdf0d..5d04bf7ec 100644 --- a/html/recherche.php +++ b/html/recherche.php @@ -28,6 +28,8 @@ require_once NOALYSS_INCLUDE.'/class/acc_ledger.class.php'; require_once NOALYSS_INCLUDE.'/class/acc_ledger_search.class.php'; require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php'; require_once NOALYSS_INCLUDE.'/lib/http_input.class.php'; +MaintenanceMode("block.html"); + if ( ! isset ($_SESSION[SESSION_KEY.'g_theme'])) { echo "

"._('Vous êtes déconnecté')."

"; diff --git a/html/user_login.php b/html/user_login.php index 3582a17c9..e4477ff43 100644 --- a/html/user_login.php +++ b/html/user_login.php @@ -30,6 +30,8 @@ require_once NOALYSS_INCLUDE.'/lib/function_javascript.php'; require_once NOALYSS_INCLUDE.'/lib/icon_action.class.php'; @html_page_start($_SESSION[SESSION_KEY.'g_theme']); +MaintenanceMode("block.html"); + $rep=new Database(); require_once NOALYSS_INCLUDE . '/class/noalyss_user.class.php'; $User=new Noalyss_user($rep); diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index a2659f714..98ec334db 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -1686,3 +1686,15 @@ function linkTo($p_url) return $p_url; } } +/** + * @brief When you want to prevent users to connect, create a file in noalyss/ (NOALYSS_BASE) with the + * message in Html + * @param string $p_file file in NOALYSS_BASE + */ +function MaintenanceMode($p_file) +{ + if ( file_exists(NOALYSS_BASE."/".$p_file )) { + include NOALYSS_BASE."/".$p_file; + exit; + } +} diff --git a/unit-test/global.php b/unit-test/global.php index 2eeeb83aa..13d094206 100644 --- a/unit-test/global.php +++ b/unit-test/global.php @@ -24,7 +24,7 @@ * Global variables */ global $g_connection,$g_parameter,$g_user; -if (!defined("DOSSIER"))define ("DOSSIER",25); +if (!defined("DOSSIER"))define ("DOSSIER",101); $_REQUEST['gDossier'] = DOSSIER; $g_connection=new Database(DOSSIER); From 4679238d37a4045f0ef0a11efa78f2d5e4244456 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 14 Jan 2023 14:04:06 +0100 Subject: [PATCH 03/12] Fix : generate_random_string returns always same value , due to a change in srand() --- include/lib/ac_common.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/lib/ac_common.php b/include/lib/ac_common.php index 98ec334db..581d8b30d 100644 --- a/include/lib/ac_common.php +++ b/include/lib/ac_common.php @@ -1473,7 +1473,7 @@ function generate_random_string($car) { $string=""; $chaine="abcdefghijklmnpqrstuvwxyABCDEFGHIJKLMNPQRSTUVWXY0123456789*/+-="; - srand((int) microtime()*1020030); + srand((float) microtime(true)*1020030); for ($i=0; $i<$car; $i++) { $string .= $chaine[rand()%strlen($chaine)]; From e29412c2baab988111a5714ae53557e41a37fa3a Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 14 Jan 2023 14:07:06 +0100 Subject: [PATCH 04/12] Improve security : function isAdmin recheck the password --- html/user_login.php | 4 ++-- include/ajax/ajax_admin.php | 2 +- include/class/noalyss_user.class.php | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/html/user_login.php b/html/user_login.php index e4477ff43..126a4ebec 100644 --- a/html/user_login.php +++ b/html/user_login.php @@ -98,7 +98,7 @@ if ( $version < DBVERSIONREPO ) echo ''.$a.''; } -if ( $User->Admin() == 1) +if ( $User->isAdmin() == 1) { if (SITE_UPDATE !="") { $update=@file_get_contents(SITE_UPDATE); @@ -137,7 +137,7 @@ load_all_script(); $result=""; $result.=""; $result.=''; -if ( $User->Admin() == 1 ) +if ( $User->isAdmin() == 1 ) { $result.=""; } diff --git a/include/ajax/ajax_admin.php b/include/ajax/ajax_admin.php index 5715b3c29..b49d96053 100644 --- a/include/ajax/ajax_admin.php +++ b/include/ajax/ajax_admin.php @@ -28,7 +28,7 @@ if (!defined('ALLOWED')) * @see admin-noalyss.php ajax_misc.php admin.js */ global $g_user; -if ($g_user->Admin()==0) +if ($g_user->isAdmin()==0) { die(); } diff --git a/include/class/noalyss_user.class.php b/include/class/noalyss_user.class.php index f7bce1716..0394287d0 100644 --- a/include/class/noalyss_user.class.php +++ b/include/class/noalyss_user.class.php @@ -657,25 +657,25 @@ class Noalyss_User * synomym for isAdmin, * @deprecated */ - function Admin() + function Admin():int { return $this->isAdmin(); } /** - * @brief Check if an user is an admin + * @brief Check if an user is an admin and check also his password * * @return 1 for yes 0 for no */ - function isAdmin() + function isAdmin():int { $this->admin=0; $pass5=$this->password; $sql="select count(*) from ac_users where use_login=$1 - and use_active=1 and use_admin=1 "; + and use_active=1 and use_admin=1 and use_pass=$2 "; $cn=new Database(); - $this->admin=$cn->get_value($sql, array($this->login)); + $this->admin=$cn->get_value($sql, array($this->login,$pass5)); return $this->admin; } From 7eb0a5a72c7007b6917f9884ef508d0ef754bf8a Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 14 Jan 2023 14:07:34 +0100 Subject: [PATCH 05/12] Improve security : replace $_POST by Http_Input --- include/dossier.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/dossier.inc.php b/include/dossier.inc.php index f27008a1d..e00d460c7 100644 --- a/include/dossier.inc.php +++ b/include/dossier.inc.php @@ -82,7 +82,7 @@ if ( isset ($_POST["DATABASE"]) ) { alert(_('Désolé vous devez migrer ce modèle en unicode')); echo ''; - echo _('le modele ').domaine.'mod'.$_POST["FMOD_ID"]._(" doit être migré en unicode."); + echo _('le modele ').domaine.'mod'.$http->post("FMOD_ID","number")._(" doit être migré en unicode."); echo _('Pour le passer en unicode, faites-en une sauvegarde puis restaurez le fichier reçu').''; echo HtmlInput::button_anchor('Retour','admin-noalyss.php?action=dossier_mgt'); return; From c8d44807981f140c6b981b6b98d78e886a7dd0c8 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 15 Jan 2023 17:00:51 +0100 Subject: [PATCH 06/12] Fix : the select range select also the hidden element --- html/js/noalyss_checkbox.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/html/js/noalyss_checkbox.js b/html/js/noalyss_checkbox.js index 04c44b26e..61272c176 100644 --- a/html/js/noalyss_checkbox.js +++ b/html/js/noalyss_checkbox.js @@ -58,7 +58,15 @@ function checkbox_set_range(evt, elt, p_name) { } var check = (aName[from].checked) ? true : false; for (x = from; x <= end; x++) { - aName[x].checked = check; + if (aName[x].parentNode.parentNode ) + { + if ( window.getComputedStyle(aName[x].parentNode.parentNode).display != "none" ) { + /* console.debug(window.getComputedStyle(aName[x].parentNode.parentNode).display);*/ + aName[x].checked = check; + } + } else { + aName[x].checked = check; + } } } From 1b166ea8cb5131eaa6ca3b248c8caf1268836ba9 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 15 Jan 2023 22:24:54 +0100 Subject: [PATCH 07/12] Documentation --- include/lib/data_sql.class.php | 53 +++++++++++++++++++++++++- include/lib/manage_table_sql.class.php | 3 +- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/include/lib/data_sql.class.php b/include/lib/data_sql.class.php index 37b0bc1f5..55d0353d3 100644 --- a/include/lib/data_sql.class.php +++ b/include/lib/data_sql.class.php @@ -38,7 +38,31 @@ * - type = array , match between column and type of data * - default = array of column with a default value * - date_format = format of the date - * + * + * if you give a SQL or a View you have to give a primary key, usually , the best is to use a key composed of + * different PK of the tables + * Example : in this SQL (or view) the PK is id and it is composed with the PK f_id and sg_id , remember that the + * pk cannot be null and must be unique ! For SQL , the value is computed , so you need a subselect like this + @code + select + ssw.sg_id::text||'-'||vfp.f_id::text id, + vfp.f_id,vfp.f_enable,vfp.person_name ,vfp.person_fname ,vfp.person_qcode ,ssw.sg_id + from rash.vw_fiche_person vfp + join rash.security_social_worker ssw using(f_id) ; + @endcode + * + * For SQL , the value is computed , so you need a subselect like this +@code + select * from ( + select + ssw.sg_id::text||'-'||vfp.f_id::text id, + vfp.f_id,vfp.f_enable,vfp.person_name ,vfp.person_fname ,vfp.person_qcode ,ssw.sg_id + from rash.vw_fiche_person vfp + join rash.security_social_worker ssw using(f_id))sub1 +@encode + * + * + * * After you call the parent constructor * @note the view or the table must include an unique key, otherwise the load * doesn't work. @@ -199,6 +223,33 @@ abstract class Data_SQL return $this->$pk; } + /** + * @brief Load the current row return false if not found + * @code + $pk=$this->primary_key; + if ( $this->get_limit_fiche_qcode() != 0 ) + { + $sql=sprintf($this->sql," limit ".$this->get_limit_fiche_qcode()); + } else + { + $sql=sprintf($this->sql," "); + } + $result=$this->cn->get_array($sql. " where id=$1",array ($this->$pk)); + if ($this->cn->count()==0) + { + $this->$pk=-1; + return false; + } + + foreach ($result[0] as $key=> $value) + { + $this->$key=$value; + } + return true; + * + * @endcode + * @return bool + */ abstract function load():bool; public function get_info() diff --git a/include/lib/manage_table_sql.class.php b/include/lib/manage_table_sql.class.php index ba52307db..45cffff6f 100644 --- a/include/lib/manage_table_sql.class.php +++ b/include/lib/manage_table_sql.class.php @@ -31,7 +31,7 @@ \code $objet->set_pk($p_id); // It is very important to set the name of the javascript variable - // Contained in the http_input variable "ctl" + // Contained in the http_input variable "ctl" , without this the list cannot be updated $objet->set_object_name($objet_name); // Set the ajax to call @@ -51,6 +51,7 @@ $json=json_encode($aJson); $objet->param_set($json); + // Display the box header('Content-type: text/xml; charset=UTF-8'); $xml=$objet->ajax_input(); From 59ddb6e97f8e029aa9b9415c1a7aa905db296b89 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sun, 15 Jan 2023 22:25:28 +0100 Subject: [PATCH 08/12] Fix : if there is no stock there is an exception instead of a warning --- include/class/stock_goods.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/include/class/stock_goods.class.php b/include/class/stock_goods.class.php index 1e2d8da7d..668f07985 100644 --- a/include/class/stock_goods.class.php +++ b/include/class/stock_goods.class.php @@ -74,10 +74,10 @@ class Stock_Goods extends Stock_Goods_Sql $motif->size = 80; $idepo = HtmlInput::select_stock($cn, "p_depot", "W"); $idepo->setReadOnly($p_readonly); - if (count($idepo->value) == 0) + if (empty($idepo->value) ) { - NoAccess(); - die(); + echo_warning(_("Aucun stock disponible")); + return; } $idepo->selected = $p_depot; if ($p_readonly ) { From 322b74a01453a018ae57e010352f4381b3a93d3a Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 21 Jan 2023 14:05:10 +0100 Subject: [PATCH 09/12] Cosmetic : improve CSS for enrich text --- html/css/style-classic7.css | 43 ++++++++++++++++++++++++++++++++++--- 1 file changed, 40 insertions(+), 3 deletions(-) diff --git a/html/css/style-classic7.css b/html/css/style-classic7.css index 494cb253a..d09d9b863 100644 --- a/html/css/style-classic7.css +++ b/html/css/style-classic7.css @@ -3307,7 +3307,7 @@ li.li-active { margin-left:2rem !important; } - div.nicEdit-main hr { + * div.nicEdit-main hr { background-color: #756f6f !important; width:90% !important; margin-left:5% !important; @@ -3316,13 +3316,50 @@ li.li-active { height:2px; } - div.nicEdit-main h2 { + * div.nicEdit-main h2 { margin: 0px; padding: 0px; + margin-left:2rem; font-size: 1.6em; font-style: normal; margin-bottom: .5rem; font-size: 2rem !important; - background-color: white; + background-color: transparent; color: navy; + text-decoration: underline; } + + * div.nicEdit-main h1 { + margin: 0px; + padding: 0px; + margin-left:1rem; + font-style: normal; + margin-bottom: .5rem; + font-size: 2.5rem !important; + background-color: transparent; + color: navy; + text-decoration: underline double; + } + + * div.nicEdit-main h3 { + margin: 0px; + padding: 0px; + font-style: normal; + margin-bottom: .5rem; + font-size: 1.5 rem !important; + background-color: transparent; + color: navy; + text-decoration: underline dashed; + margin-left:3rem; + } + * div.nicEdit-main h4 { + margin: 0px; + padding: 0px; + font-style: normal; + margin-bottom: .5rem; + font-size: 1.1 rem !important; + background-color: transparent; + color: navy; + text-decoration: underline wavy; + margin-left:4rem; + } \ No newline at end of file From f00d5f8d515883dac6fe4bac88df9e5af7eb3a67 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Wed, 25 Jan 2023 15:49:50 +0100 Subject: [PATCH 10/12] improve code : sql : document table action_gestion --- include/constant.php | 2 +- include/sql/patch/upgrade183.sql | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 include/sql/patch/upgrade183.sql diff --git a/include/constant.php b/include/constant.php index 9b1e7bd4a..6cc75512c 100644 --- a/include/constant.php +++ b/include/constant.php @@ -116,7 +116,7 @@ if (!defined("NOALYSS_PACKAGE_REPOSITORY")) { if (!defined("SYSINFO_DISPLAY")) { define("SYSINFO_DISPLAY", TRUE); } -define("DBVERSION", 183); +define("DBVERSION", 184); define("MONO_DATABASE", 25); define("DBVERSIONREPO", 20); define('NOTFOUND', '--not found--'); diff --git a/include/sql/patch/upgrade183.sql b/include/sql/patch/upgrade183.sql new file mode 100644 index 000000000..59a899c93 --- /dev/null +++ b/include/sql/patch/upgrade183.sql @@ -0,0 +1,13 @@ +begin; +COMMENT ON COLUMN public.action_gestion.f_id_dest IS 'third party'; +COMMENT ON COLUMN public.action_gestion.ag_priority IS 'Low, medium, important'; +COMMENT ON COLUMN public.action_gestion.ag_dest IS 'is the profile which has to take care of this action'; +COMMENT ON COLUMN public.action_gestion.ag_owner IS 'is the owner of this action'; +COMMENT ON COLUMN public.action_gestion.ag_contact IS 'contact of the third part'; +COMMENT ON COLUMN public.action_gestion.ag_title IS 'title'; +COMMENT ON COLUMN public.action_gestion.ag_timestamp IS ''; +COMMENT ON COLUMN public.action_gestion.ag_ref IS 'its reference'; +COMMENT ON COLUMN public.action_gestion.ag_state IS 'state of the action same as document_state'; + +insert into version (val,v_description) values (184,'document table action_gestion'); +commit; From 553ac0a02c6c0cba7ee1016fd0f6a5bb627f27dd Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 28 Jan 2023 19:12:02 +0100 Subject: [PATCH 11/12] Documentation ManageTable.js --- html/js/managetable.js | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/html/js/managetable.js b/html/js/managetable.js index a9c4d4113..864b17230 100644 --- a/html/js/managetable.js +++ b/html/js/managetable.js @@ -64,6 +64,21 @@ How to call a function AFTER save ? You set a function afterSaveFct like in the example, it will be trigger after you submit the FORM + a function named afterSaveFct(r) where r is the row in HTML to display, with a attribute ctl_pk_id which is the primary key and id of the row + Example : + @code + document_attach_obj.afterSaveFct=function(e) { + var ctl_pk_id=e.getAttribute("ctl_pk_id"); + var formData = new FormData(); + var file_data=document.getElementById('da_file_name'); + formData.append('da_file_name', file_data.files[0]); + var xhr = new XMLHttpRequest(); + xhr.open("POST", "ajax.php?p_id="+ctl_pk_id+"&do=upload_document", true); + xhr.send(formData); +} + + @endcode + As a hidden parameter the Manage_Table:object_name must be set Example : @code @@ -231,7 +246,11 @@ var ManageTable = function (p_table_name) the current object * - * + * *Call the ajax with the action save , it is possible to call a function after the save by creating + * + * a function named afterSaveFct(r) where r is the row in HTML to display, with a attribute ctl_pk_id which is the + * + * primary key and id of the row + * + * + * + * As a hidden parameter the Manage_Table:object_name must be set * */ this.save = function (form_id) { From 1c7f0086a66bc5f53460f83d8170109a53949ca0 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Sat, 28 Jan 2023 19:14:37 +0100 Subject: [PATCH 12/12] =?UTF-8?q?Bug=20#0002231:=20"Pay=C3=A9e=20par"=20-?= =?UTF-8?q?=20date=20non=20prise=20en=20compte?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/class/acc_ledger_purchase.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/class/acc_ledger_purchase.class.php b/include/class/acc_ledger_purchase.class.php index 46a9a7619..21f053aaa 100644 --- a/include/class/acc_ledger_purchase.class.php +++ b/include/class/acc_ledger_purchase.class.php @@ -1000,7 +1000,7 @@ class Acc_Ledger_Purchase extends Acc_Ledger /* Insert supplier */ $acc_pay=new Acc_Operation($this->db); - $acc_pay->date=$e_date; + $acc_pay->date=$mp_date; $acc_pay->poste=$poste; $acc_pay->qcode=$e_client; $acc_pay->amount=abs(round($famount,2));
"._("Administration")."