From afbe5f6017f02af0255617d847bb8d32bfb2126c Mon Sep 17 00:00:00 2001 From: John Botella Date: Wed, 30 Sep 2020 15:26:13 +0200 Subject: [PATCH 1/3] Add search param for close date --- htdocs/commande/list.php | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 1e7e0d1d9d7..7750cd7146f 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -55,6 +55,10 @@ $confirm = GETPOST('confirm', 'alpha'); $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist'; +$search_datecloture_start = GETPOST('search_datecloture_start', 'int'); +if(empty($search_datecloture_start)) $search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int')); +$search_datecloture_end = GETPOST('search_datecloture_end', 'int'); +if(empty($search_datecloture_end)) $search_datecloture_end = dol_mktime(23, 59, 59, GETPOST('search_datecloture_endmonth', 'int'), GETPOST('search_datecloture_endday', 'int'), GETPOST('search_datecloture_endyear', 'int')); $search_dateorder_start = dol_mktime(0, 0, 0, GETPOST('search_dateorder_startmonth', 'int'), GETPOST('search_dateorder_startday', 'int'), GETPOST('search_dateorder_startyear', 'int')); $search_dateorder_end = dol_mktime(23, 59, 59, GETPOST('search_dateorder_endmonth', 'int'), GETPOST('search_dateorder_endday', 'int'), GETPOST('search_dateorder_endyear', 'int')); $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); @@ -227,6 +231,8 @@ if (empty($reshook)) $toselect = ''; $search_array_options = array(); $search_categ_cus = 0; + $search_datecloture_start = ''; + $search_datecloture_end = ''; } if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha') || GETPOST('button_search_x', 'alpha') || GETPOST('button_search.x', 'alpha') || GETPOST('button_search', 'alpha')) @@ -333,6 +339,8 @@ if ($search_status <> '') } } +if ($search_datecloture_start) $sql .= " AND c.date_cloture >= '".$db->idate($search_datecloture_start)."'"; +if ($search_datecloture_end) $sql .= " AND c.date_cloture <= '".$db->idate($search_datecloture_end)."'"; if ($search_dateorder_start) $sql .= " AND c.date_commande >= '".$db->idate($search_dateorder_start)."'"; if ($search_dateorder_end) $sql .= " AND c.date_commande <= '".$db->idate($search_dateorder_end)."'"; if ($search_datedelivery_start) $sql .= " AND c.date_livraison >= '".$db->idate($search_datedelivery_start)."'"; @@ -438,6 +446,8 @@ if ($resql) if ($sall) $param .= '&sall='.urlencode($sall); if ($socid > 0) $param .= '&socid='.urlencode($socid); if ($search_status != '') $param .= '&search_status='.urlencode($search_status); + if ($search_datecloture_start) $param .= '&search_datecloture_start='.urlencode($search_datecloture_start); + if ($search_datecloture_end) $param .= '&search_datecloture_end='.urlencode($search_datecloture_end); if ($search_dateorder_start) $param .= '&search_dateorder_start='.urlencode($search_dateorder_start); if ($search_dateorder_end) $param .= '&search_dateorder_end='.urlencode($search_dateorder_end); if ($search_datedelivery_start) $param .= '&search_datedelivery_start='.urlencode($search_datedelivery_start); @@ -798,7 +808,15 @@ if ($resql) // Date cloture if (!empty($arrayfields['c.date_cloture']['checked'])) { - print ''; + print ''; + print '
'; + print $langs->trans('From').' '; + print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1, 'search_datecloture_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to').' '; + print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1, 'search_datecloture_end', 0, 0, 1); + print '
'; print ''; } // Status From f31e689480d81af0b52aeca99e6e87fcbcaf2e50 Mon Sep 17 00:00:00 2001 From: John Botella Date: Fri, 2 Oct 2020 09:39:54 +0200 Subject: [PATCH 2/3] Fix new look and feel --- htdocs/commande/list.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index ab284c4af8c..666d894bdda 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -813,12 +813,10 @@ if ($resql) { print ''; print '
'; - print $langs->trans('From').' '; - print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1, 'search_datecloture_start', 0, 0, 1); + print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1, 'search_datecloture_start', 0, 0, 1,'', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; - print $langs->trans('to').' '; - print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1, 'search_datecloture_end', 0, 0, 1); + print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1, 'search_datecloture_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print ''; } From a7b4f0ec49267519dfff01ba44e9185d3f6bfc97 Mon Sep 17 00:00:00 2001 From: stickler-ci Date: Fri, 2 Oct 2020 07:43:29 +0000 Subject: [PATCH 3/3] Fixing style errors. --- htdocs/commande/list.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/htdocs/commande/list.php b/htdocs/commande/list.php index 666d894bdda..ae73b23a876 100644 --- a/htdocs/commande/list.php +++ b/htdocs/commande/list.php @@ -56,9 +56,9 @@ $toselect = GETPOST('toselect', 'array'); $contextpage = GETPOST('contextpage', 'aZ') ?GETPOST('contextpage', 'aZ') : 'orderlist'; $search_datecloture_start = GETPOST('search_datecloture_start', 'int'); -if(empty($search_datecloture_start)) $search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int')); +if (empty($search_datecloture_start)) $search_datecloture_start = dol_mktime(0, 0, 0, GETPOST('search_datecloture_startmonth', 'int'), GETPOST('search_datecloture_startday', 'int'), GETPOST('search_datecloture_startyear', 'int')); $search_datecloture_end = GETPOST('search_datecloture_end', 'int'); -if(empty($search_datecloture_end)) $search_datecloture_end = dol_mktime(23, 59, 59, GETPOST('search_datecloture_endmonth', 'int'), GETPOST('search_datecloture_endday', 'int'), GETPOST('search_datecloture_endyear', 'int')); +if (empty($search_datecloture_end)) $search_datecloture_end = dol_mktime(23, 59, 59, GETPOST('search_datecloture_endmonth', 'int'), GETPOST('search_datecloture_endday', 'int'), GETPOST('search_datecloture_endyear', 'int')); $search_dateorder_start = dol_mktime(0, 0, 0, GETPOST('search_dateorder_startmonth', 'int'), GETPOST('search_dateorder_startday', 'int'), GETPOST('search_dateorder_startyear', 'int')); $search_dateorder_end = dol_mktime(23, 59, 59, GETPOST('search_dateorder_endmonth', 'int'), GETPOST('search_dateorder_endday', 'int'), GETPOST('search_dateorder_endyear', 'int')); $search_datedelivery_start = dol_mktime(0, 0, 0, GETPOST('search_datedelivery_startmonth', 'int'), GETPOST('search_datedelivery_startday', 'int'), GETPOST('search_datedelivery_startyear', 'int')); @@ -813,7 +813,7 @@ if ($resql) { print ''; print '
'; - print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1, 'search_datecloture_start', 0, 0, 1,'', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); + print $form->selectDate($search_datecloture_start ? $search_datecloture_start : -1, 'search_datecloture_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; print $form->selectDate($search_datecloture_end ? $search_datecloture_end : -1, 'search_datecloture_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to'));