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

(-)a/Koha/Biblio.pm (-4 / +3 lines)
Lines 435-445 sub items { Link Here
435
435
436
    return Koha::Items->_new_from_dbic( $items_rs ) unless $params->{host_items};
436
    return Koha::Items->_new_from_dbic( $items_rs ) unless $params->{host_items};
437
437
438
    my @itemnumbers = $items_rs->get_column('itemnumber')->all;
438
    my $host_itemnumbers = $self->_host_itemnumbers();
439
    my $host_itemnumbers = $self->_host_itemnumbers();
439
    my $params = { -or => [biblionumber => $self->id] };
440
    push @itemnumbers, @{ $host_itemnumbers };
440
    push @{$params->{'-or'}}, itemnumber => { -in => $host_itemnumbers } if $host_itemnumbers;
441
    return Koha::Items->search({ "me.itemnumber" => { -in => \@itemnumbers } });
441
442
    return Koha::Items->search($params);
443
}
442
}
444
443
445
=head3 host_items
444
=head3 host_items
(-)a/Koha/Item.pm (-1 / +3 lines)
Lines 566-572 we still expect the item to end up at a final location eventually. Link Here
566
sub get_transfer {
566
sub get_transfer {
567
    my ($self) = @_;
567
    my ($self) = @_;
568
568
569
    return $self->get_transfers->search( {}, { rows => 1 } )->next;
569
    my $transfer = $self->_result->branchtransfer;
570
571
    return Koha::Item::Transfers->_new_from_dbic($transfer)->next;
570
}
572
}
571
573
572
=head3 get_transfers
574
=head3 get_transfers
(-)a/Koha/Schema/Result/Item.pm (+14 lines)
Lines 968-973 __PACKAGE__->many_to_many( Link Here
968
  "ordernumber",
968
  "ordernumber",
969
);
969
);
970
970
971
__PACKAGE__->has_many(
972
  "branchtransfer",
973
  "Koha::Schema::Result::Branchtransfer",
974
  sub {
975
      my $args = shift;
976
      return {
977
          "$args->{foreign_alias}.itemnumber" => { -ident => "$args->{self_alias}.itemnumber" },
978
          "$args->{foreign_alias}.datearrived" => undef,
979
          "$args->{foreign_alias}.datecancelled" => undef,
980
      };
981
  },
982
  { cascade_copy => 0, cascade_delete => 0 },
983
);
984
971
use C4::Context;
985
use C4::Context;
972
sub effective_itemtype {
986
sub effective_itemtype {
973
    my ( $self ) = @_;
987
    my ( $self ) = @_;
(-)a/catalogue/detail.pl (-2 / +1 lines)
Lines 193-199 my $itemtypes = { map { $_->itemtype => $_ } @{ Koha::ItemTypes->search_with_loc Link Here
193
my $params;
193
my $params;
194
my $patron = Koha::Patrons->find( $borrowernumber );
194
my $patron = Koha::Patrons->find( $borrowernumber );
195
$params->{ itemlost } = 0 if $patron->category->hidelostitems && !$showallitems;
195
$params->{ itemlost } = 0 if $patron->category->hidelostitems && !$showallitems;
196
my $items = $biblio->items({ host_items => 1 })->search_ordered( $params, { prefetch => ['issue','branchtransfers'] } );
196
my $items = $biblio->items({ host_items => 1 })->search_ordered( $params, { prefetch => ['issue','branchtransfer'] } );
197
197
198
# flag indicating existence of at least one item linked via a host record
198
# flag indicating existence of at least one item linked via a host record
199
my $hostrecords = $biblio->host_items->count;
199
my $hostrecords = $biblio->host_items->count;
200
- 

Return to bug 33167