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..8111b69eaa7 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,14 +74,14 @@ 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 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..86ad725e63c 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,14 +163,14 @@ 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/ 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..608dfc62fcf 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 }} @@ -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 @@ -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 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/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index 6f995b9917b..4d6e0662746 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -135,6 +135,8 @@ 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 + * @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 +299,31 @@ 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'); + } + } 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'); } @@ -768,7 +795,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) @@ -948,7 +975,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') { + $relativefile = $tmpreldir.dol_sanitizeFileName((string) $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 { 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'); 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 ''; 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 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 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 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! 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 diff --git a/htdocs/langs/en_US/other.lang b/htdocs/langs/en_US/other.lang index 6ddee3d893a..4fdd82681a2 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__ 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 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 */