LP#1282783: Use patron hold notification defaults for KPAC
authorTerran McCanna <tmccanna@georgialibraries.org>
Tue, 26 Aug 2014 21:58:52 +0000 (17:58 -0400)
committerBen Shum <bshum@biblio.org>
Thu, 28 Aug 2014 01:58:01 +0000 (21:58 -0400)
Since the KPAC interface doesn't display a patron's email/phone notification
preferences, we had initially assumed it was pulling in the patron's default
notification info, but we've found that it does not.

Emails are not sent to patrons who have their notification preferences set to
email, and hold slips print out without phone numbers or email addresses. This
causes extra work for Circ staff in processing incoming holds as they need to
look up each account number to get the patron's contact information.

This patch pulls in the patron's email & phone notification preferences and
related values in hidden fields and allows the patron to choose their pickup
library at time of hold placement (defaults to their preferred pickup location).

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Ben Shum <bshum@biblio.org>

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGKPacLoader.pm
Open-ILS/src/templates/kpac/getit.tt2

index 30fbca2..0598947 100644 (file)
@@ -92,6 +92,20 @@ sub load_getit {
         ]);
     }
 
+    # If user is logged in, get default hold pickup and notification info 
+    if ($ctx->{user}) {
+        my $set_map = $self->ctx->{user_setting_map};
+        if ($$set_map{'opac.default_pickup_location'}) {
+            $ctx->{default_pickup_lib} = $$set_map{'opac.default_pickup_location'};
+        }
+        if ($$set_map{'opac.default_phone'}) {
+            $ctx->{default_phone} = $$set_map{'opac.default_phone'};
+        }
+        if ($$set_map{'opac.hold_notify'}) {
+            $ctx->{notify_method} = $$set_map{'opac.hold_notify'};
+        }
+    }
+
     $self->ctx->{page} = 'getit'; # repair the page
     return Apache2::Const::OK;
 }
@@ -107,6 +121,11 @@ sub login_and_place_hold {
     return Apache2::Const::HTTP_BAD_REQUEST 
         unless $pickup_lib =~ /^\d+$/;
 
+    #If a pickup library hasn't been selected, reload page
+    if ($pickup_lib == '0') {
+        return $self->load_login;
+    }
+
     my $new_uri = $self->apache->unparsed_uri;
     my $sep = ($new_uri =~ /\?/) ? '&' : '?';
 
index a807b0d..95d2931 100644 (file)
                                         onclick="helpPopup('password_help', this, event);"><img 
                                         src="[% ctx.media_prefix %]/images/kpac/question_mark.png" alt="[% l('password help') %]" /></a>
 
+                                    <input type="hidden" name='pickup_lib' value='0' id='pickup_lib'>
+                                    
                                     <div class="clear">&nbsp;</div>
                                     <div class="hr">&nbsp;</div>
-                                [% END %]
+
+                                [% ELSE %]
 
                                 <p>[% l('Choose a Pickup Library:') %]</p>
                                 <div class="pickup_lib">
                                     [%  def_lib = ctx.default_pickup_lib || ctx.physical_loc;
                                         PROCESS "opac/parts/org_selector.tt2";
                                         INCLUDE build_org_selector name='pickup_lib' 
-                                        value=def_lib id='pickup_lib' can_have_vols_only=1 %]
+                                        value=def_lib id='pickup_lib' can_have_vols_only=1 hold_pickup_lib=0 %]
+
+                                 <!-- HIDDEN FIELDS FOR DEFAULT NOTIFICATION PREFERENCES -->
+                                 [%- IF ctx.notify_method -%]
+                                     [%- IF ctx.notify_method == '' OR ctx.notify_method == 'phone:email' -%]
+                                         [%- SET ctx.notify_method = 'email|phone' -%]
+                                     [%- END -%]
+                                 [%- ELSE -%]
+                                     [%- SET ctx.notify_method = 'email|phone' -%]
+                                 [%- END -%]
+                                 
+                                 [%- IF ctx.user.email -%]
+                                      [%- IF ctx.notify_method == 'email' OR ctx.notify_method == 'email|phone' -%]
+                                           <input type="hidden" id="email_notify" name="email_notify" value="t"/>
+                                      [%- END -%]
+                                   [%- END -%]
+
+                                   [%- IF allow_phone_notifications == 'true' -%]
+                                      [%- IF ctx.notify_method == 'phone' OR ctx.notify_method == 'email|phone' -%]
+                                             <input type="hidden" id="phone_notify_checkbox" name="phone_notify_checkbox" value="t"/>
+                                             <input type="hidden" name="phone_notify" 
+                                                value='[% IF ctx.default_phone %][%- ctx.default_phone -%][% ELSE %][%- ctx.user.day_phone -%][% END %]'/>
+                                      [%- END -%]
+                                   [%- END -%]
+
                                 </div>
+                                [% END %]
                             </div>
                         </div>
                         <div class="submit_btn">