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

This commit is contained in:
Laurent Destailleur 2021-10-22 11:58:17 +02:00
commit 42dceeafd4
17 changed files with 61 additions and 22 deletions

View File

@ -20,7 +20,7 @@
*/
/**
* \file hrm/admin/setup.php
* \file htdocs/admin/hrm.php
* \ingroup hrm
* \brief HrmTest setup page.
*/

View File

@ -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',

View File

@ -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

View File

@ -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();
}

View File

@ -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
*/

View File

@ -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

View File

@ -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

View File

@ -2196,7 +2196,7 @@ if ($action == 'create') {
print '</td>';
print '<td class="nowrap right">';
print !empty($line->rule_warning_message) ? img_info(html_entity_decode($line->rule_warning_message)) : '&nbsp;';
print !empty($line->rule_warning_message) ? img_warning(html_entity_decode($line->rule_warning_message)) : '&nbsp;';
print '</td>';
// Ajout des boutons de modification/suppression

View File

@ -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

View File

@ -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
*

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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. <b>d</b> 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 <u>d</u> = 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)

View File

@ -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

View File

@ -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