Set langauge value for patron info response user/berick/patron-info-lang
authorBill Erickson <berick@esilibrary.com>
Wed, 26 Dec 2012 18:53:39 +0000 (13:53 -0500)
committerBill Erickson <berick@esilibrary.com>
Wed, 26 Dec 2012 18:53:39 +0000 (13:53 -0500)
Ensure the 3-char language field has a value (defaulting to '000') in
the patron info response.  Without the value, there is a 3-char offset
in the response message fixed fields.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Sip/MsgType.pm

index abdeec2..6fb4793 100644 (file)
@@ -919,6 +919,7 @@ sub handle_patron_info {
     my $fields = $self->{fields};
     my ($inst_id, $patron_id, $terminal_pwd, $patron_pwd, $start, $end);
     my ($resp, $patron, $count);
+    $lang ||= '000'; # unspecified
 
     $inst_id      = $fields->{(FID_INST_ID)};
     $patron_id    = $fields->{(FID_PATRON_ID)};
@@ -932,6 +933,8 @@ sub handle_patron_info {
     $resp = (PATRON_INFO_RESP);
     if ($patron) {
         $resp .= patron_status_string($patron);
+
+        $lang = $patron->language if $patron->language;
         $resp .= $lang . Sip::timestamp();
 
         $resp .= add_count('patron_info/hold_items',    scalar @{$patron->hold_items   });