From e74043d48e8cec111fb052506bc9621f107b8f1d Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Wed, 22 Sep 2021 17:56:31 +0200 Subject: [PATCH 01/14] Close: #18801 Jan-30 + 1m IS NOT Mar-2 Close: #18801 related to avoid this behaviour https://bugs.php.net/bug.php?id=74013 --- htdocs/core/lib/date.lib.php | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index fe21071901a..21a8835a229 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -166,7 +166,33 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) } else { $date->add($interval); } - + //Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (php returns March 1, 2 or 3 respectively) + if ($conf->global->MAIN_DATE_CHANGE_PHP_DATEINTERVAL_RESULT_FEBRUARY && $duration_unit == 'm') { + + $timeyear = dol_print_date($time, '%Y'); + $timemonth = dol_print_date($time, '%m'); + $timetotalmonths = (($timeyear * 12) + $timemonth); + + $monthsexpected = ($timetotalmonths + $duration_value); + + $newtime = $date->getTimestamp(); + + $newtimeyear = dol_print_date($newtime, '%Y'); + $newtimemonth = dol_print_date($newtime, '%m'); + $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth); + + if ($monthsexpected < $newtimetotalmonths) { + + $newtimehours = dol_print_date($newtime, '%m'); + $newtimemins = dol_print_date($newtime, '%m'); + $newtimesecs = dol_print_date($newtime, '%m'); + + $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear); + $datelim -= (3600 * 24); + + $date->setTimestamp($datelim); + } + } return $date->getTimestamp(); } From e5cff0ede117553c11b269a2a529fbac41eee8fb Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Wed, 22 Sep 2021 16:07:36 +0000 Subject: [PATCH 02/14] Fixing style errors. --- htdocs/core/lib/date.lib.php | 46 +++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 21a8835a229..cff6d22518f 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -168,30 +168,28 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) } //Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (php returns March 1, 2 or 3 respectively) if ($conf->global->MAIN_DATE_CHANGE_PHP_DATEINTERVAL_RESULT_FEBRUARY && $duration_unit == 'm') { - - $timeyear = dol_print_date($time, '%Y'); - $timemonth = dol_print_date($time, '%m'); - $timetotalmonths = (($timeyear * 12) + $timemonth); - - $monthsexpected = ($timetotalmonths + $duration_value); - - $newtime = $date->getTimestamp(); - - $newtimeyear = dol_print_date($newtime, '%Y'); - $newtimemonth = dol_print_date($newtime, '%m'); - $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth); - - if ($monthsexpected < $newtimetotalmonths) { - - $newtimehours = dol_print_date($newtime, '%m'); - $newtimemins = dol_print_date($newtime, '%m'); - $newtimesecs = dol_print_date($newtime, '%m'); - - $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear); - $datelim -= (3600 * 24); - - $date->setTimestamp($datelim); - } + $timeyear = dol_print_date($time, '%Y'); + $timemonth = dol_print_date($time, '%m'); + $timetotalmonths = (($timeyear * 12) + $timemonth); + + $monthsexpected = ($timetotalmonths + $duration_value); + + $newtime = $date->getTimestamp(); + + $newtimeyear = dol_print_date($newtime, '%Y'); + $newtimemonth = dol_print_date($newtime, '%m'); + $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth); + + if ($monthsexpected < $newtimetotalmonths) { + $newtimehours = dol_print_date($newtime, '%m'); + $newtimemins = dol_print_date($newtime, '%m'); + $newtimesecs = dol_print_date($newtime, '%m'); + + $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear); + $datelim -= (3600 * 24); + + $date->setTimestamp($datelim); + } } return $date->getTimestamp(); } From c4f1eb0c46fdaa81cc335e906177d752e8bb829e Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Mon, 27 Sep 2021 14:32:03 +0200 Subject: [PATCH 03/14] Update date.lib.php Fix my error --- htdocs/core/lib/date.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index cff6d22518f..b17c0c9d56d 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -181,9 +181,9 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth); if ($monthsexpected < $newtimetotalmonths) { - $newtimehours = dol_print_date($newtime, '%m'); - $newtimemins = dol_print_date($newtime, '%m'); - $newtimesecs = dol_print_date($newtime, '%m'); + $newtimehours = dol_print_date($newtime, '%h'); + $newtimemins = dol_print_date($newtime, '%i'); + $newtimesecs = dol_print_date($newtime, '%s'); $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear); $datelim -= (3600 * 24); From 11723c2cd08fb15ffac8a51e8526fb9fec5c287a Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Mon, 27 Sep 2021 14:49:22 +0200 Subject: [PATCH 04/14] Update date.lib.php Without words, sorry --- htdocs/core/lib/date.lib.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index b17c0c9d56d..613533a443a 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -181,9 +181,9 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) $newtimetotalmonths = (($newtimeyear * 12) + $newtimemonth); if ($monthsexpected < $newtimetotalmonths) { - $newtimehours = dol_print_date($newtime, '%h'); - $newtimemins = dol_print_date($newtime, '%i'); - $newtimesecs = dol_print_date($newtime, '%s'); + $newtimehours = dol_print_date($newtime, '%H'); + $newtimemins = dol_print_date($newtime, '%M'); + $newtimesecs = dol_print_date($newtime, '%S'); $datelim = dol_mktime($newtimehours, $newtimemins, $newtimesecs, $newtimemonth, 1, $newtimeyear); $datelim -= (3600 * 24); From 2ca0a1facf2e82fc76983d6613238badbb4f0b57 Mon Sep 17 00:00:00 2001 From: javieralapps4up Date: Wed, 20 Oct 2021 00:36:24 +0200 Subject: [PATCH 05/14] Update date.lib.php --- htdocs/core/lib/date.lib.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 613533a443a..ac91ea3065e 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -117,7 +117,7 @@ function getServerTimeZoneInt($refgmtdate = 'now') * @param int $duration_unit Unit of added delay (d, m, y, w, h, i) * @return int New timestamp */ -function dol_time_plus_duree($time, $duration_value, $duration_unit) +function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth = 0) { global $conf; @@ -167,7 +167,7 @@ function dol_time_plus_duree($time, $duration_value, $duration_unit) $date->add($interval); } //Change the behavior of PHP over data-interval when the result of this function is Feb 29 (non-leap years), 30 or Feb 31 (php returns March 1, 2 or 3 respectively) - if ($conf->global->MAIN_DATE_CHANGE_PHP_DATEINTERVAL_RESULT_FEBRUARY && $duration_unit == 'm') { + if ($ruleforendofmonth == 1 && $duration_unit == 'm') { $timeyear = dol_print_date($time, '%Y'); $timemonth = dol_print_date($time, '%m'); $timetotalmonths = (($timeyear * 12) + $timemonth); From 054388be0101b73225c75040c679cf0d593bf501 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Oct 2021 11:45:36 +0200 Subject: [PATCH 06/14] doxygen --- htdocs/admin/hrm.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/admin/hrm.php b/htdocs/admin/hrm.php index 2bcd4977716..8eb2f93c13c 100644 --- a/htdocs/admin/hrm.php +++ b/htdocs/admin/hrm.php @@ -20,7 +20,7 @@ */ /** - * \file hrm/admin/setup.php + * \file htdocs/admin/hrm.php * \ingroup hrm * \brief HrmTest setup page. */ From 82b9dc6c87857fe4d1de90e6c2fa7623bd6fed9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Thu, 21 Oct 2021 11:50:48 +0200 Subject: [PATCH 07/14] doxygen --- htdocs/core/modules/modEventOrganization.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/core/modules/modEventOrganization.class.php b/htdocs/core/modules/modEventOrganization.class.php index 8a3fb3d80cf..6ab1c8acb89 100644 --- a/htdocs/core/modules/modEventOrganization.class.php +++ b/htdocs/core/modules/modEventOrganization.class.php @@ -19,7 +19,7 @@ * \defgroup eventorganization Module EventOrganization * \brief EventOrganization module descriptor. * - * \file htdocs/eventorganization/core/modules/modEventOrganization.class.php + * \file htdocs/core/modules/modEventOrganization.class.php * \ingroup eventorganization * \brief Description and activation file for the EventOrganization */ From 860fb21d2db049835e8e12c58b564703c275ba15 Mon Sep 17 00:00:00 2001 From: Maxime Kohlhaas Date: Thu, 21 Oct 2021 23:50:20 +0200 Subject: [PATCH 08/14] Fix expense report warning display + translations --- htdocs/expensereport/card.php | 2 +- htdocs/expensereport/class/expensereport.class.php | 4 ++-- htdocs/langs/en_US/trips.lang | 10 +++++----- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/expensereport/card.php b/htdocs/expensereport/card.php index 736acf5683d..2942358545b 100644 --- a/htdocs/expensereport/card.php +++ b/htdocs/expensereport/card.php @@ -2196,7 +2196,7 @@ if ($action == 'create') { print ''; print ''; - print !empty($line->rule_warning_message) ? img_info(html_entity_decode($line->rule_warning_message)) : ' '; + print !empty($line->rule_warning_message) ? img_warning(html_entity_decode($line->rule_warning_message)) : ' '; print ''; // Ajout des boutons de modification/suppression diff --git a/htdocs/expensereport/class/expensereport.class.php b/htdocs/expensereport/class/expensereport.class.php index b58a478f3c0..877a7c79ade 100644 --- a/htdocs/expensereport/class/expensereport.class.php +++ b/htdocs/expensereport/class/expensereport.class.php @@ -1912,12 +1912,12 @@ class ExpenseReport extends CommonObject $this->errors[] = $this->error; $new_current_total_ttc -= $amount_to_test - $rule->amount; // ex, entered 16€, limit 12€, subtracts 4€; - $rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationError', $rule->id, price($amount_to_test, 0, $langs, 1, -1, -1, $conf->currency), price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency), $langs->trans('by'.$rule->code_expense_rules_type, price($new_current_total_ttc, 0, $langs, 1, -1, -1, $conf->currency))); + $rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationError', $rule->id, price($amount_to_test, 0, $langs, 1, -1, -1, $conf->currency), price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency)); } else { $this->error = 'ExpenseReportConstraintViolationWarning'; $this->errors[] = $this->error; - $rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationWarning', $rule->id, price($amount_to_test, 0, $langs, 1, -1, -1, $conf->currency), price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency), $langs->trans('nolimitby'.$rule->code_expense_rules_type)); + $rule_warning_message_tab[] = $langs->trans('ExpenseReportConstraintViolationWarning', $rule->id, price($amount_to_test, 0, $langs, 1, -1, -1, $conf->currency), price($rule->amount, 0, $langs, 1, -1, -1, $conf->currency)); } // No break, we sould test if another rule is violated diff --git a/htdocs/langs/en_US/trips.lang b/htdocs/langs/en_US/trips.lang index c9a6c792077..9210ede360c 100644 --- a/htdocs/langs/en_US/trips.lang +++ b/htdocs/langs/en_US/trips.lang @@ -112,7 +112,7 @@ ConfirmCloneExpenseReport=Are you sure you want to clone this expense report ? ExpenseReportsIk=Configuration of mileage charges ExpenseReportsRules=Expense report rules ExpenseReportIkDesc=You can modify the calculation of kilometers expense by category and range who they are previously defined. d is the distance in kilometers -ExpenseReportRulesDesc=You can create or update any rules of calculation. This part will be used when user will create a new expense report +ExpenseReportRulesDesc=You can define max amount rules for expense reports. These rules will be applied when a new expense is added to an expense report expenseReportOffset=Offset expenseReportCoef=Coefficient expenseReportTotalForFive=Example with d = 5 @@ -127,19 +127,19 @@ ExpenseReportDomain=Domain to apply ExpenseReportLimitOn=Limit on ExpenseReportDateStart=Date start ExpenseReportDateEnd=Date end -ExpenseReportLimitAmount=Limite amount -ExpenseReportRestrictive=Restrictive +ExpenseReportLimitAmount=Max amount +ExpenseReportRestrictive=Exceeding forbidden AllExpenseReport=All type of expense report OnExpense=Expense line ExpenseReportRuleSave=Expense report rule saved ExpenseReportRuleErrorOnSave=Error: %s RangeNum=Range %d -ExpenseReportConstraintViolationError=Constraint violation id [%s]: %s is superior to %s %s +ExpenseReportConstraintViolationError=Max amount exceeded (rule %s): %s is higher than %s (Exceeding forbidden) byEX_DAY=by day (limitation to %s) byEX_MON=by month (limitation to %s) byEX_YEA=by year (limitation to %s) byEX_EXP=by line (limitation to %s) -ExpenseReportConstraintViolationWarning=Constraint violation id [%s]: %s is superior to %s %s +ExpenseReportConstraintViolationWarning=Max amount exceeded (rule %s): %s is higher than %s (Exceeding authorized) nolimitbyEX_DAY=by day (no limitation) nolimitbyEX_MON=by month (no limitation) nolimitbyEX_YEA=by year (no limitation) From d1c9877c411640022079aa3b4d34bcd3b08cfba6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 22 Oct 2021 07:02:44 +0200 Subject: [PATCH 09/14] fix missing code comment --- htdocs/core/lib/date.lib.php | 1 + 1 file changed, 1 insertion(+) diff --git a/htdocs/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php index 8514ab56554..e7ab98ca3b6 100644 --- a/htdocs/core/lib/date.lib.php +++ b/htdocs/core/lib/date.lib.php @@ -115,6 +115,7 @@ function getServerTimeZoneInt($refgmtdate = 'now') * @param int $time Date timestamp (or string with format YYYY-MM-DD) * @param int $duration_value Value of delay to add * @param int $duration_unit Unit of added delay (d, m, y, w, h, i) + * @param int $ruleforendofmonth Change the behavior of PHP over data-interval, 0 or 1 * @return int New timestamp */ function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth = 0) From 0adb910e56586115e2329b6395a910304562c916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 22 Oct 2021 07:27:10 +0200 Subject: [PATCH 10/14] fix sql error --- htdocs/eventorganization/conferenceorbooth_list.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/eventorganization/conferenceorbooth_list.php b/htdocs/eventorganization/conferenceorbooth_list.php index d6266ec241e..c02306ba6be 100644 --- a/htdocs/eventorganization/conferenceorbooth_list.php +++ b/htdocs/eventorganization/conferenceorbooth_list.php @@ -487,7 +487,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks From e2e3e8ef7b1a561a3700d7edf8b3844a08f354e8 Mon Sep 17 00:00:00 2001 From: Dennis Priskorn <68460690+dpriskorn@users.noreply.github.com> Date: Fri, 22 Oct 2021 10:18:23 +0200 Subject: [PATCH 11/14] Update api_supplier_invoices.class.php Add 2 examples --- htdocs/fourn/class/api_supplier_invoices.class.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index df1bf36b723..4c2b66caa96 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -201,6 +201,10 @@ class SupplierInvoices extends DolibarrApi /** * Create supplier invoice object * + * Note: soc_id = dolibarr_order_id + * + * Example: {'ref': 'auto', 'ref_supplier': '7985630', 'socid': 1, 'note': 'Inserted with Python', 'order_supplier': 1, 'date': '2021-07-28'} + * * @param array $request_data Request datas * * @return int ID of supplier invoice @@ -525,6 +529,10 @@ class SupplierInvoices extends DolibarrApi /** * Add a line to given supplier invoice * + * Note: socid = dolibarr_order_id, pu_ht = net price, remise = discount + * + * Example: {'socid': 1, 'qty': 1, 'pu_ht': 21.0, 'tva_tx': 25.0, 'fk_product': '1189', 'product_type': 0, 'remise_percent': 1.0, 'vat_src_code': None} + * * @param int $id Id of supplier invoice to update * @param array $request_data supplier invoice line data * From 4d63586e2a5de90a10c3ec932f70f645407db4e7 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 22 Oct 2021 08:22:23 +0000 Subject: [PATCH 12/14] Fixing style errors. --- htdocs/fourn/class/api_supplier_invoices.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php index 4c2b66caa96..51cd2673b0b 100644 --- a/htdocs/fourn/class/api_supplier_invoices.class.php +++ b/htdocs/fourn/class/api_supplier_invoices.class.php @@ -204,7 +204,7 @@ class SupplierInvoices extends DolibarrApi * Note: soc_id = dolibarr_order_id * * Example: {'ref': 'auto', 'ref_supplier': '7985630', 'socid': 1, 'note': 'Inserted with Python', 'order_supplier': 1, 'date': '2021-07-28'} - * + * * @param array $request_data Request datas * * @return int ID of supplier invoice From c789b12715052f3aa875edc2746fc0be2bea72a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Fri, 22 Oct 2021 11:07:38 +0200 Subject: [PATCH 13/14] fix more than one extrafield cause bug sql --- htdocs/compta/cashcontrol/cashcontrol_list.php | 2 +- htdocs/eventorganization/conferenceorboothattendee_list.php | 2 +- htdocs/hrm/evaluation_list.php | 2 +- htdocs/hrm/job_list.php | 2 +- htdocs/hrm/position_list.php | 2 +- htdocs/hrm/skill_list.php | 2 +- htdocs/product/inventory/list.php | 2 +- htdocs/recruitment/recruitmentjobposition_list.php | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/compta/cashcontrol/cashcontrol_list.php b/htdocs/compta/cashcontrol/cashcontrol_list.php index 21a6c56689e..b46ff9433e3 100644 --- a/htdocs/compta/cashcontrol/cashcontrol_list.php +++ b/htdocs/compta/cashcontrol/cashcontrol_list.php @@ -223,7 +223,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks diff --git a/htdocs/eventorganization/conferenceorboothattendee_list.php b/htdocs/eventorganization/conferenceorboothattendee_list.php index 3fe20e3c814..12d62e0ab76 100644 --- a/htdocs/eventorganization/conferenceorboothattendee_list.php +++ b/htdocs/eventorganization/conferenceorboothattendee_list.php @@ -266,7 +266,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks diff --git a/htdocs/hrm/evaluation_list.php b/htdocs/hrm/evaluation_list.php index 54c4d547ffe..a713b37ca48 100644 --- a/htdocs/hrm/evaluation_list.php +++ b/htdocs/hrm/evaluation_list.php @@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks diff --git a/htdocs/hrm/job_list.php b/htdocs/hrm/job_list.php index 0c169616f5a..ebd4535e6e7 100644 --- a/htdocs/hrm/job_list.php +++ b/htdocs/hrm/job_list.php @@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks diff --git a/htdocs/hrm/position_list.php b/htdocs/hrm/position_list.php index 60e69bfac3f..3877a6ea14d 100644 --- a/htdocs/hrm/position_list.php +++ b/htdocs/hrm/position_list.php @@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks diff --git a/htdocs/hrm/skill_list.php b/htdocs/hrm/skill_list.php index c0af4e28edc..fc2998d046a 100644 --- a/htdocs/hrm/skill_list.php +++ b/htdocs/hrm/skill_list.php @@ -268,7 +268,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks diff --git a/htdocs/product/inventory/list.php b/htdocs/product/inventory/list.php index 44726bb489c..41e43fdf433 100644 --- a/htdocs/product/inventory/list.php +++ b/htdocs/product/inventory/list.php @@ -205,7 +205,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks diff --git a/htdocs/recruitment/recruitmentjobposition_list.php b/htdocs/recruitment/recruitmentjobposition_list.php index 26a3a81e998..29fde993e25 100644 --- a/htdocs/recruitment/recruitmentjobposition_list.php +++ b/htdocs/recruitment/recruitmentjobposition_list.php @@ -246,7 +246,7 @@ $sql .= $object->getFieldList('t'); // Add fields from extrafields if (!empty($extrafields->attributes[$object->table_element]['label'])) { foreach ($extrafields->attributes[$object->table_element]['label'] as $key => $val) { - $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key.', ' : ''); + $sql .= ($extrafields->attributes[$object->table_element]['type'][$key] != 'separate' ? ", ef.".$key." as options_".$key : ''); } } // Add fields from hooks From 0d868aa0d9eb3cc670c3f536aace6176a3662958 Mon Sep 17 00:00:00 2001 From: Theo Date: Fri, 22 Oct 2021 11:14:04 +0200 Subject: [PATCH 14/14] Fix: can't delete categories when linked to some objects --- htdocs/categories/class/categorie.class.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php index d5c135279bf..7547d04e2e4 100644 --- a/htdocs/categories/class/categorie.class.php +++ b/htdocs/categories/class/categorie.class.php @@ -626,12 +626,18 @@ class Categorie extends CommonObject } $arraydelete = array( - 'categorie_societe' => 'fk_categorie', - 'categorie_fournisseur' => 'fk_categorie', 'categorie_product' => 'fk_categorie', + 'categorie_fournisseur' => 'fk_categorie', + 'categorie_societe' => 'fk_categorie', 'categorie_member' => 'fk_categorie', 'categorie_contact' => 'fk_categorie', + 'categorie_user' => 'fk_categorie', + 'categorie_project' => 'fk_categorie', 'categorie_account' => 'fk_categorie', + 'categorie_website_page' => 'fk_categorie', + 'categorie_warehouse' => 'fk_categorie', + 'categorie_actioncomm' => 'fk_categorie', + 'categorie_ticket' => 'fk_categorie', 'bank_class' => 'fk_categ', 'categorie_lang' => 'fk_category', 'categorie' => 'rowid',