From 98bf06c5fced83e3821380b3dbcfc0e19cd99bca Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 11 Dec 2023 17:55:20 +0100 Subject: [PATCH 001/104] New column in website table for stock name of template imported --- htdocs/install/mysql/migration/18.0.0-19.0.0.sql | 2 ++ 1 file changed, 2 insertions(+) diff --git a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql index 2461ed733cb..e9b846bbf4a 100644 --- a/htdocs/install/mysql/migration/18.0.0-19.0.0.sql +++ b/htdocs/install/mysql/migration/18.0.0-19.0.0.sql @@ -201,3 +201,5 @@ ALTER TABLE llx_commande_fournisseur_dispatch ADD COLUMN element_type varchar(50 ALTER TABLE llx_expensereport DROP INDEX idx_expensereport_fk_refuse, ADD INDEX idx_expensereport_fk_refuse(fk_user_refuse); INSERT INTO llx_c_forme_juridique (fk_pays, code, libelle) VALUES (1,'66','Société publique locale'); + +ALTER TABLE llx_website ADD COLUMN name_template varchar(255) NULL; \ No newline at end of file From b61d6f43dc60f3573c458fc482d88a70dc3b9097 Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Mon, 18 Dec 2023 18:41:38 +0100 Subject: [PATCH 002/104] add column in table --- htdocs/install/mysql/tables/llx_website-website.sql | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_website-website.sql b/htdocs/install/mysql/tables/llx_website-website.sql index 8ac580919aa..8b027e39a8c 100644 --- a/htdocs/install/mysql/tables/llx_website-website.sql +++ b/htdocs/install/mysql/tables/llx_website-website.sql @@ -41,5 +41,6 @@ CREATE TABLE llx_website pageviews_month BIGINT UNSIGNED DEFAULT 0, -- increased by 1 at each page access, saved into pageviews_previous_month when on different month than lastaccess pageviews_total BIGINT UNSIGNED DEFAULT 0, -- increased by 1 at each page access, no reset tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, - import_key varchar(14) -- import key + import_key varchar(14), -- import key + name_template varchar(255) NULL ) ENGINE=innodb; From e4356ef635eda6fa0c865b259f74475effabf86e Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Tue, 19 Dec 2023 15:53:17 +0100 Subject: [PATCH 003/104] add column in table website --- htdocs/install/mysql/tables/llx_website-website.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/install/mysql/tables/llx_website-website.sql b/htdocs/install/mysql/tables/llx_website-website.sql index 8b027e39a8c..7380fe678df 100644 --- a/htdocs/install/mysql/tables/llx_website-website.sql +++ b/htdocs/install/mysql/tables/llx_website-website.sql @@ -42,5 +42,5 @@ CREATE TABLE llx_website pageviews_total BIGINT UNSIGNED DEFAULT 0, -- increased by 1 at each page access, no reset tms timestamp DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, import_key varchar(14), -- import key - name_template varchar(255) NULL + name_template varchar(255) NULL --name of template imported ) ENGINE=innodb; From 133b2a43ce22e9147169a2a35269e548163c5bcc Mon Sep 17 00:00:00 2001 From: Lamrani Abdel Date: Sat, 6 Jan 2024 19:24:46 +0100 Subject: [PATCH 004/104] add in migration file --- htdocs/install/mysql/migration/19.0.0-20.0.0.sql | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql index b5ce150595a..975b4abf416 100644 --- a/htdocs/install/mysql/migration/19.0.0-20.0.0.sql +++ b/htdocs/install/mysql/migration/19.0.0-20.0.0.sql @@ -158,3 +158,4 @@ ALTER TABLE llx_user_extrafields DROP INDEX idx_user_extrafields; ALTER TABLE llx_user_extrafields ADD UNIQUE INDEX uk_user_extrafields (fk_object); ALTER TABLE llx_usergroup_extrafields DROP INDEX idx_usergroup_extrafields; ALTER TABLE llx_usergroup_extrafields ADD UNIQUE INDEX uk_usergroup_extrafields (fk_object); +ALTER TABLE llx_website ADD COLUMN name_template varchar(255) NULL; From 9e3c6f1dd6366977d259f21aa6652d1c28e8c42d Mon Sep 17 00:00:00 2001 From: Greg Chanton <87117114+GregChant@users.noreply.github.com> Date: Mon, 15 Jan 2024 14:53:25 +0100 Subject: [PATCH 005/104] Update balance.php adds conditions to correctly manage column alignment following the MAIN_CHECKBOX_LEFT_COLUMN option --- htdocs/accountancy/bookkeeping/balance.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/htdocs/accountancy/bookkeeping/balance.php b/htdocs/accountancy/bookkeeping/balance.php index 0a097d5a036..2fccaceb0c3 100644 --- a/htdocs/accountancy/bookkeeping/balance.php +++ b/htdocs/accountancy/bookkeeping/balance.php @@ -525,6 +525,9 @@ if ($action != 'export_csv') { if ($displayed_account != "") { print ''; print ''.$langs->trans("SubTotal").':'; + if (getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print ''; + } if (getDolGlobalString('ACCOUNTANCY_SHOW_OPENING_BALANCE')) { print ''.price($sous_total_opening_balance).''; } @@ -535,7 +538,9 @@ if ($action != 'export_csv') { } else { print ''.price(price2num($sous_total_debit - $sous_total_credit)).''; } - print "\n"; + if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { + print "\n"; + } print ''; } From d4fd234b7589f14b65185dbc6e42e96a606d3dc1 Mon Sep 17 00:00:00 2001 From: Regis Houssin Date: Mon, 15 Jan 2024 15:11:27 +0100 Subject: [PATCH 006/104] FIX missing entity filter for check if period exists --- htdocs/expensereport/class/expensereport.class.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index 9a1866247eb..8af62d14736 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -2340,10 +2340,13 @@ class ExpenseReport extends CommonObject */ public function periode_existe($fuser, $date_debut, $date_fin) { + global $conf; + // phpcs:enable $sql = "SELECT rowid, date_debut, date_fin"; $sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element; - $sql .= " WHERE fk_user_author = ".((int) $fuser->id); + $sql .= " WHERE entity = ".((int) $conf->entity); // not shared, only for the current entity + $sql .= " AND fk_user_author = ".((int) $fuser->id); dol_syslog(get_class($this)."::periode_existe sql=".$sql); $result = $this->db->query($sql); From 3599b43005787849bd618318bf23740e545786d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 15 Jan 2024 17:39:31 +0100 Subject: [PATCH 007/104] fix incorrect case --- htdocs/accountancy/admin/categories.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/accountancy/admin/categories.php b/htdocs/accountancy/admin/categories.php index abc45763361..899cb89ff90 100644 --- a/htdocs/accountancy/admin/categories.php +++ b/htdocs/accountancy/admin/categories.php @@ -115,7 +115,7 @@ $formaccounting = new FormAccounting($db); $help_url = 'EN:Module_Double_Entry_Accounting#Setup|FR:Module_Comptabilité_en_Partie_Double#Configuration'; -llxheader('', $langs->trans('AccountingCategory'), $help_url); +llxHeader('', $langs->trans('AccountingCategory'), $help_url); $linkback = ''.$langs->trans("BackToList").''; $titlepicto = 'setup'; From 55067371ca57ada4aecb3f34e03479bea7026401 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jan 2024 18:06:11 +0100 Subject: [PATCH 008/104] Doc --- htdocs/core/class/html.form.class.php | 6 +++--- htdocs/core/lib/functions.lib.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 9f189cc9a89..82103ef0a2d 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -6458,8 +6458,8 @@ class Form * Si vendeur non assujeti a TVA, TVA par defaut=0. Fin de regle. * Si le (pays vendeur = pays acheteur) alors la TVA par defaut=TVA du produit vendu. Fin de regle. * Si (vendeur et acheteur dans Communaute europeenne) et bien vendu = moyen de transports neuf (auto, bateau, avion), TVA par defaut=0 (La TVA doit etre paye par l'acheteur au centre d'impots de son pays et non au vendeur). Fin de regle. - * Si vendeur et acheteur dans Communauté européenne et acheteur= particulier alors TVA par défaut=TVA du produit vendu. Fin de règle. - * Si vendeur et acheteur dans Communauté européenne et acheteur= entreprise alors TVA par défaut=0. Fin de règle. + * Si vendeur et acheteur dans Communauté européenne et acheteur=particulier alors TVA par défaut=TVA du produit vendu. Fin de règle. + * Si vendeur et acheteur dans Communauté européenne et acheteur=entreprise alors TVA par défaut=0. Fin de règle. * Sinon la TVA proposee par defaut=0. Fin de regle. * @param bool $options_only Return HTML options lines only (for ajax treatment) * @param int $mode 0=Use vat rate as key in combo list, 1=Add VAT code after vat rate into key, -1=Use id of vat line as key @@ -6528,7 +6528,7 @@ class Form } // Now we get list - $num = $this->load_cache_vatrates($code_country); // If no vat defined, return -1 with message into this->error + $num = $this->load_cache_vatrates($code_country); // If no vat at all defined for this country, return -1 with message into this->error if ($num > 0) { // Definition du taux a pre-selectionner (si defaulttx non force et donc vaut -1 ou '') diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 151b24110b6..f820d3f5b92 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -6703,7 +6703,7 @@ function get_product_vat_for_country($idprod, $thirdpartytouse, $idprodfournpric $found = 1; } } else { - // TODO Read default product vat according to product and another countrycode. + // TODO Read default product vat according to product and an other countrycode. // Vat for couple anothercountrycode/product is data that is not managed and store yet, so we will fallback on next rule. } } From 82bc2e2d7192886c964862cdd206d657523c5d70 Mon Sep 17 00:00:00 2001 From: thibdrev Date: Mon, 15 Jan 2024 21:22:59 +0100 Subject: [PATCH 009/104] phpstan Property ProductCombination2ValuePair::$fk_prod_attr (int) does not accept string. Property ProductCombination2ValuePair::$fk_prod_attr_val (int) does not accept string. --- htdocs/variants/combinations.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/variants/combinations.php b/htdocs/variants/combinations.php index ee667ea4c49..a7850bd660b 100644 --- a/htdocs/variants/combinations.php +++ b/htdocs/variants/combinations.php @@ -175,8 +175,8 @@ if (($action == 'add' || $action == 'create') && empty($massaction) && !GETPOST( $sanit_features[$explode[0]] = $explode[1]; $tmp = new ProductCombination2ValuePair($db); - $tmp->fk_prod_attr = $explode[0]; - $tmp->fk_prod_attr_val = $explode[1]; + $tmp->fk_prod_attr = (int) $explode[0]; + $tmp->fk_prod_attr_val = (int) $explode[1]; $productCombination2ValuePairs1[] = $tmp; } From a1e117283d432a7d51c27d47042ed5f9a3d2c7f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Mon, 15 Jan 2024 21:28:19 +0100 Subject: [PATCH 010/104] fix warnings --- .../doc/pdf_eagle_proforma.modules.php | 2 +- htdocs/mrp/mo_production.php | 22 +++++++++---------- .../stocktransfer/stocktransfer_card.php | 6 ++--- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php index 7973c3425f9..9d6bc9a33c9 100644 --- a/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php +++ b/htdocs/core/modules/stocktransfer/doc/pdf_eagle_proforma.modules.php @@ -1602,7 +1602,7 @@ class pdf_eagle_proforma extends ModelePDFCommandes ), 'border-left' => true, // add left line separator ); - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $this->cols['unit']['status'] = true; } diff --git a/htdocs/mrp/mo_production.php b/htdocs/mrp/mo_production.php index 7cbdcef0abc..23b996fcca0 100644 --- a/htdocs/mrp/mo_production.php +++ b/htdocs/mrp/mo_production.php @@ -204,7 +204,7 @@ if (empty($reshook)) { $moline->fk_default_workstation = $tmpproduct->fk_default_workstation; } $moline->disable_stock_change = ($tmpproduct->type == Product::TYPE_SERVICE ? 1 : 0); - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { $moline->fk_unit = $tmpproduct->fk_unit; } } @@ -840,7 +840,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Qty print ''.$langs->trans("Qty").''; // Unit - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print '' . $langs->trans("Unit") . ''; } // Cost price @@ -911,7 +911,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Qty print ''; - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; } // Cost price @@ -1029,7 +1029,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; print ''; // Unit - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; print measuringUnitString($line->fk_unit, '', '', 1); print ''; @@ -1107,7 +1107,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print price2num($line->qty, 'MS'); print ''; // Unit - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; print measuringUnitString($line->fk_unit, '', '', 1); print ''; @@ -1323,7 +1323,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // Unit - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; } @@ -1449,7 +1449,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Qty print ''.$langs->trans("Qty").''; /// Unit - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''.$langs->trans("Unit").''; } // Cost price @@ -1502,7 +1502,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Qty print ''; //Unit - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; } // Cost price @@ -1569,7 +1569,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Qty print ''.$line->qty.''; // Unit - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''.measuringUnitString($line->fk_unit, '', '', 1).''; } // Cost price @@ -1668,7 +1668,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Qty print ''; // Unit - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; } // Cost price @@ -1721,7 +1721,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea // Qty print ''; //Unit - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; } // Cost diff --git a/htdocs/product/stock/stocktransfer/stocktransfer_card.php b/htdocs/product/stock/stocktransfer/stocktransfer_card.php index 1def7644d9d..48c2ae2ebf5 100644 --- a/htdocs/product/stock/stocktransfer/stocktransfer_card.php +++ b/htdocs/product/stock/stocktransfer/stocktransfer_card.php @@ -773,7 +773,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print getTitleFieldOfList($langs->trans('WarehouseSource'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone '); print getTitleFieldOfList($langs->trans('WarehouseTarget'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone '); print getTitleFieldOfList($langs->trans('Qty'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'center tagtd maxwidthonsmartphone '); - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print getTitleFieldOfList($langs->trans('Unit'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'tagtd maxwidthonsmartphone '); } print getTitleFieldOfList($langs->trans('AverageUnitPricePMPShort'), 0, $_SERVER["PHP_SELF"], '', $param, '', '', $sortfield, $sortorder, 'center tagtd maxwidthonsmartphone '); @@ -846,7 +846,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''.$line->qty.''; } - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { print ''; $label = $productstatic->getLabelOfUnit('short'); if ($label !== '') { @@ -968,7 +968,7 @@ if ($object->id > 0 && (empty($action) || ($action != 'edit' && $action != 'crea print ''; // PMP print ''; - if ($conf->global->PRODUCT_USE_UNITS) { + if (getDolGlobalInt('PRODUCT_USE_UNITS')) { // Unité print ''; } From ee2ed963e8e97981028b76ab06a7c653d0e990b3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Mon, 15 Jan 2024 21:32:17 +0100 Subject: [PATCH 011/104] FIX #22506 --- htdocs/core/class/extrafields.class.php | 17 +++++++++++------ htdocs/core/class/html.form.class.php | 10 ++++++++-- 2 files changed, 19 insertions(+), 8 deletions(-) diff --git a/htdocs/core/class/extrafields.class.php b/htdocs/core/class/extrafields.class.php index 5d28ea7501e..7295ee84886 100644 --- a/htdocs/core/class/extrafields.class.php +++ b/htdocs/core/class/extrafields.class.php @@ -1120,9 +1120,10 @@ class ExtraFields } else { $checked = ' value="1" '; } - $out = ''; + $out = ''; // A hidden field ending with "_boolean" that is always set to 1. + $out .= ''; } else { - $out .= $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1); + $out = $form->selectyesno($keyprefix.$key.$keysuffix, $value, 1, false, 1); } } elseif ($type == 'price') { if (!empty($value)) { // $value in memory is a php numeric, we format it into user number format. @@ -2352,7 +2353,9 @@ class ExtraFields $value_key = GETPOST($keysuffix."options_".$key.$keyprefix); } } elseif (in_array($key_type, array('checkbox', 'chkbxlst'))) { - if (!GETPOST($keysuffix."options_".$key.$keyprefix)) { + // We test on a hidden field named "..._multiselect" that is always set to 1 if param is in form so + // when nothing is provided we can make a difference between noparam in the form and param was set to nothing. + if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix.'_multiselect')) { continue; // Value was not provided, we should not set it. } $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); @@ -2360,7 +2363,7 @@ class ExtraFields $value_arr = (array) $value_arr; $value_key = implode(',', $value_arr); } elseif (in_array($key_type, array('price', 'double', 'int'))) { - if (!GETPOST($keysuffix."options_".$key.$keyprefix)) { + if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) { continue; // Value was not provided, we should not set it. } $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); @@ -2370,14 +2373,16 @@ class ExtraFields $value_key = $value_arr; } } elseif (in_array($key_type, array('boolean'))) { - if (!GETPOST($keysuffix."options_".$key.$keyprefix)) { + // We test on a hidden field named "..._boolean" that is always set to 1 if param is in form so + // when nothing is provided we can make a difference between noparam in the form and param was set to nothing. + if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix."_boolean")) { $value_key = ''; } else { $value_arr = GETPOST($keysuffix."options_".$key.$keyprefix); $value_key = $value_arr; } } elseif (in_array($key_type, array('html'))) { - if (!GETPOST($keysuffix."options_".$key.$keyprefix)) { + if (!GETPOSTISSET($keysuffix."options_".$key.$keyprefix)) { continue; // Value was not provided, we should not set it. } $value_key = dol_htmlcleanlastbr(GETPOST($keysuffix."options_".$key.$keyprefix, 'restricthtml')); diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index 82103ef0a2d..9db677432d1 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8752,10 +8752,16 @@ class Form } $useenhancedmultiselect = 0; - if (!empty($conf->use_javascript_ajax) && getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT')) { - $useenhancedmultiselect = 1; + if (!empty($conf->use_javascript_ajax) && (getDolGlobalString('MAIN_USE_JQUERY_MULTISELECT') || defined('REQUIRE_JQUERY_MULTISELECT'))) { + if ($addjscombo) { + $useenhancedmultiselect = 1; // Use the js multiselect in one line. Possible only if $addjscombo not 0. + } } + // We need a hidden field because when using the multiselect, if we unselect all, there is no + // variable submitted at all, so no way to make a difference between variable not submited and variable + // submited to nothing. + $out .= ''; // Output select component $out .= ''; - $out .= ''; + $out .= ''; + $out .= ''; + $out .= ''; $out .= "\n"; + $out .= " + "; return $out; } + + /** * Return templates of email with type = $type_template or type = 'all'. * This search into table c_email_templates. Used by the get_form function. From 6ba594efd8d03af3da4f7a19e9587b05cbc7aeda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 17 Jan 2024 18:38:06 +0100 Subject: [PATCH 072/104] fix phpstan in target.class.php --- htdocs/webhook/class/target.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 0ee668af87f..912c3d779b4 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -223,7 +223,7 @@ class Target extends CommonObject public function create(User $user, $notrigger = 0) { $resultcreate = $this->createCommon($user, $notrigger); - $this->ref = $this->id; + $this->ref = (string) $this->id; if ($resultcreate <= 0) { return $resultcreate; From 5667349d1eee848155feec4510adb726a67f0e31 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Wed, 17 Jan 2024 18:39:51 +0100 Subject: [PATCH 073/104] Update target.class.php --- htdocs/webhook/class/target.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/webhook/class/target.class.php b/htdocs/webhook/class/target.class.php index 912c3d779b4..9ae8dc6ee45 100644 --- a/htdocs/webhook/class/target.class.php +++ b/htdocs/webhook/class/target.class.php @@ -341,7 +341,7 @@ class Target extends CommonObject { $result = $this->fetchCommon($id, $ref); if (empty($this->ref)) { - $this->ref = $this->id; + $this->ref = (string) $this->id; } return $result; From aefd288f04ce8c4cf173b694b230ded7a6b6f8da Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Jan 2024 18:55:28 +0100 Subject: [PATCH 074/104] Fix merge pb --- htdocs/fourn/commande/list.php | 1 - 1 file changed, 1 deletion(-) diff --git a/htdocs/fourn/commande/list.php b/htdocs/fourn/commande/list.php index 39e6aac7e84..5178244186a 100644 --- a/htdocs/fourn/commande/list.php +++ b/htdocs/fourn/commande/list.php @@ -1020,7 +1020,6 @@ if ($resql) { exit; } - llxHeader('', $title, $help_url); llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-supplier-order page-list'); $param = ''; From f7485182f7b61949eeed1af60396f1948e9f6612 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Jan 2024 19:52:17 +0100 Subject: [PATCH 075/104] Fix warning and MAIN_MAIL_AUTOCOPY_... --- htdocs/comm/mailing/card.php | 2 +- htdocs/core/class/html.formmail.class.php | 21 ++++++++++++++------- htdocs/core/tpl/card_presend.tpl.php | 14 +++++++------- htdocs/expedition/card.php | 1 + htdocs/reception/card.php | 1 + 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/htdocs/comm/mailing/card.php b/htdocs/comm/mailing/card.php index 49d367f3935..8b4a885a16e 100644 --- a/htdocs/comm/mailing/card.php +++ b/htdocs/comm/mailing/card.php @@ -1147,7 +1147,7 @@ if ($action == 'create') { $formmail->withfrom = 0; $formmail->withto = $user->email ? $user->email : 1; $formmail->withtocc = 0; - $formmail->withtoccc = $conf->global->MAIN_EMAIL_USECCC; + $formmail->withtoccc = getDolGlobalString('MAIN_EMAIL_USECCC'); $formmail->withtopic = 0; $formmail->withtopicreadonly = 1; $formmail->withfile = 0; diff --git a/htdocs/core/class/html.formmail.class.php b/htdocs/core/class/html.formmail.class.php index 739223a5c66..6e086bba3d1 100644 --- a/htdocs/core/class/html.formmail.class.php +++ b/htdocs/core/class/html.formmail.class.php @@ -1201,6 +1201,7 @@ class FormMail extends Form public function getHtmlForWithCcc() { global $conf, $langs, $form; + $out = ''; $out .= $form->textwithpicto($langs->trans("MailCCC"), $langs->trans("YouCanUseCommaSeparatorForSeveralRecipients")); $out .= ''; @@ -1239,25 +1240,31 @@ class FormMail extends Form $showinfobcc = ''; if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO') && !empty($this->param['models']) && $this->param['models'] == 'propal_send') { - $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_PROPOSAL_TO; + $showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROPOSAL_TO'); } if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO') && !empty($this->param['models']) && $this->param['models'] == 'order_send') { - $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_ORDER_TO; + $showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_ORDER_TO'); } if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO') && !empty($this->param['models']) && $this->param['models'] == 'facture_send') { - $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_INVOICE_TO; + $showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_INVOICE_TO'); } if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO') && !empty($this->param['models']) && $this->param['models'] == 'supplier_proposal_send') { - $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO; + $showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_PROPOSAL_TO'); } if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO') && !empty($this->param['models']) && $this->param['models'] == 'order_supplier_send') { - $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO; + $showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_ORDER_TO'); } if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO') && !empty($this->param['models']) && $this->param['models'] == 'invoice_supplier_send') { - $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO; + $showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_SUPPLIER_INVOICE_TO'); } if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO') && !empty($this->param['models']) && $this->param['models'] == 'project') { - $showinfobcc = $conf->global->MAIN_MAIL_AUTOCOPY_PROJECT_TO; + $showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_PROJECT_TO'); + } + if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_SHIPMENT_TO') && !empty($this->param['models']) && $this->param['models'] == 'shipping_send') { + $showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_SHIPMENT_TO'); + } + if (getDolGlobalString('MAIN_MAIL_AUTOCOPY_RECEPTION_TO') && !empty($this->param['models']) && $this->param['models'] == 'reception_send') { + $showinfobcc = getDolGlobalString('MAIN_MAIL_AUTOCOPY_RECEPTION_TO'); } if ($showinfobcc) { $out .= ' + '.$showinfobcc; diff --git a/htdocs/core/tpl/card_presend.tpl.php b/htdocs/core/tpl/card_presend.tpl.php index 79c143849a6..039f4e2a96a 100644 --- a/htdocs/core/tpl/card_presend.tpl.php +++ b/htdocs/core/tpl/card_presend.tpl.php @@ -138,32 +138,32 @@ if ($action == 'presend') { } if ($object->element == 'salary' && getDolGlobalString('INVOICE_EMAIL_SENDER')) { $formmail->frommail = $conf->global->SINVOICE_EMAIL_SENDER; - $formmail->fromname = (getDolGlobalString('INVOICE_EMAIL_SENDER_NAME') ? $conf->global->INVOICE_EMAIL_SENDER_NAME : ''); + $formmail->fromname = getDolGlobalString('INVOICE_EMAIL_SENDER_NAME', ''); $formmail->fromtype = 'special'; } if ($object->element === 'facture' && getDolGlobalString('INVOICE_EMAIL_SENDER')) { $formmail->frommail = $conf->global->INVOICE_EMAIL_SENDER; - $formmail->fromname = (getDolGlobalString('INVOICE_EMAIL_SENDER_NAME') ? $conf->global->INVOICE_EMAIL_SENDER_NAME : ''); + $formmail->fromname = getDolGlobalString('INVOICE_EMAIL_SENDER_NAME', ''); $formmail->fromtype = 'special'; } if ($object->element === 'shipping' && getDolGlobalString('SHIPPING_EMAIL_SENDER')) { $formmail->frommail = $conf->global->SHIPPING_EMAIL_SENDER; - $formmail->fromname = (getDolGlobalString('SHIPPING_EMAIL_SENDER_NAME') ? $conf->global->SHIPPING_EMAIL_SENDER_NAME : ''); + $formmail->fromname = getDolGlobalString('SHIPPING_EMAIL_SENDER_NAME', ''); $formmail->fromtype = 'special'; } if ($object->element === 'commande' && getDolGlobalString('COMMANDE_EMAIL_SENDER')) { $formmail->frommail = $conf->global->COMMANDE_EMAIL_SENDER; - $formmail->fromname = (getDolGlobalString('COMMANDE_EMAIL_SENDER_NAME') ? $conf->global->COMMANDE_EMAIL_SENDER_NAME : ''); + $formmail->fromname = getDolGlobalString('COMMANDE_EMAIL_SENDER_NAME', ''); $formmail->fromtype = 'special'; } if ($object->element === 'order_supplier' && getDolGlobalString('ORDER_SUPPLIER_EMAIL_SENDER')) { $formmail->frommail = $conf->global->ORDER_SUPPLIER_EMAIL_SENDER; - $formmail->fromname = (getDolGlobalString('ORDER_SUPPLIER_EMAIL_SENDER_NAME') ? $conf->global->ORDER_SUPPLIER_EMAIL_SENDER_NAME : ''); + $formmail->fromname = getDolGlobalString('ORDER_SUPPLIER_EMAIL_SENDER_NAME', ''); $formmail->fromtype = 'special'; } if ($object->element === 'recruitmentcandidature') { - $formmail->frommail = (getDolGlobalString('RECRUITMENT_EMAIL_SENDER') ? $conf->global->RECRUITMENT_EMAIL_SENDER : $recruitermail); - $formmail->fromname = (getDolGlobalString('RECRUITMENT_EMAIL_SENDER_NAME') ? $conf->global->RECRUITMENT_EMAIL_SENDER_NAME : (!empty($recruitername) ? $recruitername : '')); + $formmail->frommail = getDolGlobalString('RECRUITMENT_EMAIL_SENDER', (!empty($recruitermail) ? $recruitermail : '')); + $formmail->fromname = getDolGlobalString('RECRUITMENT_EMAIL_SENDER_NAME', (!empty($recruitername) ? $recruitername : '')); $formmail->fromtype = 'special'; } diff --git a/htdocs/expedition/card.php b/htdocs/expedition/card.php index d939deac498..2cefd50cc3e 100644 --- a/htdocs/expedition/card.php +++ b/htdocs/expedition/card.php @@ -874,6 +874,7 @@ if (empty($reshook)) { } $triggersendname = 'SHIPPING_SENTBYMAIL'; $paramname = 'id'; + $autocopy = 'MAIN_MAIL_AUTOCOPY_SHIPMENT_TO'; $mode = 'emailfromshipment'; $trackid = 'shi'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; diff --git a/htdocs/reception/card.php b/htdocs/reception/card.php index 68851629917..a210353f01c 100644 --- a/htdocs/reception/card.php +++ b/htdocs/reception/card.php @@ -733,6 +733,7 @@ if (empty($reshook)) { $triggersendname = 'RECEPTION_SENTBYMAIL'; $paramname = 'id'; $mode = 'emailfromreception'; + $autocopy = 'MAIN_MAIL_AUTOCOPY_RECEPTION_TO'; $trackid = 'rec'.$object->id; include DOL_DOCUMENT_ROOT.'/core/actions_sendmails.inc.php'; } From 11a2f2c35252b5cb7b3cab2da74f1de90fd7913e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20France?= Date: Wed, 17 Jan 2024 20:09:10 +0100 Subject: [PATCH 076/104] extend bookeepingline class --- htdocs/accountancy/bookkeeping/card.php | 2 +- htdocs/accountancy/bookkeeping/export.php | 2 +- htdocs/accountancy/bookkeeping/list.php | 2 +- htdocs/accountancy/class/bookkeeping.class.php | 13 +++++++------ 4 files changed, 10 insertions(+), 9 deletions(-) diff --git a/htdocs/accountancy/bookkeeping/card.php b/htdocs/accountancy/bookkeeping/card.php index 7d42cb64a00..0e4abdaebd4 100644 --- a/htdocs/accountancy/bookkeeping/card.php +++ b/htdocs/accountancy/bookkeeping/card.php @@ -663,7 +663,7 @@ if ($action == 'create') { if (!empty($object->linesmvt[0])) { $tmpline = $object->linesmvt[0]; if (!empty($tmpline->numero_compte)) { - $line = new BookKeepingLine(); + $line = new BookKeepingLine($db); $object->linesmvt[] = $line; } } diff --git a/htdocs/accountancy/bookkeeping/export.php b/htdocs/accountancy/bookkeeping/export.php index 498a8ee2ed3..f92c3aee5f0 100644 --- a/htdocs/accountancy/bookkeeping/export.php +++ b/htdocs/accountancy/bookkeeping/export.php @@ -1087,7 +1087,7 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print "\n"; -$line = new BookKeepingLine(); +$line = new BookKeepingLine($db); // Loop on record // -------------------------------------------------------------------- diff --git a/htdocs/accountancy/bookkeeping/list.php b/htdocs/accountancy/bookkeeping/list.php index ed00a185230..be1c5a34fcd 100644 --- a/htdocs/accountancy/bookkeeping/list.php +++ b/htdocs/accountancy/bookkeeping/list.php @@ -1037,7 +1037,7 @@ if (!getDolGlobalString('MAIN_CHECKBOX_LEFT_COLUMN')) { print "\n"; -$line = new BookKeepingLine(); +$line = new BookKeepingLine($db); // Loop on record // -------------------------------------------------------------------- diff --git a/htdocs/accountancy/class/bookkeeping.class.php b/htdocs/accountancy/class/bookkeeping.class.php index a479ce52bc2..554f4390510 100644 --- a/htdocs/accountancy/class/bookkeeping.class.php +++ b/htdocs/accountancy/class/bookkeeping.class.php @@ -26,6 +26,7 @@ // Class require_once DOL_DOCUMENT_ROOT.'/core/class/commonobject.class.php'; +require_once DOL_DOCUMENT_ROOT.'/core/class/commonobjectline.class.php'; require_once DOL_DOCUMENT_ROOT.'/core/class/fiscalyear.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingjournal.class.php'; require_once DOL_DOCUMENT_ROOT.'/accountancy/class/accountingaccount.class.php'; @@ -986,7 +987,7 @@ class BookKeeping extends CommonObject $i = 0; while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) { - $line = new BookKeepingLine(); + $line = new BookKeepingLine($this->db); $line->id = $obj->rowid; @@ -1140,7 +1141,7 @@ class BookKeeping extends CommonObject $i = 0; while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) { - $line = new BookKeepingLine(); + $line = new BookKeepingLine($this->db); $line->id = $obj->rowid; @@ -1275,7 +1276,7 @@ class BookKeeping extends CommonObject $i = 0; while (($obj = $this->db->fetch_object($resql)) && (empty($limit) || $i < min($limit, $num))) { - $line = new BookKeepingLine(); + $line = new BookKeepingLine($this->db); $line->numero_compte = $obj->numero_compte; //$line->label_compte = $obj->label_compte; @@ -1881,7 +1882,7 @@ class BookKeeping extends CommonObject $result = $this->db->query($sql); if ($result) { while ($obj = $this->db->fetch_object($result)) { - $line = new BookKeepingLine(); + $line = new BookKeepingLine($this->db); $line->id = $obj->rowid; @@ -1951,7 +1952,7 @@ class BookKeeping extends CommonObject $num = $this->db->num_rows($resql); while ($obj = $this->db->fetch_object($resql)) { - $line = new BookKeepingLine(); + $line = new BookKeepingLine($this->db); $line->id = $obj->rowid; @@ -2976,7 +2977,7 @@ class BookKeeping extends CommonObject /** * Class BookKeepingLine */ -class BookKeepingLine +class BookKeepingLine extends CommonObjectLine { /** * @var int ID From af3bb1d1444acb6b9f12a3994ebd2b69b33c889c Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Jan 2024 20:23:38 +0100 Subject: [PATCH 077/104] Merge --- htdocs/core/class/html.form.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index eaea84e8dc8..f7b8edb5eee 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8021,7 +8021,7 @@ class Form $objectdescorig = $objectdesc; $objecttmp = null; $InfoFieldList = array(); - + var_dump($objectfield); if ($objectfield) { // We must retreive the objectdesc from the field or extrafield // Example: $objectfield = 'product:options_package' $tmparray = explode(':', $objectfield); From 8ca7f0c989213c985d70614479b0f0b9857d4493 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 17 Jan 2024 20:38:22 +0100 Subject: [PATCH 078/104] Fix var_dump --- htdocs/core/class/html.form.class.php | 16 ++++++---------- htdocs/core/lib/functions.lib.php | 3 +++ 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/htdocs/core/class/html.form.class.php b/htdocs/core/class/html.form.class.php index e291dfb27fe..eeffd1aea4a 100644 --- a/htdocs/core/class/html.form.class.php +++ b/htdocs/core/class/html.form.class.php @@ -8019,7 +8019,7 @@ class Form $objectdescorig = $objectdesc; $objecttmp = null; $InfoFieldList = array(); - var_dump($objectfield); + if ($objectfield) { // We must retreive the objectdesc from the field or extrafield // Example: $objectfield = 'product:options_package' $tmparray = explode(':', $objectfield); @@ -8486,10 +8486,6 @@ class Form $out .= ajax_combobox($idname, array(), 0, 0, 'resolve', (((int) $show_empty) < 0 ? (string) $show_empty : '-1'), $morecss); } - - - - return $out; } @@ -9034,11 +9030,11 @@ class Form /** * Show linked object block. * - * @param CommonObject $object Object we want to show links to - * @param string $morehtmlright More html to show on right of title - * @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action - * @param string $title Title - * @return int Return integer <0 if KO, >=0 if OK + * @param CommonObject $object Object we want to show links to + * @param string $morehtmlright More html to show on right of title + * @param array $compatibleImportElementsList Array of compatibles elements object for "import from" action + * @param string $title Title + * @return int Return integer <0 if KO, >=0 if OK */ public function showLinkedObjectBlock($object, $morehtmlright = '', $compatibleImportElementsList = array(), $title = 'RelatedObjects') { diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index f820d3f5b92..1e04926cad9 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -11856,6 +11856,9 @@ function getElementProperties($element_type) $module = 'societe'; $subelement = 'contact'; $table_element = 'socpeople'; + } elseif ($element_type == 'inventory') { + $module = 'product'; + $classpath = 'product/inventory/class'; } elseif ($element_type == 'stock') { $classpath = 'product/stock/class'; $classfile = 'entrepot'; From 3134021875c86c653333be0b366b779b73beb28d Mon Sep 17 00:00:00 2001 From: pascal Date: Wed, 17 Jan 2024 20:41:25 +0100 Subject: [PATCH 079/104] Enhancing rest error messages --- htdocs/api/class/api_setup.class.php | 120 +++++++++++++++++---------- 1 file changed, 77 insertions(+), 43 deletions(-) diff --git a/htdocs/api/class/api_setup.class.php b/htdocs/api/class/api_setup.class.php index fe9e885dcc8..3bb8c08e892 100644 --- a/htdocs/api/class/api_setup.class.php +++ b/htdocs/api/class/api_setup.class.php @@ -63,7 +63,9 @@ class Setup extends DolibarrApi * * @return array [List of ordering methods] * - * @throws RestException 400 + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 401 Access denied + * @throws RestException 503 Error retrieving list of ordering methods */ public function getOrderingMethods($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -81,7 +83,7 @@ class Setup extends DolibarrApi $errormessage = ''; $sql .= forgeSQLFromUniversalSearchCriteria($sqlfilters, $errormessage); if ($errormessage) { - throw new RestException(503, 'Error when validating parameter sqlfilters -> '.$errormessage); + throw new RestException(400, 'Error when validating parameter sqlfilters -> '.$errormessage); } } @@ -106,7 +108,7 @@ class Setup extends DolibarrApi $list[] = $this->db->fetch_object($result); } } else { - throw new RestException(400, $this->db->lasterror()); + throw new RestException(503, $this->db->lasterror()); } return $list; @@ -125,7 +127,9 @@ class Setup extends DolibarrApi * * @url GET dictionary/ordering_origins * - * @throws RestException 400 + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 401 Access denied + * @throws RestException 503 Error retrieving list of ordering origins */ public function getOrderingOrigins($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -168,7 +172,7 @@ class Setup extends DolibarrApi $list[] = $this->db->fetch_object($result); } } else { - throw new RestException(400, $this->db->lasterror()); + throw new RestException(503, $this->db->lasterror()); } return $list; @@ -188,7 +192,9 @@ class Setup extends DolibarrApi * * @return array [List of payment types] * - * @throws RestException 400 + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 401 Access denied + * @throws RestException 503 Error retrieving list of payment types */ public function getPaymentTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -232,7 +238,7 @@ class Setup extends DolibarrApi $list[] = $this->db->fetch_object($result); } } else { - throw new RestException(400, $this->db->lasterror()); + throw new RestException(503, $this->db->lasterror()); } return $list; @@ -253,7 +259,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/regions * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error retrieving list of regions */ public function getListOfRegions($sortfield = "code_region", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $filter = '', $sqlfilters = '') { @@ -316,7 +323,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/regions/{id} * - * @throws RestException + * @throws RestException 404 Region not found + * @throws RestException 503 Error retrieving region */ public function getRegionByID($id) { @@ -331,7 +339,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/regions/byCode/{code} * - * @throws RestException + * @throws RestException 404 Region not found + * @throws RestException 503 Error when retrieving region */ public function getRegionByCode($code) { @@ -357,7 +366,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/states * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error retrieving list of states */ public function getListOfStates($sortfield = "code_departement", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $filter = '', $sqlfilters = '') { @@ -422,7 +432,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/states/{id} * - * @throws RestException + * @throws RestException 404 State not found + * @throws RestException 503 Error retrieving state */ public function getStateByID($id) { @@ -437,7 +448,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/states/byCode/{code} * - * @throws RestException + * @throws RestException 404 State not found + * @throws RestException 503 Error retrieving state */ public function getStateByCode($code) { @@ -463,7 +475,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/countries * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error retrieving list of countries */ public function getListOfCountries($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $filter = '', $lang = '', $sqlfilters = '') { @@ -527,7 +540,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/countries/{id} * - * @throws RestException + * @throws RestException 404 Country not found + * @throws RestException 503 Error retrieving country */ public function getCountryByID($id, $lang = '') { @@ -543,7 +557,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/countries/byCode/{code} * - * @throws RestException + * @throws RestException 404 Country not found + * @throws RestException 503 Error retrieving country */ public function getCountryByCode($code, $lang = '') { @@ -559,7 +574,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/countries/byISO/{iso} * - * @throws RestException + * @throws RestException 404 Country not found + * @throws RestException 503 Error retrieving country */ public function getCountryByISO($iso, $lang = '') { @@ -654,7 +670,9 @@ class Setup extends DolibarrApi * * @return array [List of availability] * - * @throws RestException 400 + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 401 Access denied + * @throws RestException 503 Error when retrieving list of availabilities */ public function getAvailability($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -697,7 +715,7 @@ class Setup extends DolibarrApi $list[] = $this->db->fetch_object($result); } } else { - throw new RestException(400, $this->db->lasterror()); + throw new RestException(503, $this->db->lasterror()); } return $list; @@ -766,7 +784,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/event_types * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of events types */ public function getListOfEventTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $sqlfilters = '') { @@ -832,7 +851,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/expensereport_types * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of expense report types */ public function getListOfExpenseReportsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $sqlfilters = '') { @@ -897,7 +917,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/contact_types * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of contacts types */ public function getListOfContactTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $type = '', $module = '', $active = 1, $lang = '', $sqlfilters = '') { @@ -965,7 +986,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/civilities * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of civilities */ public function getListOfCivilities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $module = '', $active = 1, $lang = '', $sqlfilters = '') { @@ -1029,7 +1051,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/currencies * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of currencies */ public function getListOfCurrencies($multicurrency = 0, $sortfield = "code_iso", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -1098,7 +1121,8 @@ class Setup extends DolibarrApi * * @url GET extrafields * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of extra fields */ public function getListOfExtrafields($sortfield = "t.pos", $sortorder = 'ASC', $type = '', $sqlfilters = '') { @@ -1175,7 +1199,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/towns * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of towns */ public function getListOfTowns($sortfield = "zip,town", $sortorder = 'ASC', $limit = 100, $page = 0, $zipcode = '', $town = '', $active = 1, $sqlfilters = '') { @@ -1240,7 +1265,8 @@ class Setup extends DolibarrApi * * @return array List of payment terms * - * @throws RestException 400 + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of payments terms */ public function getPaymentTerms($sortfield = "sortorder", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -1284,7 +1310,7 @@ class Setup extends DolibarrApi $list[] = $this->db->fetch_object($result); } } else { - throw new RestException(400, $this->db->lasterror()); + throw new RestException(503, $this->db->lasterror()); } return $list; @@ -1303,7 +1329,8 @@ class Setup extends DolibarrApi * * @return array List of shipping methods * - * @throws RestException 400 + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of shipping modes */ public function getShippingModes($limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '') { @@ -1345,7 +1372,7 @@ class Setup extends DolibarrApi $list[] = $method; } } else { - throw new RestException(400, $this->db->lasterror()); + throw new RestException(503, $this->db->lasterror()); } return $list; @@ -1364,7 +1391,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/units * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of measuring units */ public function getListOfMeasuringUnits($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -1423,7 +1451,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/legal_form * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of legal form */ public function getListOfLegalForm($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $country = 0, $active = 1, $sqlfilters = '') { @@ -1484,7 +1513,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/staff * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of staff */ public function getListOfStaff($sortfield = "id", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -1542,7 +1572,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/socialnetworks * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of social networks */ public function getListOfsocialNetworks($sortfield = "rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $sqlfilters = '') { @@ -1608,7 +1639,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/ticket_categories * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of tickets categories */ public function getTicketsCategories($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '') { @@ -1670,7 +1702,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/ticket_severities * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of tickets severities */ public function getTicketsSeverities($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '') { @@ -1732,7 +1765,8 @@ class Setup extends DolibarrApi * * @url GET dictionary/ticket_types * - * @throws RestException + * @throws RestException 400 Bad value for sqlfilters + * @throws RestException 503 Error when retrieving list of tickets types */ public function getTicketsTypes($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '') { @@ -1795,7 +1829,7 @@ class Setup extends DolibarrApi * * @url GET dictionary/incoterms * - * @throws RestException + * @throws RestException 503 Error when retrieving list of incoterms types */ public function getListOfIncoterms($sortfield = "code", $sortorder = 'ASC', $limit = 100, $page = 0, $active = 1, $lang = '', $sqlfilters = '') { @@ -1905,7 +1939,7 @@ class Setup extends DolibarrApi * * @url GET /establishments * - * @throws RestException + * @throws RestException 503 Error when retrieving list of establishments */ public function getEstablishments() { @@ -1943,7 +1977,8 @@ class Setup extends DolibarrApi * * @url GET establishments/{id} * - * @throws RestException + * @throws RestException 404 Establishment not found + * @throws RestException 503 Error when retrieving establishment */ public function getEtablishmentByID($id) { @@ -1969,8 +2004,8 @@ class Setup extends DolibarrApi * * @url GET conf/{constantname} * + * @throws RestException 400 Error Bad or unknown value for constantname * @throws RestException 403 Forbidden - * @throws RestException 404 Error Bad or unknown value for constantname */ public function getConf($constantname) { @@ -1982,7 +2017,7 @@ class Setup extends DolibarrApi } if (!preg_match('/^[a-zA-Z0-9_]+$/', $constantname) || !isset($conf->global->$constantname)) { - throw new RestException(404, 'Error Bad or unknown value for constantname'); + throw new RestException(400, 'Error Bad or unknown value for constantname'); } if (isASecretKey($constantname)) { throw new RestException(403, 'Forbidden. This parameter can not be read with APIs'); @@ -2002,7 +2037,6 @@ class Setup extends DolibarrApi * @throws RestException 403 Forbidden * @throws RestException 404 Signature file not found * @throws RestException 500 Technical error - * @throws RestException 503 Forbidden */ public function getCheckIntegrity($target) { From b052e1b4cceab75ea9cf77e17c660a0a6a94930e Mon Sep 17 00:00:00 2001 From: pascal Date: Wed, 17 Jan 2024 20:52:32 +0100 Subject: [PATCH 080/104] qual enhance rest --- htdocs/bom/class/api_boms.class.php | 39 +++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/htdocs/bom/class/api_boms.class.php b/htdocs/bom/class/api_boms.class.php index d84b25d7225..2f68b565394 100644 --- a/htdocs/bom/class/api_boms.class.php +++ b/htdocs/bom/class/api_boms.class.php @@ -61,7 +61,9 @@ class Boms extends DolibarrApi * @return Object Object with cleaned properties * * @url GET {id} - * @throws RestException + * + * @throws RestException 401 Access denied + * @throws RestException 404 BOM not found */ public function get($id) { @@ -95,7 +97,9 @@ class Boms extends DolibarrApi * @param string $properties Restrict the data returned to these properties. Ignored if empty. Comma separated list of properties names * @return array Array of order objects * - * @throws RestException + * @throws RestException 400 Bad sqlfilters + * @throws RestException 401 Access denied + * @throws RestException 503 Error retrieving list of boms */ public function index($sortfield = "t.rowid", $sortorder = 'ASC', $limit = 100, $page = 0, $sqlfilters = '', $properties = '') { @@ -176,6 +180,9 @@ class Boms extends DolibarrApi * * @param array $request_data Request datas * @return int ID of bom + * + * @throws RestException 401 Access denied + * @throws RestException 500 Error retrieving list of boms */ public function post($request_data = null) { @@ -210,6 +217,10 @@ class Boms extends DolibarrApi * @param array $request_data Datas * * @return int + * + * @throws RestException 401 Access denied + * @throws RestException 404 BOM not found + * @throws RestException 500 Error updating bom */ public function put($id, $request_data = null) { @@ -253,6 +264,10 @@ class Boms extends DolibarrApi * * @param int $id BOM ID * @return array + * + * @throws RestException 401 Access denied + * @throws RestException 404 BOM not found + * @throws RestException 500 Error deleting bom */ public function delete($id) { @@ -288,6 +303,9 @@ class Boms extends DolibarrApi * @url GET {id}/lines * * @return array + * + * @throws RestException 401 Access denied + * @throws RestException 404 BOM not found */ public function getLines($id) { @@ -320,6 +338,10 @@ class Boms extends DolibarrApi * @url POST {id}/lines * * @return int + * + * @throws RestException 401 Access denied + * @throws RestException 404 BOM not found + * @throws RestException 500 Error adding bom line */ public function postLine($id, $request_data = null) { @@ -353,7 +375,7 @@ class Boms extends DolibarrApi if ($updateRes > 0) { return $updateRes; } else { - throw new RestException(400, $this->bom->error); + throw new RestException(500, $this->bom->error); } } @@ -367,6 +389,9 @@ class Boms extends DolibarrApi * @url PUT {id}/lines/{lineid} * * @return object|bool + * + * @throws RestException 401 Access denied + * @throws RestException 404 BOM not found */ public function putLine($id, $lineid, $request_data = null) { @@ -415,9 +440,9 @@ class Boms extends DolibarrApi * * @return int * - * @throws RestException 401 - * @throws RestException 404 - * @throws RestException 500 + * @throws RestException 401 Access denied + * @throws RestException 404 BOM not found + * @throws RestException 500 Error deleting bom line */ public function deleteLine($id, $lineid) { @@ -450,7 +475,7 @@ class Boms extends DolibarrApi if ($updateRes > 0) { return $this->get($id); } else { - throw new RestException(405, $this->bom->error); + throw new RestException(500, $this->bom->error); } } From 16c30d5ef9e308c4322d906c5a4e4b015ae2293d Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 17 Jan 2024 20:55:01 +0100 Subject: [PATCH 081/104] fix: exchange bad translation --- htdocs/compta/resultat/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/compta/resultat/index.php b/htdocs/compta/resultat/index.php index 8a5c2855fac..6a1fd134562 100644 --- a/htdocs/compta/resultat/index.php +++ b/htdocs/compta/resultat/index.php @@ -189,12 +189,12 @@ if (isModEnabled('accounting')) { $calcmode .= ''; $calcmode .= '
'; } -$calcmode .= '