diff --git a/htdocs/fichinter/list.php b/htdocs/fichinter/list.php index b4d6eb6c20c..20eb6c8e26c 100644 --- a/htdocs/fichinter/list.php +++ b/htdocs/fichinter/list.php @@ -8,6 +8,7 @@ * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2021-2023 Frédéric France * Copyright (C) 2022 Charlène Benke + * Copyright (C) 2024 William Mead * * 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 ' '; } if (!empty($arrayfields['fd.date']['checked'])) { - print ' '; + print ''; + print '
'; + print $form->selectDate($search_date_start ?: -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print '
'; + print '
'; + print $form->selectDate($search_date_end ?: -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); + print '
'; + print ''; } if (!empty($arrayfields['fd.duree']['checked'])) { print ' ';