Add support for protocol extension 'Patron Internet Profile' with
authordjfiander <djfiander>
Fri, 28 Jul 2006 23:50:30 +0000 (23:50 +0000)
committerdjfiander <djfiander>
Fri, 28 Jul 2006 23:50:30 +0000 (23:50 +0000)
protocol field code 'PI'

ILS/Patron.pm
Sip/Constants.pm
Sip/MsgType.pm
t/02patron_info.t
t/SIPtest.pm

index 0b53f08..ce79210 100644 (file)
@@ -48,6 +48,7 @@ our %patron_db = (
                      fine_items => ['Computer Time'],
                      recall_items => [],
                      unavail_holds => [],
+                     inet => 1,
                  },
                  miker => {
                      name => "Mike Rylander",
@@ -76,6 +77,7 @@ our %patron_db = (
                      fine_items => [],
                      recall_items => [],
                      unavail_holds => [],
+                     inet => 0,
                  },
                  );
 
@@ -369,6 +371,13 @@ sub enable {
     return $self;
 }
 
+
+sub inet_privileges {
+    my $self = shift;
+
+    return $self->{inet} ? 'Y' : 'N';
+}
+
 #
 # Messages
 #
index 6749e2b..f210046 100644 (file)
@@ -47,7 +47,10 @@ our (@ISA, @EXPORT_OK, %EXPORT_TAGS);
                FID_SECURITY_INHIBIT FID_RECALL_DATE
                FID_MEDIA_TYPE FID_SORT_BIN FID_HOLD_PICKUP_DATE
                FID_LOGIN_UID FID_LOGIN_PWD FID_LOCATION_CODE
-               FID_VALID_PATRON_PWD FID_PATRON_BIRTHDATE FID_PATRON_CLASS
+               FID_VALID_PATRON_PWD
+
+               FID_PATRON_BIRTHDATE FID_PATRON_CLASS FID_INET_PROFILE
+
                SC_STATUS_OK SC_STATUS_PAPER SC_STATUS_SHUTDOWN
                SIP_DATETIME);
 
@@ -123,8 +126,10 @@ our (@ISA, @EXPORT_OK, %EXPORT_TAGS);
                                  FID_LOGIN_UID FID_LOGIN_PWD
                                  FID_LOCATION_CODE
                                  FID_VALID_PATRON_PWD
+
                                  FID_PATRON_BIRTHDATE
-                                 FID_PATRON_CLASS)],
+                                 FID_PATRON_CLASS
+                                 FID_INET_PROFILE)],
 
                SC_status => [qw(SC_STATUS_OK SC_STATUS_PAPER
                                 SC_STATUS_SHUTDOWN)],
@@ -177,6 +182,7 @@ our (@ISA, @EXPORT_OK, %EXPORT_TAGS);
                           FID_LOGIN_UID FID_LOGIN_PWD
                           FID_LOCATION_CODE FID_VALID_PATRON_PWD
                           FID_PATRON_BIRTHDATE FID_PATRON_CLASS
+                          FID_INET_PROFILE
                           SC_STATUS_OK SC_STATUS_PAPER SC_STATUS_SHUTDOWN
                           SIP_DATETIME
                           )]);
@@ -311,6 +317,9 @@ use constant {
     # SIP Extensions used by Envisionware Terminals
     FID_PATRON_BIRTHDATE       => 'PB',
     FID_PATRON_CLASS           => 'PC',
+
+    # SIP Extension for reporting patron internet privileges
+    FID_INET_PROFILE           => 'PI',
 };
 
 #
index dba579f..4d203a5 100644 (file)
@@ -457,6 +457,7 @@ sub build_patron_status {
            $resp .= maybe_add(FID_CURRENCY, $patron->currency);
            $resp .= maybe_add(FID_FEE_AMT, $patron->fee_amount);
        }
+
        $resp .= maybe_add(FID_SCREEN_MSG, $patron->screen_msg);
        $resp .= maybe_add(FID_PRINT_LINE, $patron->print_line);
     } else {
@@ -939,6 +940,8 @@ sub handle_patron_info {
        $resp .= maybe_add(FID_PATRON_BIRTHDATE, $patron->sip_birthdate);
        $resp .= maybe_add(FID_PATRON_CLASS, $patron->ptype);
 
+       # Custom protocol extension to report patron internet privileges
+       $resp .= maybe_add(FID_INET_PROFILE, $patron->inet_privileges);
     } else {
        # Invalid patron ID
        # He has no privileges, no items associated with him,
index 69d9fba..292c279 100644 (file)
@@ -9,7 +9,7 @@ use Sip::Constants qw(:all);
 
 use SIPtest qw($datepat $textpat $instid $currency $user_barcode $user_pin
               $user_fullname $user_homeaddr $user_email $user_phone
-              $user_birthday $user_ptype);
+              $user_birthday $user_ptype $user_inet);
 
 # This is a template test case for the Patron Information
 # message handling.  Because of the large number of fields,
@@ -60,7 +60,10 @@ my $patron_info_test_template = {
               { field    => FID_PATRON_CLASS,
                 pat      => qr/^$user_ptype$/o,
                 required => 1, },
-              ], };
+              { field    => FID_INET_PROFILE,
+                pat      => qr/^$user_inet$/,
+                required => 1, },
+             ], };
 
 my @tests = (
             $SIPtest::login_test,
index 7f442a1..aa9b87b 100644 (file)
@@ -15,6 +15,7 @@ our @EXPORT_OK = qw(run_sip_tests no_tagged_fields
                    $instid $currency $server $username $password
                    $user_barcode $user_pin $user_fullname $user_homeaddr
                    $user_email $user_phone $user_birthday $user_ptype
+                   $user_inet
                    $item_barcode $item_title $item_owner
                    $item2_barcode $item2_title $item2_owner);
 #use Data::Dumper;
@@ -51,6 +52,7 @@ our $user_email   = 'djfiander\@hotmail\.com';
 our $user_phone   = '\(519\) 555 1234';
 our $user_birthday= '19640925';
 our $user_ptype   = 'A';
+our $user_inet    = 'Y';
 
 # Valid item barcode and corresponding title
 our $item_barcode = '1565921879';