From 295f64b981fc93bb66ca4360bbdcc9ff32283eae Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 5 Apr 2012 12:35:39 -0400 Subject: [PATCH] kpac : initial login + place hold combined action Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- .../perlmods/lib/OpenILS/WWW/EGKPacLoader.pm | 30 +++++++ Open-ILS/src/templates/kpac/getit.tt2 | 86 ++++++++++--------- 2 files changed, 77 insertions(+), 39 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm index c0b1f5ea30..01e2b359c9 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm @@ -62,6 +62,7 @@ sub load_getit { $self->ctx->{page} = 'getit'; # repair the page return $self->save_item_to_bookbag($rec_id, $bbag_id) if $action eq 'save'; + return $self->login_and_place_hold($rec_id) if $action eq 'hold'; # if the user is logged in, fetch his bookbags if ($ctx->{user}) { @@ -78,6 +79,35 @@ sub load_getit { $self->ctx->{page} = 'getit'; # repair the page return Apache2::Const::OK; } + +sub login_and_place_hold { + my $self = shift; + my $bre_id = shift; + my $ctx = $self->ctx; + my $username = $self->cgi->param('username'); + my $password = $self->cgi->param('password'); + my $pickup_lib = $self->cgi->param('pickup_lib'); + + if (!$ctx->{user}) { + # First, log the user in and return to + # TODO: let user know username/password is required.. + return Apache2::Const::OK unless $username and $password; + my $new_uri = $self->apache->unparsed_uri; + my $sep = ($new_uri =~ /\?/) ? '&' : '?'; + $new_uri .= "${sep}pickup_lib=$pickup_lib&action=hold"; + $self->cgi->param('redirect_to', $new_uri); + return $self->load_login; + } + + # TODO: place hold + + my $hold_id = ''; +# (my $new_uri = $self->apache->unparsed_uri) =~ s/getit/getit_results/g; +# $new_uri .= ($new_uri =~ /\?/) ? "&hold=$hold_id" : "?hold=$hold_id"; +# return $self->generic_redirect($new_uri); + + return Apache2::Const::OK; +} sub save_item_to_bookbag { my $self = shift; diff --git a/Open-ILS/src/templates/kpac/getit.tt2 b/Open-ILS/src/templates/kpac/getit.tt2 index 1b0dbf69be..ebdbbfe6dc 100644 --- a/Open-ILS/src/templates/kpac/getit.tt2 +++ b/Open-ILS/src/templates/kpac/getit.tt2 @@ -26,52 +26,60 @@

get it!

-

[% |l %]If you would like to request this item, please enter the following information and click
Submit below:[% END %]

+

[% |l %]If you would like to request this item, please enter the + following information and click
Submit below:[% END %]

-
-
 
-
- [% IF !ctx.user %] - [% seed = l(' Enter Numbers... ') %] -

[% l('Library Card Number without spaces:') %]

-
- -
- pin number help -
 
-
 
+
+ +
+
 
+
+ + [% IF !ctx.user %] + [% seed = l(' Enter Numbers... ') %] +

[% l('Library Card Number without spaces:') %]

+
+ +
+ pin number help -

[% l('Password') %]

-
- +
 
+
 
- [% l('password help') %] +

[% l('Password') %]

+
+ +
-
 
-
 
- [% END %] + [% l('password help') %] -

[% l('Choose a Pickup Library:') %]

-
- [% def_lib = ctx.default_pickup_lib || ctx.physical_loc; - PROCESS "opac/parts/org_selector.tt2"; - PROCESS build_org_selector name='pickup_lib' - value=def_lib id='pickup_lib' can_have_vols_only=1 %] +
 
+
 
+ [% END %] + +

[% l('Choose a Pickup Library:') %]

+
+ [% def_lib = ctx.default_pickup_lib || ctx.physical_loc; + PROCESS "opac/parts/org_selector.tt2"; + PROCESS build_org_selector name='pickup_lib' + value=def_lib id='pickup_lib' can_have_vols_only=1 %] +
-
-
- submit -
+
+ + +
+
@@ -83,7 +91,7 @@
- [% IF ctx.user AND ctx.bookbags.size > 0 %] + [% IF ctx.user AND ctx.bookbags AND ctx.bookbags.size > 0 %]
 
-- 2.43.2