Merge pull request #21201 from fappels/15_reception_list_search_date

Fix reception list for search date extrafield
This commit is contained in:
Laurent Destailleur 2022-06-12 11:54:19 +02:00 committed by GitHub
commit 89e3a344ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -620,6 +620,22 @@ if ($search_array_options) {
foreach ($search_array_options as $key => $val) {
$crit = $val;
$tmpkey = preg_replace('/search_options_/', '', $key);
if (is_array($val) && array_key_exists('start', $val) && array_key_exists('end', $val)) {
// date range from list filters is stored as array('start' => <timestamp>, 'end' => <timestamp>)
// start date
$param .= '&search_options_'.$tmpkey.'_startyear='.dol_print_date($val['start'], '%Y');
$param .= '&search_options_'.$tmpkey.'_startmonth='.dol_print_date($val['start'], '%m');
$param .= '&search_options_'.$tmpkey.'_startday='.dol_print_date($val['start'], '%d');
$param .= '&search_options_'.$tmpkey.'_starthour='.dol_print_date($val['start'], '%H');
$param .= '&search_options_'.$tmpkey.'_startmin='.dol_print_date($val['start'], '%M');
// end date
$param .= '&search_options_'.$tmpkey.'_endyear='.dol_print_date($val['end'], '%Y');
$param .= '&search_options_'.$tmpkey.'_endmonth='.dol_print_date($val['end'], '%m');
$param .= '&search_options_'.$tmpkey.'_endday='.dol_print_date($val['end'], '%d');
$param .= '&search_options_'.$tmpkey.'_endhour='.dol_print_date($val['end'], '%H');
$param .= '&search_options_'.$tmpkey.'_endmin='.dol_print_date($val['end'], '%M');
$val = '';
}
if ($val != '') {
$param .= '&search_options_'.$tmpkey.'='.urlencode($val);
}