From cff522928cb6e2680cdd9da09dadae82c11ee8f4 Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 13 Jun 2025 11:44:10 +0200 Subject: [PATCH 1/6] Updated PHPDoc (#34429) --- htdocs/api/class/api_documents.class.php | 28 +++++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) diff --git a/htdocs/api/class/api_documents.class.php b/htdocs/api/class/api_documents.class.php index d0a98771495..f34c9307a4f 100644 --- a/htdocs/api/class/api_documents.class.php +++ b/htdocs/api/class/api_documents.class.php @@ -31,6 +31,8 @@ require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php'; /** * API class for receive files * + * @since 6.0.0 Initial implementation + * * @access protected * @class Documents {@requires user,external} */ @@ -47,11 +49,13 @@ class Documents extends DolibarrApi /** - * Download a document. + * Download a document * * Note that, this API is similar to using the wrapper link "documents.php" to download a file (used for * internal HTML links of documents into application), but with no need to have a session cookie (the token is used instead). * + * @since 7.0.0 Initial implementation + * * @param string $modulepart Name of module or area concerned by file download ('facture', ...) * @param string $original_file Relative path with filename, relative to modulepart (for example: IN201701-999/IN201701-999.pdf) * @return array List of documents @@ -115,11 +119,16 @@ class Documents extends DolibarrApi /** - * Build a document. + * Build a document * * Test sample 1: { "modulepart": "invoice", "original_file": "FA1701-001/FA1701-001.pdf", "doctemplate": "crabe", "langcode": "fr_FR" }. * - * Supported modules: invoice, order, proposal, contract, shipment + * Supported modules: invoice, order, proposal, contract, supplier invoice, shipment, mrp + * + * @since 7.0.0 Initial implementation, support for invoice, order and proposal documents + * @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 * * @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). @@ -301,10 +310,13 @@ class Documents extends DolibarrApi } /** - * Return the list of documents of a dedicated element (from its ID or Ref) + * List documents of an element * + * Use element ID or Ref. * Supported modules: thirdparty, user, member, proposal, order, supplier_order, shipment, invoice, supplier_invoice, product, event, expensereport, knowledgemanagement, category, contract * + * @since 7.0.0 Initial implementation + * * @param string $modulepart Name of module or area concerned ('thirdparty', 'member', 'proposal', 'order', 'invoice', 'supplier_invoice', 'shipment', 'project', ...) * @param int $id ID of element * @param string $ref Ref of element @@ -683,7 +695,7 @@ class Documents extends DolibarrApi /** - * Upload a document. + * Upload a document * * Test sample for invoice: { "filename": "mynewfile.txt", "modulepart": "invoice", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }. * Test sample for supplier invoice: { "filename": "mynewfile.txt", "modulepart": "supplier_invoice", "ref": "FA1701-001", "subdir": "", "filecontent": "content text", "fileencoding": "", "overwriteifexists": "0" }. @@ -691,6 +703,8 @@ class Documents extends DolibarrApi * * Supported modules: invoice, order, supplier_order, task/project_task, product/service, expensereport, fichinter, member, propale, agenda, contact * + * @since 6.0.0 Initial implementation + * * @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) @@ -1008,7 +1022,9 @@ class Documents extends DolibarrApi } /** - * Delete a document. + * Delete a document + * + * @since 11.0.0 Initial implementation * * @param string $modulepart Name of module or area concerned by file download ('product', ...) * @param string $original_file Relative path with filename, relative to modulepart (for example: PRODUCT-REF-999/IMAGE-999.jpg) From 6d8c9f629f4b3c9a3be895e3a4f082775f981458 Mon Sep 17 00:00:00 2001 From: William Mead Date: Fri, 13 Jun 2025 11:47:11 +0200 Subject: [PATCH 2/6] QUAL Updated proposals API PHPDoc (#34434) * Updated PHPDoc * Updated PHPDoc * Updated PHPDoc * Updated PHPDoc --- .../comm/propal/class/api_proposals.class.php | 88 +++++++++++++++---- 1 file changed, 73 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/propal/class/api_proposals.class.php b/htdocs/comm/propal/class/api_proposals.class.php index b2f1cb8671f..43a182561dc 100644 --- a/htdocs/comm/propal/class/api_proposals.class.php +++ b/htdocs/comm/propal/class/api_proposals.class.php @@ -6,6 +6,7 @@ * Copyright (C) 2022 OpenDSI * Copyright (C) 2024-2025 MDW * Copyright (C) 2024 Frédéric France + * 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 @@ -29,6 +30,8 @@ require_once DOL_DOCUMENT_ROOT.'/comm/propal/class/propal.class.php'; /** * API class for orders * + * @since 5.0.0 Initial implementation + * * @access protected * @class DolibarrApiAccess {@requires user,external} */ @@ -57,10 +60,12 @@ class Proposals extends DolibarrApi } /** - * Get properties of a commercial proposal object + * Get a commercial proposal * * Return an array with commercial proposal information * + * @since 5.0.0 Initial implementation + * * @param int $id ID of commercial proposal * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id * @return Object Object with cleaned properties @@ -73,10 +78,12 @@ class Proposals extends DolibarrApi } /** - * Get properties of an proposal object by ref + * Get a commercial proposal by ref * * Return an array with proposal information * + * @since 12.0.0 Initial implementation + * * @param string $ref Ref of object * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id * @return Object Object with cleaned properties @@ -91,10 +98,12 @@ class Proposals extends DolibarrApi } /** - * Get properties of an proposal object by ref_ext + * Get a commercial proposal by ref_ext * * Return an array with proposal information * + * @since 12.0.0 Initial implementation + * * @param string $ref_ext External reference of object * @param int $contact_list 0: Returned array of contacts/addresses contains all properties, 1: Return array contains just id * @return Object Object with cleaned properties @@ -158,6 +167,8 @@ class Proposals extends DolibarrApi * * Get a list of commercial proposals * + * @since 5.0.0 Initial implementation + * * @param string $sortfield Sort field * @param string $sortorder Sort order * @param int $limit Limit for list @@ -170,6 +181,8 @@ class Proposals extends DolibarrApi * @return array Array of order objects * @phan-return Propal[]|array{data:Propal[],pagination:array{total:int,page:int,page_count:int,limit:int}} * @phpstan-return Propal[]|array{data:Propal[],pagination:array{total:int,page:int,page_count:int,limit:int}} + * + * @throws RestException */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $thirdparty_ids = '', $sqlfilters = '', $properties = '', $pagination_data = false, $loadlinkedobjects = 0) { @@ -276,12 +289,16 @@ class Proposals extends DolibarrApi } /** - * Create commercial proposal object + * Create a commercial proposal + * + * @since 5.0.0 Initial implementation * * @param array $request_data Request data * @phan-param ?array $request_data * @phpstan-param ?array $request_data * @return int ID of proposal + * + * @throws RestException */ public function post($request_data = null) { @@ -317,6 +334,8 @@ class Proposals extends DolibarrApi /** * Get lines of a commercial proposal * + * @since 5.0.0 Initial implementation + * * @param int $id Id of commercial proposal * @param string $sqlfilters Other criteria to filter answers separated by a comma. d is the alias for proposal lines table, p is the alias for product table. "Syntax example "(p.ref:like:'SO-%') AND (d.date_start:<:'20220101')" * @@ -325,6 +344,8 @@ class Proposals extends DolibarrApi * @return array * @phan-return PropaleLigne[] * @phpstan-return PropaleLigne[] + * + * @throws RestException */ public function getLines($id, $sqlfilters = '') { @@ -359,7 +380,9 @@ class Proposals extends DolibarrApi } /** - * Add a line to given commercial proposal + * Add a line to a commercial proposal + * + * @since 5.0.0 Initial implementation * * @param int $id Id of commercial proposal to update * @param array $request_data Commercial proposal line data @@ -369,6 +392,8 @@ class Proposals extends DolibarrApi * @url POST {id}/line * * @return int + * + * @throws RestException */ public function postLine($id, $request_data = null) { @@ -427,7 +452,7 @@ class Proposals extends DolibarrApi } /** - * Add lines to given commercial proposal + * Add lines to a commercial proposal * * @param int $id Id of commercial proposal to update * @param array $request_data Commercial proposal line data @@ -437,6 +462,8 @@ class Proposals extends DolibarrApi * @url POST {id}/lines * * @return int + * + * @throws RestException */ public function postLines($id, $request_data = null) { @@ -510,7 +537,9 @@ class Proposals extends DolibarrApi } /** - * Update a line of given commercial proposal + * Update a line of a commercial proposal + * + * @since 5.0.0 Initial implementation * * @param int $id Id of commercial proposal to update * @param int $lineid Id of line to update @@ -520,6 +549,8 @@ class Proposals extends DolibarrApi * @return Object|false Object with cleaned properties * * @url PUT {id}/lines/{lineid} + * + * @throws RestException */ public function putLine($id, $lineid, $request_data = null) { @@ -587,8 +618,9 @@ class Proposals extends DolibarrApi } /** - * Delete a line of given commercial proposal + * Delete a line of a commercial proposal * + * @since 5.0.0 Initial implementation * * @param int $id Id of commercial proposal to update * @param int $lineid Id of line to delete @@ -623,7 +655,9 @@ class Proposals extends DolibarrApi } /** - * Add a contact type of given commercial proposal + * Add (link) a contact to a commercial proposal + * + * @since 10.0.0 Initial implementation * * @param int $id Id of commercial proposal to update * @param int $contactid Id of external or internal contact to add @@ -681,7 +715,9 @@ class Proposals extends DolibarrApi } /** - * Delete a contact type of given commercial proposal + * Remove (unlink) a contact from commercial proposal + * + * @since 10.0.0 Initial implementation * * @param int $id Id of commercial proposal to update * @param int $contactid Row key of the contact in the array contact_ids. @@ -726,13 +762,17 @@ class Proposals extends DolibarrApi } /** - * Update commercial proposal general fields (won't touch lines of commercial proposal) + * Update a commercial proposal general fields (won't change lines of commercial proposal) + * + * @since 5.0.0 Initial implementation * * @param int $id Id of commercial proposal to update * @param array $request_data Datas * @phan-param ?array $request_data * @phpstan-param ?array $request_data * @return Object Object with cleaned properties + * + * @throws RestException */ public function put($id, $request_data = null) { @@ -785,12 +825,16 @@ class Proposals extends DolibarrApi } /** - * Delete commercial proposal + * Delete a commercial proposal + * + * @since 5.0.0 Initial implementation * * @param int $id Commercial proposal ID * @return array * @phan-return array{success:array{code:int,message:string}} * @phpstan-return array{success:array{code:int,message:string}} + * + * @throws RestException */ public function delete($id) { @@ -819,12 +863,16 @@ class Proposals extends DolibarrApi } /** - * Set a proposal to draft + * Set a commercial proposal to draft + * + * @since 7.0.0 Initial implementation * * @param int $id Order ID * @return Object Object with cleaned properties * * @url POST {id}/settodraft + * + * @throws RestException */ public function settodraft($id) { @@ -871,6 +919,8 @@ class Proposals extends DolibarrApi * "notrigger": 0 * } * + * @since 5.0.0 Initial implementation + * * @param int $id Commercial proposal ID * @param int $notrigger 1=Does not execute triggers, 0= execute triggers * @return Object Object with cleaned properties @@ -919,7 +969,9 @@ class Proposals extends DolibarrApi } /** - * Close (Accept or refuse) a quote / commercial proposal + * Close (accept or refuse) a commercial proposal + * + * @since 7.0.0 Initial implementation * * @param int $id Commercial proposal ID * @param int $status Must be 2 (accepted) or 3 (refused) {@min 2}{@max 3} @@ -929,6 +981,8 @@ class Proposals extends DolibarrApi * @return Object Object with cleaned properties * * @url POST {id}/close + * + * @throws RestException */ public function close($id, $status, $note_private = '', $notrigger = 0, $note_public = '') { @@ -967,12 +1021,16 @@ class Proposals extends DolibarrApi } /** - * Set a commercial proposal billed. Could be also called setbilled + * Set a commercial proposal to billed + * + * @since 7.0.0 Initial implementation * * @param int $id Commercial proposal ID * @return Object Object with cleaned properties * * @url POST {id}/setinvoiced + * + * @throws RestException */ public function setinvoiced($id) { From a59c3a759bde98fbfc948bea4bf8c8626e29e3d1 Mon Sep 17 00:00:00 2001 From: Chloe-Moreau-2009 Date: Fri, 13 Jun 2025 12:01:07 +0200 Subject: [PATCH 3/6] replace getpost by getpostdate (#34428) Co-authored-by: Theobald --- htdocs/bom/bom_list.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/bom/bom_list.php b/htdocs/bom/bom_list.php index b5202ebdde3..65f6ffbc3f5 100644 --- a/htdocs/bom/bom_list.php +++ b/htdocs/bom/bom_list.php @@ -99,8 +99,8 @@ foreach ($object->fields as $key => $val) { $search[$key] = GETPOST('search_'.$key, 'alpha'); } if (preg_match('/^(date|timestamp|datetime)/', $val['type'])) { - $search[$key.'_dtstart'] = dol_mktime(0, 0, 0, GETPOSTINT('search_'.$key.'_dtstartmonth'), GETPOSTINT('search_'.$key.'_dtstartday'), GETPOSTINT('search_'.$key.'_dtstartyear')); - $search[$key.'_dtend'] = dol_mktime(23, 59, 59, GETPOSTINT('search_'.$key.'_dtendmonth'), GETPOSTINT('search_'.$key.'_dtendday'), GETPOSTINT('search_'.$key.'_dtendyear')); + $search[$key.'_dtstart'] = GETPOSTDATE('search_'.$key); + $search[$key.'_dtend'] = GETPOSTDATE('search_'.$key, 'end'); } } From 215a365bf9704ff0c520625f6ae48649b11f712b Mon Sep 17 00:00:00 2001 From: Marc de Lima Lucio <68746600+marc-dll@users.noreply.github.com> Date: Fri, 13 Jun 2025 12:01:55 +0200 Subject: [PATCH 4/6] QUAL: github pull request template: add warning about target branch in case of bugfix (#34427) --- .github/PULL_REQUEST_TEMPLATE.md | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 8d103d233a2..f57d8bdb363 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -3,6 +3,7 @@ *Please:* - *only keep the "FIX", "CLOSE", "NEW", "UIUX", PERF" or "QUAL" section* (use uppercase to have the PR appears into the ChangeLog, lowercase will not appears) - *follow the project [contributing guidelines](/.github/CONTRIBUTING.md)* +- ***in particular, in case of a bugfix, please check that you are targetting the branch corresponding to the oldest version in which the bug occurs*** - *replace the bracket enclosed texts with meaningful information* From a68bd9c1a3cb96054a7d932c7483ed2d9ea32170 Mon Sep 17 00:00:00 2001 From: Vincent Maury Date: Fri, 13 Jun 2025 12:22:49 +0200 Subject: [PATCH 5/6] Update functions.lib.php (#34436) --- htdocs/core/lib/functions.lib.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f1421fb35e6..8ef806cbdb8 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -14012,7 +14012,7 @@ function getElementProperties($elementType) $table_element = 'ecmfiles'; $subelement = ''; } elseif ($elementType == 'knowledgerecord' || $elementType == 'knowledgemanagement') { - $module = ''; + $module = 'knowledgemanagement'; $classpath = 'knowledgemanagement/class'; $classfile = 'knowledgerecord'; $classname = 'KnowledgeRecord'; From cdd401f58ec8ec04580be29ed4eba34df26580d3 Mon Sep 17 00:00:00 2001 From: moreauftheobald Date: Fri, 13 Jun 2025 15:09:54 +0200 Subject: [PATCH 6/6] FIX: Warning on external modules Pages: Unknown array key. (#34418) * FIX: Warning on external modules Pages: Unknown array key. * FIX: Warning on external modules Pages: Unknown array key. WIP * FIX: Warning on external modules Pages: Unknown array key. WIP * Update externalModules.class.php --------- Co-authored-by: Theobald Co-authored-by: Laurent Destailleur --- htdocs/admin/remotestore/class/externalModules.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/admin/remotestore/class/externalModules.class.php b/htdocs/admin/remotestore/class/externalModules.class.php index d926868f75f..c537f5fe254 100644 --- a/htdocs/admin/remotestore/class/externalModules.class.php +++ b/htdocs/admin/remotestore/class/externalModules.class.php @@ -876,7 +876,8 @@ class ExternalModules continue; } $adaptedPackage = [ - 'ref' => str_replace(' ', '', $package['modulename'].'-'.$package['current_version'].'@'.$package['author']), + 'ref' => str_replace(' ', '', $package['modulename'] . '-' . $package['current_version'] . '@' . + (array_key_exists('author', $package) ? $package['author'] : 'unkownauthor')), 'label' => !empty($package['label'][substr($this->lang, 0, 2)]) ? $package['label'][substr($this->lang, 0, 2)] : (!empty($package['label']['en']) ? $package['label']['en'] : $package['modulename']),