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

Conflicts:
	htdocs/core/lib/functions.lib.php
	htdocs/holiday/month_report.php
This commit is contained in:
Laurent Destailleur
2021-12-19 00:01:11 +01:00
3 changed files with 14 additions and 13 deletions

View File

@@ -4944,20 +4944,18 @@ function price2num($amount, $rounding = '', $option = 0)
$nbofdectoround = ''; $nbofdectoround = '';
if ($rounding == 'MU') { if ($rounding == 'MU') {
$nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_UNIT; $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_UNIT;
} } elseif ($rounding == 'MT') {
elseif ($rounding == 'MT') {
$nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_TOT; $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_TOT;
} } elseif ($rounding == 'MS') {
elseif ($rounding == 'MS') { $nbofdectoround = isset($conf->global->MAIN_MAX_DECIMALS_STOCK) ? $conf->global->MAIN_MAX_DECIMALS_STOCK : 5;
$nbofdectoround = empty($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK; } elseif ($rounding == 'CU') {
}
elseif ($rounding == 'CU') {
$nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_UNIT, 8); // TODO Use param of currency $nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_UNIT, 8); // TODO Use param of currency
} } elseif ($rounding == 'CT') {
elseif ($rounding == 'CT') {
$nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8); // TODO Use param of currency $nbofdectoround = max($conf->global->MAIN_MAX_DECIMALS_TOT, 8); // TODO Use param of currency
} elseif (is_numeric($rounding)) {
$nbofdectoround = $rounding;
} }
elseif (is_numeric($rounding)) $nbofdectoround = $rounding;
//print " RR".$amount.' - '.$nbofdectoround.'<br>'; //print " RR".$amount.' - '.$nbofdectoround.'<br>';
if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0. if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0.
else return 'ErrorBadParameterProvidedToFunction'; else return 'ErrorBadParameterProvidedToFunction';

View File

@@ -1927,7 +1927,7 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm
if ($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) if ($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF)
{ {
$prev_progress = 0; $prev_progress = 0;
if (method_exists($object, 'get_prev_progress')) if (method_exists($object->lines[$i], 'get_prev_progress'))
{ {
$prev_progress = $object->lines[$i]->get_prev_progress($object->id); $prev_progress = $object->lines[$i]->get_prev_progress($object->id);
} }

View File

@@ -139,8 +139,11 @@ $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."user u ON cp.fk_user = u.rowid";
$sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid"; $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."c_holiday_types ct ON cp.fk_type = ct.rowid";
$sql .= " WHERE cp.rowid > 0"; $sql .= " WHERE cp.rowid > 0";
$sql .= " AND cp.statut = ".Holiday::STATUS_APPROVED; $sql .= " AND cp.statut = ".Holiday::STATUS_APPROVED;
$sql .= " AND (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')"; $sql .= " AND (";
$sql .= " (date_format(cp.date_debut, '%Y-%m') = '".$db->escape($year_month)."' OR date_format(cp.date_fin, '%Y-%m') = '".$db->escape($year_month)."')";
$sql .= " OR"; // For leave over several months
$sql .= " (date_format(cp.date_debut, '%Y-%m') < '".$db->escape($year_month)."' AND date_format(cp.date_fin, '%Y-%m') > '".$db->escape($year_month)."') ";
$sql .= " )";
if (!empty($search_ref)) { if (!empty($search_ref)) {
$sql .= natural_search('cp.ref', $search_ref); $sql .= natural_search('cp.ref', $search_ref);
} }