# Get most of the needed data
my $biblioitemnumber = $biblioitem->{'biblioitemnumber'};
my $holds = $biblio->current_holds->unblessed;
- my $issues = GetBiblioIssues($biblionumber);
+ my $checkouts = Koha::Checkouts->search(
+ { biblionumber => $biblionumber },
+ {
+ join => 'item',
+ '+select' => ['item.barcode'],
+ '+as' => ['barcode'],
+ }
+ )->unblessed;
my @items = $biblio->items->as_list;
$biblioitem->{items}->{item} = [];
$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} = {
# Hashref building...
$biblioitem->{'reserves'}->{'reserve'} = $holds;
- $biblioitem->{'issues'}->{'issue'} = $issues;
+ $biblioitem->{'issues'}->{'issue'} = $checkouts;
push @records, $biblioitem;
}
if ( $show_attributes && $show_attributes eq "1" ) {
# FIXME Regression expected here, we do not retrieve the same field as previously
# Waiting for answer on bug 14257 comment 15
- my $attrs = $patron->get_extended_attributes->search({ opac_display => 1 })->unblessed;
- $borrower->{'attributes'} = $attrs;
+ $borrower->{'attributes'} = [
+ map {
+ $_->type->opac_display
+ ? {
+ %{ $_->unblessed },
+ %{ $_->type->unblessed },
+ value => $_->attribute, # Backward compatibility
+ value_description => $_->description, # Awkward retro-compability...
+ }
+ : ()
+ } $patron->extended_attributes->search
+ ];
}
# Add is expired information
# Add renewal if possible
my @renewal = CanBookBeRenewed( $borrowernumber, $itemnumber );
- if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber ); }
+ if ( $renewal[0] ) { AddRenewal( $borrowernumber, $itemnumber, undef, undef, undef, undef, 0 ); }
my $issue = $item->checkout;
return unless $issue; # FIXME should be handled
my $priority= C4::Reserves::CalculatePriority( $biblionumber );
AddReserve(
{
- branch => $branch,
+ branchcode => $branch,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => $priority,
my $priority = C4::Reserves::CalculatePriority($biblionumber);
AddReserve(
{
- branch => $branch,
+ branchcode => $branch,
borrowernumber => $borrowernumber,
biblionumber => $biblionumber,
priority => $priority,