diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ac019f33bc2..ff1dcc535f3 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -4944,20 +4944,18 @@ function price2num($amount, $rounding = '', $option = 0) $nbofdectoround = ''; if ($rounding == 'MU') { $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_UNIT; - } - elseif ($rounding == 'MT') { + } elseif ($rounding == 'MT') { $nbofdectoround = $conf->global->MAIN_MAX_DECIMALS_TOT; - } - elseif ($rounding == 'MS') { - $nbofdectoround = empty($conf->global->MAIN_MAX_DECIMALS_STOCK) ? 5 : $conf->global->MAIN_MAX_DECIMALS_STOCK; - } - elseif ($rounding == 'CU') { + } elseif ($rounding == 'MS') { + $nbofdectoround = isset($conf->global->MAIN_MAX_DECIMALS_STOCK) ? $conf->global->MAIN_MAX_DECIMALS_STOCK : 5; + } elseif ($rounding == 'CU') { $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 + } elseif (is_numeric($rounding)) { + $nbofdectoround = $rounding; } - elseif (is_numeric($rounding)) $nbofdectoround = $rounding; + //print " RR".$amount.' - '.$nbofdectoround.'
'; if (dol_strlen($nbofdectoround)) $amount = round(is_string($amount) ? (float) $amount : $amount, $nbofdectoround); // $nbofdectoround can be 0. else return 'ErrorBadParameterProvidedToFunction'; diff --git a/htdocs/core/lib/pdf.lib.php b/htdocs/core/lib/pdf.lib.php index 6a17f4b6d44..54c7d9060ab 100644 --- a/htdocs/core/lib/pdf.lib.php +++ b/htdocs/core/lib/pdf.lib.php @@ -1927,7 +1927,7 @@ function pdf_getlineprogress($object, $i, $outputlangs, $hidedetails = 0, $hookm if ($conf->global->SITUATION_DISPLAY_DIFF_ON_PDF) { $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); } diff --git a/htdocs/holiday/month_report.php b/htdocs/holiday/month_report.php index 922c313840b..6f8b0830b2a 100644 --- a/htdocs/holiday/month_report.php +++ b/htdocs/holiday/month_report.php @@ -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 .= " WHERE cp.rowid > 0"; $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)) { $sql .= natural_search('cp.ref', $search_ref); }