Merge pull request #27889 from W1W1-M/new-intervention-list-date-filter

NEW intervention list date filter
This commit is contained in:
Laurent Destailleur 2024-01-30 16:24:48 +01:00 committed by GitHub
commit f51f911249
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -8,6 +8,7 @@
* Copyright (C) 2018 Ferran Marcet <fmarcet@2byte.es>
* Copyright (C) 2021-2023 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2022 Charlène Benke <charlene@patas-monkey.com>
* Copyright (C) 2024 William Mead <william.mead@manchenumerique.fr>
*
* 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
@ -67,6 +68,14 @@ $search_projet_ref = GETPOST('search_projet_ref', 'alpha');
$search_contrat_ref = GETPOST('search_contrat_ref', 'alpha');
$search_status = GETPOST('search_status', 'alpha');
$search_all = trim((GETPOST('search_all', 'alphanohtml') != '') ? GETPOST('search_all', 'alphanohtml') : GETPOST('sall', 'alphanohtml'));
$search_date_startday = GETPOSTINT('search_date_startday');
$search_date_startmonth = GETPOSTINT('search_date_startmonth');
$search_date_startyear = GETPOSTINT('search_date_startyear');
$search_date_endday = GETPOSTINT('search_date_endday');
$search_date_endmonth = GETPOSTINT('search_date_endmonth');
$search_date_endyear = GETPOSTINT('search_date_endyear');
$search_date_start = dol_mktime(0, 0, 0, $search_date_startmonth, $search_date_startday, $search_date_startyear); // Use tzserver
$search_date_end = dol_mktime(23, 59, 59, $search_date_endmonth, $search_date_endday, $search_date_endyear);
$optioncss = GETPOST('optioncss', 'alpha');
$socid = GETPOST('socid', 'int');
@ -183,6 +192,14 @@ if (empty($reshook)) {
$search_contrat_ref = "";
$search_desc = "";
$search_status = "";
$search_date_startday = '';
$search_date_startmonth = '';
$search_date_startyear = '';
$search_date_endday = '';
$search_date_endmonth = '';
$search_date_endyear = '';
$search_date_start = '';
$search_date_end = '';
$toselect = array();
$search_array_options = array();
}
@ -306,6 +323,14 @@ if ($search_desc) {
if ($search_status != '' && $search_status >= 0) {
$sql .= ' AND f.fk_statut = '.urlencode($search_status);
}
if (!getDolGlobalString('FICHINTER_DISABLE_DETAILS') && $atleastonefieldinlines) {
if ($search_date_start) {
$sql .= " AND fd.date >= '".$db->idate($search_date_start)."'";
}
if ($search_date_end) {
$sql .= " AND fd.date <= '".$db->idate($search_date_end)."'";
}
}
if (!$user->hasRight('societe', 'client', 'voir')) {
$sql .= " AND s.rowid = sc.fk_soc AND sc.fk_user = ".((int) $user->id);
}
@ -427,6 +452,24 @@ if ($search_desc) {
if ($search_status != '' && $search_status > -1) {
$param .= "&search_status=".urlencode($search_status);
}
if ($search_date_startday > 0) {
$param .= '&search_date_startday='.urlencode($search_date_startday);
}
if ($search_date_startmonth > 0) {
$param .= '&search_date_startmonth='.urlencode($search_date_startmonth);
}
if ($search_date_startyear > 0) {
$param .= '&search_date_startyear='.urlencode($search_date_startyear);
}
if ($search_date_endday > 0) {
$param .= '&search_date_endday='.urlencode($search_date_endday);
}
if ($search_date_endmonth > 0) {
$param .= '&search_date_endmonth='.urlencode($search_date_endmonth);
}
if ($search_date_endyear > 0) {
$param .= '&search_date_endyear='.urlencode($search_date_endyear);
}
if ($show_files) {
$param .= '&show_files='.urlencode($show_files);
}
@ -611,7 +654,14 @@ if (!empty($arrayfields['fd.description']['checked'])) {
print '<td class="liste_titre">&nbsp;</td>';
}
if (!empty($arrayfields['fd.date']['checked'])) {
print '<td class="liste_titre">&nbsp;</td>';
print '<td class="liste_titre">';
print '<div class="nowrapfordate">';
print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From'));
print '</div>';
print '<div class="nowrapfordate">';
print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));
print '</div>';
print '</td>';
}
if (!empty($arrayfields['fd.duree']['checked'])) {
print '<td class="liste_titre">&nbsp;</td>';