From b5904e49a023354f435858c7060a1d02cf9d3a07 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Jun 2021 22:43:43 +0200 Subject: [PATCH 1/4] NEW Add field date from/to in customer payment list --- htdocs/compta/paiement/list.php | 32 ++++++++++++++++++++------------ 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 1e99cf8676f..eb6d50712c5 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -56,11 +56,10 @@ $contextpage = GETPOST('contextpage', 'aZ') ? GETPOST('contextpage', 'aZ') : 'p $facid = GETPOST('facid', 'int'); $socid = GETPOST('socid', 'int'); $userid = GETPOST('userid', 'int'); -$day = GETPOST('day', 'int'); -$month = GETPOST('month', 'int'); -$year = GETPOST('year', 'int'); $search_ref = GETPOST("search_ref", "alpha"); +$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); +$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); $search_company = GETPOST("search_company", 'alpha'); $search_paymenttype = GETPOST("search_paymenttype"); $search_account = GETPOST("search_account", "int"); @@ -130,14 +129,13 @@ if (empty($reshook)) { // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $search_ref = ''; + $search_date_start = ''; + $search_date_end = ''; $search_account = ''; $search_amount = ''; $search_paymenttype = ''; $search_payment_num = ''; $search_company = ''; - $day = ''; - $year = ''; - $month = ''; $option = ''; $toselect = ''; $search_array_options = array(); @@ -211,10 +209,15 @@ if (GETPOST("orphelins", "alpha")) { } // Search criteria - $sql .= dolSqlDateFilter("p.datep", $day, $month, $year); if ($search_ref) { $sql .= natural_search('p.ref', $search_ref); } + if ($search_date_start) { + $sql .= " AND p.datep >= '" . $db->idate($search_date_start) . "'"; + } + if ($search_date_end) { + $sql .= " AND p.datep <= '" . $db->idate($search_date_end) . "'"; + } if ($search_account > 0) { $sql .= " AND b.fk_account=".((int) $search_account); } @@ -275,6 +278,8 @@ if ($limit > 0 && $limit != $conf->liste_limit) { } $param .= (GETPOST("orphelins") ? "&orphelins=1" : ''); $param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : ''); +$param .= ($search_date_start ? "&search_date_start=".urlencode($search_date_start) : ''); +$param .= ($search_date_end ? "&search_date_end=".urlencode($search_date_end) : ''); $param .= ($search_company ? "&search_company=".urlencode($search_company) : ''); $param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : ''); $param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : ''); @@ -331,11 +336,14 @@ if (!empty($arrayfields['p.ref']['checked'])) { // Filter: Date if (!empty($arrayfields['p.datep']['checked'])) { print ''; - if (!empty($conf->global->MAIN_LIST_FILTER_ON_DAY)) { - print ''; - } - print ''; - $formother->select_year($year ? $year : -1, 'year', 1, 20, 5); + print '
'; + print $langs->trans('From') . ' '; + print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print '
'; + print '
'; + print $langs->trans('to') . ' '; + print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print '
'; print ''; } From 3744ccdd286b8e33968031248884f331cbefd133 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Tue, 1 Jun 2021 22:50:55 +0200 Subject: [PATCH 2/4] Look & feel v14 --- htdocs/compta/paiement/list.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index eb6d50712c5..c06f8ee9cb5 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -337,12 +337,10 @@ if (!empty($arrayfields['p.ref']['checked'])) { if (!empty($arrayfields['p.datep']['checked'])) { print ''; print '
'; - print $langs->trans('From') . ' '; - print $form->selectDate($search_date_start?$search_date_start:-1, 'search_date_start', 0, 0, 1); + print $form->selectDate($search_date_start ? $search_date_start : -1, 'search_date_start', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('From')); print '
'; print '
'; - print $langs->trans('to') . ' '; - print $form->selectDate($search_date_end?$search_date_end:-1, 'search_date_end', 0, 0, 1); + print $form->selectDate($search_date_end ? $search_date_end : -1, 'search_date_end', 0, 0, 1, '', 1, 0, 0, '', '', '', '', 1, '', $langs->trans('to')); print '
'; print ''; } From a92bd31ce14d46b5786ad5fc303d5452a5af3b5e Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sat, 5 Jun 2021 07:39:15 +0200 Subject: [PATCH 3/4] Fix search_datexxx --- htdocs/compta/paiement/list.php | 68 +++++++++++++++++++++++++-------- 1 file changed, 53 insertions(+), 15 deletions(-) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index c06f8ee9cb5..b6835765c00 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -5,7 +5,7 @@ * Copyright (C) 2013 Cédric Salvador * Copyright (C) 2015 Jean-François Ferry * Copyright (C) 2015 Juanjo Menent - * Copyright (C) 2017 Alexandre Spangaro + * Copyright (C) 2017-2021 Alexandre Spangaro * Copyright (C) 2018 Ferran Marcet * Copyright (C) 2018 Charlene Benke * Copyright (C) 2020 Tobias Sekan @@ -58,12 +58,18 @@ $socid = GETPOST('socid', 'int'); $userid = GETPOST('userid', 'int'); $search_ref = GETPOST("search_ref", "alpha"); -$search_date_start = dol_mktime(0, 0, 0, GETPOST('search_date_startmonth', 'int'), GETPOST('search_date_startday', 'int'), GETPOST('search_date_startyear', 'int')); -$search_date_end = dol_mktime(23, 59, 59, GETPOST('search_date_endmonth', 'int'), GETPOST('search_date_endday', 'int'), GETPOST('search_date_endyear', 'int')); -$search_company = GETPOST("search_company", 'alpha'); -$search_paymenttype = GETPOST("search_paymenttype"); -$search_account = GETPOST("search_account", "int"); -$search_payment_num = GETPOST('search_payment_num', 'alpha'); +$search_date_startday = GETPOST('search_date_startday', 'int'); +$search_date_startmonth = GETPOST('search_date_startmonth', 'int'); +$search_date_startyear = GETPOST('search_date_startyear', 'int'); +$search_date_endday = GETPOST('search_date_endday', 'int'); +$search_date_endmonth = GETPOST('search_date_endmonth', 'int'); +$search_date_endyear = GETPOST('search_date_endyear', 'int'); +$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); +$search_company = GETPOST("search_company", 'alpha'); +$search_paymenttype = GETPOST("search_paymenttype"); +$search_account = GETPOST("search_account", "int"); +$search_payment_num = GETPOST('search_payment_num', 'alpha'); $search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x" $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; @@ -129,8 +135,13 @@ if (empty($reshook)) { // All tests are required to be compatible with all browsers if (GETPOST('button_removefilter_x', 'alpha') || GETPOST('button_removefilter.x', 'alpha') || GETPOST('button_removefilter', 'alpha')) { $search_ref = ''; + $search_date_startday = ''; + $search_date_startmonth = ''; + $search_date_startyear = ''; + $search_date_endday = ''; + $search_date_endmonth = ''; + $search_date_endyear = ''; $search_date_start = ''; - $search_date_end = ''; $search_account = ''; $search_amount = ''; $search_paymenttype = ''; @@ -276,13 +287,40 @@ if (!empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) { if ($limit > 0 && $limit != $conf->liste_limit) { $param .= '&limit='.urlencode($limit); } -$param .= (GETPOST("orphelins") ? "&orphelins=1" : ''); -$param .= ($search_ref ? "&search_ref=".urlencode($search_ref) : ''); -$param .= ($search_date_start ? "&search_date_start=".urlencode($search_date_start) : ''); -$param .= ($search_date_end ? "&search_date_end=".urlencode($search_date_end) : ''); -$param .= ($search_company ? "&search_company=".urlencode($search_company) : ''); -$param .= ($search_amount ? "&search_amount=".urlencode($search_amount) : ''); -$param .= ($search_payment_num ? "&search_payment_num=".urlencode($search_payment_num) : ''); + +if (GETPOST("orphelins")) { + $param .= '&orphelins=1'; +} +if ($search_ref) { + $param .= '&search_ref='.urlencode($search_ref); +} +if ($search_date_startday) { + $param .= '&search_date_startday='.urlencode($search_date_startday); +} +if ($search_date_startmonth) { + $param .= '&search_date_startmonth='.urlencode($search_date_startmonth); +} +if ($search_date_startyear) { + $param .= '&search_date_startyear='.urlencode($search_date_startyear); +} +if ($search_date_endday) { + $param .= '&search_date_endday='.urlencode($search_date_endday); +} +if ($search_date_endmonth) { + $param .= '&search_date_endmonth='.urlencode($search_date_endmonth); +} +if ($search_date_endyear) { + $param .= '&search_date_endyear='.urlencode($search_date_endyear); +} +if ($search_company) { + $param .= '&search_company='.urlencode($search_company); +} +if ($search_amount != '') { + $param .= '&search_amount='.urlencode($search_amount); +} +if ($search_payment_num) { + $param .= '&search_payment_num='.urlencode($search_payment_num); +} if ($optioncss != '') { $param .= '&optioncss='.urlencode($optioncss); } From c1757bdbd8b0476274ba452e774857fb51a8c754 Mon Sep 17 00:00:00 2001 From: Alexandre SPANGARO Date: Sun, 6 Jun 2021 06:28:38 +0200 Subject: [PATCH 4/4] Remove warning --- htdocs/compta/paiement/list.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index b6835765c00..ee847603954 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -71,6 +71,7 @@ $search_paymenttype = GETPOST("search_paymenttype"); $search_account = GETPOST("search_account", "int"); $search_payment_num = GETPOST('search_payment_num', 'alpha'); $search_amount = GETPOST("search_amount", 'alpha'); // alpha because we must be able to search on "< x" +$search_status = GETPOST('search_status', 'intcomma'); $limit = GETPOST('limit', 'int') ? GETPOST('limit', 'int') : $conf->liste_limit; $sortfield = GETPOST("sortfield", 'alpha'); @@ -142,11 +143,13 @@ if (empty($reshook)) { $search_date_endmonth = ''; $search_date_endyear = ''; $search_date_start = ''; + $search_date_end = ''; $search_account = ''; $search_amount = ''; $search_paymenttype = ''; $search_payment_num = ''; $search_company = ''; + $search_status = ''; $option = ''; $toselect = ''; $search_array_options = array(); @@ -348,10 +351,12 @@ if ($search_all) { $varpage = empty($contextpage) ? $_SERVER["PHP_SELF"] : $contextpage; $selectedfields = $form->multiSelectArrayWithCheckbox('selectedfields', $arrayfields, $varpage); // This also change content of $arrayfields +$massactionbutton = ''; if ($massactionbutton) { $selectedfields .= $form->showCheckAddButtons('checkforselect', 1); } +$moreforfilter = ''; print '
'; print '';