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

This commit is contained in:
Laurent Destailleur 2025-11-20 11:20:10 +01:00
commit a8ed7e50f4
4 changed files with 65 additions and 7 deletions

View file

@ -233,6 +233,34 @@ insert into llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 9
-- Colombie Regions (id country=70)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) values ( 70, 7001, '', 0, 'Colombie');
-- Regions DRC (id country=73)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7301, 'Kinshasa', 0, 'Kinshasa', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7302, 'Matadi', 0, 'Kongo Central', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7303, 'Kenge', 0, 'Kwango', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7304, 'Bandundu', 0, 'Kwilu', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7305, 'Inongo', 0, 'Mai-Ndombe', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7306, 'Tshikapa', 0, 'Kasaï', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7307, 'Kananga', 0, 'Kasaï-Central', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7308, 'Mbuji-Mayi', 0, 'Kasaï-Oriental', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7309, 'Kabinda', 0, 'Lomami', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7310, 'Lusambo', 0, 'Sankuru', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7311, 'Kindu', 0, 'Maniema', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7312, 'Bukavu', 0, 'Sud-Kivu', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7313, 'Goma', 0, 'Nord-Kivu', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7314, 'Bunia', 0, 'Ituri', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7315, 'Isiro', 0, 'Haut-Uélé', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7316, 'Buta', 0, 'Bas-Uélé', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7317, 'Kisangani', 0, 'Tshopo', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7318, 'Boende', 0, 'Tshuapa', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7319, 'Mbandaka', 0, 'Équateur', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7320, 'Lisala', 0, 'Mongala', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7321, 'Gbadolite', 0, 'Nord-Ubangi', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7322, 'Gemena', 0, 'Sud-Ubangi', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7323, 'Kamina', 0, 'Haut-Lomami', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7324, 'Kolwezi', 0, 'Lualaba', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7325, 'Lubumbashi', 0, 'Haut-Katanga', 1);
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom, active) VALUES (73, 7326, 'Kalemie', 0, 'Tanganyika', 1);
-- Croatia Regions (id country=76)
INSERT INTO llx_c_regions (fk_pays, code_region, cheflieu, tncc, nom) VALUES ( 76, 7601, '', 0, 'Središnja');

View file

@ -343,6 +343,16 @@ class Contacts extends DolibarrApi
// Check mandatory fields
$result = $this->_validate($request_data);
// External api user does not know internal country ID
if (!isset($request_data['country_id']) && isset($request_data['country_code'])) {
$field = strlen($request_data['country_code']) > 2 ? 'code_iso' : 'code';
$id = dol_getIdFromCode($this->db, $request_data['country_code'], "c_country", $field, "rowid");
if ($id < 0) {
throw new RestException(404, 'Country code not found in database: ' . $this->db->error);
}
$request_data['country_id'] = $id;
}
foreach ($request_data as $field => $value) {
if ($field === 'caller') {
// Add a mention of caller so on trigger called after action, we can filter to avoid a loop if we try to sync back again with the caller

View file

@ -134,7 +134,7 @@ This will exclude all tests that contain either `setup_modules` or `status` in t
### Verbose Output
You can enable verbose output by providing the `--verbose` or `--very-verbose` option to the `run.sh` script. For example:
You can enable verbose output by providing the `--verbose` (also `-v`) or `--very-verbose` option to the `run.sh` script. For example:
```bash
./run.sh --verbose setup_modules
@ -142,6 +142,16 @@ You can enable verbose output by providing the `--verbose` or `--very-verbose` o
This will run all tests that contain `setup_modules` in their name with verbose output.
### Quiet Output
You can disable part of the informational output by providing the `--quiet` (also `-q`) option to the `run.sh` script. For example:
```bash
./run.sh --quiet setup_modules
```
This will run all tests that contain `setup_modules` in their name with info output disabled.
## Directory and file structure for hurl tests
To avoid ending up with thousands of files in the same directory, we should use directories and possible subdirectories where relevant.

View file

@ -23,8 +23,9 @@ Options:
--apikey=APIKEY Specify the API key for API tests.
--suburl=SUBURL Specify the suburl of the Dolibarr server.
--exclude=PATTERN Exclude tests that match the specified pattern.
--verbose Verbose hurl output
--verbose | -v Verbose hurl output
--very-verbose Very verbose hurl output
--quiet | -q Disable info output
--help Display this help message and exit.
Test Filters:
@ -42,15 +43,21 @@ Examples:
EOHELP
}
# Github compatible messages
print_error() { printf "::error::%s\n" "$*" >&2 ; }
print_warning() { printf "::warning::%s\n" "$*" >&2 ; }
print_info() { printf "::notice::%s\n" "$*" >&2 ; }
if [[ -n "${GITHUB_WORKSPACE}" ]]; then
# Github compatible messages
print_error() { printf "::error::%s\n" "$*" >&2; }
print_warning() { if [[ "${QUIET}" = false ]]; then printf "::warning::%s\n" "$*" >&2 ; fi; }
print_info() { if [[ "${QUIET}" = false ]]; then printf "::notice::%s\n" "$*" >&2 ; fi; }
else
print_error() { printf "ERROR: %s\n" "$*" >&2; }
print_warning() { if [[ "${QUIET}" = false ]]; then printf "WARNING: %s\n" "$*" >&2 ; fi; }
print_info() { if [[ "${QUIET}" = false ]]; then printf "INFO: %s\n" "$*" >&2 ; fi; }
fi
# Parse command-line arguments as test filters
test_filters=()
exclude_patterns=()
QUIET=false
for arg in "$@"; do
case "$arg" in
@ -84,6 +91,9 @@ for arg in "$@"; do
--very-verbose|--verbose|-v)
VERBOSE=${arg}
;;
--quiet|-q)
QUIET=true
;;
--help)
display_help
exit 0