parent
15728375bb
commit
4c37ab4950
@ -8,6 +8,7 @@ class Transaction {
|
|||||||
private $sError = '';
|
private $sError = '';
|
||||||
private $table = 'transactions';
|
private $table = 'transactions';
|
||||||
private $tableBlocks = 'blocks';
|
private $tableBlocks = 'blocks';
|
||||||
|
public $num_rows = 0;
|
||||||
|
|
||||||
public function __construct($debug, $mysqli, $config, $block, $user) {
|
public function __construct($debug, $mysqli, $config, $block, $user) {
|
||||||
$this->debug = $debug;
|
$this->debug = $debug;
|
||||||
@ -89,6 +90,7 @@ class Transaction {
|
|||||||
$this->debug->append("STA " . __METHOD__, 4);
|
$this->debug->append("STA " . __METHOD__, 4);
|
||||||
$sql = "
|
$sql = "
|
||||||
SELECT
|
SELECT
|
||||||
|
SQL_CALC_FOUND_ROWS
|
||||||
t.id AS id,
|
t.id AS id,
|
||||||
a.username as username,
|
a.username as username,
|
||||||
t.type AS type,
|
t.type AS type,
|
||||||
@ -142,8 +144,13 @@ class Transaction {
|
|||||||
LIMIT ?,?
|
LIMIT ?,?
|
||||||
";
|
";
|
||||||
$stmt = $this->mysqli->prepare($sql);
|
$stmt = $this->mysqli->prepare($sql);
|
||||||
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $start, $limit) && $stmt->execute() && $result = $stmt->get_result())
|
if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $start, $limit) && $stmt->execute() && $result = $stmt->get_result()) {
|
||||||
|
// Fetch matching row count
|
||||||
|
$num_rows = $this->mysqli->prepare("SELECT FOUND_ROWS() AS num_rows");
|
||||||
|
if ($num_rows->execute() && $row_count = $num_rows->get_result()->fetch_object()->num_rows)
|
||||||
|
$this->num_rows = $row_count;
|
||||||
return $result->fetch_all(MYSQLI_ASSOC);
|
return $result->fetch_all(MYSQLI_ASSOC);
|
||||||
|
}
|
||||||
$this->debug->append('Unable to fetch transactions');
|
$this->debug->append('Unable to fetch transactions');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -10,11 +10,10 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
if (!$smarty->isCached('master.tpl', $smarty_cache_key)) {
|
||||||
$iLimit = 30;
|
$iLimit = 4;
|
||||||
$debug->append('No cached version available, fetching from backend', 3);
|
$debug->append('No cached version available, fetching from backend', 3);
|
||||||
$aTransactions = $transaction->getAllTransactions(@$_REQUEST['start'], @$_REQUEST['filter'], $iLimit);
|
$aTransactions = $transaction->getAllTransactions(@$_REQUEST['start'], @$_REQUEST['filter'], $iLimit);
|
||||||
$iCountTransactions = $transaction->getCountAllTransactions();
|
$iCountTransactions = $transaction->num_rows;
|
||||||
$aTransactionTypes = $transaction->getTypes();
|
|
||||||
if (!$aTransactions) $_SESSION['POPUP'][] = array('CONTENT' => 'Could not find any transaction', 'TYPE' => 'errormsg');
|
if (!$aTransactions) $_SESSION['POPUP'][] = array('CONTENT' => 'Could not find any transaction', 'TYPE' => 'errormsg');
|
||||||
$smarty->assign('LIMIT', $iLimit);
|
$smarty->assign('LIMIT', $iLimit);
|
||||||
$smarty->assign('TRANSACTIONS', $aTransactions);
|
$smarty->assign('TRANSACTIONS', $aTransactions);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user