From fb2a495c47c1ae3bebce846488d9c43ae16bd4be Mon Sep 17 00:00:00 2001 From: Lebbeous Fogle-Weekley Date: Mon, 25 Jul 2011 17:55:58 -0400 Subject: [PATCH] Select-all checkboxes for fine payment In the process, had to change the checkbox/cgi param name of the misc fees to xact_misc and tell the middle layer to lump xact together with xact_misc. Should test carefully. Signed-off-by: Lebbeous Fogle-Weekley --- .../perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 6 +++--- Open-ILS/web/js/ui/default/opac/simple.js | 8 ++++++++ Open-ILS/web/templates/default/opac/myopac/main.tt2 | 13 ++++++++----- .../default/opac/myopac/main_payment_form.tt2 | 7 +++++-- 4 files changed, 24 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 213965d7f6..d1c16589b7 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -777,7 +777,7 @@ sub load_myopac_payment_form { my $self = shift; my $r; - $r = $self->prepare_fines(undef, undef, [$self->cgi->param('xact')]) and return $r; + $r = $self->prepare_fines(undef, undef, [$self->cgi->param('xact'), $self->cgi->param('xact_misc')]) and return $r; $r = $self->prepare_extended_user_info and return $r; return Apache2::Const::OK; @@ -820,7 +820,7 @@ sub load_myopac_pay { my $self = shift; my $r; - $r = $self->prepare_fines(undef, undef, [$self->cgi->param('xact')]) and + $r = $self->prepare_fines(undef, undef, [$self->cgi->param('xact'), $self->cgi->param('xact_misc')]) and return $r; # balance_owed is computed specifically from the fines we're trying @@ -828,7 +828,7 @@ sub load_myopac_pay { if ($self->ctx->{fines}->{balance_owed} <= 0) { $self->apache->log->info( sprintf("Can't pay non-positive balance. xacts selected: (%s)", - join(", ", map(int, $self->cgi->param("xact")))) + join(", ", map(int, $self->cgi->param("xact"), $self->cgi->param('xact_misc')))) ); return Apache2::Const::HTTP_INTERNAL_SERVER_ERROR; } diff --git a/Open-ILS/web/js/ui/default/opac/simple.js b/Open-ILS/web/js/ui/default/opac/simple.js index d71c98a68d..d80b108572 100644 --- a/Open-ILS/web/js/ui/default/opac/simple.js +++ b/Open-ILS/web/js/ui/default/opac/simple.js @@ -48,3 +48,11 @@ function print_node(node_id) { try { iframe.print(); } catch (e) { iwin.print(); } setTimeout(function() { iframe.style.display = "none"; }, 3500); } +function select_all_checkboxes(name, checked) { + var all = document.getElementsByTagName("input"); + for (var i = 0; i < all.length; i++) { + if (all[i].type == "checkbox" && all[i].name == name) { + all[i].checked = checked; + } + } +} diff --git a/Open-ILS/web/templates/default/opac/myopac/main.tt2 b/Open-ILS/web/templates/default/opac/myopac/main.tt2 index 674e097eb8..354b5b07db 100644 --- a/Open-ILS/web/templates/default/opac/myopac/main.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/main.tt2 @@ -22,8 +22,9 @@ [% l("Date Returned") %] [% l("Balance Owed") %] - + @@ -78,7 +79,8 @@ + title="[% l('Pay this fine') %]" name="xact" + value="[% f.xact.id %]" /> [% END %] @@ -111,7 +113,7 @@ @@ -143,7 +145,8 @@ [% f.xact.last_billing_type %] + name="xact_misc" value="[% f.xact.id %]" + checked="checked" /> [% END %] diff --git a/Open-ILS/web/templates/default/opac/myopac/main_payment_form.tt2 b/Open-ILS/web/templates/default/opac/myopac/main_payment_form.tt2 index c10d5a200f..f5345d57f2 100644 --- a/Open-ILS/web/templates/default/opac/myopac/main_payment_form.tt2 +++ b/Open-ILS/web/templates/default/opac/myopac/main_payment_form.tt2 @@ -16,6 +16,9 @@ [% FOR xact IN CGI.param('xact') %] [% END %] + [% FOR xact IN CGI.param('xact_misc') %] + + [% END %] @@ -47,8 +50,8 @@ [% END; FOR f IN ctx.fines.grocery; - NEXT IF CGI.param('xact').size && - !CGI.param('xact').grep(f.xact.id).size %] + NEXT IF CGI.param('xact_misc').size && + !CGI.param('xact_misc').grep(f.xact.id).size %] -- 2.43.2
[% f.xact.last_billing_type %] [% money(f.xact.balance_owed) %]