ssafronova (ssafronova) wrote in changelog,
ssafronova
ssafronova
changelog

[ljcom] r7756: LJSUP-4203: Userpic Add-on - LJSUP-4457:...

Committer: ssafronova
LJSUP-4203: Userpic Add-on - LJSUP-4457: move bulk code to class structure - bugfix

U   branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Coupon.pm
U   branches/shop/cgi-bin/LJ/Pay/Payment/PayItem.pm
U   branches/shop/cgi-bin/LJ/Pay/Payment.pm
U   branches/shop/htdocs/pay/modify.bml
Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Coupon.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Coupon.pm	2009-10-07 07:54:39 UTC (rev 7755)
+++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem/Coupon.pm	2009-10-07 08:34:50 UTC (rev 7756)
@@ -12,7 +12,7 @@
 sub remove_from_cart {
     my $self = shift;
 
-    my $dbh = $self->get_dbh
+    my $dbh = $self->_get_dbh
         or return _err("unable to connect to global db master");
 
     # when removing coupons, set their payid back to 0

Modified: branches/shop/cgi-bin/LJ/Pay/Payment/PayItem.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment/PayItem.pm	2009-10-07 07:54:39 UTC (rev 7755)
+++ branches/shop/cgi-bin/LJ/Pay/Payment/PayItem.pm	2009-10-07 08:34:50 UTC (rev 7756)
@@ -96,11 +96,6 @@
                 anon giveafter token tokenid qty_res)) {
         $self->{$_} = $args{$_};
     }
-    my @where;
-    for (my $i = 0; $i < 6; $i++) {
-        my ($package, $filename, $line) = caller($i);
-        push @where, "$filename:$line";
-    }
 
     $self->{item} = $self->item unless defined $self->{item};
 
@@ -181,7 +176,13 @@
 
 # set $@ on error
 sub _err {
-    $@ = join(": ", grep { $_  } @_, $@);
+    my @where;
+    for (my $i = 0; $i < 6; $i++) {
+        my ($package, $filename, $line) = caller($i);
+        push @where, "$filename:$line";
+    }
+
+    $@ = join(": ", grep { $_  } @_, $@) . ' Called from: ' . join(' from ', @where);
     return undef;
 }
 

Modified: branches/shop/cgi-bin/LJ/Pay/Payment.pm
===================================================================
--- branches/shop/cgi-bin/LJ/Pay/Payment.pm	2009-10-07 07:54:39 UTC (rev 7755)
+++ branches/shop/cgi-bin/LJ/Pay/Payment.pm	2009-10-07 08:34:50 UTC (rev 7756)
@@ -278,7 +278,13 @@
 
 # set $@ on error
 sub _err {
-    die join(": ", grep { $_  } @_, $@);
+    my @where;
+    for (my $i = 0; $i < 6; $i++) {
+        my ($package, $filename, $line) = caller($i);
+        push @where, "$filename:$line";
+    }
+
+    die join(": ", grep { $_  } @_, $@) . ' Called from: ' . join(' from ', @where);
 }
 
 sub _min {

Modified: branches/shop/htdocs/pay/modify.bml
===================================================================
--- branches/shop/htdocs/pay/modify.bml	2009-10-07 07:54:39 UTC (rev 7755)
+++ branches/shop/htdocs/pay/modify.bml	2009-10-07 08:34:50 UTC (rev 7756)
@@ -96,42 +96,54 @@
             push @remove, $it if $POST{"del_$it->{'piid'}"};
         }
 
-        $cartobj->remove_items(@remove);
+        $cartobj->remove_items(@remove) if @remove;
         @remove = (); # already remove - clean list
 
         my @errs = ();
         my @warns = ();
+
         # make new list to remove - payitems, which depends on removed
         $cartobj->short_recheck_cart(\@errs, \@warns, \@remove);
+        #push @errs, '{{error}}';
+        #push @remove, LJ::Pay::Payment::PayItem::Coupon->new_memonly(rcptid => 2, subitem => 'dollaroff');
+        #push @warns, '{{warning}}';
 
-            if (@remove) {
-                $body .= "<?h1 $ML{'.extrasremoved.header'} h1?>";
-                $body .= "<?p $ML{'.extrasremoved.text'} p?>";
+        if (@errs) {
+            $body .= "<?h2 $ML{'.errors'} h2?>";
+            $body .= join('<br>', @errs);
+        }
 
-                $body .= "<ul>";
+        if (@remove) {
 
-                # load usernames so we can report them below
-                my $users = LJ::load_userids(map { $_->{'rcptid'} } @remove);
-                foreach my $it (@remove) {
-                    $body .= "<li>" . LJ::ljuser($users->{$it->{'rcptid'}}) . " - ";
-                    $body .= $it->product_name("short") . "</li>";
-                }
-                $body .= "</ul>";
+            $body .= "<?h2 $ML{'.extrasremoved.header'} h2?>";
+            $body .= "<ul>";
 
-                $body .= "<form method='get' action='/pay/'>";
-                $body .= LJ::html_hidden('c', $cart);
-                $body .= "<p align='center'>" . LJ::html_submit($ML{'.btn.acknowledged'}) . "</p>";
-                $body .= "</form>";
+            # load usernames so we can report them below
+            my $users = LJ::load_userids(map { $_->{'rcptid'} } @remove);
+            foreach my $it (@remove) {
+                $body .= "<li>" . LJ::ljuser($users->{$it->{'rcptid'}}) . " - ";
+                $body .= $it->product_name("short") . "</li>";
+            }
+            $body .= "</ul>";
 
-                $body .= LJ::bad_input(@errs);
-                $body .= join('<br>', @warns);
+            $cartobj->remove_items(@remove);
+        }
 
-                $cartobj->remove_items(@remove);
-                return;
-            }
+        if (@warns) {
+            $body .= "<?h2 $ML{'.warns'} h2?>";
+            $body .= join('<br>', @warns);
+        }
 
-            return BML::redirect("/pay/?c=$cart");
-    }
+        if (@errs or @remove or @warns) {
+            $body .= "<form method='get' action='/pay/'>";
+            $body .= LJ::html_hidden('c', $cart);
+            $body .= "<p align='center'>" . LJ::html_submit($ML{'.btn.acknowledged'}) . "</p>";
+            $body .= "</form>";
+            return;
+        }
+
+        return BML::redirect("/pay/?c=$cart");
+        }
     # end removesel block
 
     # checkout
@@ -343,11 +355,18 @@
             my @remove;
 
             $cartobj->short_recheck_cart(\@errs, \@warns, \@remove);
+            #push @errs, '{{error}}';
+            #push @remove, LJ::Pay::Payment::PayItem::Coupon->new_memonly(rcptid => 2, subitem => 'dollaroff');
+            #push @warns, '{{warning}}';
 
+            if (@errs) {
+                $body .= "<?h2 $ML{'.errors'} h2?>";
+                $body .= join('<br>', @errs);
+            }
+
             if (@remove) {
-                $body .= "<?h1 $ML{'.extrasremoved.header'} h1?>";
-                $body .= "<?p $ML{'.extrasremoved.text'} p?>";
 
+                $body .= "<?h2 $ML{'.extrasremoved.header'} h2?>";
                 $body .= "<ul>";
 
                 # load usernames so we can report them below
@@ -358,15 +377,19 @@
                 }
                 $body .= "</ul>";
 
+                $cartobj->remove_items(@remove);
+            }
+
+            if (@warns) {
+                $body .= "<?h2 $ML{'.warns'} h2?>";
+                $body .= join('<br>', @warns);
+            }
+
+            if (@errs or @remove or @warns) {
                 $body .= "<form method='get' action='/pay/'>";
                 $body .= LJ::html_hidden('c', $cart);
                 $body .= "<p align='center'>" . LJ::html_submit($ML{'.btn.acknowledged'}) . "</p>";
                 $body .= "</form>";
-
-                $body .= LJ::bad_input(@errs);
-                $body .= join('<br>', @warns);
-
-                $cartobj->remove_items(@remove);
                 return;
             }
         }

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