changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[ljcom] r7557: LJSUP-4585

Committer: gproschaev
LJSUP-4585


U   branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Sized.pm
U   branches/shop/cgi-bin/paylib.pl
U   branches/shop/htdocs/admin/accounts/enternew.bml
U   branches/shop/htdocs/manage/account/index.bml
U   branches/shop/htdocs/manage/account/modify.bml
U   branches/shop/htdocs/pay/modify.bml
U   branches/shop/htdocs/shop/view.bml
Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Sized.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Sized.pm	2009-08-10 03:26:17 UTC (rev 7556)
+++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Addon/Sized.pm	2009-08-10 07:22:06 UTC (rev 7557)
@@ -17,11 +17,13 @@
 
 # given a cart can we add a given item?
 sub can_apply_sized_bonus {
-    my ($u, $cartobj, $item, $size, $qty, $opts) = @_;
+    my ($self, $u, $cartobj, $opts) = @_;
     $u = LJ::want_user($u);
 
     my $userid = $u->{userid};
 
+    my ($item, $size, $qty) = ($self->{item}, $self->{subitem}, $self->{qty});
+
     # easy/obvious checks
     return undef unless $userid && LJ::Pay::Payment::PayItem::Addon::item_is_bonus($item, 'sized');
 
@@ -213,7 +215,7 @@
     my $self = shift;
     my $cartobj = shift;
 
-    return can_apply_sized_bonus($self->{'rcptid'}, $cartobj, $self->{'item'});
+    return $self->can_apply_sized_bonus($self->{'rcptid'}, $cartobj);
 }
 
 sub get_item_base_price {
@@ -237,7 +239,7 @@
     my $rcptuser = LJ::load_userid($self->{'rcptid'});
     return 0 unless $rcptuser;
 
-    unless (can_apply_sized_bonus($rcptuser, $cartobj, $self->{'item'}, $self->{'subitem'}, $self->{'qty'})) {
+    unless ($self->can_apply_sized_bonus($rcptuser, $cartobj)) {
         $errs_ref->[0] = BML::ml('.error.cantbuyitem', {'item' => "<b>$dispname</b>"});
         return 0;
     }

Modified: branches/shop/cgi-bin/paylib.pl
===================================================================
--- branches/shop/cgi-bin/paylib.pl	2009-08-10 03:26:17 UTC (rev 7556)
+++ branches/shop/cgi-bin/paylib.pl	2009-08-10 07:22:06 UTC (rev 7557)
@@ -75,7 +75,6 @@
 sub get_account_exp    { return LJ::Pay::Payment::PayItem::PaidAccount::get_account_exp(@_); }
 sub remove_paid_time   { return LJ::Pay::Payment::PayItem::PaidAccount::remove_paid_time(@_); }
 sub clothing_availability { return LJ::Pay::Payment::PayItem::Clothes::clothing_availability(@_); }
-sub can_apply_sized_bonus { return LJ::Pay::Payment::PayItem::Addon::Sized::can_apply_sized_bonus(@_); }
 sub get_bonus_dim      { return LJ::Pay::Payment::PayItem::Addon::Sized::get_bonus_dim(@_); }
 sub apply_bonus_item   { return LJ::Pay::Payment::PayItem::Addon::apply_bonus_item(@_); }
 sub expire_bonus       { return LJ::Pay::Payment::PayItem::Addon::expire_bonus(@_); }

Modified: branches/shop/htdocs/admin/accounts/enternew.bml
===================================================================
--- branches/shop/htdocs/admin/accounts/enternew.bml	2009-08-10 03:26:17 UTC (rev 7556)
+++ branches/shop/htdocs/admin/accounts/enternew.bml	2009-08-10 07:22:06 UTC (rev 7557)
@@ -132,9 +132,9 @@
             return LJ::bad_input("Must specify a size (in megabytes) for disk quota.")
                 unless $POST{'diskquota_size'};
 
+            my $item = LJ::Pay::Payment::PayItem->new_memonly(item => 'diskquota', subitem => $POST{'diskquota_size'}, qty => $POST{'diskquota_mo'});
             return LJ::bad_input("Cannot apply disk quota to account.")
-                unless LJ::Pay::can_apply_sized_bonus($rcptuserid, undef, 'diskquota', 
-                                                      $POST{'diskquota_size'}, $POST{'diskquota_mo'});
+                unless $item->can_apply_sized_bonus($rcptuserid, undef);
 
             $payit{'qty'} = $POST{'diskquota_mo'};
             my ($prev_exp, $prev_size) = LJ::Pay::get_bonus_dim($rcptuserid, 'diskquota');

Modified: branches/shop/htdocs/manage/account/index.bml
===================================================================
--- branches/shop/htdocs/manage/account/index.bml	2009-08-10 03:26:17 UTC (rev 7556)
+++ branches/shop/htdocs/manage/account/index.bml	2009-08-10 07:22:06 UTC (rev 7557)
@@ -193,7 +193,7 @@
                 next if $_->get_name() eq 'paidacct';
                 next unless $_->get_recflag eq 'on';
                 $body .= "<tr><td> - ";
-                my $item = LJ::Pay::Payment::PayItem->new_memonly(item => $_->get_name(), amt => $_->get_size());
+                my $item = LJ::Pay::Payment::PayItem->new_memonly(item => $_->get_name(), subitem => $_->get_size());
                 $body .= $item->product_name( 1 );
                 $body .= "</td><td class='price'>\$";
                 $item_price =
@@ -310,7 +310,7 @@
                 }
 
                 if ($exp) {
-                    my $item_obj = LJ::Pay::Payment::PayItem->new_memonly(item => $item, amt => $size);
+                    my $item_obj = LJ::Pay::Payment::PayItem->new_memonly(item => $item, subitem => $size);
                     $manual{$item} = {
                         'name' => $item_obj->product_name('short'),
                         'exp'  => $exp,

Modified: branches/shop/htdocs/manage/account/modify.bml
===================================================================
--- branches/shop/htdocs/manage/account/modify.bml	2009-08-10 03:26:17 UTC (rev 7556)
+++ branches/shop/htdocs/manage/account/modify.bml	2009-08-10 07:22:06 UTC (rev 7557)
@@ -365,8 +365,8 @@
             if ($disksize < $newsize) {
 
                 my $gb = $good_bonus->('diskquota', $newsize, $curr_bill_interval);
-                my $ca = LJ::Pay::can_apply_sized_bonus($u, $pmt, 'diskquota', $newsize, $curr_bill_interval,
-                                                        {'recurring' => 1});
+                my $item = LJ::Pay::Payment::PayItem->new_memonly(item => 'diskquota', subitem => $newsize, qty => $curr_bill_interval);
+                my $ca = $item->can_apply_sized_bonus($u, $pmt, {'recurring' => 1});
 
                 if ($gb && $ca) {
                     my $amt = $rec->calc_item_activation_price('diskquota', $newsize, $bill_interval)
@@ -746,7 +746,7 @@
 
         foreach (sort { $b <=> $a } keys %{ $prices{$bill_interval} }) {
             next unless /^disk_(\d+)/;
-            my $item = LJ::Pay::Payment::PayItem->new_memonly(item => 'diskquota', amt => $1);
+            my $item = LJ::Pay::Payment::PayItem->new_memonly(item => 'diskquota', subitem => $1);
             my $txt = $item->product_name();
             $POST{"disk_amount"} ||= "disk_$disksize";
             $body .= LJ::html_check(
@@ -892,8 +892,7 @@
                     $body .= "<tr><td colspan='2'><strong>$ML{'.todayspay.payment'}</strong></td></tr>";
                     my $sub_total = 0;
                     foreach (@cart) {
-                        my $item = LJ::Pay::Payment::PayItem->new_memonly(item => $_->get_item());
-                        my $it_name = $item->product_name('short');
+                        my $it_name = $_->product_name('short');
                         next if $it_name =~ /^coupon/i;
 
                         my $it_amt = $_->get_amt;

Modified: branches/shop/htdocs/pay/modify.bml
===================================================================
--- branches/shop/htdocs/pay/modify.bml	2009-08-10 03:26:17 UTC (rev 7556)
+++ branches/shop/htdocs/pay/modify.bml	2009-08-10 07:22:06 UTC (rev 7557)
@@ -174,8 +174,7 @@
                     next unless $extra_remove{$it->{'piid'}} && LJ::Pay::is_bonus($it);
 
                     $body .= "<li>" . LJ::ljuser($users{$it->{'rcptid'}}) . " - ";
-                    my $itemobj = LJ::Pay::Payment::PayItem->new_memonly(item => $it->{'item'});
-                    $body .= $itemobj->product_name("short") . "</li>";
+                    $body .= $it->product_name("short") . "</li>";
                 }
                 $body .= "</ul>";
 

Modified: branches/shop/htdocs/shop/view.bml
===================================================================
--- branches/shop/htdocs/shop/view.bml	2009-08-10 03:26:17 UTC (rev 7556)
+++ branches/shop/htdocs/shop/view.bml	2009-08-10 07:22:06 UTC (rev 7557)
@@ -315,7 +315,7 @@
                 next unless $mo && $LJ::Pay::account{$mo};
                 next unless $mo && $LJ::Pay::account{$mo}->{'amount'};
                 my $checked = $mo eq $selected ? "checked='checked'" : "";
-                my $item = LJ::Pay::Payment::PayItem->new_memonly(item => "paidacct", amt => $mo);
+                my $item = LJ::Pay::Payment::PayItem->new_memonly(item => "paidacct", subitem => $mo);
                 my $name  = $item->product_name;
                 my $price = '($' . $LJ::Pay::account{$mo}->{'amount'} . ".00 USD)";
 
@@ -369,7 +369,8 @@
                     foreach my $qty (sort { $b <=> $a } keys %{$sizeit->{'qty'}}) {
 
                         # do a bunch of checks, $u probably is $remote since gifts aren't allowed
-                        next unless LJ::Pay::can_apply_sized_bonus($remote, $cartobj, "diskquota", $size, $qty);
+                        my $item = LJ::Pay::Payment::PayItem->new_memonly(item => 'diskquota', subitem => $size, qty => $qty);
+                        next unless $item->can_apply_sized_bonus($remote, $cartobj);
                         my $checked = 1 unless $highest_available;
                         $highest_available = 1 if $highest_available == 0;
                         # will be interpretted as item-subitem-qty

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