18 Commits

Author SHA1 Message Date
Laurent Destailleur
578a1ef568 Clean files 2026-01-07 19:01:54 +01:00
Jon Bendtsen
280ca20600 more API endpoints checks multicompany auth with the same error message (#36409)
Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-11-25 14:32:28 +01:00
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
Jon Bendtsen
ff44d3ce3c fixing hurl test for api users (#36380)
Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-11-24 15:06:17 +01:00
Jon Bendtsen
54134eb0fa Hurl checks update Friday November 21st 2025 (#36366)
* Hurl checks update Friday November 21st 2025

* Looks like someone changed how to handle the multi entity tests that I used earlier

* updating warehouse check

* same update for users api

* and for group api

* fix GUI admin/mails_template.php checks

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-11-22 19:49:58 +01:00
Jon Bendtsen
111dce3854 Qual: fix 2 hurl tests: Contract and Emailtemplates (#36332)
* remove hurl test that requires a contract to exist

* change emailtemplates hurl tests to work when there is debug information in the API response

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-11-20 01:46:55 +01:00
Jon Bendtsen
ff2d9e987a Qual/Fix: remove entity=2 hurl test which doesn't work (#36336)
JonSweet16:hurl jonbendtsen$ ./run.sh module

----- Run hurl test on APIs ---
::notice::1. Running tests (API,GUI,public) that do not require authentication
::notice::Using existing DOLAPIKEY.
::notice::2.a. Running API tests that do require authentication
Success api/setup/10_setup_modules.hurl (13 request(s) in 2547 ms)
--------------------------------------------------------------------------------
Executed files:    1
Executed requests: 13 (5.1/s)
Succeeded files:   1 (100.0%)
Failed files:      0 (0.0%)
Duration:          2548 ms

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-11-20 01:45:09 +01:00
Jon Bendtsen
12c0f73682 Fix hurl assert for API warehouses to new reply from Dolibarr (#36274)
* Fix hurl assert for API warehouses to new reply from Dolibarr

* Asserting with jsonpath can handle if there are extra keys in the json like debug which mdeweerd experienced

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-11-19 19:34:11 +01:00
Jon Bendtsen
df4cd2fc65 FIX adding tms and datec to email templates (#36189)
* NEW: adding tms and datec to email templates

* Escaping a timestamp string I just generated myself

* switching single and double quotes in escape line for tms and datec to make the build system happy?

* Add an id to the table

* showing better names than tms and datec

* Changing code to label to fix #29116

* using hregis advice to use idate not escape the string with date

* requested changes

* forgot to add my name to editors

* had to make class changes for API to work

* setting datec back to int|string

* removing unused code lines and using idate in the api file

* no tms in create or update, but select. No datec in update

* expanding hurl tests to prevent post with id or tms, put with id or datec

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-11-11 09:02:57 +01:00
Jon Bendtsen
31cc6a702a NEW qual fixes on api contract (#36066)
* QUAL: API contract: RestException update, check if thirdparty exists before creating contract

* using the entity of this contract

* Safer usage of getEntity

* using global ->entity

* testing if create with socid=0 should fail

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-11-05 22:35:25 +01:00
Jon Bendtsen
20a428e2de QUAL: API contract: RestException update, check if thirdparty exists before creating/updating contract (#36007)
* QUAL: API contract: RestException update, check if thirdparty exists before creating contract

* also checking if socid exists during put

* using the entity of this contract

* also fixing entity during post

* some hurl tests of contract api

* check if contract id is 0, because that is not possible

* check (un)activate permissions and getEntity()

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-11-01 22:47:18 +01:00
Jon Bendtsen
982e0ed64e NEW: API endpoint for getting products in a warehouse (#35918)
* mostly updating fetch with all the fields and adding 2 missing variables

* adding throw RestException numbers, @url and a test for if you try with id=0

* Adding hurl file that do some testing og warehouses API endpoints

* Class for API prevented ever seeing model_pdf in API json

* Check for auth before doing other tests on the request

* New function list Products in warehouse. Work done by defrance, revived by JonB

* API PUT/update now allows for more database fields

* hurl tests for the new list products in warehouse endpoint

* also rejecting warehouse_id in a post

* pre-commit fix api warehouses

* copy paste error from api_usergroup

* Just return the lines, no cleaning needed

* PHAN fixes

* trying to fix PHAN error

* fix api update so it returns error when error, and fix object->update with import_key

* this->db not global db

* Advice from hregis

* Typo this d not dB

* Array of strings

* Changed listProducts in warehouse, uses api_product->get with variables from that

* hurl tests for API warehouses, and the new function get products in warehouse

* some STAN fixes

* more phan fixes

* changes revealed necessary by hurl testing

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-10-28 10:23:06 +01:00
Jon Bendtsen
802e4b6491 NEW API user/groups/ POST, PUT, DELETE + some hurl tests (#35903)
* NEW API user/groups/ POST, PUT, DELETE + some hurl tests

* indent fix

* saving note_private (Ryan) during create and detect if we call ourselves?

* fix call with wrong arguments

* Reshow array's in the json output

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-10-23 13:56:22 +02:00
Jon Bendtsen
1f47cfd583 NEW API for getting, adding, deleting and/or modifying email templates (#35853)
* NEW API for getting, adding, deleting and/or modifying email templates

* removing duplicate class formmail which has been moved to a separate file

* hurl file for testing the emailtemplates api

* more comprehensive tests of posting a new email template, all required fields and making sure that ID is rejected

* first GUI test of email templates

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-10-22 18:04:39 +02:00
Jon Bendtsen
7fc9b253bf Reviving some old PR with API get, activate and disable modules (#35718)
* Reviving some old PR with API get, activate and disable modules

* expanding hurl test for setup wih some module tests

* return array, not object

* fix PHPStan on getmodules

* typecasting module functions to string

* instiating class DolibarrModule into an object so we can call functions on it

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-10-14 19:33:40 +02:00
Jon Bendtsen
e8a347f89e NEW API for handling mass mailing targets (#35603)
* NEW API for handling mailing targets

* fix PHP Codesniffer

* adding return values to make phpstan happy

* Update function actually updates

* defining mailing_target public function create

* using a different language translation

* mailing_target - phpstan fixes

* mailing target - no check properties body

* mailing target int typecast fk_mailing

* mailing target - just 1 parameter

* mailing_target phpstan fixes

* mailing_target setting labelStatus

* mailing target class public function delete

* reveal the list of status name for the Mass mailing object in the API

* set tms to now when it is set to draft

* functions to set the mailing target status

* hurl testing api mailings

* hurl test - exit run script at first error

* hurl test mailings - should cover all endpoints

* using self:: in front of the CONST

* Trying to find out which line evaluates to noting

* API mailings can now get the targets of a mailing

* Protected method name "Mailings::_cleanTargetDatas" must not be prefixed with an underscore

* give me fk_project

* API endpoints for: Get all targets of a mass mailing + Get information about a specific target id

* API endpoint to update a mailing target

* telling pre-commit check to ignore, just like done in the function I copied

* be more explicit about for GUI tests we need username and password

* Prevent updating fk_mailing value

* API endpoint deleteTarget

* post to create a mailing target does work, but need slight more testing after work

* correct indent

* fixing some build errors

* More comprehensive hurl test of creation of a target

* adding status_dest to mailing targets json

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
2025-10-09 18:38:13 +02:00
Jon Bendtsen
1cb221efe9 Make hurl tests work on GUI page requiring login (#35652)
* Adding hurl tests to Dolibarr

* modifying run.sh to get it past commit checks

* change the APIHEADER to be read from the environment

* spell fix

* test to see if build system will accept this file

* deleting script method that doesn't work

* beginning to make hurl tests accept environment variables for the location

* Add GUI login to hurl tests

* Fix CI

* clean code (#35640)

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* clean code

* Fix warning

* Clean code

* PHPStan > Update baseline (#35644)

Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>

* NEW Can drag and drop in BOM card

* WIP Upload files

* WIP Upload files

* Adding hurl tests to Dolibarr

* using hostnport variable for all remaining tests

* Add some asserts and gui login tests

* double quotes around shell variables

* adding -r to read

* expand mass mail gui test with all 6 columns in the table

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
Co-authored-by: ldestailleur <eldy@destailleur.fr>
Co-authored-by: Frédéric FRANCE <frederic34@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Dolibot <dolibarr-bot@users.noreply.github.com>
2025-10-06 01:38:44 +02:00
Jon Bendtsen
c1aceed820 Adding hurl tests to Dolibarr (#35643)
* Adding hurl tests to Dolibarr

* modifying run.sh to get it past commit checks

* change the APIHEADER to be read from the environment

* spell fix

* test to see if build system will accept this file

* deleting script method that doesn't work

* beginning to make hurl tests accept environment variables for the location

---------

Co-authored-by: Jon Bendtsen <xcodeauthor@jonb.dk>
Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
2025-10-05 18:08:10 +02:00