From d82c62c40d9558d9c97c49a5cf62053d0ffc5125 Mon Sep 17 00:00:00 2001 From: abb Date: Fri, 12 Feb 2021 23:53:05 +0100 Subject: [PATCH 01/37] New:Constant MAIN_SHOW_SOCIETE2EXTERN to allow access to any thirdparty for external users --- htdocs/core/lib/security.lib.php | 2 +- htdocs/societe/card.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 2f1e3d5596b..f2714dc9fb2 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -493,7 +493,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand } elseif (in_array($feature, $checksoc)) // We check feature = checksoc { // If external user: Check permission for external users - if ($user->socid > 0) + if ($user->socid > 0 && empty($conf->global->MAIN_SHOW_SOCIETE2EXTERN)) { if ($user->socid <> $objectid) return false; } // If internal user: Check permission for internal users that are restricted on their objects diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index b471ca23ead..757b168e0cf 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -64,7 +64,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); -if ($user->socid) $socid = $user->socid; +if ($user->socid && empty($conf->global->MAIN_SHOW_SOCIETE2EXTERN)) $socid = $user->socid; if (empty($socid) && $action == 'view') $action = 'create'; $object = new Societe($db); From ae60f452cc8c5d909be58d26d74d0ec918fc2bc3 Mon Sep 17 00:00:00 2001 From: x Date: Wed, 3 Mar 2021 16:36:21 +0100 Subject: [PATCH 02/37] FIX : pencil to update employee field on card view --- htdocs/salaries/card.php | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 91330cf318e..76a37382a45 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -59,6 +59,7 @@ $datev = dol_mktime(12, 0, 0, GETPOST("datevmonth", 'int'), GETPOST("datevday", $datesp = dol_mktime(12, 0, 0, GETPOST("datespmonth", 'int'), GETPOST("datespday", 'int'), GETPOST("datespyear", 'int')); $dateep = dol_mktime(12, 0, 0, GETPOST("dateepmonth", 'int'), GETPOST("dateepday", 'int'), GETPOST("dateepyear", 'int')); $label = GETPOST('label'); +$fk_user = GETPOST('userid', 'int'); // Security check $socid = GETPOST("socid", "int"); @@ -98,6 +99,12 @@ if ($action == 'confirm_paid' && $user->rights->salaries->write && $confirm == ' $result = $object->set_paid($user); } +if($action == 'setfk_user' && $user->rights->salaries->write) { + $object->fetch($id); + $object->fk_user = $fk_user; + $object->update($user); +} + if ($action == 'reopen' && $user->rights->salaries->write) { $result = $object->fetch($id); if ($object->paye) @@ -627,11 +634,25 @@ if ($id) $morehtmlref .= ''; $morehtmlref .= ''; } - - // Employee - $userstatic = new User($db); - $userstatic->fetch($object->fk_user); - $morehtmlref .= '
' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(1); + + //Employee + if($action != 'editfk_user') { + $morehtmlref .= '
' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); + + if(!empty($object->fk_user)) { + $userstatic = new User($db); + $userstatic->fetch($object->fk_user); + $morehtmlref .= $userstatic->getNomUrl(1); + } + } else { + $morehtmlref .= '
'.$langs->trans('Employee').' : '; + $morehtmlref .= '
'; + $morehtmlref .= ''; + $morehtmlref .= ''; + $morehtmlref .= $form->select_dolusers($object->fk_user, 'userid', 1); + $morehtmlref .= ''; + $morehtmlref .= '
'; + } // Project if (!empty($conf->projet->enabled)) From 55e9908601db3248e4c579c0719a02b1e77501fd Mon Sep 17 00:00:00 2001 From: x Date: Mon, 8 Mar 2021 10:09:38 +0100 Subject: [PATCH 03/37] FIX : PR returns --- htdocs/salaries/card.php | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 76a37382a45..3c4ea63160a 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -100,9 +100,15 @@ if ($action == 'confirm_paid' && $user->rights->salaries->write && $confirm == ' } if($action == 'setfk_user' && $user->rights->salaries->write) { - $object->fetch($id); - $object->fk_user = $fk_user; - $object->update($user); + $result = $object->fetch($id); + if ($result > 0){ + $object->fk_user = $fk_user; + $object->update($user); + } else { + dol_print_error($db); + exit; + } + } if ($action == 'reopen' && $user->rights->salaries->write) { @@ -641,8 +647,13 @@ if ($id) if(!empty($object->fk_user)) { $userstatic = new User($db); - $userstatic->fetch($object->fk_user); - $morehtmlref .= $userstatic->getNomUrl(1); + $result = $userstatic->fetch($object->fk_user); + if ($result > 0){ + $morehtmlref .= $userstatic->getNomUrl(1); + } else { + dol_print_error($db); + exit(); + } } } else { $morehtmlref .= '
'.$langs->trans('Employee').' : '; From 1fec98c546602a46ae8c07e51c0d2553e5bb91e8 Mon Sep 17 00:00:00 2001 From: x Date: Mon, 8 Mar 2021 11:10:51 +0100 Subject: [PATCH 04/37] FIX : Rounding amount on card updating --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 htdocs/salaries/card.php diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php old mode 100644 new mode 100755 index 72148a30c35..8cc504c0b99 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -718,7 +718,7 @@ if ($id) print '';*/ if ($action == 'edit') { - print '' . $langs->trans("Amount") . ''; + print '' . $langs->trans("Amount") . ''; } else { print '' . $langs->trans("Amount") . '' . price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency) . ''; } From cb5d5326650b7af51c5caed4d60f17e3fa378d54 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Mon, 8 Mar 2021 16:24:54 +0000 Subject: [PATCH 05/37] Fixing style errors. --- htdocs/salaries/card.php | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 1e6726afefc..e1bbf371cc1 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -108,16 +108,15 @@ if ($action == 'confirm_paid' && $user->rights->salaries->write && $confirm == ' $result = $object->set_paid($user); } -if($action == 'setfk_user' && $user->rights->salaries->write) { +if ($action == 'setfk_user' && $user->rights->salaries->write) { $result = $object->fetch($id); - if ($result > 0){ + if ($result > 0) { $object->fk_user = $fk_user; $object->update($user); } else { dol_print_error($db); exit; } - } if ($action == 'reopen' && $user->rights->salaries->write) { @@ -606,13 +605,13 @@ if ($id) { } //Employee - if($action != 'editfk_user') { + if ($action != 'editfk_user') { $morehtmlref .= '
' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); - if(!empty($object->fk_user)) { + if (!empty($object->fk_user)) { $userstatic = new User($db); $result = $userstatic->fetch($object->fk_user); - if ($result > 0){ + if ($result > 0) { $morehtmlref .= $userstatic->getNomUrl(1); } else { dol_print_error($db); From a67fd6c0a428faa4b9828cbdf25867813a6d92d3 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 9 Mar 2021 10:55:10 +0100 Subject: [PATCH 06/37] FIX : Update pencil should be shown only when no payments has been entered --- htdocs/salaries/card.php | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index e1bbf371cc1..caa37119c57 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -604,18 +604,32 @@ if ($id) { $morehtmlref .= ''; } - //Employee - if ($action != 'editfk_user') { - $morehtmlref .= '
' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); + $sql = 'SELECT fk_salary, amount'; + $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_salary'; + $sql .= ' WHERE fk_salary = '.$object->id; - if (!empty($object->fk_user)) { + $resql = $db->query($sql); + $obj = $db->fetch_object($resql); + //Employee + if($action != 'editfk_user') { + if (!empty($obj) && !empty($object->fk_user)){ $userstatic = new User($db); $result = $userstatic->fetch($object->fk_user); - if ($result > 0) { - $morehtmlref .= $userstatic->getNomUrl(1); - } else { - dol_print_error($db); - exit(); + if ($result > 0){ + $morehtmlref .= '
' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(1); + } + } else { + $morehtmlref .= '
' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); + + if(!empty($object->fk_user)) { + $userstatic = new User($db); + $result = $userstatic->fetch($object->fk_user); + if ($result > 0){ + $morehtmlref .= $userstatic->getNomUrl(1); + } else { + dol_print_error($db); + exit(); + } } } } else { From c55c1ab854f36ab4f04483a2606f72fd2cedd846 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 9 Mar 2021 09:58:11 +0000 Subject: [PATCH 07/37] Fixing style errors. --- htdocs/salaries/card.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index caa37119c57..1082c6dbd80 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -611,20 +611,20 @@ if ($id) { $resql = $db->query($sql); $obj = $db->fetch_object($resql); //Employee - if($action != 'editfk_user') { - if (!empty($obj) && !empty($object->fk_user)){ + if ($action != 'editfk_user') { + if (!empty($obj) && !empty($object->fk_user)) { $userstatic = new User($db); $result = $userstatic->fetch($object->fk_user); - if ($result > 0){ + if ($result > 0) { $morehtmlref .= '
' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(1); } } else { $morehtmlref .= '
' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); - if(!empty($object->fk_user)) { + if (!empty($object->fk_user)) { $userstatic = new User($db); $result = $userstatic->fetch($object->fk_user); - if ($result > 0){ + if ($result > 0) { $morehtmlref .= $userstatic->getNomUrl(1); } else { dol_print_error($db); From 07015ef29eceba2ba67103ae2b78c52039954769 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 9 Mar 2021 11:35:24 +0100 Subject: [PATCH 08/37] FIX : Using function getSommePaiement() instead of using SQL request --- htdocs/salaries/card.php | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 1082c6dbd80..c2f93cc8354 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -604,15 +604,11 @@ if ($id) { $morehtmlref .= ''; } - $sql = 'SELECT fk_salary, amount'; - $sql .= ' FROM '.MAIN_DB_PREFIX.'payment_salary'; - $sql .= ' WHERE fk_salary = '.$object->id; - - $resql = $db->query($sql); - $obj = $db->fetch_object($resql); + $sal = new Salary($db); + $sal->fetch($object->id); //Employee if ($action != 'editfk_user') { - if (!empty($obj) && !empty($object->fk_user)) { + if ($sal->getSommePaiement() > 0 && !empty($object->fk_user)){ $userstatic = new User($db); $result = $userstatic->fetch($object->fk_user); if ($result > 0) { From 1afddabed45923558923d19707567f4efabde3b3 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 9 Mar 2021 10:41:03 +0000 Subject: [PATCH 09/37] Fixing style errors. --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index c2f93cc8354..98f2cec2523 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -608,7 +608,7 @@ if ($id) { $sal->fetch($object->id); //Employee if ($action != 'editfk_user') { - if ($sal->getSommePaiement() > 0 && !empty($object->fk_user)){ + if ($sal->getSommePaiement() > 0 && !empty($object->fk_user)) { $userstatic = new User($db); $result = $userstatic->fetch($object->fk_user); if ($result > 0) { From b82f14859cfc03ca48b843870528d93fa92ddc74 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 9 Mar 2021 11:48:25 +0100 Subject: [PATCH 10/37] FIX : no fetch required --- htdocs/salaries/card.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 98f2cec2523..8fbcc53539b 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -603,12 +603,10 @@ if ($id) { $morehtmlref .= ''; $morehtmlref .= ''; } - - $sal = new Salary($db); - $sal->fetch($object->id); + //Employee if ($action != 'editfk_user') { - if ($sal->getSommePaiement() > 0 && !empty($object->fk_user)) { + if ($object->getSommePaiement() > 0 && !empty($object->fk_user)) { $userstatic = new User($db); $result = $userstatic->fetch($object->fk_user); if ($result > 0) { From 93e50bcba63bc8900a8cd66bf29283b3e8d11af8 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Tue, 9 Mar 2021 10:50:59 +0000 Subject: [PATCH 11/37] Fixing style errors. --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 8fbcc53539b..a816d6a7a07 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -603,7 +603,7 @@ if ($id) { $morehtmlref .= ''; $morehtmlref .= ''; } - + //Employee if ($action != 'editfk_user') { if ($object->getSommePaiement() > 0 && !empty($object->fk_user)) { From f3508eed831b757e939a2cc6f2b1a2382bc948f3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 9 Mar 2021 15:09:28 +0100 Subject: [PATCH 12/37] Update card.php --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index a816d6a7a07..028f043b805 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -714,7 +714,7 @@ if ($id) { if ($action == 'edit') { print '' . $langs->trans("Amount") . ''; } else { - print '' . $langs->trans("Amount") . '' . price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency) . ''; + print '' . $langs->trans("Amount") . '' . price($object->amount) . ''; } // Mode of payment From 3eb72ad833c57f3846ae84d68cec4404ff896bcb Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 9 Mar 2021 17:55:51 +0100 Subject: [PATCH 13/37] truc --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index f72a933c688..3e4f70eeecc 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -44,7 +44,7 @@ if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) { // Add Xdebug code coverage //define('XDEBUGCOVERAGE',1); if (defined('XDEBUGCOVERAGE')) { - xdebug_start_code_coverage(); + xdebug_start_code_coverage('sdfd'); } } From 34080b19a11bced1d2cb47181ed336d8fada202f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 9 Mar 2021 18:23:57 +0100 Subject: [PATCH 14/37] fix debug --- htdocs/main.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index 3e4f70eeecc..f72a933c688 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -44,7 +44,7 @@ if (!empty($_SERVER['MAIN_SHOW_TUNING_INFO'])) { // Add Xdebug code coverage //define('XDEBUGCOVERAGE',1); if (defined('XDEBUGCOVERAGE')) { - xdebug_start_code_coverage('sdfd'); + xdebug_start_code_coverage(); } } From 7aec2fc02b333a7aede33e107e7048301c8fe67f Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Tue, 9 Mar 2021 18:52:52 +0100 Subject: [PATCH 15/37] create task --- .../modules/modEventOrganization.class.php | 2 +- ...ntOrganization_EventOrganization.class.php | 123 ++++++++++++++++++ 2 files changed, 124 insertions(+), 1 deletion(-) create mode 100644 htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index b0527ad30b5..77d0cc0c81f 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -66,7 +66,7 @@ class modEventOrganization extends DolibarrModules // Define some features supported by module (triggers, login, substitutions, menus, css, etc...) $this->module_parts = array( // Set this to 1 if module has its own trigger directory (core/triggers) - 'triggers' => 0, + 'triggers' => 1, // Set this to 1 if module has its own login method file (core/login) 'login' => 0, // Set this to 1 if module has its own substitution function file (core/substitutions) diff --git a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php new file mode 100644 index 00000000000..c5d978c7534 --- /dev/null +++ b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php @@ -0,0 +1,123 @@ + + * Copyright (C) 2021 Florian Henry + * + * This program 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 3 of the License, or + * (at your option) any later version. + * + * This program 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 this program. If not, see . + */ + +/** + * \file htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php + * \ingroup eventorganization + * \brief Trigger file for Event Organization module + */ + +require_once DOL_DOCUMENT_ROOT.'/core/triggers/dolibarrtriggers.class.php'; + + +/** + * Class of triggered functions for agenda module + */ +class InterfaceEventOrganization extends DolibarrTriggers +{ + /** + * Constructor + * + * @param DoliDB $db Database handler + */ + public function __construct($db) + { + $this->db = $db; + + $this->name = preg_replace('/^Interface/i', '', get_class($this)); + $this->family = "eventorganization"; + $this->description = "Triggers of this module to manage event organization triggers action"; + // 'development', 'experimental', 'dolibarr' or version + $this->version = self::VERSION_DOLIBARR; + $this->picto = 'action'; + } + + /** + * Function called when a Dolibarrr business event is done. + * All functions "runTrigger" are triggered if file is inside directory htdocs/core/triggers or htdocs/module/code/triggers (and declared) + * + * Following properties may be set before calling trigger. The may be completed by this trigger to be used for writing the event into database: + * $object->actiontypecode (translation action code: AC_OTH, ...) + * $object->actionmsg (note, long text) + * $object->actionmsg2 (label, short text) + * $object->sendtoid (id of contact or array of ids of contacts) + * $object->socid (id of thirdparty) + * $object->fk_project + * $object->fk_element (ID of object to link action event to) + * $object->elementtype (->element of object to link action to) + * $object->module (if defined, elementtype in llx_actioncomm will be elementtype@module) + * + * @param string $action Event action code ('CONTRACT_MODIFY', 'RECRUITMENTCANDIDATURE_MODIFIY', ...) + * @param Object $object Object + * @param User $user Object user + * @param Translate $langs Object langs + * @param conf $conf Object conf + * @return int <0 if KO, 0 if no triggered ran, >0 if OK + */ + public function runTrigger($action, $object, User $user, Translate $langs, Conf $conf) + { + if (empty($conf->eventorganization->enabled)) { + return 0; // Module not active, we do nothing + } + $error=0; + // Actions + if ($action == 'PROJECT_VALIDATE') { + // Load translation files required by the page + $langs->loadLangs(array("eventorganization")); + + if (!empty($conf->global->EVENTORGANIZATION_TASK_LABEL)) { + $taskToDo = explode("\n", $conf->global->EVENTORGANIZATION_TASK_LABEL); + if (is_array($taskToDo) && count($taskToDo)>0) { + $this->db->begin(); + foreach ($taskToDo as $taskLabel) { + $task = new Task($this->db); + $task->label = $taskLabel; + $task->fk_project = $object->id; + $defaultref = ''; + $obj = empty($conf->global->PROJECT_TASK_ADDON) ? 'mod_task_simple' : $conf->global->PROJECT_TASK_ADDON; + if (!empty($conf->global->PROJECT_TASK_ADDON) && is_readable(DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . ".php")) { + require_once DOL_DOCUMENT_ROOT . "/core/modules/project/task/" . $conf->global->PROJECT_TASK_ADDON . '.php'; + $modTask = new $obj; + $defaultref = $modTask->getNextValue($object->thirdparty, null); + } + if (is_numeric($defaultref) && $defaultref <= 0) { + $defaultref = ''; + } + $task->ref = $defaultref; + $task->date_start = $object->date_start; + $task->date_end = $object->date_end; + $result = $task->create($user); + if ($result < 0) { + $this->errors=array_merge($this->errors, $task->errors); + $error++; + } + } + } + } + + if (empty($error)) { + $this->db->commit(); + return 1; + } else { + dol_syslog("InterfaceEventOrganization.class.php: ".implode(',', $this->errors), LOG_ERR); + $this->db->rollback(); + return -1; + } + } + } +} From 3a3793d5092cd12f86f77b1f417da187b01c2fdc Mon Sep 17 00:00:00 2001 From: TuxGasy Date: Wed, 10 Mar 2021 10:24:20 +0100 Subject: [PATCH 16/37] Add hidden option ALLOW_USE_KITS_INTO_BOM_AND_MO --- htdocs/mrp/class/mo.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index d911a53ef5e..b0dbf65cc0a 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -248,7 +248,8 @@ class Mo extends CommonObject $this->db->begin(); - if ($this->fk_product > 0) { + // Check that product is not a kit/virtual product + if (empty($conf->global->ALLOW_USE_KITS_INTO_BOM_AND_MO) and $this->fk_product > 0) { include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $tmpproduct = new Product($this->db); $tmpproduct->fetch($this->fk_product); @@ -260,7 +261,6 @@ class Mo extends CommonObject } } - // Check that product is not a kit/virtual product if (!$error) { $idcreated = $this->createCommon($user, $notrigger); if ($idcreated <= 0) { From a9a8a177a243c59be004006f4ac214cea5c2bb11 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 10 Mar 2021 09:54:43 +0000 Subject: [PATCH 17/37] Fixing style errors. --- htdocs/mrp/class/mo.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/mrp/class/mo.class.php b/htdocs/mrp/class/mo.class.php index b0dbf65cc0a..6fd903c0038 100644 --- a/htdocs/mrp/class/mo.class.php +++ b/htdocs/mrp/class/mo.class.php @@ -248,7 +248,7 @@ class Mo extends CommonObject $this->db->begin(); - // Check that product is not a kit/virtual product + // Check that product is not a kit/virtual product if (empty($conf->global->ALLOW_USE_KITS_INTO_BOM_AND_MO) and $this->fk_product > 0) { include_once DOL_DOCUMENT_ROOT.'/product/class/product.class.php'; $tmpproduct = new Product($this->db); From 6a7ecf210fb11ad46426508da8b297f697d93cb2 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Wed, 10 Mar 2021 15:38:01 +0100 Subject: [PATCH 18/37] FIX : Travis returns --- htdocs/salaries/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 028f043b805..53f46320073 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -613,7 +613,7 @@ if ($id) { $morehtmlref .= '
' .$langs->trans('Employee').' : '.$userstatic->getNomUrl(1); } } else { - $morehtmlref .= '
' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); + $morehtmlref .= '
' . $form->editfieldkey("Employee", 'fk_user', $object->label, $object, $user->rights->salaries->write, 'string', '', 0, 1); if (!empty($object->fk_user)) { $userstatic = new User($db); From 204302ac15d3b2535d084c345637a81f1a3a1a44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 10 Mar 2021 15:43:50 +0100 Subject: [PATCH 19/37] replace value with constant --- htdocs/fichinter/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fichinter/card.php b/htdocs/fichinter/card.php index d1507d52418..5c162c4bf4f 100644 --- a/htdocs/fichinter/card.php +++ b/htdocs/fichinter/card.php @@ -510,7 +510,7 @@ if (empty($reshook)) { } } elseif ($action == 'classifybilled' && $user->rights->ficheinter->creer) { // Classify Billed - $result = $object->setStatut(2); + $result = $object->setStatut(Fichinter::STATUS_BILLED); if ($result > 0) { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; @@ -519,7 +519,7 @@ if (empty($reshook)) { } } elseif ($action == 'classifyunbilled' && $user->rights->ficheinter->creer) { // Classify unbilled - $result = $object->setStatut(1); + $result = $object->setStatut(Fichinter::STATUS_VALIDATED); if ($result > 0) { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; @@ -528,7 +528,7 @@ if (empty($reshook)) { } } elseif ($action == 'classifydone' && $user->rights->ficheinter->creer) { // Classify Done - $result = $object->setStatut(3); + $result = $object->setStatut(Fichinter::STATUS_CLOSED); if ($result > 0) { header('Location: '.$_SERVER["PHP_SELF"].'?id='.$object->id); exit; From 82d5c7289dd0c45d4b5191edce9c321c1de158e9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Mar 2021 17:02:39 +0100 Subject: [PATCH 20/37] Add property widgettype --- htdocs/adherents/index.php | 3 +++ htdocs/core/boxes/box_graph_invoices_permonth.php | 2 ++ .../core/boxes/box_graph_invoices_supplier_permonth.php | 2 ++ htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php | 8 +++----- htdocs/core/boxes/box_graph_nb_tickets_type.php | 9 ++++----- htdocs/core/boxes/box_graph_new_vs_close_ticket.php | 9 ++++----- htdocs/core/boxes/box_graph_orders_permonth.php | 2 ++ htdocs/core/boxes/box_graph_orders_supplier_permonth.php | 2 ++ htdocs/core/boxes/box_graph_product_distribution.php | 2 ++ htdocs/core/boxes/box_graph_propales_permonth.php | 2 ++ htdocs/core/boxes/box_graph_ticket_by_severity.php | 5 ++++- htdocs/core/boxes/modules_boxes.php | 6 ++++++ .../template/core/boxes/mymodulewidget1.php | 6 ++++++ 13 files changed, 42 insertions(+), 16 deletions(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 7b4d2f6bba9..7a6b0d7b7d1 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -195,6 +195,7 @@ if ($conf->use_javascript_ajax) { $SommeA = 0; $SommeB = 0; + $SommeC = 0; $SommeD = 0; $total = 0; @@ -492,6 +493,8 @@ print ''; print "\n"; print ""; +print '
'; + print $resultboxes['boxlistb']; print ''."\n"; diff --git a/htdocs/core/boxes/box_graph_invoices_permonth.php b/htdocs/core/boxes/box_graph_invoices_permonth.php index ca77fec51e4..e4418020bfc 100644 --- a/htdocs/core/boxes/box_graph_invoices_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_permonth.php @@ -41,6 +41,8 @@ class box_graph_invoices_permonth extends ModeleBoxes public $info_box_head = array(); public $info_box_contents = array(); + public $widgettype = 'graph'; + /** * Constructor diff --git a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php index 21931b1a071..5ecc26c3f90 100644 --- a/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_invoices_supplier_permonth.php @@ -41,6 +41,8 @@ class box_graph_invoices_supplier_permonth extends ModeleBoxes public $info_box_head = array(); public $info_box_contents = array(); + public $widgettype = 'graph'; + /** * Constructor diff --git a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php index 9595d264ee4..31b6bb20a8d 100644 --- a/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php +++ b/htdocs/core/boxes/box_graph_nb_ticket_last_x_days.php @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; /** * Class to manage the box */ -class box_nb_ticket_last_x_days extends ModeleBoxes +class box_graph_nb_ticket_last_x_days extends ModeleBoxes { public $boxcode = "box_nb_ticket_last_x_days"; @@ -36,14 +36,12 @@ class box_nb_ticket_last_x_days extends ModeleBoxes public $boxlabel; public $depends = array("ticket"); - /** - * @var DoliDB Database handler. - */ - public $param; public $info_box_head = array(); public $info_box_contents = array(); + public $widgettype = 'graph'; + /** * Constructor * @param DoliDB $db Database handler diff --git a/htdocs/core/boxes/box_graph_nb_tickets_type.php b/htdocs/core/boxes/box_graph_nb_tickets_type.php index 10eebc05b06..eea0f0ccf77 100644 --- a/htdocs/core/boxes/box_graph_nb_tickets_type.php +++ b/htdocs/core/boxes/box_graph_nb_tickets_type.php @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; /** * Class to manage the box */ -class box_nb_tickets_type extends ModeleBoxes +class box_graph_nb_tickets_type extends ModeleBoxes { public $boxcode = "box_nb_tickets_type"; @@ -36,14 +36,13 @@ class box_nb_tickets_type extends ModeleBoxes public $boxlabel; public $depends = array("ticket"); - /** - * @var DoliDB Database handler. - */ - public $param; public $info_box_head = array(); public $info_box_contents = array(); + public $widgettype = 'graph'; + + /** * Constructor * @param DoliDB $db Database handler diff --git a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php index 32eb82984e7..bd835d6cc07 100644 --- a/htdocs/core/boxes/box_graph_new_vs_close_ticket.php +++ b/htdocs/core/boxes/box_graph_new_vs_close_ticket.php @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; /** * Class to manage the box */ -class box_new_vs_close_ticket extends ModeleBoxes +class box_graph_new_vs_close_ticket extends ModeleBoxes { public $boxcode = "box_nb_tickets_type"; @@ -36,14 +36,13 @@ class box_new_vs_close_ticket extends ModeleBoxes public $boxlabel; public $depends = array("ticket"); - /** - * @var DoliDB Database handler. - */ - public $param; public $info_box_head = array(); public $info_box_contents = array(); + public $widgettype = 'graph'; + + /** * Constructor * @param DoliDB $db Database handler diff --git a/htdocs/core/boxes/box_graph_orders_permonth.php b/htdocs/core/boxes/box_graph_orders_permonth.php index ec11d07a28f..48f0bd67ec3 100644 --- a/htdocs/core/boxes/box_graph_orders_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_permonth.php @@ -41,6 +41,8 @@ class box_graph_orders_permonth extends ModeleBoxes public $info_box_head = array(); public $info_box_contents = array(); + public $widgettype = 'graph'; + /** * Constructor diff --git a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php index a6dfead80f0..a394834cd97 100644 --- a/htdocs/core/boxes/box_graph_orders_supplier_permonth.php +++ b/htdocs/core/boxes/box_graph_orders_supplier_permonth.php @@ -41,6 +41,8 @@ class box_graph_orders_supplier_permonth extends ModeleBoxes public $info_box_head = array(); public $info_box_contents = array(); + public $widgettype = 'graph'; + /** * Constructor diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 5c3e55fcc2f..4a88617de4e 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -44,6 +44,8 @@ class box_graph_product_distribution extends ModeleBoxes public $info_box_head = array(); public $info_box_contents = array(); + public $widgettype = 'graph'; + /** * Constructor diff --git a/htdocs/core/boxes/box_graph_propales_permonth.php b/htdocs/core/boxes/box_graph_propales_permonth.php index f8028e3bdb8..8a95761ea08 100644 --- a/htdocs/core/boxes/box_graph_propales_permonth.php +++ b/htdocs/core/boxes/box_graph_propales_permonth.php @@ -41,6 +41,8 @@ class box_graph_propales_permonth extends ModeleBoxes public $info_box_head = array(); public $info_box_contents = array(); + public $widgettype = 'graph'; + /** * Constructor diff --git a/htdocs/core/boxes/box_graph_ticket_by_severity.php b/htdocs/core/boxes/box_graph_ticket_by_severity.php index 52c3e938798..252769abd0e 100644 --- a/htdocs/core/boxes/box_graph_ticket_by_severity.php +++ b/htdocs/core/boxes/box_graph_ticket_by_severity.php @@ -28,7 +28,7 @@ require_once DOL_DOCUMENT_ROOT."/core/boxes/modules_boxes.php"; /** * Class to manage the box */ -class box_ticket_by_severity extends ModeleBoxes +class box_graph_ticket_by_severity extends ModeleBoxes { public $boxcode = "box_ticket_by_severity"; @@ -45,6 +45,9 @@ class box_ticket_by_severity extends ModeleBoxes public $info_box_head = array(); public $info_box_contents = array(); + public $widgettype = 'graph'; + + /** * Constructor * @param DoliDB $db Database handler diff --git a/htdocs/core/boxes/modules_boxes.php b/htdocs/core/boxes/modules_boxes.php index 379a65b7a5d..b7b9d979174 100644 --- a/htdocs/core/boxes/modules_boxes.php +++ b/htdocs/core/boxes/modules_boxes.php @@ -109,6 +109,12 @@ class ModeleBoxes // Can't be abtract as it is instantiated to build "empty" box */ public $note; + /** + * @var string Widget type ('graph' means the widget is a graph widget) + */ + public $widgettype = ''; + + /** * Constructor * diff --git a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php index e356792ed42..23809eb6a33 100644 --- a/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php +++ b/htdocs/modulebuilder/template/core/boxes/mymodulewidget1.php @@ -77,6 +77,12 @@ class mymodulewidget1 extends ModeleBoxes */ public $info_box_contents = array(); + /** + * @var string Widget type ('graph' means the widget is a graph widget) + */ + public $widgettype = 'graph'; + + /** * Constructor * From 2ff2640c8da4737beb399d2a39230ed4c7452d34 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Mar 2021 17:16:49 +0100 Subject: [PATCH 21/37] Update card.php --- htdocs/salaries/card.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 53f46320073..9638c2ff019 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -712,9 +712,9 @@ if ($id) { print '';*/ if ($action == 'edit') { - print '' . $langs->trans("Amount") . ''; + print '' . $langs->trans("Amount") . ''; } else { - print '' . $langs->trans("Amount") . '' . price($object->amount) . ''; + print '' . $langs->trans("Amount") . '' . price($object->amount, 0, $outputlangs, 1, -1, -1, $conf->currency) . ''; } // Mode of payment From 46d835b2bdb19c49052198f83233a6d2a30ed366 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Mar 2021 17:25:26 +0100 Subject: [PATCH 22/37] Fix css --- htdocs/salaries/card.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/salaries/card.php b/htdocs/salaries/card.php index 9638c2ff019..72d7d4838c0 100755 --- a/htdocs/salaries/card.php +++ b/htdocs/salaries/card.php @@ -432,7 +432,7 @@ if ($action == 'create') { print ''; // Employee - print ''; // Project @@ -472,7 +472,7 @@ if ($action == 'create') { } // Comments - print ''; + print ''; print ''; print ''; print ''; From e015f66936d47f1eee1791887777ec98acaff62d Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Mar 2021 17:31:33 +0100 Subject: [PATCH 23/37] Fix filter on employee --- htdocs/salaries/class/salariesstats.class.php | 17 ++++++++--------- htdocs/salaries/stats/index.php | 10 ++++++---- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/htdocs/salaries/class/salariesstats.class.php b/htdocs/salaries/class/salariesstats.class.php index 7d7f9a7b5f2..123dc044a4a 100644 --- a/htdocs/salaries/class/salariesstats.class.php +++ b/htdocs/salaries/class/salariesstats.class.php @@ -62,8 +62,8 @@ class SalariesStats extends Stats $this->from = MAIN_DB_PREFIX.$object->table_element; $this->field = 'amount'; - $this->where .= " entity = ".$conf->entity; - if ($this->socid) { + $this->where = " entity = ".$conf->entity; + if ($this->socid > 0) { $this->where .= " AND fk_soc = ".$this->socid; } if (is_array($this->userid) && count($this->userid) > 0) { @@ -83,8 +83,8 @@ class SalariesStats extends Stats { $sql = "SELECT YEAR(datep) as dm, count(*)"; $sql .= " FROM ".$this->from; + $sql .= " WHERE ".$this->where; $sql .= " GROUP BY dm DESC"; - //$sql .= " WHERE ".$this->where; return $this->_getNbByYear($sql); } @@ -102,12 +102,12 @@ class SalariesStats extends Stats $sql = "SELECT MONTH(datep) as dm, count(*)"; $sql .= " FROM ".$this->from; $sql .= " WHERE YEAR(datep) = ".$year; - //$sql .= " AND ".$this->where; + $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); $res = $this->_getNbByMonth($year, $sql, $format); - //var_dump($res);print '
'; + return $res; } @@ -124,12 +124,11 @@ class SalariesStats extends Stats $sql = "SELECT date_format(datep,'%m') as dm, sum(".$this->field.")"; $sql .= " FROM ".$this->from; $sql .= " WHERE date_format(datep,'%Y') = '".$this->db->escape($year)."'"; - //$sql .= " AND ".$this->where; + $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); $res = $this->_getAmountByMonth($year, $sql, $format); - //var_dump($res);print '
'; return $res; } @@ -145,7 +144,7 @@ class SalariesStats extends Stats $sql = "SELECT date_format(datep,'%m') as dm, avg(".$this->field.")"; $sql .= " FROM ".$this->from; $sql .= " WHERE date_format(datep,'%Y') = '".$this->db->escape($year)."'"; - //$sql .= " AND ".$this->where; + $sql .= " AND ".$this->where; $sql .= " GROUP BY dm"; $sql .= $this->db->order('dm', 'DESC'); @@ -161,7 +160,7 @@ class SalariesStats extends Stats { $sql = "SELECT date_format(datep,'%Y') as year, count(*) as nb, sum(".$this->field.") as total, avg(".$this->field.") as avg"; $sql .= " FROM ".$this->from; - //$sql .= " WHERE ".$this->where; + $sql .= " WHERE ".$this->where; $sql .= " GROUP BY year"; $sql .= $this->db->order('year', 'DESC'); diff --git a/htdocs/salaries/stats/index.php b/htdocs/salaries/stats/index.php index ac746a215e3..1fe914d38c2 100644 --- a/htdocs/salaries/stats/index.php +++ b/htdocs/salaries/stats/index.php @@ -33,10 +33,12 @@ $langs->loadLangs(array("salaries", "companies", "bills")); $WIDTH = DolGraph::getDefaultGraphSizeForStats('width'); $HEIGHT = DolGraph::getDefaultGraphSizeForStats('height'); -$userid = GETPOST('userid', 'int'); if ($userid < 0) { +$userid = GETPOST('userid', 'int'); +if ($userid < 0) { $userid = 0; } -$socid = GETPOST('socid', 'int'); if ($socid < 0) { +$socid = GETPOST('socid', 'int'); +if ($socid < 0) { $socid = 0; } $id = GETPOST('id', 'int'); @@ -201,8 +203,8 @@ print ''; print '
'; + print '
'; print $form->editfieldkey('Employee', 'fk_user', '', $object, 0, 'string', '', 1).''; $noactive = 0; // We keep active and unactive users print img_picto('', 'user', 'class="paddingrighonly"').$form->select_dolusers(GETPOST('fk_user', 'int'), 'fk_user', 1, '', 0, '', '', 0, 0, 0, 'AND employee=1', 0, '', 'maxwidth300', $noactive); @@ -459,7 +459,7 @@ if ($action == 'create') { // Amount print '
'; print $form->editfieldkey('Amount', 'amount', '', $object, 0, 'string', '', 1).''; - print ''; + print ''; print '
'.$langs->trans("Comments").'
'; print ''; // User -print ''; // Year print ''; print ''; // Accountancy_code_buy_intra From 135932633711c43f11fa3a9839f1042b3e7d3e8b Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Thu, 11 Mar 2021 04:01:43 +0100 Subject: [PATCH 26/37] Update card.php --- htdocs/societe/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 757b168e0cf..22f8f843c13 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -64,7 +64,7 @@ $backtopage = GETPOST('backtopage', 'alpha'); $confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); -if ($user->socid && empty($conf->global->MAIN_SHOW_SOCIETE2EXTERN)) $socid = $user->socid; +if ($user->socid && empty($conf->global->MAIN_EXTERNAL_USERS_CAN_SEE_SUBSIDIARY_COMPANIES)) $socid = $user->socid; if (empty($socid) && $action == 'view') $action = 'create'; $object = new Societe($db); From 0158cbb89327253229e53c30ae3186f2a27509cf Mon Sep 17 00:00:00 2001 From: Bahfir Abbes Date: Thu, 11 Mar 2021 04:02:30 +0100 Subject: [PATCH 27/37] Update security.lib.php --- htdocs/core/lib/security.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index f2714dc9fb2..7062e3cc2ab 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -493,7 +493,7 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand } elseif (in_array($feature, $checksoc)) // We check feature = checksoc { // If external user: Check permission for external users - if ($user->socid > 0 && empty($conf->global->MAIN_SHOW_SOCIETE2EXTERN)) + if ($user->socid > 0 && empty($conf->global->MAIN_EXTERNAL_USERS_CAN_SEE_SUBSIDIARY_COMPANIES)) { if ($user->socid <> $objectid) return false; } // If internal user: Check permission for internal users that are restricted on their objects From 1b242a8a1956543ded24ba1da274350b0fba5cfe Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 11 Mar 2021 09:43:56 +0100 Subject: [PATCH 28/37] Fix #16615 : Adherent statistics color --- htdocs/adherents/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/adherents/index.php b/htdocs/adherents/index.php index 7a6b0d7b7d1..7ec39b7eda8 100644 --- a/htdocs/adherents/index.php +++ b/htdocs/adherents/index.php @@ -219,7 +219,7 @@ if ($conf->use_javascript_ajax) { $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusResiliated"), round($SommeD)); $dataseries[] = array($langs->transnoentitiesnoconv("MembersStatusToValid"), round($SommeA)); - include_once DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; + include DOL_DOCUMENT_ROOT.'/theme/'.$conf->theme.'/theme_vars.inc.php'; include_once DOL_DOCUMENT_ROOT.'/core/class/dolgraph.class.php'; $dolgraph = new DolGraph(); From 9aa20585be4b23781eeab5eace74f1bc723cad65 Mon Sep 17 00:00:00 2001 From: lmarcouiller Date: Thu, 11 Mar 2021 10:10:20 +0100 Subject: [PATCH 29/37] Fix #16617 : fix event add when removing boxes --- htdocs/core/class/html.formother.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.formother.class.php b/htdocs/core/class/html.formother.class.php index 127bfd2fd50..ed986cadbb3 100644 --- a/htdocs/core/class/html.formother.class.php +++ b/htdocs/core/class/html.formother.class.php @@ -1150,7 +1150,7 @@ class FormOther if (boxorder==\'A:A-B:B\' && closing == 1) // There is no more boxes on screen, and we are after a delete of a box so we must hide title { jQuery.ajax({ - url: \''.DOL_URL_ROOT.'/core/ajax/box.php?closing=0&boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.', + url: \''.DOL_URL_ROOT.'/core/ajax/box.php?closing=1&boxorder=\'+boxorder+\'&zone='.$areacode.'&userid=\'+'.$user->id.', async: false }); // We force reload to be sure to get all boxes into list From 245453f3c6565c8274263579e4371dbf6b4fdd58 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Mar 2021 12:47:55 +0100 Subject: [PATCH 30/37] Add ignore --- htdocs/conf/.gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/conf/.gitignore b/htdocs/conf/.gitignore index ed21fdfaa4c..8d06ea77328 100644 --- a/htdocs/conf/.gitignore +++ b/htdocs/conf/.gitignore @@ -5,3 +5,4 @@ /conf.php.pgsql /conf.php.sqlite /conf.php.utf8 +/conf.php.nov* From 26cb59e2f93f0962b1a885ca07a191460d0efabd Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Mar 2021 14:10:08 +0100 Subject: [PATCH 31/37] Enhance regeneration of pages --- htdocs/website/index.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 508a871de68..8f0a107fdc4 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2060,6 +2060,19 @@ if ($action == 'exportsite') { // Regenerate site if ($action == 'regeneratesite') { + // Check symlink to medias and restore it if ko. Recreate also dir of website if not found. + $pathtomedias = DOL_DATA_ROOT.'/medias'; + $pathtomediasinwebsite = $pathofwebsite.'/medias'; + if (!is_link(dol_osencode($pathtomediasinwebsite))) { + dol_syslog("Create symlink for ".$pathtomedias." into name ".$pathtomediasinwebsite); + dol_mkdir(dirname($pathtomediasinwebsite)); // To be sure dir for website exists + $result = symlink($pathtomedias, $pathtomediasinwebsite); + if (!$result) { + setEventMessages($langs->trans("ErrorFieldToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors'); + $action = 'importsite'; + } + } + $result = $object->rebuildWebSiteFiles(); if ($result > 0) { setEventMessages($langs->trans("PagesRegenerated", $result), null, 'mesgs'); @@ -2077,7 +2090,7 @@ if ($action == 'importsiteconfirm') { $action = 'importsite'; } else { if (!empty($_FILES) || GETPOSTISSET('templateuserfile')) { - // Check symlink to medias and restore it if ko + // Check symlink to medias and restore it if ko. Recreate also dir of website if not found. $pathtomedias = DOL_DATA_ROOT.'/medias'; $pathtomediasinwebsite = $pathofwebsite.'/medias'; if (!is_link(dol_osencode($pathtomediasinwebsite))) { From 5e75da331924d18d9816eb7a72755c1dd08e4b08 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Mar 2021 14:10:50 +0100 Subject: [PATCH 32/37] Fix return page if error --- htdocs/website/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/website/index.php b/htdocs/website/index.php index 8f0a107fdc4..03cd9366aba 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -2069,7 +2069,7 @@ if ($action == 'regeneratesite') { $result = symlink($pathtomedias, $pathtomediasinwebsite); if (!$result) { setEventMessages($langs->trans("ErrorFieldToCreateSymLinkToMedias", $pathtomediasinwebsite, $pathtomedias), null, 'errors'); - $action = 'importsite'; + $action = 'preview'; } } From 345fe648b3cc11c296c6a44810e7cfba78e2c33d Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Thu, 11 Mar 2021 15:37:27 +0000 Subject: [PATCH 33/37] Fixing style errors. --- htdocs/core/lib/security.lib.php | 6 +++--- htdocs/societe/card.php | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/core/lib/security.lib.php b/htdocs/core/lib/security.lib.php index 00c2d8ee99b..c8c2c5cdc2b 100644 --- a/htdocs/core/lib/security.lib.php +++ b/htdocs/core/lib/security.lib.php @@ -623,10 +623,10 @@ function checkUserAccessToObject($user, $featuresarray, $objectid = 0, $tableand // If external user: Check permission for external users if ($user->socid > 0 && empty($conf->global->MAIN_EXTERNAL_USERS_CAN_SEE_SUBSIDIARY_COMPANIES)) { if ($user->socid <> $objectid) { - return false; - } + return false; + } } elseif (!empty($conf->societe->enabled) && ($user->rights->societe->lire && !$user->rights->societe->client->voir)) { - // If internal user: Check permission for internal users that are restricted on their objects + // If internal user: Check permission for internal users that are restricted on their objects $sql = "SELECT COUNT(sc.fk_soc) as nb"; $sql .= " FROM (".MAIN_DB_PREFIX."societe_commerciaux as sc"; $sql .= ", ".MAIN_DB_PREFIX."societe as s)"; diff --git a/htdocs/societe/card.php b/htdocs/societe/card.php index 220576bd927..d69a602c900 100644 --- a/htdocs/societe/card.php +++ b/htdocs/societe/card.php @@ -81,10 +81,10 @@ $confirm = GETPOST('confirm', 'alpha'); $socid = GETPOST('socid', 'int') ?GETPOST('socid', 'int') : GETPOST('id', 'int'); if ($user->socid && empty($conf->global->MAIN_EXTERNAL_USERS_CAN_SEE_SUBSIDIARY_COMPANIES)) { - $socid = $user->socid; + $socid = $user->socid; } if (empty($socid) && $action == 'view') { - $action = 'create'; + $action = 'create'; } $object = new Societe($db); From 674224163992911d7962b00cd198bfe9200704f8 Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Thu, 11 Mar 2021 16:55:49 +0100 Subject: [PATCH 34/37] better tranaction and condition --- ...ntOrganization_EventOrganization.class.php | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php index c5d978c7534..63b038196fa 100644 --- a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php +++ b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php @@ -80,7 +80,7 @@ class InterfaceEventOrganization extends DolibarrTriggers // Load translation files required by the page $langs->loadLangs(array("eventorganization")); - if (!empty($conf->global->EVENTORGANIZATION_TASK_LABEL)) { + if (!empty($conf->global->EVENTORGANIZATION_TASK_LABEL) && !empty($object->usage_organize_event)) { $taskToDo = explode("\n", $conf->global->EVENTORGANIZATION_TASK_LABEL); if (is_array($taskToDo) && count($taskToDo)>0) { $this->db->begin(); @@ -107,17 +107,18 @@ class InterfaceEventOrganization extends DolibarrTriggers $error++; } } + + if (empty($error)) { + $this->db->commit(); + return 1; + } else { + dol_syslog("InterfaceEventOrganization.class.php: ".implode(',', $this->errors), LOG_ERR); + $this->db->rollback(); + return -1; + } } } - - if (empty($error)) { - $this->db->commit(); - return 1; - } else { - dol_syslog("InterfaceEventOrganization.class.php: ".implode(',', $this->errors), LOG_ERR); - $this->db->rollback(); - return -1; - } } + return 0; } } From e8bbef8d2df154afc6cfc6adbea175b7116a69d9 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Mar 2021 21:35:22 +0100 Subject: [PATCH 35/37] Update interface_50_modEventOrganization_EventOrganization.class.php --- ...ce_50_modEventOrganization_EventOrganization.class.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php index 63b038196fa..386a723bb5e 100644 --- a/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php +++ b/htdocs/core/triggers/interface_50_modEventOrganization_EventOrganization.class.php @@ -74,15 +74,17 @@ class InterfaceEventOrganization extends DolibarrTriggers if (empty($conf->eventorganization->enabled)) { return 0; // Module not active, we do nothing } + $error=0; + // Actions if ($action == 'PROJECT_VALIDATE') { - // Load translation files required by the page - $langs->loadLangs(array("eventorganization")); - if (!empty($conf->global->EVENTORGANIZATION_TASK_LABEL) && !empty($object->usage_organize_event)) { $taskToDo = explode("\n", $conf->global->EVENTORGANIZATION_TASK_LABEL); if (is_array($taskToDo) && count($taskToDo)>0) { + // Load translation files required by the page + $langs->loadLangs(array("eventorganization")); + $this->db->begin(); foreach ($taskToDo as $taskLabel) { $task = new Task($this->db); From f9918dd51fbb6fa8abb6b8468a57d182a3de148c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Mar 2021 11:50:48 +0100 Subject: [PATCH 36/37] Code comment --- htdocs/core/modules/modProductBatch.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modProductBatch.class.php b/htdocs/core/modules/modProductBatch.class.php index 781948d0f52..3da2523ad40 100644 --- a/htdocs/core/modules/modProductBatch.class.php +++ b/htdocs/core/modules/modProductBatch.class.php @@ -64,7 +64,7 @@ class modProductBatch extends DolibarrModules // Data directories to create when module is enabled. $this->dirs = array(); - // Config pages. Put here list of php page, stored into productdluo/admin directory, to use to setup module. + // Config pages. Put here list of php page, stored into /product/admin/ directory, to setup the module. $this->config_page_url = array("product_lot_extrafields.php@product"); // Dependencies From a79c9a9019d8b7e76bc24cbf6c1466870b14af67 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Fri, 12 Mar 2021 12:07:38 +0100 Subject: [PATCH 37/37] Fix help of an option --- htdocs/langs/bs_BA/admin.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/bs_BA/admin.lang b/htdocs/langs/bs_BA/admin.lang index 8edb636b439..268bcdc7337 100644 --- a/htdocs/langs/bs_BA/admin.lang +++ b/htdocs/langs/bs_BA/admin.lang @@ -1367,7 +1367,7 @@ BillsNumberingModule=Invoices and credit notes numbering model BillsPDFModules=Invoice documents models BillsPDFModulesAccordindToInvoiceType=Invoice documents models according to invoice type PaymentsPDFModules=Payment documents models -ForceInvoiceDate=Force invoice date to validation date +ForceInvoiceDate=Force invoice date to validation date (forcing is possible only the first time an invoice is validated) SuggestedPaymentModesIfNotDefinedInInvoice=Suggested payments mode on invoice by default if not defined on the invoice SuggestPaymentByRIBOnAccount=Suggest payment by withdrawal on account SuggestPaymentByChequeToAddress=Suggest payment by check to
'.$langs->trans("Filter").'
'.$langs->trans("User").''; -print $form->select_dolusers($userid, 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); +print '
'.$langs->trans("Employee").''; +print $form->select_dolusers(($userid ? $userid : -1), 'userid', 1, '', 0, '', '', 0, 0, 0, '', 0, '', 'maxwidth300'); print '
'.$langs->trans("Year").''; From 8bdc80918b1be70508b02ee7c208a3af477b7511 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Mar 2021 18:57:24 +0100 Subject: [PATCH 24/37] trans --- htdocs/langs/en_US/categories.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/categories.lang b/htdocs/langs/en_US/categories.lang index 4ddf0d6093f..5ec33145da1 100644 --- a/htdocs/langs/en_US/categories.lang +++ b/htdocs/langs/en_US/categories.lang @@ -14,7 +14,7 @@ SuppliersCategoriesArea=Vendors tags/categories area CustomersCategoriesArea=Customers tags/categories area MembersCategoriesArea=Members tags/categories area ContactsCategoriesArea=Contacts tags/categories area -AccountsCategoriesArea=Accounts tags/categories area +AccountsCategoriesArea=Bank accounts tags/categories area ProjectsCategoriesArea=Projects tags/categories area UsersCategoriesArea=Users tags/categories area SubCats=Sub-categories From 3007141b2b43ef68933528d0bf7d7bba97c281ba Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 10 Mar 2021 20:40:34 +0100 Subject: [PATCH 25/37] Fix phpcs --- .../supplier_order/doc/pdf_cornas.modules.php | 6 ++---- htdocs/product/card.php | 12 ++++++------ 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php index 8f7ed11ba16..fc5cbd1027e 100644 --- a/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php +++ b/htdocs/core/modules/supplier_order/doc/pdf_cornas.modules.php @@ -1557,8 +1557,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders 'border-left' => true, // add left line separator ); - if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE)) - { + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_UNIT_PRICE)) { $this->cols['subprice']['status'] = true; } @@ -1612,8 +1611,7 @@ class pdf_cornas extends ModelePDFSuppliersOrders 'border-left' => true, // add left line separator ); - if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) - { + if (empty($conf->global->MAIN_GENERATE_DOCUMENTS_PURCHASE_ORDER_WITHOUT_TOTAL_COLUMN)) { $this->cols['totalexcltax']['status'] = true; } diff --git a/htdocs/product/card.php b/htdocs/product/card.php index 1a3967f2de7..1ab642dab83 100644 --- a/htdocs/product/card.php +++ b/htdocs/product/card.php @@ -1363,12 +1363,12 @@ if (is_object($objcanvas) && $objcanvas->displayCanvasExists($action)) { // Accountancy_code_buy print '
'.$langs->trans("ProductAccountancyBuyCode").''; - if ($type == 0) { - $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT); - } else { - $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT); - } - print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1); + if ($type == 0) { + $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_PRODUCT_BUY_ACCOUNT); + } else { + $accountancy_code_buy = (GETPOST('accountancy_code_buy', 'alpha') ? (GETPOST('accountancy_code_buy', 'alpha')) : $conf->global->ACCOUNTING_SERVICE_BUY_ACCOUNT); + } + print $formaccounting->select_account($accountancy_code_buy, 'accountancy_code_buy', 1, null, 1, 1, 'minwidth100 maxwidth300 maxwidthonsmartphone', 1); print '