View | Details | Raw Unified | Return to bug 23233
Collapse All | Expand All

(-)a/Koha/Item.pm (-1 / +1 lines)
Lines 383-389 This method checks the tmp_holdsqueue to see if this item has been selected for Link Here
383
sub has_pending_hold {
383
sub has_pending_hold {
384
    my ( $self ) = @_;
384
    my ( $self ) = @_;
385
    my $pending_hold = $self->_result->tmp_holdsqueues;
385
    my $pending_hold = $self->_result->tmp_holdsqueues;
386
    return !C4::Context->preference('AllowItemsOnHoldCheckoutSIP') && $pending_hold->count ? 1: 0;
386
    return $pending_hold->count ? 1: 0;
387
}
387
}
388
388
389
=head3 as_marc_field
389
=head3 as_marc_field
(-)a/t/db_dependent/Koha/Item.t (-6 / +1 lines)
Lines 66-72 subtest 'hidden_in_opac() tests' => sub { Link Here
66
66
67
subtest 'has_pending_hold() tests' => sub {
67
subtest 'has_pending_hold() tests' => sub {
68
68
69
    plan tests => 3;
69
    plan tests => 2;
70
70
71
    $schema->storage->txn_begin;
71
    $schema->storage->txn_begin;
72
72
Lines 75-86 subtest 'has_pending_hold() tests' => sub { Link Here
75
    my $itemnumber = $item->itemnumber;
75
    my $itemnumber = $item->itemnumber;
76
76
77
    # disable AllowItemsOnHoldCheckout as it ignores pending holds
77
    # disable AllowItemsOnHoldCheckout as it ignores pending holds
78
    t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 );
79
    $dbh->do("INSERT INTO tmp_holdsqueue (surname,borrowernumber,itemnumber) VALUES ('Clamp',42,$itemnumber)");
78
    $dbh->do("INSERT INTO tmp_holdsqueue (surname,borrowernumber,itemnumber) VALUES ('Clamp',42,$itemnumber)");
80
    ok( $item->has_pending_hold, "Yes, we have a pending hold");
79
    ok( $item->has_pending_hold, "Yes, we have a pending hold");
81
    t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 1 );
82
    ok( !$item->has_pending_hold, "We don't consider a pending hold if hold items can be checked out");
83
    t::lib::Mocks::mock_preference( 'AllowItemsOnHoldCheckout', 0 );
84
    $dbh->do("DELETE FROM tmp_holdsqueue WHERE itemnumber=$itemnumber");
80
    $dbh->do("DELETE FROM tmp_holdsqueue WHERE itemnumber=$itemnumber");
85
    ok( !$item->has_pending_hold, "We don't have a pending hold if nothing in the tmp_holdsqueue");
81
    ok( !$item->has_pending_hold, "We don't have a pending hold if nothing in the tmp_holdsqueue");
86
82
87
- 

Return to bug 23233