From 05bb25e9db3a4cf78ce9d8233861104459430a89 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 10 May 2021 16:09:17 +0100 Subject: [PATCH] Bug 27600: Remove password check from `cancel_hold` As suggested in the bugzilla comments, the cancel_hold method also doesn't require the password checking code. Test plan 1/ Run t/db_dependent/SIP/ILS.t and watch it pass Signed-off-by: Nick Clemens Signed-off-by: Jonathan Druart Signed-off-by: Kyle M Hall (cherry picked from commit f7cda73513daca37c798888c2ae8f42884deb33c) Signed-off-by: Fridolin Somers --- C4/SIP/ILS.pm | 3 --- t/db_dependent/SIP/ILS.t | 5 +++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/C4/SIP/ILS.pm b/C4/SIP/ILS.pm index a80052e033..fdc493e708 100644 --- a/C4/SIP/ILS.pm +++ b/C4/SIP/ILS.pm @@ -347,9 +347,6 @@ sub cancel_hold { if (!$patron) { $trans->screen_msg("Invalid patron barcode."); return $trans; - } elsif (defined($patron_pwd) && !$patron->check_password($patron_pwd)) { - $trans->screen_msg('Invalid patron password.'); - return $trans; } unless ($item = C4::SIP::ILS::Item->new($item_id || $title_id)) { diff --git a/t/db_dependent/SIP/ILS.t b/t/db_dependent/SIP/ILS.t index f39fb28b11..bd8d670a08 100755 --- a/t/db_dependent/SIP/ILS.t +++ b/t/db_dependent/SIP/ILS.t @@ -72,7 +72,7 @@ is( $ils->test_cardnumber_compare( 'A1234', 'b1234' ), q{}, 'borrower bc test identifies difference' ); subtest cancel_hold => sub { - plan tests => 5; + plan tests => 6; my $library = $builder->build_object ({ class => 'Koha::Libraries' }); my $patron = $builder->build_object( @@ -117,8 +117,9 @@ subtest cancel_hold => sub { my $ils = C4::SIP::ILS->new({ id => $library->branchcode }); my $sip_patron = C4::SIP::ILS::Patron->new( $patron->cardnumber ); - my $transaction = $ils->cancel_hold($patron->cardnumber,undef,$item->barcode,undef); + my $transaction = $ils->cancel_hold($patron->cardnumber,"",$item->barcode,undef); + isnt( $transaction->{screen_msg}, 'Invalid patron password.', "Empty password succeeds" ); is( $transaction->{screen_msg},"Hold Cancelled.","We get a success message when hold cancelled"); is( $item->biblio->holds->count(), 0, "Bib has 0 holds remaining"); -- 2.39.5