From bc33b19d7d11e4d1346e20f70a14d9d6840f4896 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 11 Feb 2016 20:24:15 +0100 Subject: [PATCH] NEW Can change dynamically number of records visible into lists. --- htdocs/adherents/cotisations.php | 81 +++++++++++++------------ htdocs/adherents/list.php | 28 +++++---- htdocs/comm/action/listactions.php | 48 +++++++++------ htdocs/comm/action/peruser.php | 4 +- htdocs/comm/action/rapport/index.php | 28 ++++++++- htdocs/compta/bank/search.php | 84 +++++++++++++++----------- htdocs/compta/paiement/cheque/list.php | 46 +++++++++----- htdocs/compta/paiement/list.php | 18 ++++-- htdocs/compta/tva/index.php | 4 +- htdocs/contact/list.php | 15 +++-- htdocs/core/lib/functions.lib.php | 10 +-- htdocs/fourn/facture/list.php | 13 ++-- htdocs/loan/index.php | 25 ++++++-- 13 files changed, 250 insertions(+), 154 deletions(-) diff --git a/htdocs/adherents/cotisations.php b/htdocs/adherents/cotisations.php index 7ff98ceb503..301664fab83 100644 --- a/htdocs/adherents/cotisations.php +++ b/htdocs/adherents/cotisations.php @@ -1,7 +1,7 @@ - * Copyright (C) 2003 Jean-Louis Bergamo - * Copyright (C) 2004-2009 Laurent Destailleur + * Copyright (C) 2003 Jean-Louis Bergamo + * Copyright (C) 2004-2016 Laurent Destailleur * * 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 @@ -32,19 +32,20 @@ $langs->load("members"); $filter=$_GET["filter"]; $statut=isset($_GET["statut"])?$_GET["statut"]:1; -$search_ref=GETPOST('search_ref'); -$search_lastname=GETPOST('search_lastname'); -$search_login=GETPOST('search_login'); -$search_note=GETPOST('search_note'); +$search_ref=GETPOST('search_ref','alpha'); +$search_lastname=GETPOST('search_lastname','alpha'); +$search_login=GETPOST('search_login','alpha'); +$search_note=GETPOST('search_note','alpha'); $search_account=GETPOST('search_account','int'); -$search_amount=GETPOST('search_amount','int'); +$search_amount=GETPOST('search_amount','alpha'); $optioncss = GETPOST('optioncss','alpha'); +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0 ; } -$offset = $conf->liste_limit * $page ; +$offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) { $sortorder="DESC"; } @@ -101,28 +102,21 @@ if ($search_ref) if (is_numeric($search_ref)) $sql.= " AND (c.rowid = ".$db->escape($search_ref).")"; else $sql.=" AND 1 = 2"; // Always wrong } -if ($search_lastname) -{ - $sql.= " AND (d.firstname LIKE '%".$db->escape($search_lastname)."%' OR d.lastname LIKE '%".$db->escape($search_lastname)."%' OR d.societe LIKE '%".$db->escape($search_lastname)."%')"; -} -if ($search_login) -{ - $sql.= " AND d.login LIKE '%".$db->escape($search_login)."%'"; -} -if ($search_note) -{ - $sql.= " AND c.note LIKE '%".$db->escape($search_note)."%'"; -} -if ($search_account > 0) -{ - $sql.= " AND b.fk_account = ".$search_account; -} -if ($search_amount) -{ - $sql.=" AND c.cotisation = ".$db->escape($search_amount); -} +if ($search_lastname) $sql.= natural_search(array('d.firstname','d.lastname','d.societe'), $search_lastname); +if ($search_login) $sql.= natural_search('c.cotisation', $search_login); +if ($search_note) $sql.= natural_search('c.note', $search_note); +if ($search_account > 0) $sql.= " AND b.fk_account = ".$search_account; +if ($search_amount) $sql.= natural_search('c.cotisation', $search_amount, 1); $sql.= $db->order($sortfield,$sortorder); -$sql.= $db->plimit($conf->liste_limit+1, $offset); + +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + +$sql.= $db->plimit($limit+1, $offset); $result = $db->query($sql); if ($result) @@ -133,24 +127,29 @@ if ($result) $title=$langs->trans("ListOfSubscriptions"); if (! empty($date_select)) $title.=' ('.$langs->trans("Year").' '.$date_select.')'; - $param=""; + $param=''; $param.="&statut=$statut&date_select=$date_select"; - if ($search_lastname) $param.="&search_lastname=".$search_lastname; if ($search_login) $param.="&search_login=".$search_login; if ($search_acount) $param.="&search_account=".$search_account; if ($search_amount) $param.="&search_amount=".$search_amount; if ($optioncss != '') $param.='&optioncss='.$optioncss; - print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num); + + print '
'; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print_barre_liste($title, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder,'',$num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); if ($sall) { print $langs->trans("Filter")." (".$langs->trans("Ref").", ".$langs->trans("Lastname").", ".$langs->trans("Firstname").", ".$langs->trans("EMail").", ".$langs->trans("Address")." ".$langs->trans("or")." ".$langs->trans("Town")."): ".$sall; } - - print ''; - if ($optioncss != '') print ''; print ''; print ''; @@ -164,7 +163,8 @@ if ($result) } print_liste_field_titre($langs->trans("Date"),$_SERVER["PHP_SELF"],"c.dateadh",$param,"",'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateEnd"),$_SERVER["PHP_SELF"],"c.datef",$param,"",'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.cotisation",$param,"",'colspan="2" align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"c.cotisation",$param,"",'align="right"',$sortfield,$sortorder); + print_liste_field_titre(''); print "\n"; @@ -199,7 +199,7 @@ if ($result) print ''; // Action column - print ''; @@ -270,7 +270,9 @@ if ($result) print '\n"; // Price - print ''; + print ''; + + print ''; print ""; @@ -290,7 +292,8 @@ if ($result) } print ''; print ''; - print '\n"; + print '\n"; + print ''; print "\n"; print "
'; + print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; print ''.dol_print_date($db->jdate($objp->datef),'day')."'.price($objp->cotisation).''.price($objp->cotisation).'
  '.price($total)."'.price($total)."
"; diff --git a/htdocs/adherents/list.php b/htdocs/adherents/list.php index b19c6b2e35d..f287e5bbf9a 100644 --- a/htdocs/adherents/list.php +++ b/htdocs/adherents/list.php @@ -50,11 +50,12 @@ $catid = GETPOST("catid",'int'); $sall=GETPOST("sall"); $optioncss = GETPOST('optioncss','alpha'); +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page ; +$offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; if (! $sortorder) { $sortorder=($filter=='outofdate'?"ASC":"DESC"); } @@ -143,6 +144,7 @@ if ($filter == 'outofdate') $sql.=" AND (datefin IS NULL OR datefin < '".$db->id $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; +$sql.= $db->order($sortfield,$sortorder); // Count total nb of records with no order and no limits $nbtotalofrecords = 0; @@ -152,9 +154,8 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) if ($resql) $nbtotalofrecords = $db->num_rows($resql); else dol_print_error($db); } -// Add order and limit -$sql.= $db->order($sortfield,$sortorder); -$sql.= $db->plimit($conf->liste_limit+1, $offset); +// Add limit +$sql.= $db->plimit($limit+1, $offset); dol_syslog("get list", LOG_DEBUG); $resql = $db->query($sql); @@ -185,7 +186,8 @@ if ($resql) $titre.=" (".$membertype->libelle.")"; } - $param=""; + $param=''; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($statut != "") $param.="&statut=".$statut; if ($search_nom) $param.="&search_nom=".$search_nom; if ($search_login) $param.="&search_login=".$search_login; @@ -193,12 +195,17 @@ if ($resql) if ($filter) $param.="&filter=".$filter; if ($type > 0) $param.="&type=".$type; if ($optioncss != '') $param.='&optioncss='.$optioncss; - print_barre_liste($titre,$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords); - - print ''; + + print ''; if ($optioncss != '') print ''; print ''; + print ''; + print ''; + print ''; + print ''; + print_barre_liste($titre, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); + if ($sall) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); @@ -396,10 +403,7 @@ if ($resql) print "\n"; print '
'; - if ($num > $conf->liste_limit) - { - print_barre_liste('',$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,''); - } + if ($num > $limit || $page) print_barre_liste('', $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit, 1); } else { diff --git a/htdocs/comm/action/listactions.php b/htdocs/comm/action/listactions.php index 447a247ad56..ed8227a1cb8 100644 --- a/htdocs/comm/action/listactions.php +++ b/htdocs/comm/action/listactions.php @@ -72,11 +72,11 @@ if (empty($filtert) && empty($conf->global->AGENDA_ALL_CALENDARS)) $filtert=$user->id; } +$limit = GETPOST("limit")?GETPOST("limit","int"):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0 ; } -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; if (! $sortorder) { @@ -142,20 +142,8 @@ $form=new Form($db); $userstatic=new User($db); $nav=''; -$nav.='
'; -if ($optioncss != '') $nav.= ''; -if ($actioncode) $nav.=''; -if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.=''; -if ($filter) $nav.=''; -if ($filtert) $nav.=''; -if ($socid) $nav.=''; -if ($showbirthday) $nav.=''; -if ($pid) $nav.=''; -if ($type) $nav.=''; -if ($usergroup) $nav.=''; $nav.=$form->select_date($dateselect, 'dateselect', 0, 0, 1, '', 1, 0, 1); $nav.=' '; -$nav.='
'; $now=dol_now(); @@ -166,6 +154,7 @@ llxHeader('',$langs->trans("Agenda"),$help_url); $listofextcals=array(); $param=''; +if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; if ($actioncode != '') $param.="&actioncode=".$actioncode; if ($status || isset($_GET['status']) || isset($_POST['status'])) $param.="&status=".$status; if ($filter) $param.="&filter=".$filter; @@ -220,6 +209,14 @@ if ($dateselect > 0) $sql.= " AND ((a.datep2 >= '".$db->idate($dateselect)."' AN if ($datestart > 0) $sql.= " AND a.datep BETWEEN '".$db->idate($datestart)."' AND '".$db->idate($datestart+3600*24-1)."'"; if ($dateend > 0) $sql.= " AND a.datep2 BETWEEN '".$db->idate($dateend)."' AND '".$db->idate($dateend+3600*24-1)."'"; $sql.= $db->order($sortfield,$sortorder); + +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + $sql.= $db->plimit($limit + 1, $offset); //print $sql; @@ -279,13 +276,30 @@ if ($resql) $s = $hookmanager->resPrint; } - print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, 0, '', 0, $nav); - - print '
'."\n"; + print ''."\n"; if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + $nav=''; + if ($optioncss != '') $nav.= ''; + if ($actioncode) $nav.=''; + if ($status || isset($_GET['status']) || isset($_POST['status'])) $nav.=''; + if ($filter) $nav.=''; + if ($filtert) $nav.=''; + if ($socid) $nav.=''; + if ($showbirthday) $nav.=''; + if ($pid) $nav.=''; + if ($usergroup) $nav.=''; + print $nav; + + print_barre_liste($s, $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, $link, $num, -1 * $nbtotalofrecords, '', 0, $nav, '', $limit); - $i = 0; + $i = 0; print ''; print ''; print_liste_field_titre($langs->trans("Action"),$_SERVER["PHP_SELF"],"a.label",$param,"","",$sortfield,$sortorder); diff --git a/htdocs/comm/action/peruser.php b/htdocs/comm/action/peruser.php index 318e96f7122..35b89ff129d 100644 --- a/htdocs/comm/action/peruser.php +++ b/htdocs/comm/action/peruser.php @@ -242,10 +242,10 @@ $max_day_in_month = date("t",dol_mktime(0,0,0,$month,1,$year)); $tmpday = $first_day; -$nav ="".img_previous($langs->trans("Previous"))."\n"; +$nav ="".img_previous($langs->trans("Previous"), 'class="valignbottom"')."\n"; $nav.=" ".dol_print_date(dol_mktime(0,0,0,$first_month,$first_day,$first_year),"%Y").", ".$langs->trans("Week")." ".$week; $nav.=" \n"; -$nav.="".img_next($langs->trans("Next"))."\n"; +$nav.="".img_next($langs->trans("Next"), 'class="valignbottom"')."\n"; $nav.="   (".$langs->trans("Today").")"; $picto='calendarweek'; diff --git a/htdocs/comm/action/rapport/index.php b/htdocs/comm/action/rapport/index.php index 6a33e83e585..e62af271c49 100644 --- a/htdocs/comm/action/rapport/index.php +++ b/htdocs/comm/action/rapport/index.php @@ -1,7 +1,7 @@ * Copyright (C) 2003 Eric Seigne - * Copyright (C) 2004-2014 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin * * This program is free software; you can redistribute it and/or modify @@ -37,11 +37,11 @@ $action=GETPOST('action','alpha'); $month=GETPOST('month'); $year=GETPOST('year'); +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0 ; } -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $offset = $limit * $page ; if (! $sortorder) $sortorder="DESC"; if (! $sortfield) $sortfield="a.datep"; @@ -84,6 +84,14 @@ $sql.= ' AND a.entity IN ('.getEntity('agenda', 1).')'; //$sql.= " AND percent = 100"; $sql.= " GROUP BY year, month, df"; $sql.= " ORDER BY year DESC, month DESC, df DESC"; + +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + $sql.= $db->plimit($limit+1,$offset); //print $sql; @@ -93,7 +101,18 @@ if ($resql) { $num = $db->num_rows($resql); - print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"],'',$sortfield,$sortorder,'',$num); + $param=''; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; + + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print_barre_liste($langs->trans("Actions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, '', 0, '', '', $limit); $i = 0; print '
'; @@ -143,6 +162,9 @@ if ($resql) $i++; } print "
"; + + print '
'; + $db->free($resql); } else diff --git a/htdocs/compta/bank/search.php b/htdocs/compta/bank/search.php index f5231a87ef8..e3b121065ef 100644 --- a/htdocs/compta/bank/search.php +++ b/htdocs/compta/bank/search.php @@ -42,14 +42,16 @@ $langs->load("margins"); if ($user->societe_id) $socid=$user->societe_id; $result=restrictedArea($user,'banque'); -$description=GETPOST("description"); -$debit=GETPOST("debit"); -$credit=GETPOST("credit"); -$type=GETPOST("type"); -$account=GETPOST("account"); +$description=GETPOST("description",'alpha'); +$debit=GETPOST("debit",'alpha'); +$credit=GETPOST("credit",'alpha'); +$type=GETPOST("type",'alpha'); +$account=GETPOST("account",'alpha'); $bid=GETPOST("bid","int"); $search_dt_start = dol_mktime(0, 0, 0, GETPOST('search_start_dtmonth', 'int'), GETPOST('search_start_dtday', 'int'), GETPOST('search_start_dtyear', 'int')); $search_dt_end = dol_mktime(0, 0, 0, GETPOST('search_end_dtmonth', 'int'), GETPOST('search_end_dtday', 'int'), GETPOST('search_end_dtyear', 'int')); +$search_thirdparty=GETPOST("thirdparty",'alpha'); +$search_req_nb=GETPOST("req_nb",'alpha'); $param=''; if (!empty($description)) $param.='&description='.$description; @@ -63,14 +65,14 @@ if (dol_strlen($search_dt_start) > 0) if (dol_strlen($search_dt_end) > 0) $param .= '&search_end_dtmonth=' . GETPOST('search_end_dtmonth', 'int') . '&search_end_dtday=' . GETPOST('search_end_dtday', 'int') . '&search_end_dtyear=' . GETPOST('search_end_dtyear', 'int'); +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } -$offset = $conf->liste_limit * $page; +$offset = $limit * $page; $pageprev = $page - 1; $pagenext = $page + 1; -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; if (! $sortorder) $sortorder='DESC'; if (! $sortfield) $sortfield='b.dateo'; @@ -82,6 +84,8 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $credit=""; $account=""; $bid=""; + $search_req_nb=''; + $search_thirdparty=''; } /* @@ -111,15 +115,15 @@ $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."bank_url as bu ON bu.fk_bank = b.rowid AND $sql.= " LEFT JOIN ".MAIN_DB_PREFIX."societe as s ON bu.url_id = s.rowid"; $sql.= " WHERE b.fk_account = ba.rowid"; $sql.= " AND ba.entity IN (".getEntity('bank_account', 1).")"; -if (GETPOST("req_nb")) +if ($search_req_nb) { - $sql.= " AND b.num_chq LIKE '%".$db->escape(GETPOST("req_nb"))."%'"; - $param.='&req_nb='.urlencode(GETPOST("req_nb")); + $sql.= " AND b.num_chq LIKE '%".$db->escape($search_req_nb)."%'"; + $param.='&req_nb='.urlencode($search_req_nb); } -if (GETPOST("thirdparty")) +if ($search_thirdparty) { - $sql.=" AND s.nom LIKE '%".$db->escape(GETPOST("thirdparty"))."%'"; - $param.='&thirdparty='.urlencode(GETPOST("thirdparty")); + $sql.=" AND s.nom LIKE '%".$db->escape($search_thirdparty)."%'"; + $param.='&thirdparty='.urlencode($search_thirdparty); } if ($bid) { @@ -137,22 +141,19 @@ if (dol_strlen($search_dt_end)>0) { $sql .= " AND b.dateo <= '" . $db->idate($search_dt_end) . "'"; } // Search criteria amount -$si=0; $debit = price2num(str_replace('-','',$debit)); $credit = price2num(str_replace('-','',$credit)); -if (is_numeric($debit)) { - $si++; - $sqlw[$si] .= " b.amount = -" . $debit; -} -if (is_numeric($credit)) { - $si++; - $sqlw[$si] .= " b.amount = " . $credit; -} -// Other search criteria -for ($i = 1 ; $i <= $si; $i++) { - $sql .= " AND " . $sqlw[$i]; -} +if ($debit) $sql.= natural_search('- b.amount', $debit, 1); +if ($credit) $sql.= natural_search('b.amount', $credit, 1); $sql.= $db->order($sortfield,$sortorder); + +$nbtotalofrecords = 0; +if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) +{ + $result = $db->query($sql); + $nbtotalofrecords = $db->num_rows($result); +} + $sql.= $db->plimit($limit+1,$offset); //print $sql; @@ -164,25 +165,30 @@ if ($resql) $num = $db->num_rows($resql); $i = 0; + print '
'."\n"; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print ''; + if (! empty($_REQUEST['bid'])) print ''; + // Title $bankcateg=new BankCateg($db); if (GETPOST("bid")) { $result=$bankcateg->fetch(GETPOST("bid")); - print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num,'', 'title_bank.png'); + print_barre_liste($langs->trans("BankTransactionForCategory",$bankcateg->label).' '.($socid?' '.$soc->name:''), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', 0, '', '', $limit); } else { - print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, '', 'title_bank.png'); + print_barre_liste($langs->trans("BankTransactions"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', 0, '', '', $limit); } - - print ''."\n"; - print ''."\n"; - print ''; - if (! empty($_REQUEST['bid'])) print ''; $moreforfilter = ''; - $moreforfilter.='
'; $moreforfilter .= $langs->trans('Period') . ' ('.$langs->trans('DateOperationShort').') : ' . $langs->trans('StartDate') . ' '; $moreforfilter .= $form->select_date($search_dt_start, 'search_start_dt', 0, 0, 1, "search_form", 1, 0, 1); @@ -209,6 +215,7 @@ if ($resql) print_liste_field_titre($langs->trans("Debit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Credit"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Account"),$_SERVER['PHP_SELF'],'','',$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre(''); print "\n"; print ''; @@ -218,17 +225,18 @@ if ($resql) print ''; $form->select_types_paiements(empty($type)?'':$type, 'type', '', 2, 0, 1, 8); print ''; - print ''; + print ''; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; print ''; print ''; print ''; print ''; + print ''; print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; @@ -325,6 +333,9 @@ if ($resql) $bankaccountstatic->label=$objp->bankref; print $bankaccountstatic->getNomUrl(1); print "\n"; + + print ''; + print ""; } $i++; @@ -336,6 +347,7 @@ if ($resql) print '' . price($total_debit * - 1) . ''; print '' . price($total_credit) . ''; print ''; + print ''; print ''; } diff --git a/htdocs/compta/paiement/cheque/list.php b/htdocs/compta/paiement/cheque/list.php index 2b3a7153793..5b4929ae42b 100644 --- a/htdocs/compta/paiement/cheque/list.php +++ b/htdocs/compta/paiement/cheque/list.php @@ -38,12 +38,13 @@ $langs->load("bills"); if ($user->societe_id) $socid=$user->societe_id; $result = restrictedArea($user, 'banque', '',''); -$search_ref = GETPOST('search_ref','int'); +$search_ref = GETPOST('search_ref','alpha'); $search_account = GETPOST('search_account','int'); $search_amount = GETPOST('search_amount','alpha'); + +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } $offset = $limit * $page; @@ -101,6 +102,7 @@ else if ($year > 0) { $sql.= " AND bc.date_bordereau BETWEEN '".$db->idate(dol_get_first_day($year,1,false))."' AND '".$db->idate(dol_get_last_day($year,12,false))."'"; } +$sql.= $db->order($sortfield,$sortorder); $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -109,29 +111,36 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $nbtotalofrecords = $db->num_rows($result); } -$sql.= " ORDER BY $sortfield $sortorder"; $sql.= $db->plimit($limit+1, $offset); //print "$sql"; $resql = $db->query($sql); - if ($resql) { $num = $db->num_rows($resql); $i = 0; - $params=''; + $param=''; + if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit; - print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $params, $sortfield, $sortorder, '', $num, $nbtotalofrecords); - - print ''; + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print_barre_liste($langs->trans("MenuChequeDeposits"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_bank.png', '', '', $limit); + print ''; print ''; - print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$params,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"dp","",$params,'align="center"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$params,"",$sortfield,$sortorder); - print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$params,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"bc.amount","",$params,'align="right"',$sortfield,$sortorder); - print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"bc.statut","",$params,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Ref"),$_SERVER["PHP_SELF"],"bc.number","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("DateCreation"),$_SERVER["PHP_SELF"],"dp","",$param,'align="center"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Account"),$_SERVER["PHP_SELF"],"ba.label","",$param,"",$sortfield,$sortorder); + print_liste_field_titre($langs->trans("NbOfCheques"),$_SERVER["PHP_SELF"],"bc.nbcheque","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Amount"),$_SERVER["PHP_SELF"],"bc.amount","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"bc.statut","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre(''); print "\n"; // Lignes des champs de filtre @@ -151,6 +160,7 @@ if ($resql) print ''; + print ''; print '\n"; + print ''; + + print ''; + + print "\n"; $i++; } } @@ -200,7 +214,7 @@ if ($resql) { $var=!$var; print ""; - print '"; + print '"; print ''; } print "
'; print ''; print ''; $searchpitco=$form->showFilterAndCheckAddButtons(0); print $searchpitco; @@ -192,7 +202,11 @@ if ($resql) // Statut print ''; print $checkdepositstatic->LibStatut($objp->statut,5); - print "
'.$langs->trans("None")."'.$langs->trans("None")."
"; diff --git a/htdocs/compta/paiement/list.php b/htdocs/compta/paiement/list.php index 33576328786..bcca56ed645 100644 --- a/htdocs/compta/paiement/list.php +++ b/htdocs/compta/paiement/list.php @@ -57,9 +57,9 @@ $search_amount=GETPOST("search_amount",'alpha'); // alpha because we must be $search_company=GETPOST("search_company",'alpha'); $search_payment_num=GETPOST('search_payment_num','alpha'); +$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $sortfield = GETPOST("sortfield",'alpha'); $sortorder = GETPOST("sortorder",'alpha'); -$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; $page = GETPOST("page",'int'); if ($page == -1) { $page = 0; } $offset = $limit * $page; @@ -184,6 +184,7 @@ else $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; } +$sql.= $db->order($sortfield,$sortorder); $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -192,12 +193,10 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $nbtotalofrecords = $db->num_rows($result); } -$sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); //print "$sql"; $resql = $db->query($sql); - if ($resql) { $num = $db->num_rows($resql); @@ -211,9 +210,16 @@ if ($resql) $paramlist.=($search_payment_num?"&search_payment_num=".urlencode($search_payment_num):""); if ($optioncss != '') $paramlist.='&optioncss='.urlencode($optioncss); - print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png'); - - print ''; + print ''; + if ($optioncss != '') print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + + print_barre_liste($langs->trans("ReceivedCustomersPayments"), $page, $_SERVER["PHP_SELF"],$paramlist,$sortfield,$sortorder,'',$num, $nbtotalofrecords,'title_accountancy.png', 0, '', '', $limit); + print ''; print ''; print_liste_field_titre($langs->trans("RefPayment"),$_SERVER["PHP_SELF"],"p.rowid","",$paramlist,"",$sortfield,$sortorder); diff --git a/htdocs/compta/tva/index.php b/htdocs/compta/tva/index.php index 6445eb09f02..4090f2904b7 100644 --- a/htdocs/compta/tva/index.php +++ b/htdocs/compta/tva/index.php @@ -113,8 +113,8 @@ llxHeader(); $tva = new Tva($db); -$textprevyear="".img_previous().""; -$textnextyear=" ".img_next().""; +$textprevyear="".img_previous($langs->trans("Previous"), 'class="valignbottom"').""; +$textnextyear=" ".img_next($langs->trans("Next"), 'class="valignbottom"').""; print load_fiche_titre($langs->trans("VAT"),"$textprevyear ".$langs->trans("Year")." $year_start $textnextyear"); diff --git a/htdocs/contact/list.php b/htdocs/contact/list.php index f06de2ec8ec..8db9b90ff49 100644 --- a/htdocs/contact/list.php +++ b/htdocs/contact/list.php @@ -73,7 +73,6 @@ $sortorder = GETPOST('sortorder', 'alpha'); $page = GETPOST('page', 'int'); $userid=GETPOST('userid','int'); $begin=GETPOST('begin'); - if (! $sortorder) $sortorder="ASC"; if (! $sortfield) $sortfield="p.lastname"; if ($page < 0) { $page = 0; } @@ -333,6 +332,16 @@ $parameters=array(); $reshook=$hookmanager->executeHooks('printFieldListWhere',$parameters); // Note that $action and $object may have been modified by hook $sql.=$hookmanager->resPrint; +// Add order +if($view == "recent") +{ + $sql.= $db->order("p.datec","DESC"); +} +else +{ + $sql.= $db->order($sortfield,$sortorder); +} + // Count total nb of records $nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) @@ -341,15 +350,13 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $nbtotalofrecords = $db->num_rows($result); } -// Add order and limit +// Add limit if($view == "recent") { - $sql.= $db->order("p.datec","DESC"); $sql.= $db->plimit($limit+1, $offset); } else { - $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); } diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index ba8ed5624d1..534b4f31d86 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -2965,7 +2965,7 @@ function load_fiche_titre($titre, $mesg='', $picto='title_generic.png', $pictois * @param string $sortorder ordre de tri ('' par defaut) * @param string $center chaine du centre ('' par defaut). We often find here string $massaction comming from $form->selectMassAction() * @param int $num number of records found by select with limit+1 - * @param int $totalnboflines Total number of records/lines for all pages (if known) + * @param int $totalnboflines Total number of records/lines for all pages (if known). Use a negative value to no show number. * @param string $picto Icon to use before title (should be a 32x32 transparent png file) * @param int $pictoisfullpath 1=Icon name is a full absolute url of image * @param string $morehtml More html to show @@ -2979,7 +2979,9 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so global $conf,$langs; $savlimit = $limit; - + $savtotalnboflines = $totalnboflines; + $totalnboflines=abs($totalnboflines); + if ($picto == 'setup') $picto='title_setup.png'; if (($conf->browser->name == 'ie') && $picto=='title_generic.png') $picto='title.gif'; if ($limit < 0) $limit = $conf->liste_limit; @@ -3000,9 +3002,7 @@ function print_barre_liste($titre, $page, $file, $options='', $sortfield='', $so // Left if ($picto && $titre) print ''; print ''; // Center diff --git a/htdocs/fourn/facture/list.php b/htdocs/fourn/facture/list.php index 3c238a2f6f8..5a8760eafa8 100644 --- a/htdocs/fourn/facture/list.php +++ b/htdocs/fourn/facture/list.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004-2013 Laurent Destailleur + * Copyright (C) 2004-2016 Laurent Destailleur * Copyright (C) 2005-2013 Regis Houssin * Copyright (C) 2013 Philippe Grand * Copyright (C) 2013 Florian Henry @@ -60,8 +60,8 @@ $page=GETPOST("page",'int'); $sortorder = GETPOST("sortorder",'alpha'); $sortfield = GETPOST("sortfield",'alpha'); -if ($page == -1) { $page = 0 ; } $limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit; +if ($page == -1) { $page = 0 ; } $offset = $limit * $page ; $pageprev = $page - 1; $pagenext = $page + 1; @@ -233,7 +233,6 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) $nbtotalofrecords = $db->num_rows($result); } - $sql.= $db->order($sortfield,$sortorder); $sql.= $db->plimit($limit+1, $offset); @@ -261,9 +260,7 @@ if ($resql) if ($optioncss != '') $param.='&optioncss='.$optioncss; if ($search_status >= 0) $param.="&search_status=".$search_status; - print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy'); - - print ''; + print ''; if ($optioncss != '') print ''; print ''; print ''; @@ -271,7 +268,9 @@ if ($resql) print ''; print ''; - if ($search_all) + print_barre_liste($langs->trans("BillsSuppliers").($socid?" $soc->name.":""),$page,$_SERVER["PHP_SELF"],$param,$sortfield,$sortorder,'',$num,$nbtotalofrecords,'title_accountancy',0,'','',$limit); + + if ($search_all) { foreach($fieldstosearchall as $key => $val) $fieldstosearchall[$key]=$langs->trans($val); print $langs->trans("FilterOnInto", $search_all) . join(', ',$fieldstosearchall); diff --git a/htdocs/loan/index.php b/htdocs/loan/index.php index f08618e2313..3d13c9c82fa 100644 --- a/htdocs/loan/index.php +++ b/htdocs/loan/index.php @@ -1,7 +1,8 @@ * Copyright (C) 2015 Frederic France - * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2015 Juanjo Menent + * Copyright (C) 2016 Laurent Destailleur * * 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 @@ -61,6 +62,7 @@ if (GETPOST("button_removefilter_x") || GETPOST("button_removefilter")) // Both $search_amount=""; } + /* * View */ @@ -83,12 +85,14 @@ if ($filtre) { } $sql.= " GROUP BY l.rowid, l.label, l.capital, l.datestart, l.dateend"; $sql.= $db->order($sortfield,$sortorder); -$numall = 0; + +$nbtotalofrecords = 0; if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) { $result = $db->query($sql); - $numall = $db->num_rows($result); + $nbtotalofrecords = $db->num_rows($result); } + $sql.= $db->plimit($limit+1, $offset); //print $sql; @@ -105,9 +109,15 @@ if ($resql) if ($search_amount) $param.="&search_amount=".$search_amount_ht; if ($optioncss != '') $param.='&optioncss='.$optioncss; - print ''."\n"; + print ''."\n"; if ($optioncss != '') print ''; - print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $numall,'title_generic.png'); + print ''; + print ''; + print ''; + print ''; + print ''; + + print_barre_liste($langs->trans("Loans"), $page, $_SERVER["PHP_SELF"], $param, $sortfield, $sortorder, '', $num, $nbtotalofrecords, 'title_generic.png', 0, '', '', $limit); print '
'.img_picto('', $picto, '', $pictoisfullpath).'
'.$titre; - if (!empty($totalnboflines) && !empty($titre)) { - print ' ('.$totalnboflines.')'; - } + if (!empty($titre) && $savtotalnboflines > 0) print ' ('.$totalnboflines.')'; print '
'; print ''; @@ -116,6 +126,7 @@ if ($resql) print_liste_field_titre($langs->trans("Capital"),$_SERVER["PHP_SELF"],"l.capital","",$param,'align="right"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("DateStart"),$_SERVER["PHP_SELF"],"l.datestart","",$param,'align="center"',$sortfield,$sortorder); print_liste_field_titre($langs->trans("Status"),$_SERVER["PHP_SELF"],"l.paid","",$param,'align="right"',$sortfield,$sortorder); + print_liste_field_titre(''); print "\n"; // Filters lines @@ -124,6 +135,7 @@ if ($resql) print ''; print ''; print ''; + print ''; print ''; + print ''; + print "\n"; $i++; @@ -167,6 +181,7 @@ else { dol_print_error($db); } + llxFooter(); $db->close();
 '; print ''; print ''; @@ -154,6 +166,8 @@ if ($resql) print ''.$loan_static->LibStatut($obj->paid,5,$obj->alreadypayed).'