From 7d801a561c8daf5cb706250c3c4cdc8a0ce6cb26 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sun, 21 Jul 2013 08:20:53 +0200 Subject: [PATCH 1/2] Fixing Orphan showing as unconfirmed * Fixes orphaned transactions showing as unconfirmed too * Fixes transaction tables to show orphaned credits in green, not red Fixes #490 --- public/include/classes/transaction.class.php | 4 ++-- public/templates/mmcFE/account/transactions/default.tpl | 2 +- public/templates/mmcFE/admin/transactions/default.tpl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 30867cc6..229c8581 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -235,7 +235,7 @@ class Transaction { FROM $this->table AS t LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id WHERE - t.type IN ('Credit','Bonus') AND b.confirmations < ? + t.type IN ('Credit','Bonus') AND b.confirmations < ? AND b.confirmations > 0 AND t.account_id = ? ) AS t4, ( @@ -244,7 +244,7 @@ class Transaction { LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id WHERE ( - t.type IN ('Donation','Fee') AND b.confirmations < ? + t.type IN ('Donation','Fee') AND b.confirmations < ? AND b.confirmations > 0 ) AND t.account_id = ? ) AS t5, diff --git a/public/templates/mmcFE/account/transactions/default.tpl b/public/templates/mmcFE/account/transactions/default.tpl index 4bbe7b4b..52602088 100644 --- a/public/templates/mmcFE/account/transactions/default.tpl +++ b/public/templates/mmcFE/account/transactions/default.tpl @@ -116,7 +116,7 @@ {$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"} + {$TRANSACTIONS[transaction].amount|number_format:"8"} {if $TRANSACTIONS[transaction].type == 'Credit' or $TRANSACTIONS[transaction].type == 'Bonus'} {assign var="orphan_credits" value="`$orphan_credits|default:"0"+$TRANSACTIONS[transaction].amount`"} diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index aba15f12..ecf0dc70 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -117,7 +117,7 @@ {$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"} + {$TRANSACTIONS[transaction].amount|number_format:"8"} {/if} {/section} From 36a74b0bbf206b7b0f5c9bfed48192ecf3934a79 Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Sun, 21 Jul 2013 17:25:09 +0200 Subject: [PATCH 2/2] Fix transaction table, adjust transaction class * Ensure we also check newly added blocks for unconfirmed tx * Only list orphaned transactions in the orphaned tab Fixes #490 --- public/include/classes/transaction.class.php | 4 ++-- public/templates/mmcFE/account/transactions/default.tpl | 2 +- public/templates/mmcFE/admin/transactions/default.tpl | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/public/include/classes/transaction.class.php b/public/include/classes/transaction.class.php index 229c8581..2cbe4312 100644 --- a/public/include/classes/transaction.class.php +++ b/public/include/classes/transaction.class.php @@ -235,7 +235,7 @@ class Transaction { FROM $this->table AS t LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id WHERE - t.type IN ('Credit','Bonus') AND b.confirmations < ? AND b.confirmations > 0 + t.type IN ('Credit','Bonus') AND b.confirmations < ? AND b.confirmations >= 0 AND t.account_id = ? ) AS t4, ( @@ -244,7 +244,7 @@ class Transaction { LEFT JOIN " . $this->block->getTableName() . " AS b ON t.block_id = b.id WHERE ( - t.type IN ('Donation','Fee') AND b.confirmations < ? AND b.confirmations > 0 + t.type IN ('Donation','Fee') AND b.confirmations < ? AND b.confirmations >= 0 ) AND t.account_id = ? ) AS t5, diff --git a/public/templates/mmcFE/account/transactions/default.tpl b/public/templates/mmcFE/account/transactions/default.tpl index 52602088..a7337bd6 100644 --- a/public/templates/mmcFE/account/transactions/default.tpl +++ b/public/templates/mmcFE/account/transactions/default.tpl @@ -62,7 +62,7 @@ {assign var=has_unconfirmed value=false} {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) + (($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=has_unconfirmed value=true} diff --git a/public/templates/mmcFE/admin/transactions/default.tpl b/public/templates/mmcFE/admin/transactions/default.tpl index ecf0dc70..c493de8b 100644 --- a/public/templates/mmcFE/admin/transactions/default.tpl +++ b/public/templates/mmcFE/admin/transactions/default.tpl @@ -68,7 +68,7 @@ {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} + {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} {$TRANSACTIONS[transaction].id}