# If patron password was provided, report whether it was right or not.
$password_rc = $patron->check_password($patron_pwd);
+ if ( $patron_pwd eq q{} && $server->{account}->{allow_empty_passwords} ) {
+ $password_rc = 1;
+ }
$resp .= add_field( FID_VALID_PATRON_PWD, sipbool( $password_rc ) );
}
subtest 'Testing Patron Info Request V2' => sub {
$schema->storage->txn_begin;
- plan tests => 16;
+ plan tests => 17;
$C4::SIP::Sip::protocol_version = 2;
test_request_patron_info_v2();
$schema->storage->txn_rollback;
$msg->handle_patron_info( $server );
$respcode = substr( $response, 0, 2 );
check_field( $respcode, $response, FID_VALID_PATRON_PWD, 'N', 'code CQ should be N for empty AD' );
+ # Test empty password is OK if account configured to allow
+ $server->{account}->{allow_empty_passwords} = 1;
+ $msg = C4::SIP::Sip::MsgType->new( $siprequest, 0 );
+ undef $response;
+ $msg->handle_patron_info( $server );
+ $respcode = substr( $response, 0, 2 );
+ check_field( $respcode, $response, FID_VALID_PATRON_PWD, 'Y', 'code CQ should be Y if empty AD allowed' );
# Finally, we send a wrong card number
$schema->resultset('Borrower')->search({ cardnumber => $card })->delete;