Bug 27600: Remove password check from add_hold
As suggested in the bugzilla comments, the add_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 <nick@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
This commit is contained in:
parent
f7cda73513
commit
bc72a6d508
2 changed files with 56 additions and 6 deletions
|
@ -296,11 +296,10 @@ sub add_hold {
|
|||
|
||||
my $trans = C4::SIP::ILS::Transaction::Hold->new();
|
||||
|
||||
$patron = C4::SIP::ILS::Patron->new( $patron_id);
|
||||
if (!$patron
|
||||
|| (defined($patron_pwd) && !$patron->check_password($patron_pwd))) {
|
||||
$trans->screen_msg("Invalid Patron.");
|
||||
return $trans;
|
||||
$patron = C4::SIP::ILS::Patron->new( $patron_id );
|
||||
if ( !$patron ) {
|
||||
$trans->screen_msg("Invalid patron barcode.");
|
||||
return $trans;
|
||||
}
|
||||
|
||||
unless ($item = C4::SIP::ILS::Item->new($item_id || $title_id)) {
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 12;
|
||||
use Test::More tests => 13;
|
||||
|
||||
use t::lib::TestBuilder;
|
||||
use t::lib::Mocks;
|
||||
|
@ -71,6 +71,57 @@ is( $ils->test_cardnumber_compare( 'A1234', 'a1234' ),
|
|||
is( $ils->test_cardnumber_compare( 'A1234', 'b1234' ),
|
||||
q{}, 'borrower bc test identifies difference' );
|
||||
|
||||
subtest add_hold => sub {
|
||||
plan tests => 4;
|
||||
|
||||
my $library = $builder->build_object( { class => 'Koha::Libraries' } );
|
||||
my $patron = $builder->build_object(
|
||||
{
|
||||
class => 'Koha::Patrons',
|
||||
value => {
|
||||
branchcode => $library->branchcode,
|
||||
}
|
||||
}
|
||||
);
|
||||
t::lib::Mocks::mock_userenv(
|
||||
{ branchcode => $library->branchcode, flags => 1 } );
|
||||
|
||||
my $item = $builder->build_sample_item(
|
||||
{
|
||||
library => $library->branchcode,
|
||||
}
|
||||
);
|
||||
|
||||
Koha::CirculationRules->set_rules(
|
||||
{
|
||||
categorycode => $patron->categorycode,
|
||||
branchcode => $library->branchcode,
|
||||
itemtype => $item->effective_itemtype,
|
||||
rules => {
|
||||
onshelfholds => 1,
|
||||
reservesallowed => 3,
|
||||
holds_per_record => 3,
|
||||
issuelength => 5,
|
||||
lengthunit => 'days',
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
my $ils = C4::SIP::ILS->new( { id => $library->branchcode } );
|
||||
|
||||
# Send empty AD segments (i.e. empty string for patron_pwd)
|
||||
my $transaction = $ils->add_hold( $patron->cardnumber, "", $item->barcode, undef );
|
||||
isnt(
|
||||
$transaction->{screen_msg},
|
||||
'Invalid patron password.',
|
||||
"Empty password succeeds"
|
||||
);
|
||||
ok( $transaction->{ok}, "Transaction returned success");
|
||||
is( $item->biblio->holds->count(), 1, "Hold was placed on bib");
|
||||
# FIXME: Should we not allow for item-level holds when we're passed an item barcode...
|
||||
is( $item->holds->count(),0,"Hold was placed at bib level");
|
||||
};
|
||||
|
||||
subtest cancel_hold => sub {
|
||||
plan tests => 6;
|
||||
|
||||
|
|
Loading…
Reference in a new issue