TPac; credit card assumes all xacts if none selected
authorBill Erickson <berick@esilibrary.com>
Fri, 3 Feb 2012 21:32:03 +0000 (16:32 -0500)
committerMike Rylander <mrylander@gmail.com>
Wed, 21 Mar 2012 13:57:01 +0000 (09:57 -0400)
For consistency with the initial payment form and to preserve backwards
compatibility, if no transactions are selected, assume the user wants to
pay for all transactions.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm

index da6f3b4..378bfd5 100644 (file)
@@ -1177,6 +1177,19 @@ sub load_myopac_pay_init {
 
     my @payment_xacts = ($self->cgi->param('xact'), $self->cgi->param('xact_misc'));
 
+    if (!@payment_xacts) {
+        # for consistency with load_myopac_payment_form() and
+        # to preserve backwards compatibility, if no xacts are
+        # selected, assume all (applicable) transactions are wanted.
+        my $stat = $self->prepare_fines(undef, undef, [$self->cgi->param('xact'), $self->cgi->param('xact_misc')]);
+        return $stat if $stat;
+        @payment_xacts =
+            map { $_->{xact}->id } (
+                @{$self->ctx->{fines}->{circulation}}, 
+                @{$self->ctx->{fines}->{grocery}}
+        );
+    }
+
     return $self->generic_redirect unless @payment_xacts;
 
     my $cc_args = {"where_process" => 1};