[dw-free] Add ability to go to cart by code.
[commit: http://hg.dwscoalition.org/dw-free/rev/61f0008d314b]
Add ability to go to cart by code.
Patch by
mark.
Files modified:
Add ability to go to cart by code.
Patch by
Files modified:
- htdocs/admin/pay/index.bml
- htdocs/admin/pay/view.bml
--------------------------------------------------------------------------------
diff -r ca3e5078e821 -r 61f0008d314b htdocs/admin/pay/index.bml
--- a/htdocs/admin/pay/index.bml Sat May 02 16:15:45 2009 +0000
+++ b/htdocs/admin/pay/index.bml Sun May 03 04:00:56 2009 +0000
@@ -150,6 +150,11 @@ EOF
<input type="text" name="cartid" /> <input type="submit" value="Go" />
</form>
</li>
+ <li>View invite code:
+ <form method="get" action="/admin/pay/view">
+ <input type="text" name="code" /> <input type="submit" value="Go" />
+ </form>
+ </li>
</ul>
EOF
diff -r ca3e5078e821 -r 61f0008d314b htdocs/admin/pay/view.bml
--- a/htdocs/admin/pay/view.bml Sat May 02 16:15:45 2009 +0000
+++ b/htdocs/admin/pay/view.bml Sun May 03 04:00:56 2009 +0000
@@ -38,6 +38,21 @@ to do this by clicking the button below.
<input type='submit' value='Strip that code!' />
</form>
EOF
+ }
+
+ if ( my $code = $GET{code} ) {
+ my ( $acid ) = DW::InviteCodes->decode( $code );
+ return "Code seems invalid"
+ unless $acid;
+
+ my $dbh = LJ::get_db_writer();
+ my $cartid = $dbh->selectrow_array( 'SELECT cartid FROM shop_codes WHERE acid = ?', undef, $acid );
+ return $dbh->errstr if $dbh->err;
+
+ return "Code does not appear to have any paid time on it."
+ unless $acid;
+
+ return BML::redirect( "$LJ::SITEROOT/admin/pay/view?cartid=$cartid" );
}
my $body = '<h1>Payment Manager - View Cart</h1>';
--------------------------------------------------------------------------------
