Bug 13871: [QA Follow-up] Adjust Patron Info Request

Conform QA comment, Patron Info request is slightly adjusted to be
consistent with changes to Patron Status request.

If the cardnumber is ok and the password is wrong, BL=N is reported but
also add 'Invalid password' in AF.
Additionally, an invalid card number is reported in AF.

Test plan:
[1] Send patron info request for invalid card.
[2] Idem for valid card, no password.
[3] Idem for valid card, good password.
[4] Idem for valid card, wrong password.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Verified by telnetting SIP server.
And tested additionally with the new unit test of bug 15956.

Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
(cherry picked from commit b02aa7c421)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Marcel de Rooy 2016-02-27 14:40:44 +01:00 committed by Julian Maurice
parent 120ee9461d
commit 4ec4e13ed7
1 changed files with 12 additions and 5 deletions

View File

@ -969,10 +969,12 @@ sub handle_patron_info {
# charged items limit
$resp .= add_field( FID_VALID_PATRON, 'Y' );
my $password_rc;
if ( defined($patron_pwd) ) {
# If patron password was provided, report whether it was right or not.
$resp .= add_field( FID_VALID_PATRON_PWD, sipbool( $patron->check_password($patron_pwd) ) );
$password_rc = $patron->check_password($patron_pwd);
$resp .= add_field( FID_VALID_PATRON_PWD, sipbool( $password_rc ) );
}
$resp .= maybe_add( FID_CURRENCY, $patron->currency );
@ -1000,10 +1002,14 @@ sub handle_patron_info {
# Custom protocol extension to report patron internet privileges
$resp .= maybe_add( FID_INET_PROFILE, $patron->inet_privileges );
$resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg, $server );
$resp .= maybe_add( FID_SCREEN_MSG, $patron->{branchcode}, $server )
if ( $server->{account}->{send_patron_home_library_in_af} );
my $msg = $patron->screen_msg;
if( defined( $patron_pwd ) && !$password_rc ) {
$msg .= ' -- ' . INVALID_PW;
}
if ( $server->{account}->{send_patron_home_library_in_af} ) {
$msg .= ' -- ' . $patron->{branchcode};
}
$resp .= maybe_add( FID_SCREEN_MSG, $msg, $server );
$resp .= maybe_add( FID_PRINT_LINE, $patron->print_line );
} else {
@ -1022,6 +1028,7 @@ sub handle_patron_info {
if ( $protocol_version >= 2 ) {
$resp .= add_field( FID_VALID_PATRON, 'N' );
}
$resp .= maybe_add( FID_SCREEN_MSG, INVALID_CARD );
}
$self->write_msg( $resp, undef, $server->{account}->{terminator}, $server->{account}->{encoding} );