From 2556543ec829b0d611248e23c6f39ef16258e390 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Fri, 5 Dec 2025 17:59:26 +0100 Subject: [PATCH 01/32] add missing hooks --- htdocs/public/webportal/css/themes/custom.css.php | 12 ++++++++++++ htdocs/public/webportal/tpl/header.tpl.php | 8 +++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/public/webportal/css/themes/custom.css.php b/htdocs/public/webportal/css/themes/custom.css.php index bec2de3b4c3..cb30f91bf21 100644 --- a/htdocs/public/webportal/css/themes/custom.css.php +++ b/htdocs/public/webportal/css/themes/custom.css.php @@ -48,6 +48,13 @@ session_cache_limiter('public'); require_once __DIR__.'/../../webportal.main.inc.php'; dol_include_once('/webportal/class/webPortalTheme.class.php'); +/** + * @var Conf $conf + * @var HookManager $hookmanager + * @var Translate $langs + * @var Context $context + */ + // Define css type top_httphead('text/css'); /* @@ -85,5 +92,10 @@ $webPortalTheme = new WebPortalTheme(); } initHooks(array('webPortalCustomCss')); +$parameters = array(); +$hookmanager->executeHooks('webPortalCustomCss', $parameters, $webPortalTheme); +print $hookmanager->resPrint; + print '/* Here, the content of the common custom CSS defined into Home - Setup - Display - CSS */'."\n"; print getDolGlobalString('WEBPORTAL_CUSTOM_CSS'); diff --git a/htdocs/public/webportal/tpl/header.tpl.php b/htdocs/public/webportal/tpl/header.tpl.php index cd13ea7d3ce..b930080616f 100644 --- a/htdocs/public/webportal/tpl/header.tpl.php +++ b/htdocs/public/webportal/tpl/header.tpl.php @@ -18,6 +18,7 @@ /** * @var Context $context Object context for webportal + * @var HookManager $hookmanager * @var Translate $langs * @@var string[] $vars['body-class'] more CSS classes for body * @@var string[] $vars['body-theme'] theme css to apply default is custom @@ -97,8 +98,13 @@ top_httphead(); $bodyAttributes['class'] = $vars['body-class']; } - $bodyCompiledAttributes = commonHtmlAttributeBuilder($bodyAttributes); + $parameters = array( + 'bodyAttributes' => &$bodyAttributes + ); + $hookmanager->executeHooks('webPortalHeader', $parameters, $context); + print $hookmanager->resPrint; + $bodyCompiledAttributes = commonHtmlAttributeBuilder($bodyAttributes); ?> > From 40a789f42e7fa0efcb9b8eedbfe014259f1f2b08 Mon Sep 17 00:00:00 2001 From: Pcauderlier Date: Tue, 9 Dec 2025 09:05:20 +0100 Subject: [PATCH 02/32] Fix: Use Societe->update() in ajaxstatusprospect.php to fire COMPANY_MODIFY trigger --- htdocs/core/ajax/ajaxstatusprospect.php | 28 ++++++++++++++++--------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/htdocs/core/ajax/ajaxstatusprospect.php b/htdocs/core/ajax/ajaxstatusprospect.php index cef9077144b..1b67f29f7f1 100644 --- a/htdocs/core/ajax/ajaxstatusprospect.php +++ b/htdocs/core/ajax/ajaxstatusprospect.php @@ -85,20 +85,28 @@ if ($action === "updatestatusprospect" && $permisstiontoupdate) { $prospectstatic->client = 2; $prospectstatic->loadCacheOfProspStatus(); - $response = ''; - $sql = "UPDATE ".MAIN_DB_PREFIX."societe SET "; - $sql .= "fk_stcomm = ".((int) $idstatus); - $sql .= " WHERE rowid = ".((int) $idprospect); + // Load thirdparty + $prospect = new Client($db); + $result = $prospect->fetch($idprospect); - $resql = $db->query($sql); + if ($result >= 0) { + $oldStatus = $prospect->fk_stcomm; - if (!$resql) { - dol_print_error($db); + // Apply new status + $prospect->fk_stcomm = $idstatus; + + // Update using business logic (fires COMPANY_MODIFY) + $updateResult = $prospect->update($prospect->id, $user); + + if ($updateResult >= 0) { + $response = img_action('', $prospectstatic->cacheprospectstatus[$idstatus]['code'], $prospectstatic->cacheprospectstatus[$idstatus]['picto'], 'class="inline-block valignmiddle paddingright pictoprospectstatus"'); + } else { + dol_syslog(__METHOD__.': Failed to update prospect via update() method', LOG_ERR); + dol_print_error($db); + } } else { - $num = $db->affected_rows($resql); - $response = img_action('', $prospectstatic->cacheprospectstatus[$idstatus]['code'], $prospectstatic->cacheprospectstatus[$idstatus]['picto'], 'class="inline-block valignmiddle paddingright pictoprospectstatus"'); + dol_print_error($db); } - echo json_encode(array('img' => $response)); } From 4bb5a0cdf13005c35974d57c3491b8e8097c3df5 Mon Sep 17 00:00:00 2001 From: Pcauderlier Date: Tue, 9 Dec 2025 09:30:42 +0100 Subject: [PATCH 03/32] Fix: Correct implementation of update() call in ajaxstatusprospect.php --- htdocs/core/ajax/ajaxstatusprospect.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/core/ajax/ajaxstatusprospect.php b/htdocs/core/ajax/ajaxstatusprospect.php index 1b67f29f7f1..567cf17d8ad 100644 --- a/htdocs/core/ajax/ajaxstatusprospect.php +++ b/htdocs/core/ajax/ajaxstatusprospect.php @@ -87,14 +87,12 @@ if ($action === "updatestatusprospect" && $permisstiontoupdate) { // Load thirdparty - $prospect = new Client($db); + $prospect = new Societe($db); $result = $prospect->fetch($idprospect); if ($result >= 0) { - $oldStatus = $prospect->fk_stcomm; - // Apply new status - $prospect->fk_stcomm = $idstatus; + $prospect->stcomm_id = $idstatus; // Update using business logic (fires COMPANY_MODIFY) $updateResult = $prospect->update($prospect->id, $user); From 75bf0f7d1e4073f8804ec79de79f87cf2afd0ea6 Mon Sep 17 00:00:00 2001 From: Pcauderlier Date: Thu, 11 Dec 2025 09:02:15 +0100 Subject: [PATCH 04/32] FIX php-stan erros --- htdocs/core/ajax/ajaxstatusprospect.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/ajax/ajaxstatusprospect.php b/htdocs/core/ajax/ajaxstatusprospect.php index 567cf17d8ad..a7ac677db3f 100644 --- a/htdocs/core/ajax/ajaxstatusprospect.php +++ b/htdocs/core/ajax/ajaxstatusprospect.php @@ -85,6 +85,7 @@ if ($action === "updatestatusprospect" && $permisstiontoupdate) { $prospectstatic->client = 2; $prospectstatic->loadCacheOfProspStatus(); + $response = ""; // Load thirdparty $prospect = new Societe($db); @@ -100,7 +101,7 @@ if ($action === "updatestatusprospect" && $permisstiontoupdate) { if ($updateResult >= 0) { $response = img_action('', $prospectstatic->cacheprospectstatus[$idstatus]['code'], $prospectstatic->cacheprospectstatus[$idstatus]['picto'], 'class="inline-block valignmiddle paddingright pictoprospectstatus"'); } else { - dol_syslog(__METHOD__.': Failed to update prospect via update() method', LOG_ERR); + dol_syslog('Failed to update prospect via update() method', LOG_ERR); dol_print_error($db); } } else { From c2cc34f6303e583d015d59439a8f47fab5724284 Mon Sep 17 00:00:00 2001 From: Nicolas Domenech Date: Mon, 15 Dec 2025 16:44:51 +0100 Subject: [PATCH 05/32] Fix: Need to check strict on default value on create action In php7.4 we need to check strict because with default value 0 we have true on bool check instead of false in php8.0 > --- htdocs/core/actions_addupdatedelete.inc.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/actions_addupdatedelete.inc.php b/htdocs/core/actions_addupdatedelete.inc.php index 1b086b033ea..f07e0ae0a68 100644 --- a/htdocs/core/actions_addupdatedelete.inc.php +++ b/htdocs/core/actions_addupdatedelete.inc.php @@ -177,7 +177,7 @@ if ($action == 'add' && !empty($permissiontoadd)) { //var_dump($key.' '.$value.' '.$object->fields[$key]['type'].' '.$object->fields[$key]['notnull']); $object->$key = $value; - if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] == '(PROV)') { + if (!empty($val['notnull']) && $val['notnull'] > 0 && $object->$key == '' && isset($val['default']) && $val['default'] === '(PROV)') { $object->$key = '(PROV)'; } if ($key == 'pass_crypted') { From e80a9929c05569ea6a2a4c4c39535bcde5610843 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Dec 2025 16:57:06 +0100 Subject: [PATCH 06/32] Debug v23. dolChmod required after file_puts_content --- .../class/externalModules.class.php | 2 ++ .../blockedlog/admin/blockedlog_archives.php | 1 + htdocs/blockedlog/admin/blockedlog_list.php | 1 + htdocs/core/ajax/onlineSign.php | 22 +++++++++---- htdocs/core/class/diasporahandler.class.php | 1 + htdocs/core/class/fileupload.class.php | 2 ++ htdocs/core/class/lessc.class.php | 4 ++- htdocs/core/class/mastodonhandler.class.php | 1 + htdocs/core/class/reddithandler.class.php | 1 + htdocs/core/lib/files.lib.php | 3 +- htdocs/core/lib/memory.lib.php | 1 + htdocs/core/lib/modulebuilder.lib.php | 4 +++ htdocs/core/lib/website2.lib.php | 9 ++++-- .../class/emailcollector.class.php | 4 +++ .../emailcollector/lib/emailcollector.lib.php | 2 ++ htdocs/modulebuilder/index.php | 3 +- htdocs/website/class/website.class.php | 32 +++---------------- htdocs/website/index.php | 3 +- 18 files changed, 55 insertions(+), 41 deletions(-) diff --git a/htdocs/admin/remotestore/class/externalModules.class.php b/htdocs/admin/remotestore/class/externalModules.class.php index 4fe93e2ff7f..1b3e49daed9 100644 --- a/htdocs/admin/remotestore/class/externalModules.class.php +++ b/htdocs/admin/remotestore/class/externalModules.class.php @@ -926,6 +926,8 @@ class ExternalModules $result = file_put_contents($cache_file, $yaml); if ($result === false) { $this->error = 'Failed to create cache file: ' . $cache_file; + } else { + dolChmod($cache_file); } } } else { diff --git a/htdocs/blockedlog/admin/blockedlog_archives.php b/htdocs/blockedlog/admin/blockedlog_archives.php index 752605831d5..e1acde18816 100644 --- a/htdocs/blockedlog/admin/blockedlog_archives.php +++ b/htdocs/blockedlog/admin/blockedlog_archives.php @@ -401,6 +401,7 @@ if (GETPOST('action') == 'export' && $user->hasRight('blockedlog', 'read')) { / // Now add a signature to check integrity at end of file file_put_contents($tmpfile, 'END - sha256='.$sha256.' - hmac_sha256='.$hmacsha256, FILE_APPEND); + dolChmod($tmpfile); setEventMessages($langs->trans("FileGenerated"), null); } else { diff --git a/htdocs/blockedlog/admin/blockedlog_list.php b/htdocs/blockedlog/admin/blockedlog_list.php index 9a40628312a..eda4843e2a3 100644 --- a/htdocs/blockedlog/admin/blockedlog_list.php +++ b/htdocs/blockedlog/admin/blockedlog_list.php @@ -354,6 +354,7 @@ if (GETPOST('downloadcsv', 'alpha')) { // Now add a signature to check integrity at end of file file_put_contents($tmpfile, 'END - md5='.$md5value, FILE_APPEND); + dolChmod($tmpfile); header('Content-Type: application/octet-stream'); header("Content-Transfer-Encoding: Binary"); diff --git a/htdocs/core/ajax/onlineSign.php b/htdocs/core/ajax/onlineSign.php index 31dda607808..05ab021729b 100644 --- a/htdocs/core/ajax/onlineSign.php +++ b/htdocs/core/ajax/onlineSign.php @@ -138,10 +138,12 @@ if ($action == "importSignature") { } if (!$error) { - $return = file_put_contents($upload_dir . $filename, $data); - if ($return == false) { + $return = file_put_contents($upload_dir.$filename, $data); + if ($return === false) { $error++; $response = 'Error file_put_content: failed to create signature file.'; + } else { + dolChmod($upload_dir.$filename); } } @@ -353,9 +355,11 @@ if ($action == "importSignature") { if (!$error) { $return = file_put_contents($upload_dir . $filename, $data); - if ($return == false) { + if ($return === false) { $error++; $response = 'Error file_put_content: failed to create signature file.'; + } else { + dolChmod($upload_dir.$filename); } } @@ -490,9 +494,11 @@ if ($action == "importSignature") { if (!$error) { $return = file_put_contents($upload_dir . $filename, $data); - if ($return == false) { + if ($return === false) { $error++; $response = 'Error file_put_content: failed to create signature file.'; + } else { + dolChmod($upload_dir.$filename); } } @@ -637,9 +643,11 @@ if ($action == "importSignature") { if (!$error) { $return = file_put_contents($upload_dir . $filename, $data); - if ($return == false) { + if ($return === false) { $error++; $response = 'Error file_put_content: failed to create signature file.'; + } else { + dolChmod($upload_dir.$filename); } } @@ -834,9 +842,11 @@ if ($action == "importSignature") { if (!$error) { $return = file_put_contents($upload_dir . $filename, $data); - if ($return == false) { + if ($return === false) { $error++; $response = 'Error file_put_content: failed to create signature file.'; + } else { + dolChmod($upload_dir.$filename); } } diff --git a/htdocs/core/class/diasporahandler.class.php b/htdocs/core/class/diasporahandler.class.php index 64ba5bbc9e3..c70fa0fb770 100644 --- a/htdocs/core/class/diasporahandler.class.php +++ b/htdocs/core/class/diasporahandler.class.php @@ -113,6 +113,7 @@ class DiasporaHandler if ($cacheDir) { dol_mkdir($cacheDir); file_put_contents($cacheFile, $data); + dolChmod($cacheFile); } } else { $this->error = 'Error retrieving URL ' . $urlAPI; diff --git a/htdocs/core/class/fileupload.class.php b/htdocs/core/class/fileupload.class.php index fd603b1cd8b..1354894cf41 100644 --- a/htdocs/core/class/fileupload.class.php +++ b/htdocs/core/class/fileupload.class.php @@ -456,6 +456,8 @@ class FileUpload // Non-multipart uploads (PUT method support) file_put_contents($file_path, fopen('php://input', 'r'), $append_file ? FILE_APPEND : 0); } + dolChmod($file_path); + $file_size = dol_filesize($file_path); if ($file_size === $file->size) { $file->url = $this->options['upload_url'].urlencode($file->name); diff --git a/htdocs/core/class/lessc.class.php b/htdocs/core/class/lessc.class.php index 08b97f8b6bf..452319be2b7 100644 --- a/htdocs/core/class/lessc.class.php +++ b/htdocs/core/class/lessc.class.php @@ -2246,7 +2246,9 @@ class Lessc $this->importDir = $oldImport; if ($outFname !== null) { - return file_put_contents($outFname, $out); + $res = file_put_contents($outFname, $out); + dolChmod($outFname); + return $res; } return $out; diff --git a/htdocs/core/class/mastodonhandler.class.php b/htdocs/core/class/mastodonhandler.class.php index c35a55aea96..97c45fd6a39 100644 --- a/htdocs/core/class/mastodonhandler.class.php +++ b/htdocs/core/class/mastodonhandler.class.php @@ -121,6 +121,7 @@ class MastodonHandler if ($cacheDir) { dol_mkdir($cacheDir); file_put_contents($cacheFile, $data); + dolChmod($cacheFile); } } else { $this->error = 'Error retrieving URL ' . $urlAPI; diff --git a/htdocs/core/class/reddithandler.class.php b/htdocs/core/class/reddithandler.class.php index 6c99fbce412..d399cb28dca 100644 --- a/htdocs/core/class/reddithandler.class.php +++ b/htdocs/core/class/reddithandler.class.php @@ -170,6 +170,7 @@ class RedditHandler if ($cacheDir) { dol_mkdir($cacheDir); file_put_contents($cacheFile, $data); + dolChmod($cacheFile); } } else { $this->error = 'Error retrieving URL ' . $urlAPI; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 9609b3e116a..60fae8a9443 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3815,8 +3815,7 @@ function dol_filecache($directory, $filename, $object) $cachefile = $directory.$filename; file_put_contents($cachefile, serialize($object), LOCK_EX); - - dolChmod($cachefile, '0644'); + dolChmod($cachefile); } /** diff --git a/htdocs/core/lib/memory.lib.php b/htdocs/core/lib/memory.lib.php index 3398bc1bb65..16e76c55916 100644 --- a/htdocs/core/lib/memory.lib.php +++ b/htdocs/core/lib/memory.lib.php @@ -156,6 +156,7 @@ function dol_setcache($memoryid, $data, $expire = 0, $filecache = 0, $replace = $cachejson = dolEncrypt(json_encode($cachedata)); if (!dol_is_file($pathcache.'/'.$memoryid.'.cache') || $replace > 0) { $result = file_put_contents($pathcache.'/'.$memoryid.'.cache', $cachejson); + dolChmod($pathcache.'/'.$memoryid.'.cache'); } else { return 0; } diff --git a/htdocs/core/lib/modulebuilder.lib.php b/htdocs/core/lib/modulebuilder.lib.php index dadbabf1b98..78855d41a5e 100644 --- a/htdocs/core/lib/modulebuilder.lib.php +++ b/htdocs/core/lib/modulebuilder.lib.php @@ -846,12 +846,14 @@ function deletePropsAndPermsFromDoc($file, $objectname) $search = '/' . preg_quote($start, '/') . '(.*?)' . preg_quote($end, '/') . '/s'; $new_contents = preg_replace($search, '', $str); file_put_contents($file, $new_contents); + dolChmod($file); //perms If Exist $perms = "|*".strtolower($objectname)."*|"; $search_pattern_perms = '/' . preg_quote($perms, '/') . '.*?\n/'; $new_contents = preg_replace($search_pattern_perms, '', $new_contents); file_put_contents($file, $new_contents); + dolChmod($file); } } @@ -1038,6 +1040,7 @@ function addObjectsToApiFile($srcfile, $file, $objects, $modulename) $allContent = implode("", $content); file_put_contents($file, $allContent); + dolChmod($file); // Add methods for each object $allContent = getFromFile($srcfile, '/* BEGIN MODULEBUILDER API MYOBJECT */', '/* END MODULEBUILDER API MYOBJECT */'); @@ -1107,6 +1110,7 @@ function removeObjectFromApiFile($file, $objects, $objectname) $allContent = implode("", $content); file_put_contents($file, $allContent); + dolChmod($file); // for delete methods of object $begin = '/* BEGIN MODULEBUILDER API '.strtoupper($objectname).' */'; diff --git a/htdocs/core/lib/website2.lib.php b/htdocs/core/lib/website2.lib.php index 174c7faee60..df8539a0f03 100644 --- a/htdocs/core/lib/website2.lib.php +++ b/htdocs/core/lib/website2.lib.php @@ -989,9 +989,14 @@ function checkPHPCode(&$phpfullcodestringold, &$phpfullcodestring) $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("eval", "create_function", "assert", "mb_ereg_replace")); // function with eval capabilities } if (!getDolGlobalString('WEBSITE_PHP_ALLOW_WRITE')) { // If option is not on, we disallow functions to write files - $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_compress_dir", "dol_decode", "dol_delete_file", "dol_delete_dir", "dol_delete_dir_recursive", "dol_copy", "archiveOrBackupFile")); // more dolibarr functions - $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "fputs", "fputscsv", "fwrite", "fpassthru", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask")); + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_compress_dir", "dol_delete_file", "dol_delete_dir", "dol_delete_dir_recursive", "dol_copy", "archiveOrBackupFile")); // more dolibarr functions + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("fopen", "file_put_contents", "flock", "fputs", "fputscsv", "fwrite", "fpassthru", "mkdir", "rmdir", "symlink", "touch", "unlink", "umask")); } + if (getDolGlobalString('WEBSITE_PHP_DISALLOW_READ')) { // If option is not on, we disallow functions to read files + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("dol_decode")); // more dolibarr functions + $forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("file", "fopen", "file_get_contents", "fgets", "fgetscsv", "fgetss", "fread")); + } + //$forbiddenphpfunctions = array_merge($forbiddenphpfunctions, array("require", "include")); $forbiddenphpmethods = array('invoke', 'invokeArgs'); // Method of ReflectionFunction to execute a function diff --git a/htdocs/emailcollector/class/emailcollector.class.php b/htdocs/emailcollector/class/emailcollector.class.php index 28154fa95c6..73bdc65b709 100644 --- a/htdocs/emailcollector/class/emailcollector.class.php +++ b/htdocs/emailcollector/class/emailcollector.class.php @@ -3903,6 +3903,7 @@ class EmailCollector extends CommonObject $destination = dol_sanitizePathName($destination); file_put_contents($destination, $data); + dolChmod($destination); } } @@ -4019,12 +4020,15 @@ class EmailCollector extends CommonObject $quality = $tmparraysize['quality']; file_put_contents($destdir.'/'.$filename, $content); + dolChmod($destdir.'/'.$filename); + if (image_format_supported($filename) == 1) { // Create thumbs vignette($destdir.'/'.$filename, $maxwidthsmall, $maxheightsmall, '_small', $quality, "thumbs"); // Create mini thumbs for image (Ratio is near 16/9) vignette($destdir.'/'.$filename, $maxwidthmini, $maxheightmini, '_mini', $quality, "thumbs"); } + addFileIntoDatabaseIndex($destdir, $filename); } diff --git a/htdocs/emailcollector/lib/emailcollector.lib.php b/htdocs/emailcollector/lib/emailcollector.lib.php index 731fe38d35b..7eb58caa4ce 100644 --- a/htdocs/emailcollector/lib/emailcollector.lib.php +++ b/htdocs/emailcollector/lib/emailcollector.lib.php @@ -190,6 +190,8 @@ function saveAttachment($path, $filename, $data) $i++; } file_put_contents($filepath, $data); + dolChmod($filepath); + return $filepath; } diff --git a/htdocs/modulebuilder/index.php b/htdocs/modulebuilder/index.php index bcc9ae46f95..78ec4da0fbf 100644 --- a/htdocs/modulebuilder/index.php +++ b/htdocs/modulebuilder/index.php @@ -428,7 +428,8 @@ if ($dirins && $action == 'initmodule' && $modulename /* && $user->hasRight("mod if (getDolGlobalString('MODULEBUILDER_SPECIFIC_README')) { setEventMessages($langs->trans("ContentOfREADMECustomized"), null, 'warnings'); dol_delete_file($destdir.'/README.md'); - file_put_contents($destdir.'/README.md', $conf->global->MODULEBUILDER_SPECIFIC_README); + file_put_contents($destdir.'/README.md', getDolGlobalString("MODULEBUILDER_SPECIFIC_README")); + dolChmod($destdir.'/README.md'); } // for create file to add properties // file_put_contents($destdir.'/'.strtolower($modulename).'propertycard.php',''); diff --git a/htdocs/website/class/website.class.php b/htdocs/website/class/website.class.php index 4f73279b0b4..0911dacd74a 100644 --- a/htdocs/website/class/website.class.php +++ b/htdocs/website/class/website.class.php @@ -279,6 +279,7 @@ class Website extends CommonObject $stringtodolibarrfile .= "param=value\n"; //print $conf->website->dir_output.'/'.$this->ref.'/.dolibarr';exit; file_put_contents($pathofwebsite.'/.dolibarr', $stringtodolibarrfile); + dolChmod($pathofwebsite.'/.dolibarr'); $filelicense = $pathofwebsite.'/LICENSE'; if (!dol_is_file($filelicense)) { @@ -1898,34 +1899,6 @@ class Website extends CommonObject } } - /** - * check previous state for file - * @param string $pathname path of file - * @return array|mixed - */ - public function checkPreviousState($pathname) - { - if (!file_exists($pathname)) { - if (touch($pathname)) { - dolChmod($pathname, '0664'); - } - return []; - } - return unserialize(file_get_contents($pathname)); - } - - - /** - * Save state for File - * @param mixed $etat state - * @param string $pathname path of file - * @return int|false - */ - public function saveState($etat, $pathname) - { - return file_put_contents($pathname, serialize($etat)); - } - /** * Compare two files has not same name but same content * @param string $dossierSource filepath of folder source @@ -2156,7 +2129,10 @@ class Website extends CommonObject // Reindex the table keys $contentDest = array_values($contentDest); $stringreplacement = implode("\n", $contentDest); + file_put_contents($inplaceFile, $stringreplacement); + dolChmod($inplaceFile); + foreach ($differences['lignes_dont_change'] as $linechanged => $line) { if (in_array($linechanged, $contentDest)) { dolReplaceInFile($inplaceFile, array($linechanged => $line)); diff --git a/htdocs/website/index.php b/htdocs/website/index.php index fa50173769d..a0a34c288e2 100644 --- a/htdocs/website/index.php +++ b/htdocs/website/index.php @@ -5981,7 +5981,8 @@ if ((empty($action) || $action == 'preview' || $action == 'createfromclone' || $ print $out; - /*file_put_contents($filetpl, $out); + /* + file_put_contents($filetpl, $out); dolChmod($filetpl); // Output file on browser From 2e2438084a260af1f317eceb2c2fc6ac018b21b2 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Dec 2025 23:36:16 +0100 Subject: [PATCH 07/32] Update SECURITY.md --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 41c0fd43de1..df7b1e76ce5 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -12,7 +12,7 @@ Security report are valid only on any current stable version for the last 5 majo To report a vulnerability, for a private report, you can: -- Send your report on Vulnerability Disclosure Program (VDP): Link will be updated soon (recommended for everybody) +- Send your report on Vulnerability Disclosure Program (VDP): https://github.com/Dolibarr/dolibarr/issues or https://github.com/Dolibarr/dolibarr/security/advisories (recommended for everybody) that are replaced into ... @@ -9012,6 +9014,9 @@ function dol_string_onlythesehtmltags($stringtoclean, $cleanalsosomestyles = 1, if (!in_array('link', $allowed_tags)) { $allowed_tags[] = "link"; } + if (!in_array('meta', $allowed_tags)) { + $allowed_tags[] = "meta"; + } } if ($allowscript) { if (!in_array('script', $allowed_tags)) { @@ -9088,6 +9093,7 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes { if (is_null($allowed_attributes)) { $allowed_attributes = array( + // HTML 4 "allow", "allowfullscreen", "alt", @@ -9109,13 +9115,14 @@ function dol_string_onlythesehtmlattributes($stringtoclean, $allowed_attributes "title", "type", "width", + // HTML5 - "header", "footer", - "nav", - "section", + "header", "menu", - "menuitem" + "menuitem", + "nav", + "section" ); } // Always add content and http-equiv for meta tags, required to force encoding and keep html content in utf8 by load/saveHTML functions. From 7902e311779da75939df62fd4bc4b56576c07560 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Dec 2025 00:24:48 +0100 Subject: [PATCH 09/32] Fix RSS --- dev/tools/apstats.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/dev/tools/apstats.php b/dev/tools/apstats.php index 13f34b955bd..dd72224a071 100755 --- a/dev/tools/apstats.php +++ b/dev/tools/apstats.php @@ -973,6 +973,18 @@ if ($fh) { } fwrite($fh, ''."\n"); + + // Loop on arrayofalert to remove alerts that are on develop + foreach ($arrayofalerts as $tmpkey => $alert) { + $arrayuniquetmp = array_unique($alert['branch']); + if (count($arrayuniquetmp) == 1 && in_array('develop', $arrayuniquetmp)) { + // The alert has been fixed into develop only, so we discard it for RSS alert + print 'The alert with key '.$tmpkey.' is fixed into branch develop only, so we discard it for RSS'."\n"; + unset($arrayofalerts[$tmpkey]); + } + } + + // Loop on array of alerts on stable branches foreach ($arrayofalerts as $alert) { $alert['url_commit'] = 'https://github.com/Dolibarr/dolibarr/commit/'.$alert['commitid']; From 442e1ea3e069825e5a1b87a25898c2c7c207b76e Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Dec 2025 00:48:04 +0100 Subject: [PATCH 10/32] Update SECURITY.md --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index df7b1e76ce5..59e2a4b8d4f 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -12,7 +12,7 @@ Security report are valid only on any current stable version for the last 5 majo To report a vulnerability, for a private report, you can: -- Send your report on Vulnerability Disclosure Program (VDP): https://github.com/Dolibarr/dolibarr/issues or https://github.com/Dolibarr/dolibarr/security/advisories (recommended for everybody) +- Send your report as an issue on https://github.com/Dolibarr/dolibarr/issues or on GitHub Vulnerability Disclosure Program tool (VDP): https://github.com/Dolibarr/dolibarr/security/advisories (recommended for everybody) -- Or send an email to security@dolibarr.org with clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary. +- Or send an email to security@dolibarr.org with clear textual description of the report along with steps to reproduce the issue, include attachments such as screenshots or proof of concept code as necessary (in such a case, the issue may be created by the developer that will fix the vulnerability or the Release Manager). ## Hunting vulnerabilities on Dolibarr From 4b824a82ef5309cd69afe17a930b132c416b1961 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Dec 2025 01:06:01 +0100 Subject: [PATCH 12/32] Update SECURITY.md --- SECURITY.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/SECURITY.md b/SECURITY.md index 1af3af5b81f..8df37c8a7db 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -114,3 +114,8 @@ Scope is the web application (backoffice) and the APIs. * Invalid or missing SPF (Sender Policy Framework) records (Incomplete or missing SPF/DKIM/DMARC) * Physical or social engineering attempts or issues that require physical access to a victim’s computer/device * Vulnerabilities of type XSS exploited by using javascript into a website page of the website module or by using php code into a website page (being able to set javascript or php code is the expected behaviour in the website module), except if the user does not have the permission to edit page or php code. + + +## Be informed of a new vulnerability + +You can get more information on how to be informed on a new vulnerability on the page [https://wiki.dolibarr.org/index.php/Informations_s%C3%A9curit%C3%A9](https://wiki.dolibarr.org/index.php/Security_information) From 2b7346bf97017a23f72536ef53fdb460bf423991 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Dec 2025 01:06:54 +0100 Subject: [PATCH 13/32] Fix link formatting in SECURITY.md --- SECURITY.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SECURITY.md b/SECURITY.md index 8df37c8a7db..8115a818687 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -118,4 +118,4 @@ Scope is the web application (backoffice) and the APIs. ## Be informed of a new vulnerability -You can get more information on how to be informed on a new vulnerability on the page [https://wiki.dolibarr.org/index.php/Informations_s%C3%A9curit%C3%A9](https://wiki.dolibarr.org/index.php/Security_information) +You can get more information on how to be informed on a new vulnerability on the page https://wiki.dolibarr.org/index.php/Security_information From 03728dec472fe72e0edf040e791e1ce5e95629ad Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Tue, 16 Dec 2025 10:06:06 +0100 Subject: [PATCH 14/32] Fix missing css rules for special inputs --- .../webportal/css/form-input-special.css | 80 +++++++++++++++++++ htdocs/public/webportal/css/style.css.php | 1 + 2 files changed, 81 insertions(+) create mode 100644 htdocs/public/webportal/css/form-input-special.css diff --git a/htdocs/public/webportal/css/form-input-special.css b/htdocs/public/webportal/css/form-input-special.css new file mode 100644 index 00000000000..8e28e8301b7 --- /dev/null +++ b/htdocs/public/webportal/css/form-input-special.css @@ -0,0 +1,80 @@ + +/** + * STARS INPUT + */ +.star-selection { + font-size: 1rem; + cursor: pointer; + display: flex; + white-space: nowrap; +} +.star { + color: #ccc; + transition: color 0.4s; +} +.star:hover, .star.active { + color: var(--butactionbg); +} + +/** + * SELECT 2 + */ + +.select2-container, .select2-container .selection, .select2-selection.select2-selection--single{ + height: calc(1rem * var(--line-height) + var(--form-element-spacing-vertical) * 2 + var(--border-width) * 2) !important; +} +.select2.select2-container{ + margin-bottom: calc(var(--form-element-spacing-vertical)*3); +} +.select2-selection__rendered, .select2-selection__arrow{ + line-height: calc(1rem * var(--line-height) + var(--form-element-spacing-vertical) * 2 + var(--border-width) * 2) !important; + height: calc(1rem * var(--line-height) + var(--form-element-spacing-vertical) * 2 + var(--border-width) * 2) !important; +} + +.select2-search__field[type="search"] { + margin-bottom: 3px; +} +.select2-search.select2-search--dropdown{ + border-bottom : 1px solid rgba(0,0,0,0.1); +} + +/** + * DATE + */ + +[class*="fieldname_options_"] input { + width: auto; + max-width: none; + box-sizing: border-box; /* pour que padding/border ne débordent pas */ +} + +[class*="fieldname_options_"] .nowraponall { + display: inline-flex; + align-items: center; + gap: 0.25rem; +} + +[class*="fieldname_options_"] span { + display: flex; + align-items: center; + justify-content: center; + line-height: 1; +} + +[class*="fieldname_options_"] .dpInvisibleButtons{ + display: inline-block; + width: auto; + vertical-align: baseline; +} + +/** +* Inlines forms + */ + +.nowraponall :is(input:not([type=checkbox], [type=radio]), select, textarea){ + margin-bottom: 0; +} + +.nowraponall:has(input:not([type=checkbox], [type=radio]), select, textarea){ + margin-bottom: calc(var(--form-element-spacing-vertical)*3); +} diff --git a/htdocs/public/webportal/css/style.css.php b/htdocs/public/webportal/css/style.css.php index edeb7e85c01..bb7d5da5f2f 100644 --- a/htdocs/public/webportal/css/style.css.php +++ b/htdocs/public/webportal/css/style.css.php @@ -102,6 +102,7 @@ if (empty($dolibarr_nocache)) { @import "card.css"; @import "dialog.css"; @import "btn.css"; +@import "form-input-special.css"; /** This file can overwrite default pico css */ From ac3c8df5e60adf5d921b48795719837ba59e132b Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Tue, 16 Dec 2025 10:50:36 +0100 Subject: [PATCH 15/32] fix select 2 multi select --- .../webportal/css/form-input-special.css | 24 ++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/htdocs/public/webportal/css/form-input-special.css b/htdocs/public/webportal/css/form-input-special.css index 8e28e8301b7..645924fb5c4 100644 --- a/htdocs/public/webportal/css/form-input-special.css +++ b/htdocs/public/webportal/css/form-input-special.css @@ -26,11 +26,16 @@ .select2.select2-container{ margin-bottom: calc(var(--form-element-spacing-vertical)*3); } -.select2-selection__rendered, .select2-selection__arrow{ +.select2-selection--single .select2-selection__rendered, .select2-selection__arrow{ line-height: calc(1rem * var(--line-height) + var(--form-element-spacing-vertical) * 2 + var(--border-width) * 2) !important; height: calc(1rem * var(--line-height) + var(--form-element-spacing-vertical) * 2 + var(--border-width) * 2) !important; } +.select2-selection--multiple .select2-selection__rendered{ + line-height: calc(1rem * var(--line-height) + var(--form-element-spacing-vertical) + var(--border-width) * 2) !important; + height: calc(1rem * var(--line-height) + var(--form-element-spacing-vertical) * 3 + var(--border-width) * 2 ) !important; +} + .select2-search__field[type="search"] { margin-bottom: 3px; } @@ -38,6 +43,23 @@ border-bottom : 1px solid rgba(0,0,0,0.1); } +.select2-container--default.select2-container--focus .select2-selection--multiple { + border :var(--border-width) solid var(--border-color) !important; /* fix select 2 to be compatible pico css */ +} + +.select2-container--default.select2-container--focus .select2-selection--multiple{ + --border-color: var(--primary); +} + +.select2-container .select2-selection--multiple .select2-selection__rendered { + display: block !important; /* fix select 2 to be compatible pico css */ + overflow: auto; +} + +.select2-container--default .select2-selection--multiple .select2-selection__choice{ + border: 0px solid #aaa !important; /* fix select 2 to be compatible pico css */ +} + /** * DATE */ From 3edf615d08919a1abd289e69c53dde76b87a8361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Tue, 16 Dec 2025 11:21:03 +0100 Subject: [PATCH 16/32] fix missing import_key fetch in categories class --- htdocs/categories/class/categorie.class.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index 96d846ffb62..08d8d4b7a68 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -431,7 +431,7 @@ class Categorie extends CommonObject 'cat_fk' => (empty($this->MAP_CAT_FK[$mapCode]) ? $mapCode : $this->MAP_CAT_FK[$mapCode]), 'cat_table' => (empty($this->MAP_CAT_TABLE[$mapCode]) ? $mapCode : $this->MAP_CAT_TABLE[$mapCode]), 'obj_class' => (empty($this->MAP_OBJ_CLASS[$mapCode]) ? $mapCode : $this->MAP_OBJ_CLASS[$mapCode]), - 'obj_table' => (empty($this->MAP_OBJ_TABLE[$mapCode]) ? $mapCode : $this->MAP_OBJ_TABLE[$mapCode]) + 'obj_table' => (empty($this->MAP_OBJ_TABLE[$mapCode]) ? $mapCode : $this->MAP_OBJ_TABLE[$mapCode]), ); } @@ -469,7 +469,7 @@ class Categorie extends CommonObject } $sql = "SELECT rowid, fk_parent, entity, label, description, color, position, fk_soc, visible, type, ref_ext"; - $sql .= ", date_creation, tms, fk_user_creat, fk_user_modif"; + $sql .= ", date_creation, tms, fk_user_creat, fk_user_modif, import_key"; $sql .= " FROM ".MAIN_DB_PREFIX."categorie"; if ($id) { $sql .= " WHERE rowid = ".((int) $id); @@ -502,8 +502,9 @@ class Categorie extends CommonObject $this->date_modification = $this->db->jdate($res['tms']); $this->user_creation_id = (int) $res['fk_user_creat']; $this->user_modification_id = (int) $res['fk_user_modif']; + $this->import_key = $res['import_key']; - // Retrieve all extrafield + // Retrieve all extrafields // fetch optionals attributes and labels $this->fetch_optionals(); From 4140591621a0089769d8a2e55568553896db1132 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Tue, 16 Dec 2025 11:31:33 +0100 Subject: [PATCH 17/32] Fix form price currency --- .../core/class/fields/pricecyfield.class.php | 2 +- .../webportal/css/form-input-special.css | 33 ++++++++++++++----- .../class/html.formwebportal.class.php | 15 +++++++++ 3 files changed, 40 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/fields/pricecyfield.class.php b/htdocs/core/class/fields/pricecyfield.class.php index 1e64f20ffff..a473b2b361d 100644 --- a/htdocs/core/class/fields/pricecyfield.class.php +++ b/htdocs/core/class/fields/pricecyfield.class.php @@ -94,7 +94,7 @@ class PricecyField extends CommonField $out = self::$form->inputType('text', $htmlName, (string) $value, $htmlName, $moreCss, $moreAttrib . $autoFocus); $out .= self::$form->selectCurrency($currency, $htmlName . 'currency_id'); - return $out; + return ''.$out.''; } /** diff --git a/htdocs/public/webportal/css/form-input-special.css b/htdocs/public/webportal/css/form-input-special.css index 645924fb5c4..0092130f7f7 100644 --- a/htdocs/public/webportal/css/form-input-special.css +++ b/htdocs/public/webportal/css/form-input-special.css @@ -1,4 +1,8 @@ +:root{ + --form-input-margin-bottom : calc(var(--form-element-spacing-vertical)*3); +} + /** * STARS INPUT */ @@ -24,7 +28,7 @@ height: calc(1rem * var(--line-height) + var(--form-element-spacing-vertical) * 2 + var(--border-width) * 2) !important; } .select2.select2-container{ - margin-bottom: calc(var(--form-element-spacing-vertical)*3); + margin-bottom: var(--form-input-margin-bottom); } .select2-selection--single .select2-selection__rendered, .select2-selection__arrow{ line-height: calc(1rem * var(--line-height) + var(--form-element-spacing-vertical) * 2 + var(--border-width) * 2) !important; @@ -64,7 +68,7 @@ * DATE */ -[class*="fieldname_options_"] input { +[class*="fieldname_options_"] > input { width: auto; max-width: none; box-sizing: border-box; /* pour que padding/border ne débordent pas */ @@ -76,12 +80,7 @@ gap: 0.25rem; } -[class*="fieldname_options_"] span { - display: flex; - align-items: center; - justify-content: center; - line-height: 1; -} + [class*="fieldname_options_"] .dpInvisibleButtons{ display: inline-block; @@ -98,5 +97,21 @@ } .nowraponall:has(input:not([type=checkbox], [type=radio]), select, textarea){ - margin-bottom: calc(var(--form-element-spacing-vertical)*3); + margin-bottom: var(--form-input-margin-bottom); +} + + +/** + * Form currency + */ +.form-select-price-currency-container { + display: flex; + align-items: center; + justify-content: center; + line-height: 1; + gap: 0.25rem; + margin-bottom: var(--form-input-margin-bottom);; +} +.form-select-price-currency-container > input { + text-align: right; } diff --git a/htdocs/webportal/class/html.formwebportal.class.php b/htdocs/webportal/class/html.formwebportal.class.php index 35e3a8f9508..a46885296be 100644 --- a/htdocs/webportal/class/html.formwebportal.class.php +++ b/htdocs/webportal/class/html.formwebportal.class.php @@ -1670,4 +1670,19 @@ class FormWebPortal extends Form return $html; } + + /** + * Retourne la liste des devises, dans la langue de l'utilisateur + * + * @param string $selected Preselected currency code + * @param string $htmlname Name of HTML select list + * @param int $mode 0 = Add currency symbol into label, 1 = Add 3 letter iso code, 2 = Add both symbol and code + * @param string $useempty '1'=Allow empty value + * @return string HTML component + */ + public function selectCurrency($selected = '', $htmlname = 'currency_id', $mode = 0, $useempty = '') + { + + return ''.parent::selectCurrency($selected, $htmlname, $mode, $useempty).''; + } } From 86a817257197334c002507e9326c89b016d62df2 Mon Sep 17 00:00:00 2001 From: John BOTELLA <68917336+thersane-john@users.noreply.github.com> Date: Tue, 16 Dec 2025 11:32:03 +0100 Subject: [PATCH 18/32] Fix form price currency --- htdocs/public/webportal/css/form-input-special.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/public/webportal/css/form-input-special.css b/htdocs/public/webportal/css/form-input-special.css index 0092130f7f7..8e2b3b2ada7 100644 --- a/htdocs/public/webportal/css/form-input-special.css +++ b/htdocs/public/webportal/css/form-input-special.css @@ -110,7 +110,7 @@ justify-content: center; line-height: 1; gap: 0.25rem; - margin-bottom: var(--form-input-margin-bottom);; + margin-bottom: var(--form-input-margin-bottom); } .form-select-price-currency-container > input { text-align: right; From 37da2c2630e6aa611aa3668161b50199fdaf5426 Mon Sep 17 00:00:00 2001 From: nateogroup-antoine Date: Tue, 16 Dec 2025 14:45:17 +0100 Subject: [PATCH 19/32] Filter on "all warehouse " on proposals MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Filter on "all deposits" on quotes It was no longer possible to filter on “all deposits” on quotes. Style harmonization with the order list --- htdocs/comm/propal/list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/comm/propal/list.php b/htdocs/comm/propal/list.php index 7df502cb426..6a1c085d073 100644 --- a/htdocs/comm/propal/list.php +++ b/htdocs/comm/propal/list.php @@ -1286,7 +1286,7 @@ if (isModEnabled('stock') && getDolGlobalString('WAREHOUSE_ASK_WAREHOUSE_DURING_ $formproduct = new FormProduct($db); $moreforfilter .= '
'; $tmptitle = $langs->trans('Warehouse'); - $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse'); + $moreforfilter .= img_picto($tmptitle, 'stock', 'class="pictofixedwidth"').$formproduct->selectWarehouses($search_warehouse, 'search_warehouse', '', 1, 0, 0, $tmptitle, 0, 0, array(), 'maxwidth250 widthcentpercentminusx'); $moreforfilter .= '
'; } $parameters = array(); From 1601e356969777521f976a7b334eecdcdf242618 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Dec 2025 15:04:28 +0100 Subject: [PATCH 20/32] Clean code --- htdocs/core/boxes/box_produits_alerte_stock.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 9bf1d094f92..40faa3b03a3 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -49,7 +49,7 @@ class box_produits_alerte_stock extends ModeleBoxes */ public function __construct($db, $param = '') { - global $conf, $user; + global $user; $this->db = $db; @@ -69,7 +69,7 @@ class box_produits_alerte_stock extends ModeleBoxes */ public function loadBox($max = 5) { - global $user, $langs, $conf, $hookmanager; + global $user, $langs, $hookmanager; $this->max = $max; From 205251d4b952ab9fe3c0343bfbf061f756f4153f Mon Sep 17 00:00:00 2001 From: nateogroup-antoine Date: Tue, 16 Dec 2025 15:48:35 +0100 Subject: [PATCH 21/32] If an item in the order is not managed in stock, the default quantity offered during shipping is 0 rather than the quantity ordered. If an item in the order is not managed in stock, the default quantity offered during shipping is 0 rather than the quantity ordered. --- htdocs/expedition/card.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index 3e1d15d09f0..41d473f971f 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -2051,7 +2051,7 @@ if ($action == 'create' && $usercancreate) { print ''; //ship from preselected location $stock = + (isset($product->stock_warehouse[$warehouse_id]->real) ? $product->stock_warehouse[$warehouse_id]->real : 0); // Convert to number - if ($line->product_type == Product::TYPE_SERVICE && getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) { + if (($line->product_type == Product::TYPE_SERVICE && getDolGlobalString('SHIPMENT_SUPPORTS_SERVICES')) || $product->stockable_product == Product::DISABLED_STOCK) { $deliverableQty = $quantityToBeDelivered; } else { $deliverableQty = min($quantityToBeDelivered, $stock); From ee0e2e5e16fcd4a5e55a7edeeb772c54a2230641 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Dec 2025 16:05:27 +0100 Subject: [PATCH 22/32] FIX #36667 --- htdocs/core/boxes/box_activity.php | 2 +- htdocs/core/boxes/box_customers_outstanding_bill_reached.php | 2 +- htdocs/core/boxes/box_factures.php | 2 +- htdocs/core/boxes/box_factures_fourn.php | 2 +- htdocs/core/boxes/box_factures_fourn_imp.php | 2 +- htdocs/core/boxes/box_factures_imp.php | 2 +- htdocs/core/boxes/box_ficheinter.php | 2 +- htdocs/core/boxes/box_graph_product_distribution.php | 2 +- htdocs/core/boxes/box_produits.php | 2 +- htdocs/core/boxes/box_produits_alerte_stock.php | 2 +- htdocs/core/boxes/box_propales.php | 2 +- htdocs/core/boxes/box_services_contracts.php | 2 +- htdocs/core/boxes/box_services_expired.php | 2 +- htdocs/core/boxes/box_task.php | 4 ++-- 14 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/boxes/box_activity.php b/htdocs/core/boxes/box_activity.php index 6d076b012db..914ac00ef55 100644 --- a/htdocs/core/boxes/box_activity.php +++ b/htdocs/core/boxes/box_activity.php @@ -34,7 +34,7 @@ class box_activity extends ModeleBoxes public $boxcode = "activity"; public $boximg = "object_bill"; public $boxlabel = 'BoxGlobalActivity'; - public $depends = array("facture"); + public $depends = array("invoice|propal|order"); public $enabled = 1; diff --git a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php index ef252ca29cf..f70e734e8a2 100644 --- a/htdocs/core/boxes/box_customers_outstanding_bill_reached.php +++ b/htdocs/core/boxes/box_customers_outstanding_bill_reached.php @@ -36,7 +36,7 @@ class box_customers_outstanding_bill_reached extends ModeleBoxes public $boxcode = "customersoutstandingbillreached"; public $boximg = "object_company"; public $boxlabel = "BoxCustomersOutstandingBillReached"; - public $depends = array("facture", "societe"); + public $depends = array("invoice", "societe"); public $enabled = 1; diff --git a/htdocs/core/boxes/box_factures.php b/htdocs/core/boxes/box_factures.php index 7130b514233..1a3a69d4423 100644 --- a/htdocs/core/boxes/box_factures.php +++ b/htdocs/core/boxes/box_factures.php @@ -34,7 +34,7 @@ class box_factures extends ModeleBoxes public $boxcode = "lastcustomerbills"; public $boximg = "object_bill"; public $boxlabel = "BoxLastCustomerBills"; - public $depends = array("facture"); + public $depends = array("invoice"); /** * Constructor diff --git a/htdocs/core/boxes/box_factures_fourn.php b/htdocs/core/boxes/box_factures_fourn.php index 9f90f60f3ad..5663a96dfe1 100644 --- a/htdocs/core/boxes/box_factures_fourn.php +++ b/htdocs/core/boxes/box_factures_fourn.php @@ -35,7 +35,7 @@ class box_factures_fourn extends ModeleBoxes public $boxcode = "lastsupplierbills"; public $boximg = "object_bill"; public $boxlabel = "BoxLastSupplierBills"; - public $depends = array("facture", "fournisseur"); + public $depends = array("invoice", "fournisseur"); /** * Constructor diff --git a/htdocs/core/boxes/box_factures_fourn_imp.php b/htdocs/core/boxes/box_factures_fourn_imp.php index 188fc5be4c5..818d5e46cac 100644 --- a/htdocs/core/boxes/box_factures_fourn_imp.php +++ b/htdocs/core/boxes/box_factures_fourn_imp.php @@ -34,7 +34,7 @@ class box_factures_fourn_imp extends ModeleBoxes public $boxcode = "oldestunpaidsupplierbills"; public $boximg = "object_bill"; public $boxlabel = "BoxOldestUnpaidSupplierBills"; - public $depends = array("facture", "fournisseur"); + public $depends = array("invoice", "fournisseur"); /** * Constructor diff --git a/htdocs/core/boxes/box_factures_imp.php b/htdocs/core/boxes/box_factures_imp.php index c59f62a80d9..914687414da 100644 --- a/htdocs/core/boxes/box_factures_imp.php +++ b/htdocs/core/boxes/box_factures_imp.php @@ -38,7 +38,7 @@ class box_factures_imp extends ModeleBoxes public $boxcode = "oldestunpaidcustomerbills"; public $boximg = "object_bill"; public $boxlabel = "BoxOldestUnpaidCustomerBills"; - public $depends = array("facture"); + public $depends = array("invoice"); /** * Constructor diff --git a/htdocs/core/boxes/box_ficheinter.php b/htdocs/core/boxes/box_ficheinter.php index d73e3d862c0..d9821886449 100644 --- a/htdocs/core/boxes/box_ficheinter.php +++ b/htdocs/core/boxes/box_ficheinter.php @@ -35,7 +35,7 @@ class box_ficheinter extends ModeleBoxes public $boxcode = "ficheinter"; public $boximg = "object_intervention"; public $boxlabel = "BoxFicheInter"; - public $depends = array("ficheinter"); // conf->contrat->enabled + public $depends = array("intervention"); /** * Constructor diff --git a/htdocs/core/boxes/box_graph_product_distribution.php b/htdocs/core/boxes/box_graph_product_distribution.php index 14e1740e75c..b7343d24cf0 100644 --- a/htdocs/core/boxes/box_graph_product_distribution.php +++ b/htdocs/core/boxes/box_graph_product_distribution.php @@ -33,7 +33,7 @@ class box_graph_product_distribution extends ModeleBoxes public $boxcode = "productdistribution"; public $boximg = "object_product"; public $boxlabel = "BoxProductDistribution"; - public $depends = array("product|service", "facture|propal|commande"); + public $depends = array("product|service", "invoice|propal|order"); public $widgettype = 'graph'; diff --git a/htdocs/core/boxes/box_produits.php b/htdocs/core/boxes/box_produits.php index 8bb5b154153..7eceaaa395e 100644 --- a/htdocs/core/boxes/box_produits.php +++ b/htdocs/core/boxes/box_produits.php @@ -37,7 +37,7 @@ class box_produits extends ModeleBoxes public $boxcode = "lastproducts"; public $boximg = "object_product"; public $boxlabel = "BoxLastProducts"; - public $depends = array("produit"); + public $depends = array("product"); /** * Constructor diff --git a/htdocs/core/boxes/box_produits_alerte_stock.php b/htdocs/core/boxes/box_produits_alerte_stock.php index 40faa3b03a3..913ad129903 100644 --- a/htdocs/core/boxes/box_produits_alerte_stock.php +++ b/htdocs/core/boxes/box_produits_alerte_stock.php @@ -39,7 +39,7 @@ class box_produits_alerte_stock extends ModeleBoxes public $boxcode = "productsalertstock"; public $boximg = "object_product"; public $boxlabel = "BoxProductsAlertStock"; - public $depends = array("produit"); + public $depends = array("product"); /** * Constructor diff --git a/htdocs/core/boxes/box_propales.php b/htdocs/core/boxes/box_propales.php index b76e83c82f4..fe2335b330e 100644 --- a/htdocs/core/boxes/box_propales.php +++ b/htdocs/core/boxes/box_propales.php @@ -37,7 +37,7 @@ class box_propales extends ModeleBoxes public $boxcode = "lastpropals"; public $boximg = "object_propal"; public $boxlabel = "BoxLastProposals"; - public $depends = array("propal"); // conf->propal->enabled + public $depends = array("propal"); /** * Constructor diff --git a/htdocs/core/boxes/box_services_contracts.php b/htdocs/core/boxes/box_services_contracts.php index 9993432ccb6..bbabff269ce 100644 --- a/htdocs/core/boxes/box_services_contracts.php +++ b/htdocs/core/boxes/box_services_contracts.php @@ -36,7 +36,7 @@ class box_services_contracts extends ModeleBoxes public $boxcode = "lastproductsincontract"; public $boximg = "object_product"; public $boxlabel = "BoxLastProductsInContract"; - public $depends = array("service", "contrat"); + public $depends = array("service", "contract"); /** * Constructor diff --git a/htdocs/core/boxes/box_services_expired.php b/htdocs/core/boxes/box_services_expired.php index 7b3f8a48251..a59c4ac991b 100644 --- a/htdocs/core/boxes/box_services_expired.php +++ b/htdocs/core/boxes/box_services_expired.php @@ -33,7 +33,7 @@ class box_services_expired extends ModeleBoxes public $boxcode = "expiredservices"; // id of box public $boximg = "object_contract"; public $boxlabel = "BoxOldestExpiredServices"; - public $depends = array("contrat"); // conf->propal->enabled + public $depends = array("contract"); /** * Constructor diff --git a/htdocs/core/boxes/box_task.php b/htdocs/core/boxes/box_task.php index 472f2116d22..e9ef4e3cff1 100644 --- a/htdocs/core/boxes/box_task.php +++ b/htdocs/core/boxes/box_task.php @@ -38,7 +38,7 @@ class box_task extends ModeleBoxes * @var string */ public $boxlabel; - public $depends = array("projet"); + public $depends = array("project"); public $enabled = 1; @@ -50,7 +50,7 @@ class box_task extends ModeleBoxes */ public function __construct($db, $param = '') { - global $conf, $user, $langs; + global $user, $langs; // Load translation files required by the page $langs->loadLangs(array('boxes', 'projects')); From 74bfc0af717ac8985a90b5f520a1143f40d1abef Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 16 Dec 2025 16:30:30 +0100 Subject: [PATCH 23/32] FIX : ProductLot API does not work --- htdocs/product/stock/class/api_productlots.class.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/htdocs/product/stock/class/api_productlots.class.php b/htdocs/product/stock/class/api_productlots.class.php index d7e28b08f62..541077d61a0 100644 --- a/htdocs/product/stock/class/api_productlots.class.php +++ b/htdocs/product/stock/class/api_productlots.class.php @@ -269,14 +269,13 @@ class Productlots extends DolibarrApi $result = $this->productlot->fetch($id); if ($result) { $this->productlot->fetch_optionals(); - $this->productlot->fetch_userassigned(); $this->productlot->oldcopy = clone $this->productlot; // @phan-suppress-current-line PhanTypeMismatchProperty } if (!$result) { throw new RestException(404, 'productlot not found'); } - if (!DolibarrApi::_checkAccessToResource('productlot', $this->productlot->id, 'productlot', '', 'fk_soc', 'id')) { + if (!DolibarrApi::_checkAccessToResource('productlot', $this->productlot->id, 'product_lot', '', 'fk_soc', 'rowid')) { throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } foreach ($request_data as $field => $value) { @@ -298,7 +297,7 @@ class Productlots extends DolibarrApi $this->productlot->$field = $this->_checkValForAPI($field, $value, $this->productlot); } - if ($this->productlot->update(DolibarrApiAccess::$user, 1) > 0) { + if ($this->productlot->update(DolibarrApiAccess::$user) > 0) { return $this->get($id); } @@ -334,11 +333,11 @@ class Productlots extends DolibarrApi throw new RestException(404, 'Product lot not found'); } - if (!DolibarrApi::_checkAccessToResource('productlot', $this->productlot->id, 'productlot', '', 'fk_soc', 'id')) { + if (!DolibarrApi::_checkAccessToResource('productlot', $this->productlot->id, 'product_lot', '', 'fk_soc', 'rowid')) { throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); } - if (!$this->productlot->delete(DolibarrApiAccess::$user)) { + if ($this->productlot->delete(DolibarrApiAccess::$user) < 0) { throw new RestException(500, 'Error when delete Product lot : '.$this->productlot->error); } From 55b20bfdb9bb6a6c8d04e8ee190d25d5fba244c7 Mon Sep 17 00:00:00 2001 From: Adrien Raze Date: Tue, 16 Dec 2025 16:54:24 +0100 Subject: [PATCH 24/32] FIX : displaing errors --- htdocs/product/stock/class/api_productlots.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/product/stock/class/api_productlots.class.php b/htdocs/product/stock/class/api_productlots.class.php index 541077d61a0..b9e1a82b8b0 100644 --- a/htdocs/product/stock/class/api_productlots.class.php +++ b/htdocs/product/stock/class/api_productlots.class.php @@ -338,7 +338,7 @@ class Productlots extends DolibarrApi } if ($this->productlot->delete(DolibarrApiAccess::$user) < 0) { - throw new RestException(500, 'Error when delete Product lot : '.$this->productlot->error); + throw new RestException(500, 'Error when delete Product lot : '.implode(',', $this->productlot->errors)); } return array( From 90000a24ea47c3686510693840aae02609a66341 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 16 Dec 2025 20:38:11 +0100 Subject: [PATCH 25/32] Trans --- htdocs/admin/subcontractors.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- htdocs/langs/fr_FR/admin.lang | 2 +- htdocs/theme/eldy/global.inc.php | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/subcontractors.php b/htdocs/admin/subcontractors.php index 20255b1a811..77d69fc8405 100644 --- a/htdocs/admin/subcontractors.php +++ b/htdocs/admin/subcontractors.php @@ -145,7 +145,7 @@ print ''; print ''; print ''; -print load_fiche_titre($langs->trans("AccountantingProvider"), '', 'accounting', 0, '', '', '', ''); +print load_fiche_titre($langs->trans("AccountingProvider"), '', 'accounting', 0, '', '', '', ''); print ''; print ''."\n"; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index e71f8a81c86..9db09151994 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1336,7 +1336,7 @@ CompanyFundationDesc=Edit the information of your company/organization. Click on MoreNetworksAvailableWithModule=More social networks may be available by enabling the module "Social networks". Subcontractors=Subcontractors SubcontractorsDesc=If the management of your application is subcontracted to external service providers (an accountant/bookkeeper and/or an IT service provider), you can enter here their information so it won't be lost in case of a substition of the administrator. -AccountantingProvider=Accounting service provider +AccountingProvider=Accounting service provider ITProvider=IT service prodiver AccountantFileNumber=Accountant code DisplayDesc=Parameters affecting the look and presentation of the application can be modified here. diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang index b29c8e5f33e..7aa90a65c7c 100644 --- a/htdocs/langs/fr_FR/admin.lang +++ b/htdocs/langs/fr_FR/admin.lang @@ -1334,7 +1334,7 @@ CompanyFundationDesc=Modifiez les informations de votre société/organisation. MoreNetworksAvailableWithModule=Plus de réseaux sociaux peuvent être disponible en activant le module "Réseaux Sociaux". Subcontractors=sous-traitants SubcontractorsDesc=Si la gestion de votre application est sous-traitée à des prestataires externes (un comptable/expert-comptable/un prestataire informatique), vous pouvez saisir ici leurs informations afin qu'elles ne soient pas perdues en cas de remplacement de l'administrateur. -AccountantingProvider=Fournisseur Comptabilité service +AccountingProvider=Fournisseur Comptabilité service ITProvider=Fournisseur IT service AccountantFileNumber=Code comptable DisplayDesc=Les paramètres affectant l'apparence et la présentation de l'application peuvent être modifiés ici. diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 2474566770c..31c2ecb7a9e 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -3796,6 +3796,7 @@ div.vmenu, td.vmenu { .vmenu { width: px; margin-left: 8px; + text-transform: capitalize; display: none; From 7ab079d0f0ca1795b2943164208d76898b2f6cb1 Mon Sep 17 00:00:00 2001 From: William Mead Date: Wed, 17 Dec 2025 08:39:46 +0100 Subject: [PATCH 26/32] Added stock warehouse documents --- htdocs/api/class/api_documents.class.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 4d6e0662746..ca640756e32 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -709,6 +709,19 @@ class Documents extends DolibarrApi throw new RestException(404, 'Contact not found'); } $upload_dir = $conf->societe->multidir_output[$object->entity ?? $conf->entity] . "/contact/" . get_exdir(0, 0, 0, 1, $object, 'contact'); + } elseif ($modulepart == 'stock') { + require_once DOL_DOCUMENT_ROOT.'/product/stock/class/entrepot.class.php'; + + if (!DolibarrApiAccess::$user->hasRight('stock', 'lire')) { + throw new RestException(403); + } + + $object = new Entrepot($this->db); + $result = $object->fetch($id, $ref); + if (!$result) { + throw new RestException(404, 'Warehouse not found'); + } + $upload_dir = $conf->stock->multidir_output[$object->entity ?? $conf->entity].'/'.get_exdir(0, 0, 0, 1, $object, 'stock'); } else { throw new RestException(500, 'Modulepart '.$modulepart.' not implemented yet.'); } From 969b4e68d4603bfa3e0a4b53d808c4b89b606a02 Mon Sep 17 00:00:00 2001 From: William Mead Date: Wed, 17 Dec 2025 08:58:24 +0100 Subject: [PATCH 27/32] Added warehouse document download --- htdocs/core/lib/files.lib.php | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 60fae8a9443..130c9542b7e 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -3565,6 +3565,17 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, if (isModEnabled('stock')) { $original_file = $conf->stock->multidir_output[$entity].'/movement/'.$original_file; } + } elseif ($modulepart == 'entrepot') { + // Wrapping for stock warehouse + if (empty($entity) || empty($conf->stock->multidir_output[$entity])) { + return array('accessallowed' => 0, 'error' => 'Value entity must be provided'); + } + if (($fuser->hasRight('stock', $lire) || $fuser->hasRight('stock', 'movement', $lire) || $fuser->hasRight('stock', 'mouvement', $lire)) || preg_match('/^specimen/i', $original_file)) { + $accessallowed = 1; + } + if (isModEnabled('stock')) { + $original_file = $conf->stock->multidir_output[$entity].'/'.$original_file; + } } elseif ($modulepart == 'contract' && !empty($conf->contract->multidir_output[$entity])) { // Wrapping pour les contrats if ($fuser->hasRight('contrat', $lire) || preg_match('/^specimen/i', $original_file)) { From 46cc35faff3896475334ad90046e10900aec9c2e Mon Sep 17 00:00:00 2001 From: William Mead Date: Wed, 17 Dec 2025 09:07:32 +0100 Subject: [PATCH 28/32] Added warehouse document generation --- htdocs/api/class/api_documents.class.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 4d6e0662746..30971e6368f 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -324,6 +324,22 @@ class Documents extends DolibarrApi $templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf; $result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result <= 0) { + throw new RestException(500, 'Error generating document missing doctemplate parameter'); + } + } elseif ($modulepart == 'stock') { + require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; + + $tmpobject = new Entrepot($this->db); + $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); + + if (!$result) { + throw new RestException(404, 'Warehouse not found'); + } + + $templateused = $doctemplate ? $doctemplate : $tmpobject->model_pdf; + $result = $tmpobject->generateDocument($templateused, $outputlangs, $hidedetails, $hidedesc, $hideref); + if ($result <= 0) { throw new RestException(500, 'Error generating document missing doctemplate parameter'); } From c0503d1e89f88e6216c892353452c12d9127fcd1 Mon Sep 17 00:00:00 2001 From: William Mead Date: Wed, 17 Dec 2025 09:08:00 +0100 Subject: [PATCH 29/32] Updated modulepart check --- htdocs/api/class/api_documents.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 30971e6368f..f1b68e839c1 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -327,7 +327,7 @@ class Documents extends DolibarrApi if ($result <= 0) { throw new RestException(500, 'Error generating document missing doctemplate parameter'); } - } elseif ($modulepart == 'stock') { + } elseif ($modulepart == 'stock' || $modulepart == 'entrepot') { require_once DOL_DOCUMENT_ROOT . '/product/stock/class/entrepot.class.php'; $tmpobject = new Entrepot($this->db); From 239f036252e816e3dd4c58279c2289f85937fa6b Mon Sep 17 00:00:00 2001 From: William Mead Date: Wed, 17 Dec 2025 10:11:50 +0100 Subject: [PATCH 30/32] Deleted duplicate route. Cleaned settodraft method. Updated changelog. --- ChangeLog | 1 + .../class/api_interventions.class.php | 61 ++++--------------- 2 files changed, 12 insertions(+), 50 deletions(-) diff --git a/ChangeLog b/ChangeLog index c724f3758c5..a1ce3b0ad4d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -213,6 +213,7 @@ The following changes may create regressions for some external modules, but were * $conf use into "computed formulae" of etrafields is now deprecated (not yet forbidden). You can replace use of $conf->currency by the new method getCurrency() and $conf->global->xxx by getDolGlobalString('xxx'). * $user->rights->module->perms is also deprecated. You can use $user->hasRight() instead. * The API endpoint /proposals/{id}/contact/{contactid}/{type}/{source} is now {id}/contact/{contactid}/{type} to match same behaviour than order and invoices. +* The API endpoint /interventions/{id}/reopen hase been removed in favor of /interventions/{id}/settodraft ***** ChangeLog for 22.0.3 compared to 22.0.2 ***** diff --git a/htdocs/fichinter/class/api_interventions.class.php b/htdocs/fichinter/class/api_interventions.class.php index ba7be1ab403..fc4dec547c2 100644 --- a/htdocs/fichinter/class/api_interventions.class.php +++ b/htdocs/fichinter/class/api_interventions.class.php @@ -474,43 +474,6 @@ class Interventions extends DolibarrApi ); } - /** - * Reopen an intervention - * - * @since 22.0.0 Initial implementation - * - * @param int $id Intervention ID - * - * @url POST {id}/reopen - * - * @return Object - * - * @throws RestException - */ - public function reopen($id) - { - if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { - throw new RestException(403, "Insufficiant rights"); - } - $result = $this->fichinter->fetch($id); - if (!$result) { - throw new RestException(404, 'Intervention not found'); - } - - if (!DolibarrApi::_checkAccessToResource('fichinter', $this->fichinter->id)) { - throw new RestException(403, 'Access not allowed for login '.DolibarrApiAccess::$user->login); - } - $result = $this->fichinter->setDraft(DolibarrApiAccess::$user); - if ($result == 0) { - throw new RestException(304, 'Error nothing done. May be object is already set as draft'); - } - if ($result < 0) { - throw new RestException(500, 'Error when closing Intervention: '.$this->fichinter->error); - } - $this->fichinter->fetchObjectLinked(); - return $this->_cleanObjectDatas($this->fichinter); - } - /** * Validate an intervention * @@ -651,27 +614,29 @@ class Interventions extends DolibarrApi } /** - * Sets an interventional as draft + * Sets an intervention as draft * - * @param int $id interventional ID + * @since 23.0.0 Initial implementation + * + * @param int $id ID of intervention * * @return Object Object with cleaned properties * - * @url POST {id}/settodraft + * @url POST {id}/settodraft * * @throws RestException 304 - * @throws RestException 401 + * @throws RestException 403 * @throws RestException 404 * @throws RestException 500 System error */ public function settodraft($id) { if (!DolibarrApiAccess::$user->hasRight('ficheinter', 'creer')) { - throw new RestException(403); + throw new RestException(403, "Insufficiant rights"); } $result = $this->fichinter->fetch($id); if (!$result) { - throw new RestException(404, 'Interventional not found'); + throw new RestException(404, 'Intervention not found'); } if (!DolibarrApi::_checkAccessToResource('ficheinter', $this->fichinter->id)) { @@ -680,17 +645,13 @@ class Interventions extends DolibarrApi $result = $this->fichinter->setDraft(DolibarrApiAccess::$user); if ($result == 0) { - throw new RestException(304, 'Nothing done.'); + throw new RestException(304, 'Nothing done. . May be object is already set as draft.'); } if ($result < 0) { - throw new RestException(500, 'Error : '.$this->fichinter->error); - } - - $result = $this->fichinter->fetch($id); - if (!$result) { - throw new RestException(404, 'Interventional not found'); + throw new RestException(500, 'Error when closing intervention: '.$this->fichinter->error); } + $this->fichinter->fetchObjectLinked(); return $this->_cleanObjectDatas($this->fichinter); } From 56452b122d80fbaa2021c76a0ab3632d162cf7be Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Dec 2025 12:57:44 +0100 Subject: [PATCH 31/32] Debug v23 pb with height of popup --- htdocs/admin/modules.php | 5 +++-- htdocs/core/js/lib_head.js.php | 4 ++-- htdocs/theme/eldy/global.inc.php | 5 +++++ htdocs/theme/md/style.css.php | 8 ++++++++ 4 files changed, 18 insertions(+), 4 deletions(-) diff --git a/htdocs/admin/modules.php b/htdocs/admin/modules.php index 179cc14aa43..3625d91c40a 100644 --- a/htdocs/admin/modules.php +++ b/htdocs/admin/modules.php @@ -1170,11 +1170,12 @@ if ($mode == 'common' || $mode == 'commonkanban') { } $urltogo = $_SERVER["PHP_SELF"].'?id='.$objMod->numero.'&token='.newToken().'&module_position='.$module_position.'&action=set&token='.newToken().'&value='.$modName.'&mode='.$mode.$param; - $popupwidth = 500; + $popupWidth = 500; + $popupHeight = 300; $codeenabledisable .= ''."\n"; $codeenabledisable .= 'numero.'\', '.$popupwidth.', '.$disableCancel.');"'; + $codeenabledisable .= ' onclick="return confirmDolibarr(\''.dol_escape_js($warningmessage).'\', \'idqualified'.$objMod->numero.'\', '.$popupWidth.', '.$popupHeight.','.$disableCancel.');"'; } $codeenabledisable .= '>'; $codeenabledisable .= img_picto($langs->trans("Disabled"), 'switch_off'); diff --git a/htdocs/core/js/lib_head.js.php b/htdocs/core/js/lib_head.js.php index d9e95e9cd4d..289b9a13fc6 100644 --- a/htdocs/core/js/lib_head.js.php +++ b/htdocs/core/js/lib_head.js.php @@ -570,14 +570,14 @@ function cleanSerialize(expr) { * Input: msg * Input: id * Input: popupWidth + * Input: popupHeight * Input: disableCancelButton * Licence: GPL * See also document_preview() that also maje a dialogforpopup.dialog(). * See also newpopup that use window.open. */ -function confirmDolibarr(msg, id, popupWidth = 400, disableCancelButton = 0) { +function confirmDolibarr(msg, id, popupWidth = 400, popupHeight = 300, disableCancelButton = 0) { let alink = document.getElementById(id); - let popupHeight = 200; let title = 'trans("Note")); ?>'; if (alink.getAttribute("data-alreadyclicked") === "1") { diff --git a/htdocs/theme/eldy/global.inc.php b/htdocs/theme/eldy/global.inc.php index 31c2ecb7a9e..c903ae9371f 100644 --- a/htdocs/theme/eldy/global.inc.php +++ b/htdocs/theme/eldy/global.inc.php @@ -5966,6 +5966,11 @@ button.ui-button-icon-only.ui-dialog-titlebar-close { .ui-dialog .ui-dialog-content, .ui-dialog .ui-dialog-titlebar.ui-widget-header { padding-left: 1em !important; } +/* +.ui-dialog .ui-dialog-content { + text-align: justify; +} +*/ /* ============================================================================== */ diff --git a/htdocs/theme/md/style.css.php b/htdocs/theme/md/style.css.php index 11fb28c8667..0d103a43013 100644 --- a/htdocs/theme/md/style.css.php +++ b/htdocs/theme/md/style.css.php @@ -5877,6 +5877,14 @@ div#dialogforpopup { .ui-dialog .ui-dialog-buttonpane { padding: .5em 1em .3em .4em; } +.ui-dialog .ui-dialog-content, .ui-dialog .ui-dialog-titlebar.ui-widget-header { + padding-left: 1em !important; +} +/* +.ui-dialog .ui-dialog-content { + text-align: justify; +} +*/ /* ============================================================================== */ From 96162564a396b160ab666ec1b22553a7b9ff4636 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Dec 2025 13:41:35 +0100 Subject: [PATCH 32/32] Try fix for #36513 --- htdocs/core/tpl/objectline_create.tpl.php | 26 +++++++++++------------ htdocs/core/tpl/objectline_edit.tpl.php | 14 ++++++------ 2 files changed, 21 insertions(+), 19 deletions(-) diff --git a/htdocs/core/tpl/objectline_create.tpl.php b/htdocs/core/tpl/objectline_create.tpl.php index 1922b52627e..c23fcb1f563 100644 --- a/htdocs/core/tpl/objectline_create.tpl.php +++ b/htdocs/core/tpl/objectline_create.tpl.php @@ -674,14 +674,14 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { $("input[name='np_marginRate']:first").blur(function(e) { - console.log("np_marginRate blur"); + console.log("np_marginRate blur, call checkFreeLine"); return checkFreeLine(e, "np_marginRate"); }); $("input[name='np_markRate']:first").blur(function(e) { - console.log("np_markRate blur"); + console.log("np_markRate blur, call checkFreeLine"); return checkFreeLine(e, "np_markRate"); }); hasRight('margins', 'creer')) { if (rate.val() == '') return true; - if (! $.isNumeric(rate.val().replace(',','.'))) - { + if (! $.isNumeric(rate.val().replace(',','.'))) { // TODO Use price2numjs ? alert('trans("rateMustBeNumeric")); ?>'); e.stopPropagation(); setTimeout(function () { rate.focus() }, 50); return false; } - if (npRate == "np_markRate" && rate.val() >= 100) - { + if (npRate == "np_markRate" && rate.val() >= 100) { // TODO Use price2numjs ? alert('trans("markRateShouldBeLesserThan100")); ?>'); e.stopPropagation(); setTimeout(function () { rate.focus() }, 50); @@ -714,14 +712,15 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { } var price = 0; - remisejs=price2numjs(remise.val()); + remisejs = price2numjs(remise.val()); - if (remisejs != 100) // If a discount not 100 or no discount - { - if (remisejs == '') remisejs=0; + if (remisejs != 100) { // If there is a discount that is not 100 or if no discount at all (most common case) + if (remisejs == '') { + remisejs=0; + } - bpjs=price2numjs(buying_price.val()); - ratejs=price2numjs(rate.val()); + bpjs = price2numjs(buying_price.val()); + ratejs = price2numjs(rate.val()); if (npRate == "np_marginRate") price = ((bpjs * (1 + ratejs / 100)) / (1 - remisejs / 100)); @@ -729,7 +728,8 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); } - $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formatted value + // $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formatted value + $("input[name='price_ht']:first").val(pricejs(price)); return true; } diff --git a/htdocs/core/tpl/objectline_edit.tpl.php b/htdocs/core/tpl/objectline_edit.tpl.php index 02a75697a87..7d030fbaab3 100644 --- a/htdocs/core/tpl/objectline_edit.tpl.php +++ b/htdocs/core/tpl/objectline_edit.tpl.php @@ -504,6 +504,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { if (getDolGlobalString('DISPLAY_MARGIN_RATES')) { ?> $("input[name='np_marginRate']:first").blur(function(e) { + console.log("np_marginRate blur, call checkFreeLine"); return checkFreeLine(e, "np_marginRate"); }); hasRight('margins', 'creer')) { if (getDolGlobalString('DISPLAY_MARK_RATES')) { ?> $("input[name='np_markRate']:first").blur(function(e) { + console.log("np_markRate blur, call checkFreeLine"); return checkFreeLine(e, "np_markRate"); }); hasRight('margins', 'creer')) { return true; var ratejs = price2numjs(rate.val()); - if (! $.isNumeric(ratejs)) - { + if (! $.isNumeric(rate.val().replace(',','.'))) { // TODO Use price2numjs ? alert('transnoentities("rateMustBeNumeric")); ?>'); e.stopPropagation(); setTimeout(function () { rate.focus() }, 50); return false; } - if (npRate == "np_markRate" && rate.val() >= 100) - { + if (npRate == "np_markRate" && rate.val() >= 100) { // TODO Use price2numjs ? alert('transnoentities("markRateShouldBeLesserThan100")); ?>'); e.stopPropagation(); setTimeout(function () { rate.focus() }, 50); @@ -546,7 +546,7 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { var price = 0; remisejs = price2numjs(remise.val()); - if (remisejs != 100) { // If a discount not 100 or no discount + if (remisejs != 100) { // If there is a discount that is not 100 or if no discount at all (most common case) if (remisejs == '') { remisejs = 0; } @@ -559,7 +559,9 @@ if (!empty($usemargins) && $user->hasRight('margins', 'creer')) { else if (npRate == "np_markRate") price = ((bpjs / (1 - ratejs / 100)) / (1 - remisejs / 100)); } - $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formatted value + + // $("input[name='price_ht']:first").val(price); // TODO Must use a function like php price to have here a formatted value + $("input[name='price_ht']:first").val(pricejs(price)); return true; }
'.$langs->trans("CompanyInfo").'