Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2025-06-13 15:51:39 +02:00
commit fb5148c0c2
6 changed files with 101 additions and 25 deletions

View file

@ -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*

View file

@ -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']),

View file

@ -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)

View file

@ -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');
}
}

View file

@ -6,6 +6,7 @@
* Copyright (C) 2022 OpenDSI <support@open-dsi.fr>
* Copyright (C) 2024-2025 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
* Copyright (C) 2025 William Mead <william@m34d.com>
*
* 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<string,string> $request_data
* @phpstan-param ?array<string,string> $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<string,string> $request_data
* @phpstan-param ?array<string,string> $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)
{

View file

@ -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';