@@ -, +, @@ --------------------- --------------------- --- C4/SIP/Sip/MsgType.pm | 34 +++++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 7 deletions(-) --- a/C4/SIP/Sip/MsgType.pm +++ a/C4/SIP/Sip/MsgType.pm @@ -429,14 +429,29 @@ sub handle { # ASSUMPTION: If the patron password field is present in the # message, then it must match, otherwise incomplete patron status # information will be returned to the terminal. -# +# sub build_patron_status { my ( $patron, $lang, $fields, $server ) = @_; - + my $overdrive_mode = $server->{account}->{'overdrive-mode'}; my $patron_pwd = $fields->{ (FID_PATRON_PWD) }; my $resp = (PATRON_STATUS_RESP); + my $password_ok = 1; + my $password_rc; if ($patron) { + if ($patron_pwd) { + $password_rc = $patron->check_password($patron_pwd); + $password_ok = 0 unless $password_rc; + } + elsif ( $overdrive_mode + and not exists $fields->{'AL'} # not block_request + and not $patron_pwd ) # no password supplied + { + $password_ok = 0; + } + } + + if ( $patron and $password_ok ) { $resp .= patron_status_string($patron); $resp .= $lang . Sip::timestamp(); $resp .= add_field( FID_PERSONAL_NAME, $patron->name ); @@ -444,13 +459,12 @@ sub build_patron_status { # while the patron ID we got from the SC is valid, let's # use the one returned from the ILS, just in case... $resp .= add_field( FID_PATRON_ID, $patron->id ); + if ( $protocol_version >= 2 ) { $resp .= add_field( FID_VALID_PATRON, 'Y' ); # Patron password is a required field. - $resp .= - add_field( FID_VALID_PATRON_PWD, - sipbool( $patron->check_password($patron_pwd) ) ); + $resp .= add_field( FID_VALID_PATRON_PWD, sipbool($password_rc) ); $resp .= maybe_add( FID_CURRENCY, $patron->currency ); $resp .= maybe_add( FID_FEE_AMT, $patron->fee_amount ); } @@ -458,11 +472,14 @@ sub build_patron_status { $resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg ); $resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode} ) if ( $server->{account}->{send_patron_home_library_in_af} ); - $resp .= maybe_add( FID_PRINT_LINE, $patron->print_line ); + } else { - # Invalid patron id. Report that the user has no privs., + + # Invalid patron id (and/or passwd for overdrive_mode) + # Report that the user has no privs. + # no personal name, and is invalid (if we're using 2.00) $resp .= 'YYYY' . ( ' ' x 10 ) . $lang . Sip::timestamp(); $resp .= add_field( FID_PERSONAL_NAME, '' ); @@ -473,6 +490,9 @@ sub build_patron_status { ( $protocol_version >= 2 ) and $resp .= add_field( FID_VALID_PATRON, 'N' ); + + $resp .= + maybe_add( FID_SCREEN_MSG, 'Invalid patron or patron password' ); } $resp .= add_field( FID_INST_ID, $fields->{ (FID_INST_ID) } ); --