wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[ljcom] r8425: LJSUP-5755

Committer: gprochaev
LJSUP-5755

At enternew.bml admins are able to send 1 month of large userpics to users.

U   trunk/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Packed.pm
U   trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm
U   trunk/htdocs/admin/accounts/enternew.bml
Modified: trunk/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Packed.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Packed.pm	2010-04-02 08:01:46 UTC (rev 8424)
+++ trunk/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Packed.pm	2010-04-02 08:34:18 UTC (rev 8425)
@@ -150,12 +150,19 @@
     my $self = shift;
     my ($item, $qty) = ($self->{item}, $self->{qty});
     my $is_rec = shift;
+    my $not_check_amount = shift || 0;
 
     my $itrec = $self->get_item_data;
     return 0 unless ref $itrec;
     return 0 unless $itrec->{type} eq 'bool';
     return 0 unless ref $itrec->{items}->{$qty};
-    return 0 unless defined $itrec->{items}->{$qty}->{$is_rec ? 'amount_rec' : 'amount'};
+    if ($not_check_amount) {
+        return 1;
+    } elsif (defined $itrec->{items}->{$qty}->{$is_rec ? 'amount_rec' : 'amount'}) {
+        return 1;
+    } else {
+        return 0;
+    }
     return 1;
 }
 
@@ -177,10 +184,10 @@
 }
 
 sub validate_user_input {
-    my ($self, $cartobj, $errs_ref, $warn_ref) = @_;
+    my ($self, $cartobj, $errs_ref, $warn_ref, $not_check_amount) = @_;
 
     my $is_rec = $cartobj && $cartobj->{forwhat} eq 'recbill' ? 1 : 0;
-    return $self->is_valid_bool_bonus($is_rec);
+    return $self->is_valid_bool_bonus($is_rec, $not_check_amount);
 }
 
 # fill 'amt', and, may be, 'qty' field

Modified: trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm
===================================================================
--- trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm	2010-04-02 08:01:46 UTC (rev 8424)
+++ trunk/cgi-bin/LJ/Pay/Payment/PayItem.pm	2010-04-02 08:34:18 UTC (rev 8425)
@@ -771,11 +771,11 @@
 # Errors, caused by user alteration of form data, are not guaranteed to be in $errs_ref.
 # Parameter 'action' is not used so far.
 sub can_belong_to {
-    my ($self, $cartobj, $errs_ref, $warns_ref, $action) = @_;
+    my ($self, $cartobj, $errs_ref, $warns_ref, $action, $not_check_amount) = @_;
 
     die "$errs_ref must be arrayref in call to can_belong_to()" unless ref($errs_ref) eq 'ARRAY';
 
-    unless ($self->validate_user_input($cartobj, $errs_ref, $warns_ref, $action)) {
+    unless ($self->validate_user_input($cartobj, $errs_ref, $warns_ref, $action, $not_check_amount)) {
         push @$errs_ref, BML::ml('/pay/modify.bml.interror.user.input.not.valid');
         return 0;
     }

Modified: trunk/htdocs/admin/accounts/enternew.bml
===================================================================
--- trunk/htdocs/admin/accounts/enternew.bml	2010-04-02 08:01:46 UTC (rev 8424)
+++ trunk/htdocs/admin/accounts/enternew.bml	2010-04-02 08:34:18 UTC (rev 8425)
@@ -124,7 +124,7 @@
 
             my @errs;
             return LJ::bad_input("Cannot apply large userpic to account. Reason: " . join(', ', @errs))
-                unless $item->can_belong_to(undef, \@errs, undef, 'additem');
+                unless $item->can_belong_to(undef, \@errs, undef, 'additem', 1);
 
         # small userpics
         } elsif ($POST{'item'} eq 'userpic_small') {

Tags: bml, ljcom, pm, wisest-owl
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments