From 6e8a72a434979e2cad27316a5aa5e69409fc5a37 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Wed, 29 Mar 2023 16:31:55 +0200 Subject: [PATCH] Fix filter on holiday dates --- htdocs/comm/action/index.php | 10 +++++----- htdocs/comm/action/info.php | 4 +--- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/htdocs/comm/action/index.php b/htdocs/comm/action/index.php index 91f749a1cd0..bcef5f77474 100644 --- a/htdocs/comm/action/index.php +++ b/htdocs/comm/action/index.php @@ -1000,7 +1000,7 @@ if ($showbirthday) { } } -// LEAVE CALENDAR +// LEAVE-HOLIDAY CALENDAR $sql = "SELECT u.rowid as uid, u.lastname, u.firstname, u.statut, x.rowid, x.date_debut as date_start, x.date_fin as date_end, x.halfday, x.statut as status"; $sql .= " FROM ".MAIN_DB_PREFIX."holiday as x, ".MAIN_DB_PREFIX."user as u"; $sql .= " WHERE u.rowid = x.fk_user"; @@ -1012,12 +1012,12 @@ if ($mode == 'show_day') { $sql .= " AND '".$db->escape($year)."-".$db->escape($month)."-".$db->escape($day)."' BETWEEN x.date_debut AND x.date_fin"; // date_debut and date_fin are date without time } elseif ($mode == 'show_week') { // Restrict on current month (we get more, but we will filter later) - $sql .= " AND date_debut < '".dol_get_last_day($year, $month)."'"; - $sql .= " AND date_fin >= '".dol_get_first_day($year, $month)."'"; + $sql .= " AND date_debut < '".$db->idate(dol_get_last_day($year, $month))."'"; + $sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'"; } elseif ($mode == 'show_month') { // Restrict on current month - $sql .= " AND date_debut <= '".dol_get_last_day($year, $month)."'"; - $sql .= " AND date_fin >= '".dol_get_first_day($year, $month)."'"; + $sql .= " AND date_debut <= '".$db->idate(dol_get_last_day($year, $month))."'"; + $sql .= " AND date_fin >= '".$db->idate(dol_get_first_day($year, $month))."'"; } $resql = $db->query($sql); diff --git a/htdocs/comm/action/info.php b/htdocs/comm/action/info.php index aa14224014a..ee34d07ea4b 100644 --- a/htdocs/comm/action/info.php +++ b/htdocs/comm/action/info.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2010 Laurent Destailleur + * Copyright (C) 2004-2023 Laurent Destailleur * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -98,8 +98,6 @@ if (empty($reshook)) { $linkback .= $out; $morehtmlref = '
'; -// Thirdparty -//$morehtmlref.='
'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1); // Project if (isModEnabled('project')) { $langs->load("projects");