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

(-)a/Koha/Item.pm (-3 / +2 lines)
Lines 891-899 This method checks the tmp_holdsqueue to see if this item has been selected for Link Here
891
=cut
891
=cut
892
892
893
sub has_pending_hold {
893
sub has_pending_hold {
894
    my ( $self ) = @_;
894
    my ($self) = @_;
895
    my $pending_hold = $self->_result->tmp_holdsqueues;
895
    return $self->_result->tmp_holdsqueue ? 1 : 0;
896
    return $pending_hold->count ? 1: 0;
897
}
896
}
898
897
899
=head3 has_pending_recall {
898
=head3 has_pending_recall {
(-)a/t/db_dependent/Koha/Item.t (-1 / +1 lines)
Lines 364-369 subtest 'has_pending_hold() tests' => sub { Link Here
364
    $dbh->do("INSERT INTO tmp_holdsqueue (surname,borrowernumber,itemnumber) VALUES ('Clamp',42,$itemnumber)");
364
    $dbh->do("INSERT INTO tmp_holdsqueue (surname,borrowernumber,itemnumber) VALUES ('Clamp',42,$itemnumber)");
365
    ok( $item->has_pending_hold, "Yes, we have a pending hold");
365
    ok( $item->has_pending_hold, "Yes, we have a pending hold");
366
    $dbh->do("DELETE FROM tmp_holdsqueue WHERE itemnumber=$itemnumber");
366
    $dbh->do("DELETE FROM tmp_holdsqueue WHERE itemnumber=$itemnumber");
367
    $item->discard_changes;
367
    ok( !$item->has_pending_hold, "We don't have a pending hold if nothing in the tmp_holdsqueue");
368
    ok( !$item->has_pending_hold, "We don't have a pending hold if nothing in the tmp_holdsqueue");
368
369
369
    $schema->storage->txn_rollback;
370
    $schema->storage->txn_rollback;
370
- 

Return to bug 28966