From cbdf4d355912dc86a8d3a2bec110c496385761bc Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 7 Sep 2024 02:13:53 +0200 Subject: [PATCH] Fix upload of module zip files --- htdocs/admin/modules.php | 4 ++-- htdocs/core/actions_massactions.inc.php | 2 +- htdocs/langs/en_US/errors.lang | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index dd9909163a6..e7d444e8558 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -177,9 +177,9 @@ if ($action == 'install' && $allowonlineinstall) { setEventMessages($langs->trans("ErrorFileMustBeADolibarrPackage", $original_file), null, 'errors'); $error++; } - if (!$error && !preg_match('/^(module[a-zA-Z0-9]*|theme)_.*\-([0-9][0-9\.]*)\.zip$/i', $original_file)) { + if (!$error && !preg_match('/^(module[a-zA-Z0-9]*_|theme_|).*\-([0-9][0-9\.]*)(\s\(\d+\)\s)?\.zip$/i', $original_file)) { $langs->load("errors"); - setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file, 'module_*-x.y*.zip'), null, 'errors'); + setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules", $original_file, 'modulename-x[.y.z].zip'), null, 'errors'); $error++; } if (empty($_FILES['fileinstall']['tmp_name'])) { diff --git a/htdocs/core/actions_massactions.inc.php b/htdocs/core/actions_massactions.inc.php index 116d39b1258..7c2c2bdcc1a 100644 --- a/htdocs/core/actions_massactions.inc.php +++ b/htdocs/core/actions_massactions.inc.php @@ -1842,7 +1842,7 @@ if (!$error && ($massaction == 'clonetasks' || ($action == 'clonetasks' && $conf exit(); } } else { - setEventMessages($langs->trans('ErrorNotEnougthPermission'), null, 'errors'); + setEventMessages($langs->trans('NotEnoughPermissions'), null, 'errors'); } } diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index e83bc83143e..b0947e8291d 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -222,7 +222,7 @@ ErrorUserNotAssignedToTask=User must be assigned to task to be able to enter tim ErrorTaskAlreadyAssigned=Task already assigned to user ErrorModuleFileSeemsToHaveAWrongFormat=The module package seems to have a wrong format. ErrorModuleFileSeemsToHaveAWrongFormat2=At least one mandatory directory must exists into zip of module: %s or %s -ErrorFilenameDosNotMatchDolibarrPackageRules=The name of the module package (%s) does not match expected name syntax: %s +ErrorFilenameDosNotMatchDolibarrPackageRules=The file name of the module package (%s) does not match the expected name syntax: %s ErrorDuplicateTrigger=Error, duplicate trigger name %s. Already loaded from %s. ErrorNoWarehouseDefined=Error, no warehouses defined. ErrorBadLinkSourceSetButBadValueForRef=The link you use is not valid. A 'source' for payment is defined, but value for 'ref' is not valid.