'."\n";
diff --git a/htdocs/core/class/html.formfile.class.php b/htdocs/core/class/html.formfile.class.php
index 217bba55330..56d9ca95842 100644
--- a/htdocs/core/class/html.formfile.class.php
+++ b/htdocs/core/class/html.formfile.class.php
@@ -360,8 +360,8 @@ class FormFile
* This also set the property $this->numoffiles
*
* @param string $modulepart Module the files are related to ('propal', 'facture', 'facture_fourn', 'mymodule', 'mymodule:MyObject', 'mymodule_temp', ...)
- * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into subdir of module.
- * @param string $filedir Directory to scan
+ * @param string $modulesubdir Existing (so sanitized) sub-directory to scan (Example: '0/1/10', 'FA/DD/MM/YY/9999'). Use '' if file is not into a subdir of module.
+ * @param string $filedir Directory to scan (must not end with a /). Example: '/mydolibarrdocuments/facture/FAYYMM-1234'
* @param string $urlsource Url of origin page (for return)
* @param int|string[] $genallowed Generation is allowed (1/0 or array list of templates)
* @param int $delallowed Remove is allowed (1/0)
diff --git a/htdocs/core/modules/cheque/modules_chequereceipts.php b/htdocs/core/modules/cheque/modules_chequereceipts.php
index dfdf0fbe363..e50a6877848 100644
--- a/htdocs/core/modules/cheque/modules_chequereceipts.php
+++ b/htdocs/core/modules/cheque/modules_chequereceipts.php
@@ -126,8 +126,7 @@ abstract class ModeleNumRefChequeReceipts
}
/**
- * \class ModeleChequeReceipts
- * \brief Classe mere des modeles de
+ * Class parent for templates of document generation
*/
abstract class ModeleChequeReceipts extends CommonDocGenerator
{
diff --git a/htdocs/core/tpl/massactions_pre.tpl.php b/htdocs/core/tpl/massactions_pre.tpl.php
index b3a40ba3582..de034f652d3 100644
--- a/htdocs/core/tpl/massactions_pre.tpl.php
+++ b/htdocs/core/tpl/massactions_pre.tpl.php
@@ -212,14 +212,14 @@ if ($massaction == 'presend') {
}
if ($massaction == 'preenable') {
- print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassEnabling"), $langs->trans("ConfirmMassEnablingQuestion", count($toselect)), "enable", null, '', 0, 200, 500, 1);
+ print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassEnabling"), $langs->trans("ConfirmMassEnablingQuestion", count($toselect)), "enable", null, 'yes', 0, 200, 500, 1);
}
if ($massaction == 'predisable') {
print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassDisabling"), $langs->trans("ConfirmMassDisablingQuestion", count($toselect)), "disable", null, '', 0, 200, 500, 1);
}
if ($massaction == 'preapproveleave') {
- print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassLeaveApproval"), $langs->trans("ConfirmMassLeaveApprovalQuestion", count($toselect)), "approveleave", null, '', 0, 200, 500, 1);
+ print $form->formconfirm($_SERVER["PHP_SELF"], $langs->trans("ConfirmMassLeaveApproval"), $langs->trans("ConfirmMassLeaveApprovalQuestion", count($toselect)), "approveleave", null, 'yes', 0, 200, 500, 1);
}
// Allow Pre-Mass-Action hook (eg for confirmation dialog)
diff --git a/htdocs/ecm/class/ecmfiles.class.php b/htdocs/ecm/class/ecmfiles.class.php
index 2f9bf4c41e5..3c5ef15875f 100644
--- a/htdocs/ecm/class/ecmfiles.class.php
+++ b/htdocs/ecm/class/ecmfiles.class.php
@@ -327,7 +327,11 @@ class EcmFiles extends CommonObject
$resql = $this->db->query($sql);
if (!$resql) {
$error++;
- $this->errors[] = 'Error '.$this->db->lasterror();
+ if ($this->db->lasterrno() == 'DB_ERROR_RECORD_ALREADY_EXISTS') {
+ $this->errors[] = 'Error DB_ERROR_RECORD_ALREADY_EXISTS : '.$this->db->lasterror();
+ } else {
+ $this->errors[] = 'Error '.$this->db->lasterror();
+ }
dol_syslog(__METHOD__.' '.implode(',', $this->errors), LOG_ERR);
}
diff --git a/htdocs/fourn/class/fournisseur.facture.class.php b/htdocs/fourn/class/fournisseur.facture.class.php
index 922d9f25e29..ce101573677 100644
--- a/htdocs/fourn/class/fournisseur.facture.class.php
+++ b/htdocs/fourn/class/fournisseur.facture.class.php
@@ -12,7 +12,7 @@
* Copyright (C) 2015-2019 Ferran Marcet
* Copyright (C) 2016-2021 Alexandre Spangaro
* Copyright (C) 2018 Nicolas ZABOURI
- * Copyright (C) 2018-2020 Frédéric France
+ * Copyright (C) 2018-2022 Frédéric France
*
* 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
@@ -245,7 +245,7 @@ class FactureFournisseur extends CommonInvoice
public $multicurrency_total_ht;
public $multicurrency_total_tva;
public $multicurrency_total_ttc;
- //! id of source var_dump($$this);invoice if replacement invoice or credit note
+ //! id of source invoice if replacement invoice or credit note
/**
* @var int ID
*/
diff --git a/htdocs/holiday/card.php b/htdocs/holiday/card.php
index d8643c0783b..a9bfe8ab4f2 100644
--- a/htdocs/holiday/card.php
+++ b/htdocs/holiday/card.php
@@ -1083,7 +1083,9 @@ if ((empty($id) && empty($ref)) || $action == 'create' || $action == 'add') {
if (empty($include_users)) {
print img_warning().' '.$langs->trans("NobodyHasPermissionToValidateHolidays");
} else {
- $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator); // Will work only if supervisor has permission to approve so is inside include_users
+ // Defined default approver (the forced approved of user or the supervisor if no forced value defined)
+ // Note: This use will be set only if the deinfed approvr has permission to approve so is inside include_users
+ $defaultselectuser = (empty($user->fk_user_holiday_validator) ? $user->fk_user : $user->fk_user_holiday_validator);
if (!empty($conf->global->HOLIDAY_DEFAULT_VALIDATOR)) {
$defaultselectuser = $conf->global->HOLIDAY_DEFAULT_VALIDATOR; // Can force default approver
}
diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang
index 7ab5d41f285..86d11ec59ea 100644
--- a/htdocs/langs/en_US/errors.lang
+++ b/htdocs/langs/en_US/errors.lang
@@ -278,6 +278,7 @@ ErrorIsNotADraft=%s is not a draft
ErrorExecIdFailed=Can't execute command "id"
ErrorBadCharIntoLoginName=Unauthorized character in the login name
ErrorRequestTooLarge=Error, request too large
+ErrorNotApproverForHoliday=You are not the approver for leave %s
# Warnings
WarningParamUploadMaxFileSizeHigherThanPostMaxSize=Your PHP parameter upload_max_filesize (%s) is higher than PHP parameter post_max_size (%s). This is not a consistent setup.
diff --git a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
index 13e34593bba..02eb1c18fb6 100644
--- a/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
+++ b/htdocs/modulebuilder/template/core/modules/modMyModule.class.php
@@ -432,7 +432,7 @@ class modMyModule extends DolibarrModules
$sql = array();
// Document templates
- $moduledir = 'mymodule';
+ $moduledir = dol_sanitizeFileName('mymodule');
$myTmpObjects = array();
$myTmpObjects['MyObject'] = array('includerefgeneration'=>0, 'includedocgeneration'=>0);
@@ -441,8 +441,8 @@ class modMyModule extends DolibarrModules
continue;
}
if ($myTmpObjectArray['includerefgeneration']) {
- $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/mymodule/template_myobjects.odt';
- $dirodt = DOL_DATA_ROOT.'/doctemplates/mymodule';
+ $src = DOL_DOCUMENT_ROOT.'/install/doctemplates/'.$moduledir.'/template_myobjects.odt';
+ $dirodt = DOL_DATA_ROOT.'/doctemplates/'.$moduledir;
$dest = $dirodt.'/template_myobjects.odt';
if (file_exists($src) && !file_exists($dest)) {