From 1d00bd00b881979955bb688fe0b786a99a5a835b Mon Sep 17 00:00:00 2001 From: djfiander Date: Wed, 26 Apr 2006 14:33:39 +0000 Subject: [PATCH] Fix Patron Information message handling to parallel the situation in the handling of Patron Status messages: if the password's not provided by the terminal, then we don't worry about checking the password, but if the terminal gives us the password, then it has to match before we say anything about the patron. --- Sip/MsgType.pm | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/Sip/MsgType.pm b/Sip/MsgType.pm index bf11e18..96bc265 100644 --- a/Sip/MsgType.pm +++ b/Sip/MsgType.pm @@ -890,24 +890,13 @@ sub handle_patron_info { $patron = new ILS::Patron $patron_id; $resp = (PATRON_INFO_RESP); - if (!defined($patron) || !$patron->check_password($patron_pwd)) { - # Invalid patron ID, or password mismatch. Either way - # we don't give back any status information. - # he has no privileges, no items associated with him, - # no personal name, and is invalid (if we're using 2.00) - $resp .= 'YYYY' . (' ' x 10) . $lang . Sip::timestamp(); - $resp .= '0000' x 6; - $resp .= add_field(FID_PERSONAL_NAME, ''); - - # the patron ID is invalid, but it's a required field, so - # just echo it back - $resp .= add_field(FID_PATRON_ID, $fields->{(FID_PATRON_ID)}); - - if ($protocol_version eq '2.00') { - $resp .= add_field(FID_VALID_PATRON, 'N'); - } - } else { - # Valid patron + # The patron password is an optional field in the Patron Information + # message. To parallel the Patron Status situation, I am going to + # make the ASSUMPTION that I should provide complete patron information + # if the patron password is absent, or if it's present and matches. + # + if ($patron + && (!defined($patron_pwd) || $patron->check_password($patron_pwd))) { $resp .= patron_status_string($patron); $resp .= $lang . Sip::timestamp(); @@ -935,6 +924,22 @@ sub handle_patron_info { $resp .= maybe_add(FID_HOME_PHONE, $patron->home_phone); $resp .= summary_info($patron, $summary, $start, $end); + } else { + # Invalid patron ID, or password mismatch. Either way + # we don't give back any status information. + # he has no privileges, no items associated with him, + # no personal name, and is invalid (if we're using 2.00) + $resp .= 'YYYY' . (' ' x 10) . $lang . Sip::timestamp(); + $resp .= '0000' x 6; + $resp .= add_field(FID_PERSONAL_NAME, ''); + + # the patron ID is invalid, but it's a required field, so + # just echo it back + $resp .= add_field(FID_PATRON_ID, $fields->{(FID_PATRON_ID)}); + + if ($protocol_version eq '2.00') { + $resp .= add_field(FID_VALID_PATRON, 'N'); + } } $resp .= add_field(FID_INST_ID, $server->{ils}->institution); -- 2.11.0