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

(-)a/Koha/Biblio.pm (-2 / +6 lines)
Lines 318-328 sub subscriptions { Link Here
318
    return $self->{_subscriptions};
318
    return $self->{_subscriptions};
319
}
319
}
320
320
321
=head3 hasItemswaitingOrInTransit
321
=head3 has_items_waiting_or_intransit
322
323
my $itemsWaitingOrInTransit = $biblio->has_items_waiting_or_intransit
324
325
Tells if this bibliographic record has items waiting or in transit.
322
326
323
=cut
327
=cut
324
328
325
sub hasItemswaitingOrInTransit {
329
sub has_items_waiting_or_intransit {
326
    my ( $self ) = @_;
330
    my ( $self ) = @_;
327
331
328
    if ( Koha::Holds->search({ biblionumber => $self->id,
332
    if ( Koha::Holds->search({ biblionumber => $self->id,
(-)a/opac/opac-ISBDdetail.pl (-1 / +1 lines)
Lines 181-187 for my $itm (@items) { Link Here
181
      unless $allow_onshelf_holds;
181
      unless $allow_onshelf_holds;
182
}
182
}
183
183
184
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->hasItemswaitingOrInTransit ) {
184
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
185
    $template->param( ReservableItems => 1 );
185
    $template->param( ReservableItems => 1 );
186
}
186
}
187
187
(-)a/opac/opac-MARCdetail.pl (-1 / +1 lines)
Lines 136-142 for my $itm (@all_items) { Link Here
136
    last if $allow_onshelf_holds;
136
    last if $allow_onshelf_holds;
137
}
137
}
138
138
139
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->hasItemswaitingOrInTransit ) {
139
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
140
    $template->param( ReservableItems => 1 );
140
    $template->param( ReservableItems => 1 );
141
}
141
}
142
142
(-)a/opac/opac-detail.pl (-1 / +1 lines)
Lines 719-725 if ( not $viewallitems and @items > $max_items_to_display ) { Link Here
719
  }
719
  }
720
}
720
}
721
721
722
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->hasItemswaitingOrInTransit ) {
722
if( $allow_onshelf_holds || CountItemsIssued($biblionumber) || $biblio->has_items_waiting_or_intransit ) {
723
    $template->param( ReservableItems => 1 );
723
    $template->param( ReservableItems => 1 );
724
}
724
}
725
725
(-)a/t/db_dependent/Koha/Biblios.t (-5 / +4 lines)
Lines 100-112 subtest 'waiting_or_in_transit' => sub { Link Here
100
    $reserve = Koha::Holds->find($reserve->{reserve_id});
100
    $reserve = Koha::Holds->find($reserve->{reserve_id});
101
    $biblio = Koha::Biblios->find($biblio->{biblionumber});
101
    $biblio = Koha::Biblios->find($biblio->{biblionumber});
102
102
103
    is($biblio->hasItemswaitingOrInTransit, 0, 'Item is neither waiting nor in transit');
103
    is($biblio->has_items_waiting_or_intransit, 0, 'Item is neither waiting nor in transit');
104
104
105
    $reserve->found('W')->store;
105
    $reserve->found('W')->store;
106
    is($biblio->hasItemswaitingOrInTransit, 1, 'Item is waiting');
106
    is($biblio->has_items_waiting_or_intransit, 1, 'Item is waiting');
107
107
108
    $reserve->found('T')->store;
108
    $reserve->found('T')->store;
109
    is($biblio->hasItemswaitingOrInTransit, 1, 'Item is in transit');
109
    is($biblio->has_items_waiting_or_intransit, 1, 'Item is in transit');
110
110
111
    my $transfer = $builder->build({
111
    my $transfer = $builder->build({
112
        source => 'Branchtransfer',
112
        source => 'Branchtransfer',
Lines 117-123 subtest 'waiting_or_in_transit' => sub { Link Here
117
    });
117
    });
118
    my $t = Koha::Database->new()->schema()->resultset( 'Branchtransfer' )->find($transfer->{branchtransfer_id});
118
    my $t = Koha::Database->new()->schema()->resultset( 'Branchtransfer' )->find($transfer->{branchtransfer_id});
119
    $reserve->found(undef)->store;
119
    $reserve->found(undef)->store;
120
    is($biblio->hasItemswaitingOrInTransit, 1, 'Item has transfer');
120
    is($biblio->has_items_waiting_or_intransit, 1, 'Item has transfer');
121
};
121
};
122
122
123
$schema->storage->txn_rollback;
123
$schema->storage->txn_rollback;
124
- 

Return to bug 4319