From b70cde25139e18e00f662eab30d86611a5bb052f Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Wed, 4 Nov 2015 08:36:15 -0500 Subject: [PATCH] Bug 15124 - Allow SIP2 passwordless operation Some SIP self check machines allow the use of a "passwordless" mode where the patron does not need to enter a pin or password to use the SC. Koha cannot handle this situation. Koha will assume an empty password field is an invalid password unless the patron's password is NULL in the database. --- C4/SIP/Sip/MsgType.pm | 14 +++++++------- etc/SIPconfig.xml | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/C4/SIP/Sip/MsgType.pm b/C4/SIP/Sip/MsgType.pm index 24fdc66..6bf806a 100644 --- a/C4/SIP/Sip/MsgType.pm +++ b/C4/SIP/Sip/MsgType.pm @@ -448,7 +448,7 @@ sub build_patron_status { $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( $patron->check_password($patron_pwd) || $server->{account}->{no_password_mode} ) ); $resp .= maybe_add( FID_CURRENCY, $patron->currency ); $resp .= maybe_add( FID_FEE_AMT, $patron->fee_amount ); } @@ -603,8 +603,7 @@ sub handle_checkout { # Password provided, so we can tell if it was valid or not $resp .= - add_field( FID_VALID_PATRON_PWD, - sipbool( $patron->check_password( $fields->{ (FID_PATRON_PWD) } ) ) ); + add_field( FID_VALID_PATRON_PWD, sipbool( $patron->check_password( $fields->{ (FID_PATRON_PWD) } ) || $server->{account}->{no_password_mode} ) ); } } } @@ -984,8 +983,9 @@ sub handle_patron_info { $resp .= add_field(FID_VALID_PATRON, 'Y'); 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))); + $resp .= + add_field( FID_VALID_PATRON_PWD, + sipbool( $patron->check_password($patron_pwd) || $server->{account}->{no_password_mode} ) ); } $resp .= maybe_add(FID_CURRENCY, $patron->currency); @@ -1244,7 +1244,7 @@ sub handle_patron_enable { } else { # valid patron - if ( !defined($patron_pwd) || $patron->check_password($patron_pwd) ) { + if ( !defined($patron_pwd) || $patron->check_password($patron_pwd) || || $server->{account}->{no_password_mode} ) { # Don't enable the patron if there was an invalid password $status = $patron->enable; @@ -1255,7 +1255,7 @@ sub handle_patron_enable { $resp .= add_field( FID_PATRON_ID, $patron->id ); $resp .= add_field( FID_PERSONAL_NAME, $patron->name ); if ( defined($patron_pwd) ) { - $resp .= add_field( FID_VALID_PATRON_PWD, sipbool( $patron->check_password($patron_pwd) ) ); + $resp .= add_field( FID_VALID_PATRON_PWD, sipbool( $patron->check_password($patron_pwd) || $server->{account}->{no_password_mode} ) ); } $resp .= add_field( FID_VALID_PATRON, 'Y' ); $resp .= maybe_add( FID_SCREEN_MSG, $patron->screen_msg, $server ); diff --git a/etc/SIPconfig.xml b/etc/SIPconfig.xml index 8d2d77b..1712f45 100644 --- a/etc/SIPconfig.xml +++ b/etc/SIPconfig.xml @@ -42,7 +42,7 @@ + send_patron_home_library_in_af="1" no_password_mode="1"> -- 1.7.2.5