From 3f53aa073ad1472f92faa9c37867ba637533994d Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sat, 13 Dec 2025 12:57:04 +0200 Subject: [PATCH 01/21] Fix typos --- htdocs/langs/en_US/admin.lang | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7542e7d9915..e71f8a81c86 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1378,7 +1378,7 @@ BackupDescX=The archived directory should be stored in a secure place. BackupDescY=The generated dump file should be stored in a secure place. BackupPHPWarning=Backup cannot be guaranteed with this method. Previous one recommended. RestoreDesc=To restore a Dolibarr system backup, %s steps are required. -RestoreDescMore=Note: For security reason, it is not possible to make system or data restoration from the application itself. The following steps, described here, are provided for a system administrator that has have full access on the server to remind how to make a complete system restauration. +RestoreDescMore=Note: For security reason, it is not possible to make system or data restoration from the application itself. The following steps, described here, are provided for a system administrator that has have full access on the server to remind how to make a complete system restoration. RestoreDesc2=Restore the backup file (zip file for example) of the "documents" directory to a new Dolibarr installation or into this current documents directory (%s). RestoreDesc3=Restore the database structure and data from a backup dump file into the database of the new Dolibarr installation or into the database of this current installation (%s). Warning, once the restore is complete, you must use a login/password, that existed from the backup time/installation to connect again.
To restore a backup database into this current installation, you can follow this assistant. RestoreDesc4=Restore the value of the key %s found into the file conf/conf.php @@ -2742,7 +2742,7 @@ MainSecurityPolicySucesfullyRemoved=Content Security Policy successfully removed MainErrorRemovingSecurityPolicy=An error occurred when trying to remove a Content Security Policy MainSecurityPolicySucesfullyAdded=Content Security Policy successfully added MainErrorAddingSecurityPolicy=An error occurred when trying to add a Content Security Policy -SecurityForConnection=Credentials for connexion +SecurityForConnection=Credentials for connection AddCredential=Add a credential API_ENABLE_COUNT_CALLS=Enable counting of API calls (slower). The value of API count is visible on the user page. MCPServer=MCP Server @@ -2752,7 +2752,7 @@ ShowListOfFiles=Show list of analyzed files... ModuleProviderSites=Module providers StillInDevelopment=Still in development SeeValueIntoConfPhp=Some sensitive data in database are encrypted using this key. Without it, system backup and restoration is still possible but sensitive data (Tokens, BAN) would remain obfuscated and you will need to regenerate them. -SeeValueIntoConfPhp2=For security purpose, this value can only be read by a system user, that has a file system access to the conf/conf.php file. If you need a non system backup, without encrypted data, you can use the "export" menu to export your data in clear CSV files. +SeeValueIntoConfPhp2=For security purposes, this value can only be read by a system user, that has a file system access to the conf/conf.php file. If you need a non system backup, without encrypted data, you can use the "export" menu to export your data in clear CSV files. StatusOfModule=Status of module %s DisabledByOptionADD_UNSPLASH_LOGIN_BACKGROUND=Disabled by option ADD_UNSPLASH_LOGIN_BACKGROUND GlobalParameters=Global parameters From f76605866b3d7097f3da818538a40160f665f63f Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sat, 13 Dec 2025 12:59:21 +0200 Subject: [PATCH 02/21] Fix description wording for public interface Updated description for public interface company page. --- htdocs/langs/en_US/companies.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/companies.lang b/htdocs/langs/en_US/companies.lang index 4a9e29df6e6..a7e8f075795 100644 --- a/htdocs/langs/en_US/companies.lang +++ b/htdocs/langs/en_US/companies.lang @@ -475,5 +475,5 @@ ConfirmCloneThirdparties=Are you sure that you want to clone %s company ? SocialNetworksBusiness=Social networks for company ErrorCommercialNotAllowedForThirdparty=The user %s has not the permission to see all thirdparties and is not an allowed sale representative of the company. EnablePublicCompanyPages=Enable the public contact page -PublicInterfaceCompanyDesc=This option offer a public page to offer an online contact form to allow any anonymous visitor to send you a message (creating also a thirdparty and/or contact, automatically). +PublicInterfaceCompanyDesc=This option offer a public page with an online contact form to allow any anonymous visitor to send you a message (creating also a thirdparty and/or contact, automatically). ImpossibleToCreateUserFromContact=Impossible to create user from this contact From 9d0e061bf326e58437afd63a5a6fbf09f3bdbfb1 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sat, 13 Dec 2025 13:08:54 +0200 Subject: [PATCH 03/21] Translate error message to English --- htdocs/langs/en_US/errors.lang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/langs/en_US/errors.lang b/htdocs/langs/en_US/errors.lang index 20c66ad8f15..288e52359cb 100644 --- a/htdocs/langs/en_US/errors.lang +++ b/htdocs/langs/en_US/errors.lang @@ -49,7 +49,7 @@ ErrorBadParameters=Bad parameters ErrorWrongParameters=Wrong or missing parameters ErrorBadValueForParameter=Wrong value '%s' for parameter '%s' ErrorBadImageFormat=Image file has not a supported format (Your PHP does not support functions to convert images of this format) -ErrorPHPDoesNotSupport=Votre installation PHP ne prend pas en charge les fonctions %s. +ErrorPHPDoesNotSupport=Your PHP installation does not support functions %s. ErrorSupportedFormatAre=Supported formats are: %s ErrorBadDateFormat=Value '%s' has wrong date format ErrorWrongDate=Date is not correct! @@ -166,7 +166,7 @@ ErrorDateMustBeInFuture=The date must be greater than today ErrorStartDateGreaterEnd=The start date is greater than the end date ErrorPaymentModeDefinedToWithoutSetup=A payment mode was set to type %s but setup of module Invoice was not completed to define information to show for this payment mode. ErrorPHPNeedModule=Error, your PHP must have module %s installed to use this feature. -ErrorOpenIDSetupConfNotComplete=For security reason, you must also setup the Dolibarr config file conf.php to allow OpenID authentication +ErrorOpenIDSetupConfNotComplete=For security purposes, you must also setup the Dolibarr config file conf.php to allow OpenID authentication ErrorOpenIDSetupNotComplete=You setup Dolibarr config file to allow OpenID authentication, but URL of OpenID service is not defined into constant %s ErrorWarehouseMustDiffers=Source and target warehouses must differs ErrorBadFormat=Bad format! From dd314257e625c0639263287edd019483b1606cb0 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sat, 13 Dec 2025 13:13:04 +0200 Subject: [PATCH 04/21] Fix typo --- htdocs/langs/en_US/members.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/members.lang b/htdocs/langs/en_US/members.lang index 3005c83e03e..183a6034344 100644 --- a/htdocs/langs/en_US/members.lang +++ b/htdocs/langs/en_US/members.lang @@ -250,7 +250,7 @@ Caneditamount=Can edit amount Morphy=Moral or physical ErrorBadValueForDate=Bad value for date MemberMergeSuccess=Members have been merged -MergeOriginMemberIsMAndatory= Origin member is mendatory for merging +MergeOriginMemberIsMAndatory= Origin member is mandatory for merging MergeOriginMember=Duplicated member (the member you want to delete) SelectMember=Select a member MergeMembers=Merge members From 8d62cbe91266910250cb89698b2af366a7555ba8 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sat, 13 Dec 2025 13:15:19 +0200 Subject: [PATCH 05/21] Fix typo --- htdocs/langs/en_US/other.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index a2512ce5af6..1c2c77397a1 100644 --- a/htdocs/langs/en_US/other.lang +++ b/htdocs/langs/en_US/other.lang @@ -112,7 +112,7 @@ PredefinedMailContentSendOrder=__(Hello)__\n\nPlease find order __REF__ attached PredefinedMailContentSendSupplierOrder=__(Hello)__\n\nPlease find our order __REF__ attached\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__ PredefinedMailContentSendSupplierInvoice=__(Hello)__\n\nPlease find invoice __REF__ attached\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__ PredefinedMailContentSendSupplierPayment=__(Hello)__\n\nPlease find on __DATE_YMD__ payment __REF__, corresponding to invoices : \n\n__SUPPLIER_PAYMENT_INVOICES_LIST__\n\nTotal : __SUPPLIER_PAYMENT_INVOICES_TOTAL__\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__ -AmountPayed=amount payed +AmountPayed=amount paid PredefinedMailContentSendShipping=__(Hello)__\n\nPlease find shipping __REF__ attached\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__ PredefinedMailContentSendReception=__(Hello)__\n\nPlease find reception __REF__ attached\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__ PredefinedMailContentSendFichInter=__(Hello)__\n\nPlease find intervention __REF__ attached\n\n\n__(Sincerely)__\n\n__SENDEREMAIL_SIGNATURE__ From 2b32856c7d5907376f2aea558e0c4c2f821ec368 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sat, 13 Dec 2025 13:18:25 +0200 Subject: [PATCH 06/21] fix typo --- htdocs/langs/en_US/users.lang | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/langs/en_US/users.lang b/htdocs/langs/en_US/users.lang index 2049e43c8e4..f33f2157910 100644 --- a/htdocs/langs/en_US/users.lang +++ b/htdocs/langs/en_US/users.lang @@ -159,7 +159,7 @@ BackToTokenList=Back to token list MyTeam=My team TotalAPICall=Total API Calls TOTP=TOTP (Time-base One-Time Password) -2FA=2 Factors Authentication +2FA=Two-factor authentication (2FA) UserRemovedFromGroup=User removed from group UserSetInGroup=User set in group ColorGroup=Color of group From 7456c119e5c12f3dffd6689568f99c7e36948277 Mon Sep 17 00:00:00 2001 From: MDW Date: Sat, 13 Dec 2025 12:13:11 +0100 Subject: [PATCH 07/21] Qual: Update Phan baseline and fix type mismatch in conferenceorbooth_list.php # Qual: Update Phan baseline and fix type mismatch in conferenceorbooth_list.php - Updated the Phan baseline to reflect the reduced number of PhanUndeclaredMethod occurrences - Fixed a type mismatch in conferenceorbooth_list.php by changing the values from integers to strings in the editfieldkey and editfieldval functions --- dev/tools/phan/baseline.txt | 4 +--- htdocs/eventorganization/conferenceorbooth_list.php | 8 ++++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/dev/tools/phan/baseline.txt b/dev/tools/phan/baseline.txt index 592075093a4..189308f6c13 100644 --- a/dev/tools/phan/baseline.txt +++ b/dev/tools/phan/baseline.txt @@ -16,9 +16,9 @@ return [ // PhanTypeMismatchProperty : 20+ occurrences // PhanTypeInvalidDimOffset : 15+ occurrences // PhanTypeMismatchDimFetch : 10+ occurrences - // PhanUndeclaredMethod : 6 occurrences // PhanTypeArraySuspiciousNull : 5 occurrences // PhanTypeExpectedObjectPropAccess : 5 occurrences + // PhanUndeclaredMethod : 5 occurrences // PhanPluginDuplicateArrayKey : 4 occurrences // PhanPluginUndeclaredVariableIsset : 2 occurrences // PhanPossiblyUndeclaredGlobalVariable : 2 occurrences @@ -30,7 +30,6 @@ return [ // Currently, file_suppressions and directory_suppressions are the only supported suppressions 'file_suppressions' => [ - 'htdocs/bookcal/class/calendar.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], 'htdocs/categories/viewcat.php' => ['PhanUndeclaredProperty'], 'htdocs/comm/action/index.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchProperty'], 'htdocs/comm/action/pertype.php' => ['PhanTypeExpectedObjectPropAccess'], @@ -147,7 +146,6 @@ return [ 'htdocs/delivery/class/delivery.class.php' => ['PhanUndeclaredProperty'], 'htdocs/emailcollector/class/emailcollector.class.php' => ['PhanUndeclaredProperty'], 'htdocs/eventorganization/class/conferenceorboothattendee.class.php' => ['PhanUndeclaredMethod', 'PhanUndeclaredProperty'], - 'htdocs/eventorganization/conferenceorbooth_list.php' => ['PhanTypeMismatchArgument'], 'htdocs/eventorganization/core/actions_massactions_mail.inc.php' => ['PhanUndeclaredProperty'], 'htdocs/expedition/card.php' => ['PhanUndeclaredGlobalVariable', 'PhanUndeclaredProperty'], 'htdocs/expedition/class/expedition.class.php' => ['PhanUndeclaredProperty'], diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index 05459eb7712..b41b304fde7 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -466,17 +466,17 @@ if ($projectid > 0) { print ''; $typeofdata = 'checkbox:'.($project->accept_conference_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestConfHelp"); - print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); + print $form->editfieldkey('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? '1' : '0'), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', null, null, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestConf', 'accept_conference_suggestions', ($project->accept_conference_suggestions ? '1' : '0'), $project, $permissiontoadd, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; $typeofdata = 'checkbox:'.($project->accept_booth_suggestions ? ' checked="checked"' : ''); $htmltext = $langs->trans("AllowUnknownPeopleSuggestBoothHelp"); - print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); + print $form->editfieldkey('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? '1' : '0'), $project, $permissiontoadd, $typeofdata, '', 0, 0, 'projectid', $htmltext); print ''; - print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? 1 : 0), $project, $permissiontoadd, $typeofdata, '', null, null, '', 0, '', 'projectid'); + print $form->editfieldval('AllowUnknownPeopleSuggestBooth', 'accept_booth_suggestions', ($project->accept_booth_suggestions ? '1' : '0'), $project, $permissiontoadd, $typeofdata, '', null, null, '', 0, '', 'projectid'); print ""; print ''; From af55f4efe7067ac1212670bdcedc1e0f7d3426fb Mon Sep 17 00:00:00 2001 From: William Mead Date: Sat, 13 Dec 2025 17:44:14 +0100 Subject: [PATCH 08/21] Added expense report to document API builddoc --- 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 6f995b9917b..a86f15fab7b 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -297,6 +297,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 == 'expensereport') { + require_once DOL_DOCUMENT_ROOT.'/expensereport/class/expensereport.class.php'; + + $tmpobject = new ExpenseReport($this->db); + $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); + + if (!$result) { + throw new RestException(404, 'Exepnse report 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 88853939402efa9cae40dbe3a29d5c364985fe4c Mon Sep 17 00:00:00 2001 From: William Mead Date: Sun, 14 Dec 2025 11:54:09 +0100 Subject: [PATCH 09/21] Fixed document upload for third party --- htdocs/api/class/api_documents.class.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 6f995b9917b..516294ce380 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -892,7 +892,7 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $object = new Contact($this->db); $fetchbyid = true; - } elseif ($modulepart == 'societe' || $modulepart == 'company') { + } elseif ($modulepart == 'societe' || $modulepart == 'company' || $modulepart == 'thirdparty') { $modulepart = 'societe'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $object = new Societe($this->db); @@ -948,7 +948,11 @@ class Documents extends DolibarrApi // Test on permissions //if ($modulepart != 'ecm') { // Here $modulepart is always != 'ecm' - $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); + if ($modulepart == 'societe' || $modulepart == 'company' || $modulepart == 'thirdparty') { + $relativefile = $tmpreldir.dol_sanitizeFileName($object->id); + } else { + $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); + } $tmp = dol_check_secure_access_document($modulepart, $relativefile, $entity, DolibarrApiAccess::$user, $ref, 'write'); $upload_dir = $tmp['original_file']; // No dirname here, tmp['original_file'] is already the dir because dol_check_secure_access_document was called with param original_file that is only the dir /*} else { From 905040e5ab8818036350c9a3cabe75cf06ace9c3 Mon Sep 17 00:00:00 2001 From: William Mead Date: Sun, 14 Dec 2025 12:06:41 +0100 Subject: [PATCH 10/21] Updated PHPDoc --- 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 516294ce380..af08aa5ea07 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -768,7 +768,7 @@ class Documents extends DolibarrApi * * @param string $filename Name of file to create ('FA1705-0123.txt') * @param string $modulepart Name of module or area concerned by file upload ('product', 'service', 'invoice', 'proposal', 'project', 'project_task', 'supplier_invoice', 'expensereport', 'member', ...) - * @param string $ref Reference of object (This will define subdir automatically and store submitted file into it) + * @param string $ref Reference of object (This will define subdir automatically and store submitted file into it). For third party use object ID not name. * @param string $subdir Subdirectory (Only if $ref is not provided) * @param string $filecontent File content (string with file content. An empty file will be created if this parameter is not provided) * @param string $fileencoding File encoding (''=no encoding, 'base64'=Base 64) From 96b8515b3dd9213a0f4157b04e13bbf7a8fe3591 Mon Sep 17 00:00:00 2001 From: William Mead Date: Sun, 14 Dec 2025 12:49:34 +0100 Subject: [PATCH 11/21] Fixed type --- 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 af08aa5ea07..aa62b157309 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -949,7 +949,7 @@ class Documents extends DolibarrApi // Test on permissions //if ($modulepart != 'ecm') { // Here $modulepart is always != 'ecm' if ($modulepart == 'societe' || $modulepart == 'company' || $modulepart == 'thirdparty') { - $relativefile = $tmpreldir.dol_sanitizeFileName($object->id); + $relativefile = $tmpreldir.dol_sanitizeFileName((string) $object->id); } else { $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); } From fa6e85fbed87e848147cc196f182dcbab24784da Mon Sep 17 00:00:00 2001 From: William Mead Date: Sun, 14 Dec 2025 13:19:02 +0100 Subject: [PATCH 12/21] Cleaned code --- htdocs/api/class/api_documents.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index aa62b157309..b5cd6040a4f 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -892,7 +892,7 @@ class Documents extends DolibarrApi require_once DOL_DOCUMENT_ROOT.'/contact/class/contact.class.php'; $object = new Contact($this->db); $fetchbyid = true; - } elseif ($modulepart == 'societe' || $modulepart == 'company' || $modulepart == 'thirdparty') { + } elseif ($modulepart == 'societe' || $modulepart == 'company') { $modulepart = 'societe'; require_once DOL_DOCUMENT_ROOT.'/societe/class/societe.class.php'; $object = new Societe($this->db); @@ -948,7 +948,7 @@ class Documents extends DolibarrApi // Test on permissions //if ($modulepart != 'ecm') { // Here $modulepart is always != 'ecm' - if ($modulepart == 'societe' || $modulepart == 'company' || $modulepart == 'thirdparty') { + if ($modulepart == 'societe' || $modulepart == 'company') { $relativefile = $tmpreldir.dol_sanitizeFileName((string) $object->id); } else { $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); From aa3f357064aada3ce4743c0c5883073057f87814 Mon Sep 17 00:00:00 2001 From: William Mead Date: Sun, 14 Dec 2025 13:47:53 +0100 Subject: [PATCH 13/21] Cleaned code --- 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 b5cd6040a4f..5015ee91a74 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -948,7 +948,7 @@ class Documents extends DolibarrApi // Test on permissions //if ($modulepart != 'ecm') { // Here $modulepart is always != 'ecm' - if ($modulepart == 'societe' || $modulepart == 'company') { + if ($modulepart == 'societe') { $relativefile = $tmpreldir.dol_sanitizeFileName((string) $object->id); } else { $relativefile = $tmpreldir.dol_sanitizeFileName($object->ref); From 00e48957ebe1fbbb72fab926d666d3465ab7e145 Mon Sep 17 00:00:00 2001 From: William Mead Date: Sun, 14 Dec 2025 15:23:15 +0100 Subject: [PATCH 14/21] Fixed contact document download --- htdocs/core/lib/files.lib.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index 96c74f8d3ca..9609b3e116a 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -7,6 +7,7 @@ * Copyright (C) 2019-2025 Frédéric France * Copyright (C) 2023 Lenin Rivas * Copyright (C) 2024-2025 MDW + * Copyright (C) 2025 William Mead * * 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 @@ -3334,7 +3335,7 @@ function dol_check_secure_access_document($modulepart, $original_file, $entity, } $original_file = $conf->societe->multidir_output[$entity].'/'.$original_file; $sqlprotectagainstexternals = "SELECT rowid as fk_soc FROM ".MAIN_DB_PREFIX."societe WHERE rowid='".$db->escape($refname)."' AND entity IN (".getEntity('societe').")"; - } elseif ($modulepart == 'contact' && !empty($conf->societe->multidir_output[$entity])) { + } elseif (($modulepart == 'contact' || $modulepart == 'socpeople') && !empty($conf->societe->multidir_output[$entity])) { // Wrapping for contact if (empty($entity) || empty($conf->societe->multidir_output[$entity])) { return array('accessallowed' => 0, 'error' => 'Value entity must be provided'); From 117aedfede781b19f7e377a437cc5302dc236ec4 Mon Sep 17 00:00:00 2001 From: William Mead Date: Sun, 14 Dec 2025 18:20:29 +0100 Subject: [PATCH 15/21] Added product document generation --- htdocs/api/class/api_documents.class.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 6f995b9917b..db539c55ef3 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -135,6 +135,7 @@ class Documents extends DolibarrApi * @since 18.0.0 Added support for contract and suppliers invoice documents * @since 19.0.0 Added support for shipment documents * @since 20.0.0 Added support for mrp documents + * @since 23.0.0 Added support for product documents * * @param string $modulepart Name of module or area concerned by file download ('thirdparty', 'member', 'proposal', 'supplier_proposal', 'order', 'supplier_order', 'invoice', 'supplier_invoice', 'shipment', 'project', ...) * @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf). @@ -297,6 +298,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 == 'product') { + require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php'; + + $tmpobject = new Product($this->db); + $result = $tmpobject->fetch(0, preg_replace('/\.[^\.]+$/', '', basename($original_file))); + + if (!$result) { + throw new RestException(404, 'Product 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 f7078da238f762509b2d52c871b80b2a8a5f6969 Mon Sep 17 00:00:00 2001 From: William Mead Date: Sun, 14 Dec 2025 18:21:39 +0100 Subject: [PATCH 16/21] Updated PHPDoc --- htdocs/api/class/api_documents.class.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index a86f15fab7b..b10ec135bb1 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -135,6 +135,7 @@ class Documents extends DolibarrApi * @since 18.0.0 Added support for contract and suppliers invoice documents * @since 19.0.0 Added support for shipment documents * @since 20.0.0 Added support for mrp documents + * @since 23.0.0 Added support for expense report documents * * @param string $modulepart Name of module or area concerned by file download ('thirdparty', 'member', 'proposal', 'supplier_proposal', 'order', 'supplier_order', 'invoice', 'supplier_invoice', 'shipment', 'project', ...) * @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf). From c05dc10da350350595e3590767c1e486ccea9f63 Mon Sep 17 00:00:00 2001 From: sonikf <93765174+sonikf@users.noreply.github.com> Date: Sun, 14 Dec 2025 20:45:30 +0200 Subject: [PATCH 17/21] fix regression broken layout Removed call to dol_get_fiche_end() in card.php. --- htdocs/reception/card.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index e8d9a23780e..8ae2406a832 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -2320,8 +2320,6 @@ if ($action == 'create' && $permissiontoadd) { print '
'; - print dol_get_fiche_end(); - /* * Lines of simple reception */ From 479000631d5c8f3948be73333481053d087f789a Mon Sep 17 00:00:00 2001 From: MDW Date: Sun, 14 Dec 2025 21:39:56 +0100 Subject: [PATCH 18/21] Qual: Update type hints in supplier order class # Qual: Update type hints in supplier order class - Update type hints for `$price_base_type` to be either 'HT' or 'TTC' - Update type hints for `$type` and `$notrigger` to be integers between 0 and 1 --- htdocs/fourn/class/fournisseur.commande.class.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/fourn/class/fournisseur.commande.class.php b/htdocs/fourn/class/fournisseur.commande.class.php index a24cef68d4a..f8d58d07ef2 100644 --- a/htdocs/fourn/class/fournisseur.commande.class.php +++ b/htdocs/fourn/class/fournisseur.commande.class.php @@ -2006,11 +2006,11 @@ class CommandeFournisseur extends CommonOrder * @param int $fk_prod_fourn_price Id supplier price * @param string $ref_supplier Supplier reference price * @param float $remise_percent Remise - * @param string $price_base_type HT or TTC + * @param 'HT'|'TTC' $price_base_type HT or TTC * @param float $pu_ttc Unit price TTC (used if $price_base_type is 'TTC') - * @param int $type Type of line (0=product, 1=service) + * @param int<0,1> $type Type of line (0=product, 1=service) * @param int $info_bits More information - * @param int $notrigger Disable triggers + * @param int<0,1> $notrigger Disable triggers * @param ?int $date_start Date start of service * @param ?int $date_end Date end of service * @param array $array_options extrafields array From 7112f510c1be2fc52140f8e105c394ae8117f681 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 05:02:30 +0000 Subject: [PATCH 19/21] Bump actions/cache from 4 to 5 Bumps [actions/cache](https://github.com/actions/cache) from 4 to 5. - [Release notes](https://github.com/actions/cache/releases) - [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md) - [Commits](https://github.com/actions/cache/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/cache dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/ci-phpstan_baseline.yml | 2 +- .github/workflows/phpstan.yml | 4 ++-- .github/workflows/pre-commit.yml | 4 ++-- .github/workflows/windows-ci.yml | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-phpstan_baseline.yml b/.github/workflows/ci-phpstan_baseline.yml index 692d259d1d8..dd62e499200 100644 --- a/.github/workflows/ci-phpstan_baseline.yml +++ b/.github/workflows/ci-phpstan_baseline.yml @@ -47,7 +47,7 @@ jobs: # Restore old cache - name: Restore phpstan cache id: cache - uses: actions/cache/restore@v4 + uses: actions/cache/restore@v5 with: path: ./.github/tmp key: phpstan-cache-${{ env.PHP_VERSION }}-${{ env.CACHE_KEY_PART }}-${{ diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 671326f83c1..18648ac1b52 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -52,7 +52,7 @@ jobs: # Restore old cache - name: Restore phpstan cache id: cache - uses: actions/cache/restore@v4 + uses: actions/cache/restore@v5 with: path: ./.github/tmp key: phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}-${{ @@ -74,7 +74,7 @@ jobs: # Save cache - name: Save phpstan cache - uses: actions/cache/save@v4 + uses: actions/cache/save@v5 if: ${{ success() || ( ! cancelled() && steps.cache.outputs.cache-hit != 'true' ) }} with: path: ./.github/tmp diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 7cc7ed6f379..ce487f329d0 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -75,7 +75,7 @@ jobs: - run: python -m pip install pre-commit # Restore previous cache of precommit - - uses: actions/cache/restore@v4 + - uses: actions/cache/restore@v5 with: path: ~/.cache/pre-commit/ key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} @@ -163,7 +163,7 @@ jobs: in: ${{ env.RAW_LOG }} # Save the precommit cache - - uses: actions/cache/save@v4 + - uses: actions/cache/save@v5 if: ${{ ! cancelled() }} with: path: ~/.cache/pre-commit/ diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 781a433bfbc..d2eb6c6e90f 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -57,7 +57,7 @@ jobs: # Restore cache - name: Restore cache id: cache - uses: actions/cache/restore@v4 + uses: actions/cache/restore@v5 env: HASH: ${{ hashFiles('htdocs/install/**', 'htdocs/filefunc.inc.php', 'htdocs/version.inc.php') }} KEY_ROOT: ${{ matrix.os }}-${{ env.ckey }}-${{ matrix.php_version }} @@ -187,7 +187,7 @@ jobs: # Save cache - name: Save cache - uses: actions/cache/save@v4 + uses: actions/cache/save@v5 if: ${{ ! cancelled() }} with: # See https://github.com/actions/cache/issues/1275#issuecomment-1925217178 From 491711b283502e7d1eaf4145cb0255e68796947e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 05:02:35 +0000 Subject: [PATCH 20/21] Bump actions/upload-artifact from 5 to 6 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 5 to 6. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v5...v6) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/phpstan.yml | 2 +- .github/workflows/pre-commit.yml | 2 +- .github/workflows/windows-ci.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 671326f83c1..4cf245f31ff 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -81,7 +81,7 @@ jobs: key: phpstan-cache-${{ matrix.php-version }}-${{ env.CACHE_KEY_PART }}-${{ github.run_id }} - name: Provide phpstan log as artifact - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v6 if: ${{ always() }} with: name: phpstan-srcrt diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 7cc7ed6f379..5ebfe79cca6 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -170,7 +170,7 @@ jobs: key: pre-commit-4|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} # Upload result log files of precommit into the Artifact shared store - name: Provide log as artifact - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v6 if: ${{ ! cancelled() }} with: name: precommit-logs diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/windows-ci.yml index 781a433bfbc..908ea569f5e 100644 --- a/.github/workflows/windows-ci.yml +++ b/.github/workflows/windows-ci.yml @@ -173,7 +173,7 @@ jobs: in: ${{ env.PHPUNIT_LOG }} - name: Provide dolibarr and phpunit logs as artifact - uses: actions/upload-artifact@v5 + uses: actions/upload-artifact@v6 if: ${{ ! cancelled() }} with: name: win-ci-logs From 124c304677e2b77de89f327148bc96568a241a63 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Dec 2025 13:59:56 +0100 Subject: [PATCH 21/21] Update api_documents.class.php --- 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 0a779ed1296..4d6e0662746 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -310,7 +310,7 @@ class Documents extends DolibarrApi if (!$result) { throw new RestException(404, 'Exepnse report not found'); - } + } } elseif ($modulepart == 'product') { require_once DOL_DOCUMENT_ROOT . '/product/class/product.class.php';