From 1d6cbd44a6cd6b8b1368c95639b9332fdfe7a668 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 23 Jul 2013 08:56:29 +0200 Subject: [PATCH 01/10] Adding new admin transaction view * Added transaction filters * Added proper paging support * Removed the tabs that caused confusion * Added transaction status column Fixes #404 --- public/include/classes/transaction.class.php | 73 +++++++- .../include/pages/admin/transactions.inc.php | 8 +- .../mmcFE/admin/transactions/default.tpl | 164 +++++++----------- 3 files changed, 138 insertions(+), 107 deletions(-) diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 2cbe4312..0d7bb511 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -81,12 +81,13 @@ class Transaction { /** * Fetch all transactions for all users + * Optionally apply a filter * @param none * @return mixed array or false **/ - public function getAllTransactions($start=0) { + public function getAllTransactions($start=0,$filter=NULL,$limit=30) { $this->debug->append("STA " . __METHOD__, 4); - $stmt = $this->mysqli->prepare(" + $sql = " SELECT t.id AS id, a.username as username, @@ -96,17 +97,77 @@ class Transaction { t.timestamp AS timestamp, b.height AS height, b.confirmations AS confirmations - FROM transactions AS t + FROM $this->table AS t LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id - LEFT JOIN " . $this->user->getTableName() . " AS a ON t.account_id = a.id + LEFT JOIN " . $this->user->getTableName() . " AS a ON t.account_id = a.id"; + if (is_array($filter)) { + $aFilter = array(); + foreach ($filter as $key => $value) { + if (!empty($value)) { + switch ($key) { + case 'type': + $aFilter[] = "t.type = '$value'"; + break; + case 'status': + switch ($value) { + case 'Confirmed': + $aFilter[] = "b.confirmations >= " . $this->config['confirmations']; + break; + case 'Unconfirmed': + $aFilter[] = "b.confirmations < " . $this->config['confirmations'] . " AND b.confirmations >= 0"; + break; + case 'Orphan': + $aFilter[] = "b.confirmations = -1"; + break; + } + break; + case 'account': + $aFilter[] = "LOWER(a.username) = LOWER('$value')"; + break; + case 'address': + $aFilter[] = "t.coin_address = '$value'"; + break; + } + } + } + if (!empty($aFilter)) { + $sql .= " WHERE " . implode(' AND ', $aFilter); + } + } + $sql .= " ORDER BY id DESC - LIMIT ?,30"); - if ($this->checkStmt($stmt) && $stmt->bind_param('i', $start) && $stmt->execute() && $result = $stmt->get_result()) + LIMIT ?,? + "; + $stmt = $this->mysqli->prepare($sql); + if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $start, $limit) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); $this->debug->append('Unable to fetch transactions'); return false; } + /** + * Count the amount of transactions in the table + **/ + public function getCountAllTransactions($filter=NULL) { + $stmt = $this->mysqli->prepare("SELECT COUNT(id) AS total FROM $this->table"); + if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) + return $result->fetch_object()->total; + $this->debug->append('Failed to fetch transaction count: ' . $this->mysqli->error); + return false; + } + public function getTypes() { + $stmt = $this->mysqli->prepare("SELECT DISTINCT type FROM $this->table"); + if ($this->checkStmt($stmt) && $stmt->execute() && $result = $stmt->get_result()) { + $aData = array('' => ''); + while ($row = $result->fetch_assoc()) { + $aData[$row['type']] = $row['type']; + } + return $aData; + } + $this->debug->append('Failed to fetch transaction types: ' . $this->mysqli->error); + return false; + } + private function checkStmt($bState) { if ($bState ===! true) { $this->debug->append("Failed to prepare statement: " . $this->mysqli->error); diff --git a/public/include/pages/admin/transactions.inc.php b/public/include/pages/admin/transactions.inc.php index fe991ba5..2c1126ba 100644 --- a/public/include/pages/admin/transactions.inc.php +++ b/public/include/pages/admin/transactions.inc.php @@ -11,11 +11,17 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) { if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { $debug->append('No cached version available, fetching from backend', 3); - $aTransactions = $transaction->getAllTransactions(@$_REQUEST['start']); + $aTransactions = $transaction->getAllTransactions(@$_REQUEST['start'], @$_REQUEST['filter'], 5); + $iCountTransactions = $transaction->getCountAllTransactions(); + $aTransactionTypes = $transaction->getTypes(); if (!$aTransactions) $_SESSION['POPUP'][] = array('CONTENT' => 'Could not find any transaction', 'TYPE' => 'errormsg'); } else { $debug->append('Using cached page', 3); } + $smarty->assign('TRANSACTIONS', $aTransactions); +$smarty->assign('TRANSACTIONTYPES', $aTransactionTypes); +$smarty->assign('TXSTATUS', array('' => '', 'Confirmed' => 'Confirmed', 'Unconfirmed' => 'Unconfirmed', 'Orphan' => 'Orphan')); +$smarty->assign('COUNTTRANSACTIONS', $iCountTransactions); $smarty->assign('CONTENT', 'default.tpl'); ?> diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index c493de8b..b9833bad 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -1,47 +1,91 @@ -{include file="global/block_header.tpl" BLOCK_HEADER="Transaction Log" BUTTONS=array(Confirmed,Unconfirmed,Orphan)} +{include file="global/block_header.tpl" ALIGN="left" BLOCK_STYLE="width: 23%" BLOCK_HEADER="Transaction Filter"} + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+{if $COUNTTRANSACTIONS / 5 > 1} + {if $smarty.request.start > 0} + + {else} + + {/if} +{/if} + +{if $COUNTTRANSACTIONS / 5 > 1} + {if $COUNTTRANSACTIONS - $smarty.request.start - 5 > 0} + + {else} + + {/if} +{/if} +
Type{html_options name="filter[type]" options=$TRANSACTIONTYPES selected=$smarty.request.filter.type}
Status{html_options name="filter[status]" options=$TXSTATUS selected=$smarty.request.filter.status}
Account
Address
+{include file="global/block_footer.tpl"} + +{include file="global/block_header.tpl" ALIGN="right" BLOCK_STYLE="width: 75%" BLOCK_HEADER="Transaction History"} +
- - -
-
-
- +
+ - {assign var=confirmed value=0} {section transaction $TRANSACTIONS} - {if ( - ( ( $TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Bonus' or $TRANSACTIONS[transaction].type == 'Donation' or $TRANSACTIONS[transaction].type == 'Fee' ) and $TRANSACTIONS[transaction].confirmations >= $GLOBAL.confirmations ) - or $TRANSACTIONS[transaction].type == 'Credit_PPS' or $TRANSACTIONS[transaction].type == 'Fee_PPS' or $TRANSACTIONS[transaction].type == 'Donation_PPS' - or $TRANSACTIONS[transaction].type == 'Debit_AP' or $TRANSACTIONS[transaction].type == 'Debit_MP' or $TRANSACTIONS[transaction].type == 'TXFee' - )} - {assign var=confirmed value=1} + - {/if} {/section} - {if $confirmed != 1} - - - - {/if}
TX # Account Date TX TypeStatus Payment Address Block # Amount
{$TRANSACTIONS[transaction].id} {$TRANSACTIONS[transaction].username} {$TRANSACTIONS[transaction].timestamp} {$TRANSACTIONS[transaction].type} + {if $TRANSACTIONS[transaction].type == 'Credit_PPS' OR + $TRANSACTIONS[transaction].type == 'Debit_MP' OR + $TRANSACTIONS[transaction].type == 'Debit_AP' OR + $TRANSACTIONS[transaction].confirmations > $GLOBAL.confirmations + }Confirmed + {else if $TRANSACTIONS[transaction].confirmations == -1}Orphaned + {else}Unconfirmed{/if} + ({$TRANSACTIONS[transaction].confirmations|default:"n/a"}) + {$TRANSACTIONS[transaction].coin_address} {if $TRANSACTIONS[transaction].height == 0}n/a{else}{$TRANSACTIONS[transaction].height}{/if} {$TRANSACTIONS[transaction].amount|number_format:"8"}
No confirmed transactions

@@ -51,84 +95,4 @@

-
-
- - - - - - - - - - - - - - {assign var=unconfirmed value=0} -{section transaction $TRANSACTIONS} - {if ($TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Bonus' or $TRANSACTIONS[transaction].type == 'Donation' or $TRANSACTIONS[transaction].type == 'Fee') and $TRANSACTIONS[transaction].confirmations < $GLOBAL.confirmations and $TRANSACTIONS[transaction].confirmations >= 0} - {assign var=unconfirmed value=1} - - - - - - - - - - {/if} -{/section} - {if $unconfirmed != 1} - - - - {/if} - -
TX #AccountDateTX TypePayment AddressBlock #Amount
{$TRANSACTIONS[transaction].id}{$TRANSACTIONS[transaction].username}{$TRANSACTIONS[transaction].timestamp}{$TRANSACTIONS[transaction].type}{$TRANSACTIONS[transaction].coin_address}{if $TRANSACTIONS[transaction].height == 0}n/a{else}{$TRANSACTIONS[transaction].height}{/if}{$TRANSACTIONS[transaction].amount|number_format:"8"}
No unconfirmed transactions
-

Listed are your estimated rewards and donations/fees for all blocks awaiting {$GLOBAL.confirmations} confirmations.

-
-
-
-
- - - - - - - - - - - - - - {assign var=orphaned value=0} -{section transaction $TRANSACTIONS} - {if ($TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Fee' or $TRANSACTIONS[transaction].type == 'Donation' or $TRANSACTIONS[transaction].type == 'Bonus') and $TRANSACTIONS[transaction].confirmations == -1} - {assign var=orphaned value=1} - - - - - - - - - - {/if} -{/section} - {if $orphaned != 1} - - - - {/if} - -
TX #AccountDateTX TypePayment AddressBlock #Amount
{$TRANSACTIONS[transaction].id}{$TRANSACTIONS[transaction].username}{$TRANSACTIONS[transaction].timestamp}{$TRANSACTIONS[transaction].type}{$TRANSACTIONS[transaction].coin_address}{if $TRANSACTIONS[transaction].height == 0}n/a{else}{$TRANSACTIONS[transaction].height}{/if}{$TRANSACTIONS[transaction].amount|number_format:"8"}
No orphan transactions
-

Listed are your orphaned transactions for blocks not part of the main blockchain.

-
-
{include file="global/block_footer.tpl"} From 1a5d216b7a1c820212121a553570137a818673e0 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 23 Jul 2013 09:08:57 +0200 Subject: [PATCH 02/10] Allow adjusting the tx row limit --- public/include/pages/admin/transactions.inc.php | 12 +++++++----- .../templates/mmcFE/admin/transactions/default.tpl | 6 +++--- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/public/include/pages/admin/transactions.inc.php b/public/include/pages/admin/transactions.inc.php index 2c1126ba..6089858a 100644 --- a/public/include/pages/admin/transactions.inc.php +++ b/public/include/pages/admin/transactions.inc.php @@ -10,18 +10,20 @@ if (!$user->isAuthenticated() || !$user->isAdmin($_SESSION['USERDATA']['id'])) { } if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { + $iLimit = 30; $debug->append('No cached version available, fetching from backend', 3); - $aTransactions = $transaction->getAllTransactions(@$_REQUEST['start'], @$_REQUEST['filter'], 5); + $aTransactions = $transaction->getAllTransactions(@$_REQUEST['start'], @$_REQUEST['filter'], $iLimit); $iCountTransactions = $transaction->getCountAllTransactions(); $aTransactionTypes = $transaction->getTypes(); if (!$aTransactions) $_SESSION['POPUP'][] = array('CONTENT' => 'Could not find any transaction', 'TYPE' => 'errormsg'); + $smarty->assign('LIMIT', $iLimit); + $smarty->assign('TRANSACTIONS', $aTransactions); + $smarty->assign('TRANSACTIONTYPES', $aTransactionTypes); + $smarty->assign('TXSTATUS', array('' => '', 'Confirmed' => 'Confirmed', 'Unconfirmed' => 'Unconfirmed', 'Orphan' => 'Orphan')); + $smarty->assign('COUNTTRANSACTIONS', $iCountTransactions); } else { $debug->append('Using cached page', 3); } -$smarty->assign('TRANSACTIONS', $aTransactions); -$smarty->assign('TRANSACTIONTYPES', $aTransactionTypes); -$smarty->assign('TXSTATUS', array('' => '', 'Confirmed' => 'Confirmed', 'Unconfirmed' => 'Unconfirmed', 'Orphan' => 'Orphan')); -$smarty->assign('COUNTTRANSACTIONS', $iCountTransactions); $smarty->assign('CONTENT', 'default.tpl'); ?> diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index b9833bad..fff98814 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -3,7 +3,7 @@ -{if $COUNTTRANSACTIONS / 5 > 1} +{if $COUNTTRANSACTIONS / $LIMIT > 1} {if $smarty.request.start > 0} {else} @@ -12,8 +12,8 @@ {/if} -{if $COUNTTRANSACTIONS / 5 > 1} - {if $COUNTTRANSACTIONS - $smarty.request.start - 5 > 0} +{if $COUNTTRANSACTIONS / $LIMIT > 1} + {if $COUNTTRANSACTIONS - $smarty.request.start - $LIMIT > 0} {else} From 728bfe8c9dd380c8d2030c335fcd7e478cd255a3 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 23 Jul 2013 09:18:04 +0200 Subject: [PATCH 03/10] properly filter Credit_PPS as confirmed --- public/include/classes/transaction.class.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 0d7bb511..987a8970 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -111,7 +111,7 @@ class Transaction { case 'status': switch ($value) { case 'Confirmed': - $aFilter[] = "b.confirmations >= " . $this->config['confirmations']; + if ($filter['type'] != 'Credit_PPS') $aFilter[] = "b.confirmations >= " . $this->config['confirmations']; break; case 'Unconfirmed': $aFilter[] = "b.confirmations < " . $this->config['confirmations'] . " AND b.confirmations >= 0"; @@ -137,7 +137,7 @@ class Transaction { $sql .= " ORDER BY id DESC LIMIT ?,? - "; + "; $stmt = $this->mysqli->prepare($sql); if ($this->checkStmt($stmt) && $stmt->bind_param('ii', $start, $limit) && $stmt->execute() && $result = $stmt->get_result()) return $result->fetch_all(MYSQLI_ASSOC); From 61cea524d139f6db9d643db401c657090c6209d2 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 23 Jul 2013 09:18:50 +0200 Subject: [PATCH 04/10] properly use limit for pagination --- public/templates/mmcFE/admin/transactions/default.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index fff98814..ee0b2aac 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -5,7 +5,7 @@ {if $COUNTTRANSACTIONS / $LIMIT > 1} {if $smarty.request.start > 0} - + {else} {/if} @@ -14,7 +14,7 @@ {if $COUNTTRANSACTIONS / $LIMIT > 1} {if $COUNTTRANSACTIONS - $smarty.request.start - $LIMIT > 0} - + {else} {/if} From ed259a5b4498ba1d5c0739f152d22c4fc80e0d73 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 23 Jul 2013 09:21:11 +0200 Subject: [PATCH 05/10] properly deal with Fee_PPS and Donation_PPS --- public/include/classes/transaction.class.php | 2 +- public/templates/mmcFE/admin/transactions/default.tpl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 987a8970..2d4431a9 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -111,7 +111,7 @@ class Transaction { case 'status': switch ($value) { case 'Confirmed': - if ($filter['type'] != 'Credit_PPS') $aFilter[] = "b.confirmations >= " . $this->config['confirmations']; + if ($filter['type'] != 'Credit_PPS' && $filter['type'] != 'Fee_PPS' && $filter['type'] != $filter['Donation_PPS']) $aFilter[] = "b.confirmations >= " . $this->config['confirmations']; break; case 'Unconfirmed': $aFilter[] = "b.confirmations < " . $this->config['confirmations'] . " AND b.confirmations >= 0"; diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index ee0b2aac..7141b5b1 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -73,6 +73,8 @@ {$TRANSACTIONS[transaction].type} {if $TRANSACTIONS[transaction].type == 'Credit_PPS' OR + $TRANSACTIONS[transaction].type == 'Fee_PPS' OR + $TRANSACTIONS[transaction].type == 'Donation_PPS' OR $TRANSACTIONS[transaction].type == 'Debit_MP' OR $TRANSACTIONS[transaction].type == 'Debit_AP' OR $TRANSACTIONS[transaction].confirmations > $GLOBAL.confirmations From 330169ae582a6bfe8ba011f9c637153e047fce3b Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 23 Jul 2013 10:53:47 +0200 Subject: [PATCH 06/10] more fixes and log cleanup --- public/include/classes/transaction.class.php | 4 +++- .../include/pages/admin/transactions.inc.php | 9 ++++++++ .../mmcFE/admin/transactions/default.tpl | 22 +++++++++---------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 2d4431a9..7758f4cf 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -111,7 +111,9 @@ class Transaction { case 'status': switch ($value) { case 'Confirmed': - if ($filter['type'] != 'Credit_PPS' && $filter['type'] != 'Fee_PPS' && $filter['type'] != $filter['Donation_PPS']) $aFilter[] = "b.confirmations >= " . $this->config['confirmations']; + if (empty($filter['type']) || ($filter['type'] != 'Credit_PPS' && $filter['type'] != 'Fee_PPS' && $filter['type'] != 'Donation_PPS')) { + $aFilter[] = "b.confirmations >= " . $this->config['confirmations']; + } break; case 'Unconfirmed': $aFilter[] = "b.confirmations < " . $this->config['confirmations'] . " AND b.confirmations >= 0"; diff --git a/public/include/pages/admin/transactions.inc.php b/public/include/pages/admin/transactions.inc.php index 6089858a..f106de26 100644 --- a/public/include/pages/admin/transactions.inc.php +++ b/public/include/pages/admin/transactions.inc.php @@ -25,5 +25,14 @@ if (!$smarty->isCached('master.tpl', $smarty_cache_key)) { $debug->append('Using cached page', 3); } +// Gernerate the GET URL for filters +if (isset($_REQUEST['filter'])) { + $strFilters = ''; + foreach (@$_REQUEST['filter'] as $filter => $value) { + $filter = "filter[$filter]"; + $strFilters .= "&$filter=$value"; + } + $smarty->assign('FILTERS', $strFilters); +} $smarty->assign('CONTENT', 'default.tpl'); ?> diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index 7141b5b1..8014cf09 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -4,8 +4,8 @@ {if $COUNTTRANSACTIONS / $LIMIT > 1} - {if $smarty.request.start > 0} - + {if $smarty.request.start|default:"0" > 0} + {else} {/if} @@ -13,8 +13,8 @@ {if $COUNTTRANSACTIONS / $LIMIT > 1} - {if $COUNTTRANSACTIONS - $smarty.request.start - $LIMIT > 0} - + {if $COUNTTRANSACTIONS - $smarty.request.start|default:"0" - $LIMIT > 0} + {else} {/if} @@ -25,20 +25,20 @@ - Type - {html_options name="filter[type]" options=$TRANSACTIONTYPES selected=$smarty.request.filter.type} + TX Type + {html_options name="filter[type]" options=$TRANSACTIONTYPES selected=$smarty.request.filter.type|default:""} - Status - {html_options name="filter[status]" options=$TXSTATUS selected=$smarty.request.filter.status} + TX Status + {html_options name="filter[status]" options=$TXSTATUS selected=$smarty.request.filter.status|default:""} Account - + Address - + @@ -77,7 +77,7 @@ $TRANSACTIONS[transaction].type == 'Donation_PPS' OR $TRANSACTIONS[transaction].type == 'Debit_MP' OR $TRANSACTIONS[transaction].type == 'Debit_AP' OR - $TRANSACTIONS[transaction].confirmations > $GLOBAL.confirmations + $TRANSACTIONS[transaction].confirmations >= $GLOBAL.confirmations }Confirmed {else if $TRANSACTIONS[transaction].confirmations == -1}Orphaned {else}Unconfirmed{/if} From fb24ad81ae93c4372a1e1320224ac5906ab0befe Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 23 Jul 2013 11:52:01 +0200 Subject: [PATCH 07/10] fixing php warning --- public/templates/mmcFE/admin/transactions/default.tpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index 8014cf09..4a2b18e8 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -5,7 +5,7 @@ {if $COUNTTRANSACTIONS / $LIMIT > 1} {if $smarty.request.start|default:"0" > 0} - + {else} {/if} @@ -14,7 +14,7 @@ {if $COUNTTRANSACTIONS / $LIMIT > 1} {if $COUNTTRANSACTIONS - $smarty.request.start|default:"0" - $LIMIT > 0} - + {else} {/if} From 24a277312c1faf14adf1dfd60d9c14f6475507a0 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 23 Jul 2013 12:01:45 +0200 Subject: [PATCH 08/10] fixing TXFee display and filter --- public/include/classes/transaction.class.php | 2 +- public/templates/mmcFE/admin/transactions/default.tpl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 7758f4cf..42f811f0 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -111,7 +111,7 @@ class Transaction { case 'status': switch ($value) { case 'Confirmed': - if (empty($filter['type']) || ($filter['type'] != 'Credit_PPS' && $filter['type'] != 'Fee_PPS' && $filter['type'] != 'Donation_PPS')) { + if (empty($filter['type']) || ($filter['type'] != 'TXFee' && $filter['type'] != 'Credit_PPS' && $filter['type'] != 'Fee_PPS' && $filter['type'] != 'Donation_PPS')) { $aFilter[] = "b.confirmations >= " . $this->config['confirmations']; } break; diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index 4a2b18e8..8561d114 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -77,6 +77,7 @@ $TRANSACTIONS[transaction].type == 'Donation_PPS' OR $TRANSACTIONS[transaction].type == 'Debit_MP' OR $TRANSACTIONS[transaction].type == 'Debit_AP' OR + $TRANSACTIONS[transaction].type == 'TXFee' OR $TRANSACTIONS[transaction].confirmations >= $GLOBAL.confirmations }Confirmed {else if $TRANSACTIONS[transaction].confirmations == -1}Orphaned From 9c2cefd2c367649bb38055bbac65487d7efab9b8 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 23 Jul 2013 12:10:32 +0200 Subject: [PATCH 09/10] adding blockexplorer link if URL configured --- public/include/classes/transaction.class.php | 1 + public/templates/mmcFE/admin/transactions/default.tpl | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 42f811f0..a45ca0b5 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -96,6 +96,7 @@ class Transaction { t.coin_address AS coin_address, t.timestamp AS timestamp, b.height AS height, + b.blockhash AS blockhash, b.confirmations AS confirmations FROM $this->table AS t LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index 8561d114..f23b265a 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -85,7 +85,7 @@ ({$TRANSACTIONS[transaction].confirmations|default:"n/a"}) {$TRANSACTIONS[transaction].coin_address} - {if $TRANSACTIONS[transaction].height == 0}n/a{else}{$TRANSACTIONS[transaction].height}{/if} + {if $TRANSACTIONS[transaction].height == 0}n/a{else}{if $GLOBAL.blockexplorer}{$TRANSACTIONS[transaction].height}{else}{$TRANSACTIONS[transaction].height}{/if}{/if} {$TRANSACTIONS[transaction].amount|number_format:"8"} {/section} From 9cb80c6fd90c14ae1115d55e39394cad8c42a513 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Tue, 23 Jul 2013 12:36:16 +0200 Subject: [PATCH 10/10] Properly filter Debit transactions --- public/include/classes/transaction.class.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index a45ca0b5..ab9314b9 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -112,7 +112,7 @@ class Transaction { case 'status': switch ($value) { case 'Confirmed': - if (empty($filter['type']) || ($filter['type'] != 'TXFee' && $filter['type'] != 'Credit_PPS' && $filter['type'] != 'Fee_PPS' && $filter['type'] != 'Donation_PPS')) { + if (empty($filter['type']) || ($filter['type'] != 'Debit_AP' && $filter['type'] != 'Debit_MP' && $filter['type'] != 'TXFee' && $filter['type'] != 'Credit_PPS' && $filter['type'] != 'Fee_PPS' && $filter['type'] != 'Donation_PPS')) { $aFilter[] = "b.confirmations >= " . $this->config['confirmations']; } break;