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.
*/
diff --git a/htdocs/categories/class/categorie.class.php b/htdocs/categories/class/categorie.class.php
index e7c361322bc..6691823ab6f 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',
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/core/lib/date.lib.php b/htdocs/core/lib/date.lib.php
index 8fe9352457b..e7ab98ca3b6 100644
--- a/htdocs/core/lib/date.lib.php
+++ b/htdocs/core/lib/date.lib.php
@@ -115,9 +115,10 @@ 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)
+function dol_time_plus_duree($time, $duration_value, $duration_unit, $ruleforendofmonth = 0)
{
global $conf;
@@ -166,7 +167,31 @@ 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 ($ruleforendofmonth == 1 && $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, '%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);
+
+ $date->setTimestamp($datelim);
+ }
+ }
return $date->getTimestamp();
}
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
*/
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
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/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/fourn/class/api_supplier_invoices.class.php b/htdocs/fourn/class/api_supplier_invoices.class.php
index df1bf36b723..51cd2673b0b 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
*
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/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)
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