From 6e6b66e416110590527d55a42a2db62901a5479e Mon Sep 17 00:00:00 2001 From: Florian HENRY Date: Wed, 20 May 2015 11:24:23 +0200 Subject: [PATCH] apply recommandation from https://github.com/FHenry/dolibarr/commit/ca53d3b60285de53d38d3fc7eb1f27cbb363b38d#commitcomment-11245627 --- htdocs/compta/bank/account.php | 58 ++++++++++++++++++++++++++-------- 1 file changed, 45 insertions(+), 13 deletions(-) diff --git a/htdocs/compta/bank/account.php b/htdocs/compta/bank/account.php index 0d5e8e06198..f8034f2a543 100644 --- a/htdocs/compta/bank/account.php +++ b/htdocs/compta/bank/account.php @@ -20,7 +20,7 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program. If not, see . + * along withthis program. If not, see . */ /** @@ -68,8 +68,15 @@ $thirdparty=GETPOST("thirdparty",'',3); $req_desc=GETPOST("req_desc",'',3); $req_debit=GETPOST("req_debit",'',3); $req_credit=GETPOST("req_credit",'',3); -$req_month = GETPOST('req_month', 'aplha'); -$req_year = GETPOST('req_year', 'int'); + +$req_stdtmonth=GETPOST('req_stdtmonth', 'int'); +$req_stdtday=GETPOST('req_stdtday', 'int'); +$req_stdtyear=GETPOST('req_stdtyear', 'int'); +$req_stdt = dol_mktime(0, 0, 0, $req_stdtmonth, $req_stdtday, $req_stdtyear); +$req_enddtmonth=GETPOST('req_enddtmonth', 'int'); +$req_enddtday=GETPOST('req_enddtday', 'int'); +$req_enddtyear=GETPOST('req_enddtyear', 'int'); +$req_enddt = dol_mktime(23, 59, 59, $req_enddtmonth, $req_enddtday, $req_enddtyear); $vline=GETPOST("vline"); $page=GETPOST('page','int'); @@ -90,8 +97,14 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $req_desc=""; $req_debit=""; $req_credit=""; - $req_month=""; - $req_year=""; + $req_stdtmonth=""; + $req_stdtday=""; + $req_stdtyear=""; + $req_stdt = ""; + $req_enddtmonth=""; + $req_enddtday=""; + $req_enddtyear=""; + $req_enddt = ""; } /* @@ -258,12 +271,27 @@ if ($id > 0 || ! empty($ref)) $param.='&paiementtype='.urlencode($paiementtype); $mode_search = 1; } - if ($req_dtstart || $req_dtend) + + if ($req_stdt && $req_enddt) { - $sql_rech.=" AND (b.datev BETWEN '".$db->escape($req_dtstart)."' AND '".$db->escape($req_dtend)."')"; - $param.='&req_dtstart='.urlencode($req_month); + $sql_rech.=" AND (b.datev BETWEEN '".$db->escape($db->idate($req_stdt))."' AND '".$db->escape($db->idate($req_enddt))."')"; + $param.='&req_stdtmonth='.$req_stdtmonth.'&req_stdtyear='.$req_stdtyear.'&req_stdtday='.$req_stdtday; + $param.='&req_enddtmonth='.$req_enddtmonth.'&req_enddtday='.$req_enddtday.'&req_enddtyear='.$req_enddtyear; $mode_search = 1; + } + elseif ($req_stdt) + { + $sql_rech.=" AND b.datev >= '".$db->escape($db->idate($req_stdt))."'"; + $param.='&req_stdtmonth='.$req_stdtmonth.'&req_stdtyear='.$req_stdtyear.'&req_stdtday='.$req_stdtday; + $mode_search = 1; } + elseif ($req_enddt) + { + $sql_rech.=" AND b.datev <= '".$db->escape($db->idate($req_enddt))."'"; + $param.='&req_enddtmonth='.$req_enddtmonth.'&req_enddtday='.$req_enddtday.'&req_enddtyear='.$req_enddtyear; + $mode_search = 1; + } + $sql = "SELECT count(*) as total"; $sql.= " FROM ".MAIN_DB_PREFIX."bank_account as ba"; @@ -409,9 +437,13 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; print ''; - print ''; - print ''; - + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $navig ='
'; if ($limitsql > $viewline) $navig.=''.img_previous().''; $navig.= ' "; // ' Page '; @@ -502,8 +534,8 @@ if ($id > 0 || ! empty($ref)) print ''; print ''; - $period_filter .= $langs->trans('Month') . ':'; - $period_filter .= $langs->trans('Year') . ':' . $formother->selectyear($req_year ? $req_year : - 1, 'req_year', 1, 20, 5); + $period_filter .= $langs->trans('From').' '.$form->select_date($req_stdt,'req_stdt',0,0,1,null,1,1,1); + $period_filter .= '
'. $langs->trans('to').' '.$form->select_date($req_enddt,'req_enddt',0,0,1,null,1,1,1); print ''; print ' ';