192 Commits

Author SHA1 Message Date
Jon Bendtsen
a40c97ec9c NEW: API set contact for any type in proposal, order or invoice dictionary (breaks API proposal) (#36269)
* NEW: Setting proposal contact to any in proposal contact dicitonary

* hurl tests and a little general cleanup of proposals api

* testing if the supplied type is in the dictionary

* Unique error codes

* Giving better error messages

* Making hurl tests reasonably identical for: proposals, orders and invoices

* BREAKING proposals, to make it identical with order and invoice + support for non default contacts for orders and invoices just like proposals

* adding the missing global  to order and invoice

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-11-24 20:12:35 +01:00
Frédéric FRANCE
46d6714fe0 clean code (#36317)
* clean code

* clean code

* clean doc

* clean doc

* clean doc

* clean doc

* fix

* fix

* fix

* fix

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-11-20 01:47:46 +01:00
VIAL-GOUTEYRON Quentin
c616e27274 New Hooks propals/orders (#35989)
* Add hook manager support for appending custom filter clauses across various SQL queries.

* Add hook manager support for custom SQL filters across multiple modules.

* Remove obsolete test code from api_proposals.class.php

* Remove unnecessary blank lines in card.php

* Remove unnecessary blank lines in card.php

* Remove unused object initialization and 'boxcode' parameter in product class

* Update api_proposals.class.php

* Initialize hooks for order API access

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-10-30 01:51:29 +01:00
Charlène Benke
3ff7e43648 Add parameters 'source' and 'notrigger' to postContact (#35678)
* Add parameters to postContact method

allow to add internal contact

* Add parameters 'source' and 'notrigger' to postContact
2025-10-08 10:58:01 +02:00
Charlène Benke
d1e0efc466 NEW Add getcontacts on api of interventional and proposal (#35589)
* Add getContacts method to retrieve contact information

* Implement getContacts method for proposals

Added a method to retrieve contacts associated with a proposal, including access checks and data cleaning.

* Implement getContacts method for invoices

Added a method to retrieve contacts associated with a specific invoice, including access checks and error handling.

* Update api_proposals.class.php

* Update api_invoices.class.php

* Update api_interventions.class.php

* Update api_interventions.class.php

* Add method to set invoice as draft

* Return contacts directly instead of cleaned data

* Return raw contacts instead of cleaned data

* Combine external and internal contacts in order list

Merge external and internal contacts for orders.

* Change return type from Object to array in API doc

Updated return type in API documentation for contact information.

* Change return type in api_orders.class.php docblock

Updated return type in docblock to reflect array return.

* Change return type from Object to array in API doc

* Update api_orders.class.php

* Update api_interventions.class.php

* Update api_proposals.class.php

* Update api_orders.class.php

* Update api_interventions.class.php

* Update api_interventions.class.php

* Update api_interventions.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-10-04 20:01:57 +02:00
ldestailleur
fbfeb5c978 Clean code 2025-10-04 14:12:46 +02:00
Laurent Destailleur
131d1390bc Debug v23 2025-09-28 22:20:44 +02:00
Frédéric FRANCE
e65b5575b9 clean code (#35462)
* clean code

* clean code

* clean code

* clean code

* clean code
2025-09-24 10:37:26 +02:00
Charlène Benke
496fef63a3 contact deletion in api_orders class for internal and external (#35455)
* contact deletion in api_orders class for internal and external

* Update api_orders.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-09-23 21:43:39 +02:00
ldestailleur
702d91c65d Clean code 2025-09-11 12:25:22 +02:00
Charlène Benke
1df5ea8456 NEW Add thirdparty search on api list (#34634)
* Add thirdparty search on api list

this change allow to seach element with filter on thirdparty (ex : list of bill of with name of thidparty)

* Update api_orders.class.php

* Update api_invoices.class.php

* Update api_contracts.class.php

* Update api_shipments.class.php

* Update api_interventions.class.php

* Update api_projects.class.php

* Update api_tickets.class.php

* Update api_tickets.class.php

* Update api_projects.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-07-18 02:35:50 +02:00
Jyhere
787bd1d278 CHANGE: ternary simplification (#34675) 2025-07-01 20:34:09 +02:00
ldestailleur
d13cd0f47a Fix CI 2025-05-05 04:36:28 +02:00
Charlène Benke
704910b4b3 NEW Add internal contact of proposal, order and invoice on api call (#34009)
* add internal contact of elements

* Update api_orders.class.php

* Update api_invoices.class.php

* Update api_proposals.class.php

* Update api_orders.class.php

* Fix CI

* Update api_orders.class.php

* Update api_invoices.class.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-05-05 02:07:24 +02:00
Thibault Parodi
e77b470cad NEW: Add an API endpoint to get properties of a single line of an order (#34045)
* feat: add api get line properties route

* chore: indent with tabs

* chore: preserve original spaces

* chore: tabs instead of space

* fix: return Object instead of array
2025-05-02 22:44:48 +02:00
MDW
f625f8de60 Qual: Fix api phan notices 2025-03-05 13:22:08 +01:00
MDW
eac44b164a Qual: Fix phpdoc index(), FIELDS 2025-03-05 13:21:05 +01:00
MDW
035ede5874 Qual: Fix phan notices in API classes 2025-03-02 20:49:46 +01:00
MDW
c02293a880 Qual: Add phpdoc for request_data param 2025-03-02 20:49:45 +01:00
Laurent Destailleur (aka Eldy)
e2f6c68063 Debug v21 - Restore common behaviour of other objects. 2024-12-01 23:13:50 +01:00
Norbert Penel
ad1bcc7932 Fix missing linkedObjectsIds on order API (#32175)
https://github.com/Dolibarr/dolibarr/issues/32096
2024-12-01 23:06:07 +01:00
nateogroup-antoine
c983cfff50 Typo in log : SERVICES_ARE_ECOMMERCE_200238EC => SERVICE_ARE_ECOMMERCE_200238EC and set shipment origin for shipment created by api on an order (#32143)
* Update functions.lib.php

* set shipment origin for shipment created by api on an order
2024-11-29 14:50:25 +01:00
Frédéric FRANCE
a760fc0092 fix phpstan (#31189)
* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan

* fix phpstan
2024-09-29 21:51:51 +02:00
Rémi Champlon
d2907b68c0 NEW : Add pagination data to some api routes (#29895)
* Add pagination date

* Spaces to tabs

* fix
2024-07-06 15:04:11 +02:00
Zephyriony
6f524405af QUAL Rename column fk_origin_line on shipment lines into fk_elementdet to match a generic use. (#28989)
* Update expedition.class.php 

Adapting the query and code to the new table format

* Update llx_expeditiondet.sql

* Update expedition.class.php

* Update expedition.class.php

* Update expedition.class.php

* Update expedition.class.php

* Update expedition.class.php

* Update expedition.class.php

* Update expedition.class.php

* Update expedition.class.php

* Update expedition.class.php

* Update llx_expeditiondet.sql

* Update expedition.class.php

* rename fk_origin_line to fk_elementdet

* rename fk_origin_line to fk_elementdet

* rename fk_origin_line to fk_elementdet

* rename fk_origin_line to fk_elementdet

* rename fk_origin_line to fk_elementdet

* rename fk_origin_line to fk_elementdet

* rename fk_origin_line to fk_elementdet

* rename fk_origin_line to fk_elementdet

* rename fk_origin_line to fk_elementdet

* rename fk_origin_line to fk_elementdet

* Update expedition.class.php

* Update expedition.class.php

* rename fk_origin_line to fk_elementdet

* rename fk_origin_line to fk_elementdet

* Update 19.0.0-20.0.0.sql

---------

Co-authored-by: sonikf <93765174+sonikf@users.noreply.github.com>
2024-04-08 12:44:49 +02:00
Laurent Destailleur
b5de782c6b Fix use the good HTTP code 2024-04-07 14:59:25 +02:00
Laurent Destailleur
0fe0cd7c01 Merge branch '19.0' of git@github.com:Dolibarr/dolibarr.git into develop 2024-04-04 11:39:02 +02:00
Laurent Destailleur
404ba88107 Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into 19.0 2024-04-04 11:19:45 +02:00
Laurent Destailleur
7715513ac9 Some API HTTP return code were moved from 401 to 403 to better follow
REST specification.
2024-04-02 14:47:49 +02:00
Laurent Destailleur
51f862ad28 Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into
develop
2024-04-02 13:21:00 +02:00
Laurent Destailleur
990216b13f NEW Api parameters are sanitized by the WAF, same code than GET/POST 2024-04-02 13:07:13 +02:00
Jon Bendtsen
d12f90b4d3 will allow updating 1 orders single Complementary Attribute without specifying complementary attributes that we don't want to change. Similar to # 29115 but just for orders 2024-04-01 10:08:02 +02:00
Regis Houssin
85a08a9288 FIX sometimes a string type instead integer is return, why ? 2024-03-31 19:17:58 +02:00
MDW
7b54824d49 Fix #28071 - New branch to fix bad merge (#28083)
* Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

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

* Qual: Introduce getDataToShowPhoto to prepare generic code

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

* Fix missing trans

* Fix langs

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

* Remove useless files in web templates

* Clean code

* Fix duplicate translation key

* Fix duplicate translation key

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

* Fix duplicate key

* Fix $object

* Debug v19

* WIP SMSing

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

* WIP EMAILINGS_SUPPORT_ALSO_SMS

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

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

* WIP SMSing

* Debug the "validate" feature

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

* Clean code

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

* Move rights->x->y into hasRight('x', 'y')

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

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

* Enhance rector to fix empty($user->rights->modulex->perm1)

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

* Fix template to use v19 dev rules

* Fix use v19 dev rules

* Fix phpunit

* Debug v19

* Clean code

* Use rector to convert user->rights into user->hasRight

* Clean code

* Use rector to convert user->rights into user->hasRight

* Use rector to convert user->rights into user->hasRight

* Clean code

* Fix phpcs

* add editorconfig for sql files (#27999)

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* add model_pdf field in llx_ticket-ticket.sql (#27996)

* add model_pdf field in llx_ticket-ticket.sql

* Update 19.0.0-20.0.0.sql

* Update 19.0.0-20.0.0.sql

* Improve wording in README (#27994)

* fix phpstan (#27989)

* fix phpstan

* Update UserRightsToFunction.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>

* Qual: Fix spelling/working in datapolicy translations (#28006)

# Qual: Fix spelling/wording in datapolicy translations

Fixed some spelling and wording in datapolicy translations.

* qual: phpstan for htdocs/ticket/class/ticketstats.class.php (#27986)

htdocs/ticket/class/ticketstats.class.php	98	Parameter #1 $year (string) of method TicketStats::getNbByMonth() should be compatible with parameter $year (int) of method Stats::getNbByMonth()

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

* Fix user with readonly perm on email template must be able to read.

* Fix doc

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

* Better message

* Add missing fields in merge of thirdparty

* Debug v19 selection of ticket printer per terminal

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

* Use constant

* NEW: Adding a recipient on emails sent, change status to sent partialy.

* fix travis (#28052)

* fix travis

* Update partnership.class.php

* fix php doc (#28047)

* fix undefined array key (#28048)

* Add region and departament for Cuba (#28046)

* Update llx_10_c_regions.sql

Add Cuba Regions (id_country=77)

* Update llx_20_c_departements.sql

Add Provinces Cuba (id country=77)

* Find the typo (#28050)

* Find the typo

* clean code

* add last_main_doc field to product (#28045)

* add las_main_doc field to product

* add field fetch

* NEW Add Categorie filter for ActionComm (#28041)

* New Add Categorie filter for ActionComm

New Add Categorie filter for ActionComm

* Fix space errors

Fix space errors

* Fix space errors 2

Fix space errors 2

* Update cunits.class.php (#28056)

FIX: error SQL when creating a Cunit

* Update codespell-lines-ignore.txt to avoid PR merge conflict

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
Co-authored-by: thibdrev <thibault.drevet@gmail.com>
Co-authored-by: sonikf <93765174+sonikf@users.noreply.github.com>
Co-authored-by: Ikarus <44511582+LeKarSol@users.noreply.github.com>
Co-authored-by: Anthony Damhet <73399671+EchoLoGeek@users.noreply.github.com>
Co-authored-by: Quentin-Seekness <72733832+Quentin-Seekness@users.noreply.github.com>
2024-02-09 15:58:49 +01:00
Laurent Destailleur
1d6cbe1fda Fix GETPOST use should be avoid in classes 2024-02-02 23:46:12 +01:00
Laurent Destailleur
c9823f2b8d Move 401 to 403 2024-02-01 19:34:13 +01:00
MDW
a04f2bf4e7 Qual: Spelling fixes that newly appeared. (#27495)
* Qual: Spelling fixes that newly appeared.

# Qual: Fix spelling erros that appeared since the bulk updates.

These issues mostly appeared since the bulk updates (a few ones were postponed
to make sure no real spelling errors were missed.)

* Update modulebuilder.lib.php

* Update pdf_standard.modules.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2024-01-14 12:26:37 +01:00
Laurent Destailleur
e2f49c407f Clean sql request to use exist instead of left join 2024-01-09 10:44:50 +01:00
Fabian Heinz
b78632a20e api fixes
According to [RFC2616](https://www.rfc-editor.org/rfc/rfc2616#section-10.2), APIs should return 2xx status codes if the request was correct.
The response should be status 200 with an empty result array.
2023-12-31 14:11:05 +01:00
Laurent Destailleur
d92c65ad91 FIX infinite loop in API call/trigger by adding a caller 2023-12-15 12:15:33 +01:00
Laurent Destailleur
ba10d60a0b Fix with php-cs-fixer 2023-12-04 12:02:35 +01:00
Laurent Destailleur
a0bba05b02 Merge branch '18.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts:
	htdocs/commande/class/api_orders.class.php
	htdocs/compta/facture/card.php
	htdocs/core/lib/functions.lib.php
	htdocs/core/lib/project.lib.php
	htdocs/fourn/class/api_supplier_orders.class.php
	htdocs/fourn/class/fournisseur.facture-rec.class.php
	htdocs/langs/en_US/stocks.lang
2023-11-17 18:24:53 +01:00
Christian Humpel
df31421e86 Integrate 'sqlfilterlines' in API for commande. (#26612)
Co-authored-by: christian.humpel <christian.humpel@gmail.com>
2023-11-16 15:05:32 +01:00
pascal
80f060c771 fix tab indentation 2023-09-26 18:43:25 +02:00
pascal
871f896962 implementation of properties filter 2023-09-26 18:04:48 +02:00
pascal
f9e37412c6 Add filter to restric properties returned 2023-08-03 09:32:43 +02:00
Frédéric France
a575b696e7 use user hasRight 2023-06-19 23:27:24 +02:00
ptibogxiv
5a58166614 FIX list orders API 2023-05-08 13:18:42 +02:00
VMR Global Solutions
926aa6fec7 API add / fix filter on extrafields in index()
Add / change in api_xxx.class.php files the ability to filter on extrafields when missing in the public functions index()
by changing the SQL query with the pattern 
" FROM ".MAIN_DB_PREFIX"xxxx AS t LEFT JOIN ".MAIN_DB_PREFIX."xxxx_extrafields AS ef ON (ef.fk_object = t.rowid)
2023-04-28 09:31:33 +02:00
Laurent Destailleur
3f264989ce Merge pull request #23906 from FliyFly/qodanaincompatible
Fix (qodana)
2023-03-08 13:21:14 +01:00