From 8dbbd479f60d76ae29c0794dc4ecbbdb479f2d08 Mon Sep 17 00:00:00 2001
From: Thomas Berezansky <tsbere@mvlc.org>
Date: Thu, 31 Mar 2011 08:39:28 -0400
Subject: [PATCH] Patron Expiration in PA

Signed-off-by: Thomas Berezansky <tsbere@mvlc.org>
---
 ILS/Patron.pm    | 8 ++++++++
 ILS/Patron.pod   | 8 ++++++++
 Sip/Constants.pm | 1 +
 Sip/MsgType.pm   | 1 +
 4 files changed, 18 insertions(+)

diff --git a/ILS/Patron.pm b/ILS/Patron.pm
index b36c820..991b1b8 100644
--- a/ILS/Patron.pm
+++ b/ILS/Patron.pm
@@ -68,6 +68,7 @@ our %patron_db = (
 		      recall_items => [],
 		      unavail_holds => [],
 		      inet => 1,
+		      expire => '20501231',
 		  },
 		  miker => {
 		      name => "Mike Rylander",
@@ -97,6 +98,7 @@ our %patron_db = (
 		      recall_items => [],
 		      unavail_holds => [],
 		      inet => 0,
+		      expire => '20501120',
 		  },
 		  );
 
@@ -155,6 +157,12 @@ sub sip_birthdate {
     return $self->{birthdate};
 }
 
+sub sip_expire {
+    my $self = shift;
+
+    return $self->{expire};
+}
+
 sub ptype {
     my $self = shift;
 
diff --git a/ILS/Patron.pod b/ILS/Patron.pod
index 0b81866..82b9eaf 100644
--- a/ILS/Patron.pod
+++ b/ILS/Patron.pod
@@ -42,6 +42,7 @@ and to display information about the patron's borrowing activity.
 	$str = $patron->email_addr;
 	$str = $patron->home_phone;
 	$str = $patron->sip_birthdate;	
+	$str = $patron->sip_expire;
 	$str = $patron->ptype;
 	$str = $patron->language;
 	$str = $patron->password;
@@ -119,6 +120,13 @@ specification:
 
 	YYYYMMDD    HHMMSS
 
+=head2 C<$str = $patron-E<gt>sip_expire;>
+
+Returns the patron's expiration formated according to the SIP
+specification:
+
+	YYYYMMDD    HHMMSS
+
 =head2 C<$str = $patron-E<gt>ptype;>
 
 Returns the "patron type" of the patron.  This is not used by the
diff --git a/Sip/Constants.pm b/Sip/Constants.pm
index bdfe341..b83517f 100644
--- a/Sip/Constants.pm
+++ b/Sip/Constants.pm
@@ -248,6 +248,7 @@ use constant {
     FID_VALID_PATRON_PWD       => 'CQ',
 
     # SIP Extensions used by Envisionware Terminals
+    FID_PATRON_EXPIRE          => 'PA',
     FID_PATRON_BIRTHDATE       => 'PB',
     FID_PATRON_CLASS           => 'PC',
 
diff --git a/Sip/MsgType.pm b/Sip/MsgType.pm
index e9176f9..2d828ff 100644
--- a/Sip/MsgType.pm
+++ b/Sip/MsgType.pm
@@ -969,6 +969,7 @@ sub handle_patron_info {
         # SIP 2.0 extensions used by Envisionware
         # Other types of terminals will ignore the fields, if
         # they don't recognize the codes
+        $resp .= maybe_add(FID_PATRON_EXPIRE, $patron->sip_expire);
         $resp .= maybe_add(FID_PATRON_BIRTHDATE, $patron->sip_birthdate);
         $resp .= maybe_add(FID_PATRON_CLASS, $patron->ptype);
 
-- 
2.11.0