From 7b412df90718241ec7a278a10efd5b08b01ac983 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Sat, 27 Feb 2016 14:40:44 +0100 Subject: [PATCH] Bug 13871: [QA Follow-up] Adjust Patron Info Request Content-Type: text/plain; charset=utf-8 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 Verified by telnetting SIP server. And tested additionally with the new unit test of bug 15956. --- C4/SIP/Sip/MsgType.pm | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index 65faef3..bd6f05b 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -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} ); -- 1.7.10.4