Fix feature to jump on a numbered page.

This commit is contained in:
Laurent Destailleur 2016-10-29 17:46:11 +02:00
parent 69fe2bfad6
commit 91ee1fae51
3 changed files with 40 additions and 20 deletions

View File

@ -906,9 +906,9 @@ if ($resql)
print '</td>';
}
// Town
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_town" value="'.$search_town.'"></td>';
if (! empty($arrayfields['s.town']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_town" value="'.$search_town.'"></td>';
// Zip
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="6" name="search_zip" value="'.$search_zip.'"></td>';
if (! empty($arrayfields['s.zip']['checked'])) print '<td class="liste_titre"><input class="flat" type="text" size="4" name="search_zip" value="'.$search_zip.'"></td>';
// State
if (! empty($arrayfields['state.nom']['checked']))
{
@ -951,14 +951,14 @@ if ($resql)
{
// Amount
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="5" name="search_total_ht" value="'.$search_total_ht.'">';
print '<input class="flat" type="text" size="4" name="search_total_ht" value="'.$search_total_ht.'">';
print '</td>';
}
if (! empty($arrayfields['c.total_vat']['checked']))
{
// Amount
print '<td class="liste_titre" align="right">';
print '<input class="flat" type="text" size="5" name="search_total_vat" value="'.$search_total_vat.'">';
print '<input class="flat" type="text" size="4" name="search_total_vat" value="'.$search_total_vat.'">';
print '</td>';
}
if (! empty($arrayfields['c.total_ttc']['checked']))

View File

@ -429,7 +429,7 @@ if ($id > 0 || ! empty($ref))
if ($object->canBeConciliated() > 0) {
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile&id='.$object->id.$param.'">'.$langs->trans("Conciliate").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile'.$param.'">'.$langs->trans("Conciliate").'</a>';
} else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
@ -511,7 +511,7 @@ if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST))
$nbtotalofpages = ceil($nbtotalofrecords/$limit);
}
if (($id > 0 || ! empty($ref)) && GETPOST("page",'int') === '')
if (($id > 0 || ! empty($ref)) && ((string) $page == ''))
{
// We open a list of transaction of a dedicated account and no page was set by defaut
// We force on last page.
@ -519,6 +519,13 @@ if (($id > 0 || ! empty($ref)) && GETPOST("page",'int') === '')
$offset = $limit * $page;
if ($page < 0) $page = 0;
}
if ($page >= $nbtotalofpages)
{
// If we made a search and result has low page than the page number we were on
$page = ($nbtotalofpages -1);
$offset = $limit * $page;
if ($page < 0) $page = 0;
}
if (! empty($search_ref)) $mode_balance_ok=false;
if (! empty($req_nb)) $mode_balance_ok=false;

View File

@ -65,16 +65,29 @@ if ($user->rights->banque->consolidate && $action == 'dvprev' && ! empty($dvid))
}
$sortfield = GETPOST('sortfield', 'alpha');
$sortorder = GETPOST('sortorder', 'alpha');
$page = GETPOST('page', 'int');
$limit = GETPOST('limit')?GETPOST('limit','int'):$conf->liste_limit;
$sortfield = GETPOST("sortfield",'alpha');
$sortorder = GETPOST("sortorder",'alpha');
$page = GETPOST("page",'int');
$pageplusone = GETPOST("pageplusone",'int');
if ($pageplusone) $page = $pageplusone - 1;
if ($page == -1) { $page = 0; }
$offset = $limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
if (! $sortorder) $sortorder="ASC";
if (! $sortfield) $sortfield="s.nom";
$offset = $conf->liste_limit * $page;
$pageprev = $page - 1;
$pagenext = $page + 1;
$object = new Account($db);
if ($id > 0 || ! empty($ref))
{
$result=$object->fetch($id, $ref);
$account = $object->id; // Force the search field on id of account
}
// Initialize technical object to manage context to save list fields
$contextpage='banktransactionlist'.(empty($object->ref)?'':'-'.$object->id);
/*
@ -96,12 +109,12 @@ $bankstatic=new Account($db);
$banklinestatic=new AccountLine($db);
$remisestatic = new RemiseCheque($db);
// Load account
$object = new Account($db);
if ($id > 0 || ! empty($ref))
{
$object->fetch($id, $ref);
}
// Must be before button action
$param='';
if (! empty($contextpage) && $contextpage != $_SERVER["PHP_SELF"]) $param.='&contextpage='.$contextpage;
if ($limit > 0 && $limit != $conf->liste_limit) $param.='&limit='.$limit;
if ($id > 0) $param.='&id='.urlencode($id);
if (empty($num))
{
@ -138,7 +151,7 @@ if (empty($num))
if ($object->canBeConciliated() > 0) {
// If not cash account and can be reconciliate
if ($user->rights->banque->consolidate) {
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?id='.$object->id.'">'.$langs->trans("Conciliate").'</a>';
print '<a class="butAction" href="'.DOL_URL_ROOT.'/compta/bank/bankentries.php?action=reconcile'.$param.'">'.$langs->trans("Conciliate").'</a>';
} else {
print '<a class="butActionRefused" title="'.$langs->trans("NotEnoughPermissions").'" href="#">'.$langs->trans("Conciliate").'</a>';
}
@ -216,7 +229,7 @@ if (empty($num))
else
{
/**
* Affiche liste ecritures d'un releve
* Show list of bank statements
*/
$ve=$_GET["ve"];