- my $home_library = Koha::Libraries->find( $item->{homebranch} );
- my $holding_library = Koha::Libraries->find( $item->{holdingbranch} );
- $item->{'homebranchname'} = $home_library ? $home_library->branchname : '';
- $item->{'holdingbranchname'} = $holding_library ? $holding_library->branchname : '';
+ my $home_library = $item->home_branch;
+ my $holding_library = $item->holding_branch;
+ $item{'homebranchname'} = $home_library ? $home_library->branchname : '';
+ $item{'holdingbranchname'} = $holding_library ? $holding_library->branchname : '';
+
+ if ($item->location) {
+ my $authorised_value = Koha::AuthorisedValues->find_by_koha_field({ kohafield => 'items.location', authorised_value => $item->location });
+ if ($authorised_value) {
+ $item{location_description} = $authorised_value->opac_description;
+ }
+ }
+
+ if ($item->itype) {
+ my $itemtype = Koha::ItemTypes->find($item->itype);
+ if ($itemtype) {
+ $item{itype_description} = $itemtype->description;
+ }
+ }
+
+ my $transfer = $item->get_transfer;
+ if ($transfer) {
+ $item{transfer} = {
+ datesent => $transfer->datesent,
+ frombranch => $transfer->frombranch,
+ tobranch => $transfer->tobranch,
+ };
+ }
+
+ push @{ $biblioitem->{items}->{item} }, \%item;
+ }
+
+ # Holds
+ my $holds = $biblio->current_holds->unblessed;
+ foreach my $hold (@$holds) {
+ delete $hold->{'borrowernumber'};