Fix filter on holiday dates

This commit is contained in:
Laurent Destailleur 2023-03-29 16:31:55 +02:00
parent 2a8cf082af
commit 6e8a72a434
2 changed files with 6 additions and 8 deletions

View File

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

View File

@ -1,6 +1,6 @@
<?php
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2004-2010 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2004-2023 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 = '<div class="refidno">';
// Thirdparty
//$morehtmlref.='<br>'.$langs->trans('ThirdParty') . ' : ' . $object->thirdparty->getNomUrl(1);
// Project
if (isModEnabled('project')) {
$langs->load("projects");