Merge branch '15.0' of git@github.com:Dolibarr/dolibarr.git into develop
Conflicts: htdocs/compta/bank/card.php
This commit is contained in:
commit
a528cd46bd
@ -65,7 +65,7 @@ $hookmanager->initHooks(array('bankcard', 'globalcard'));
|
||||
|
||||
// Security check
|
||||
$id = GETPOST("id", 'int') ? GETPOST("id", 'int') : GETPOST('ref', 'alpha');
|
||||
$fieldid = GETPOST("id") ? 'rowid' : 'ref';
|
||||
$fieldid = GETPOST("id", 'int') ? 'rowid' : 'ref';
|
||||
|
||||
$result = restrictedArea($user, 'banque', $id, 'bank_account&bank_account', '', '', $fieldid);
|
||||
|
||||
|
||||
@ -856,12 +856,28 @@ $sql .= ' f.rowid DESC ';
|
||||
|
||||
$nbtotalofrecords = '';
|
||||
if (empty($conf->global->MAIN_DISABLE_FULL_SCANLIST)) {
|
||||
/* This old and fast method to get and count full list returns all record so use a high amount of memory.
|
||||
$result = $db->query($sql);
|
||||
$nbtotalofrecords = $db->num_rows($result);
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total resultset is smaller then paging size (filtering), goto and load page 0
|
||||
*/
|
||||
/* The fast and low memory method to get and count full list converts the sql into a sql count */
|
||||
if ($sall || $search_product_category > 0 || $search_user > 0) {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(DISTINCT f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
} else {
|
||||
$sqlforcount = preg_replace('/^SELECT[a-zA-Z0-9\._\s\(\),=<>\:\-\']+\sFROM/', 'SELECT COUNT(f.rowid) as nbtotalofrecords FROM', $sql);
|
||||
$sqlforcount = preg_replace('/LEFT JOIN '.MAIN_DB_PREFIX.'paiement_facture as pf ON pf.fk_facture = f.rowid/', '', $sqlforcount);
|
||||
}
|
||||
$sqlforcount = preg_replace('/GROUP BY.*$/', '', $sqlforcount);
|
||||
|
||||
$resql = $db->query($sqlforcount);
|
||||
$objforcount = $db->fetch_object($resql);
|
||||
$nbtotalofrecords = $objforcount->nbtotalofrecords;
|
||||
|
||||
if (($page * $limit) > $nbtotalofrecords) { // if total of record found is smaller than page * limit, goto and load page 0
|
||||
$page = 0;
|
||||
$offset = 0;
|
||||
}
|
||||
$db->free($resql);
|
||||
}
|
||||
|
||||
$sql .= $db->plimit($limit + 1, $offset);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user