[ljcom] r12383: LJSUP-13158: Add reserved and blocking b...
Committer: nnikulochkina
LJSUP-13158: Add reserved and blocking balance to acctedit.bmlU trunk/htdocs/admin/accounts/acctedit.bml
Modified: trunk/htdocs/admin/accounts/acctedit.bml
===================================================================
--- trunk/htdocs/admin/accounts/acctedit.bml 2012-07-31 13:01:42 UTC (rev 12382)
+++ trunk/htdocs/admin/accounts/acctedit.bml 2012-07-31 14:46:07 UTC (rev 12383)
@@ -2,6 +2,7 @@
{
use strict;
use LJ::TimeUtil;
+ use LJ::Pay::Wallet::Account;
use vars qw(%GET %POST);
my $remote = LJ::get_remote();
@@ -292,6 +293,19 @@
LJ::run_hook('modify_sms_quota', $u, amount => $newval, type => 'cap');
}
+ # Refund all accounts
+ if ($POST{'refund_reserved'}) {
+ my $res = eval{LJ::Pay::Wallet::Account->get_user_active_accounts($u)};
+ die "$@" if $@;
+
+ foreach my $it (@{$res->{items}}) {
+ my $account = LJ::Pay::Wallet::Account->load($u->id,$it->{id});
+ eval {$account->revoke};
+ die "$@" if $@;
+ }
+ }
+
+
# add or subtract LJ Wallet tokens
if ($POST{'wallet_add'}) {
my $qty = int $POST{'wallet_add'};
@@ -574,13 +588,18 @@
# LJ Wallet
{
my $balance = LJ::Pay::Wallet->get_user_balance($u);
+ my ($reserved, $blocked) = LJ::Pay::Wallet::Account->get_total_for_user($u->id);
$ret .= qq{
- <tr><td colspan="5" align="left">
- <strong>LJ Wallet ($balance):</strong>
+ <tr><td align="left" colspan="5">
+ <strong>LJ Wallet:</strong><br>
+ available: $balance<br>
+ reserved: $reserved<br>
+ blocked: $blocked<br>
add
<input type="text" name="wallet_add">
tokens
<small>(can be negative)</small>
+ <input type="checkbox" name="refund_reserved"> Refund reserved LJ Tokens
</td></tr>
};
}
