diff --git a/README.md b/README.md index 3c2b2e0ac43..1161233ac3b 100644 --- a/README.md +++ b/README.md @@ -99,6 +99,7 @@ Follow these step-by-step instructions to seamlessly upgrade Dolibarr to the lat See the [ChangeLog](https://github.com/Dolibarr/dolibarr/blob/develop/ChangeLog) file. +Adding new templates must be done by adding files into a module directory. Adding files into custom with same path of the core without having using a module is now forbidden ## FEATURES diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 12bbbd3dab7..01abaaf22c9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -1569,6 +1569,9 @@ function dol_buildpath($path, $type = 0, $returnemptyifnotfound = 0) } // if (@file_exists($dirroot.'/'.$path)) { if (@file_exists($dirroot . '/' . $path)) { // avoid [php:warn] + if ($key != 'main' && preg_match('/^core\//', $path)) { // When searching into an alternative custom path, we don't want path like 'core/...' because path should be 'modulename/core/...' + continue; + } $res = $dirroot . '/' . $path; return $res; }