Default to active promo codes (not a list of all codes).
Patch by denise.
diffs (57 lines):
diff -r 6f5b183b5756 -r 28f93d764c8e cgi-bin/DW/InviteCodes.pm
--- a/cgi-bin/DW/InviteCodes.pm Tue Jun 15 16:35:02 2010 +0800
+++ b/cgi-bin/DW/InviteCodes.pm Tue Jun 15 16:56:26 2010 +0800
@@ -166,16 +166,19 @@ State can be:
* inactive ( inactive promo codes )
* unused ( unused promo codes )
* noneleft ( no uses left )
+ * all ( all promo codes )
=cut
sub get_promo_codes {
my ( $class, %opts ) = @_;
my $dbh = LJ::get_db_writer();
- my $state = $opts{state} || '';
+ my $state = $opts{state} || 'active';
my $sql = "SELECT * FROM acctcode_promo";
- if ( $state eq 'active' ) {
+ if ( $state eq 'all' ) {
+ # do nothing
+ } elsif ( $state eq 'active' ) {
$sql .= " WHERE active = '1' AND current_count < max_count";
} elsif ( $state eq 'inactive' ) {
$sql .= " WHERE active = '0' OR current_count >= max_count";
@@ -184,6 +187,7 @@ sub get_promo_codes {
} elsif ( $state eq 'noneleft' ) {
$sql .= " WHERE current_count >= max_count";
}
+
my $sth = $dbh->prepare( $sql ) or die $dbh->errstr;
$sth->execute() or die $dbh->errstr;
diff -r 6f5b183b5756 -r 28f93d764c8e htdocs/admin/invites/index.bml
--- a/htdocs/admin/invites/index.bml Tue Jun 15 16:35:02 2010 +0800
+++ b/htdocs/admin/invites/index.bml Tue Jun 15 16:56:26 2010 +0800
@@ -41,7 +41,7 @@ body<=
$ret .= "<div class='itemhead'><a href='review'><?_ml .review.head
_ml?></a></div><div class='itemdef'><?_ml .review.desc _ml?></div>"
if $haspayments;
- $ret .= "<div class='itemhead'><a href='promo'><?_ml .promo.head
_ml?></a></div><div class='itemdef'><?_ml .promo.desc _ml?></div>"
+ $ret .= "<div class='itemhead'><a href='promo?state=active'><?_ml
.promo.head _ml?></a></div><div class='itemdef'><?_ml .promo.desc _ml?></div>"
if $haspayments;
diff -r 6f5b183b5756 -r 28f93d764c8e htdocs/admin/invites/promo.bml
--- a/htdocs/admin/invites/promo.bml Tue Jun 15 16:35:02 2010 +0800
+++ b/htdocs/admin/invites/promo.bml Tue Jun 15 16:56:26 2010 +0800
@@ -175,7 +175,7 @@ body<=
my $codes = DW::InviteCodes->get_promo_codes( state => $state );
$ret .= '<a href="/admin/invites/promo?state=create">' .
$ML{'.state.new'} . '</a> | ';
- $ret .= '<a href="/admin/invites/promo">' . $ML{'.state.unfiltered'} .
'</a> | ';
+ $ret .= '<a href="/admin/invites/promo?state=all">' .
$ML{'.state.unfiltered'} . '</a> | ';
$ret .= '<a href="/admin/invites/promo?state=active">' .
$ML{'.state.active'} . '</a> | ';
$ret .= '<a href="/admin/invites/promo?state=inactive">' .
$ML{'.state.inactive'} . '</a> | ';
$ret .= '<a href="/admin/invites/promo?state=unused">' .
$ML{'.state.unused'} . '</a> | ';
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog