use C4::Koha;
use C4::Members;
use C4::Reserves;
-use C4::Items qw( GetBarcodeFromItemnumber GetItemnumbersForBiblio);
+use C4::Items qw( GetItemnumbersForBiblio);
use C4::Auth qw(checkpw);
+use Koha::Items;
use Koha::Libraries;
use Koha::Patrons;
my $self = shift;
my $item_arr = $self->x_items('hold_items', @_);
foreach my $item (@{$item_arr}) {
- $item->{barcode} = GetBarcodeFromItemnumber($item->{itemnumber});
+ my $item_obj = Koha::Items->find($item->{itemnumber});
+ $item_arr->{barcode} = $item_obj ? $item_obj->barcode : undef;
}
return $item_arr;
}
while ( my $hold = $holds->next ) {
my $item;
if ($hold->itemnumber) {
- $item = $hold->itemnumber;
+ $item = $hold->item;
}
else {
# We need to return a barcode for the biblio so the client
# can request the biblio info
- $item = ( GetItemnumbersForBiblio($hold->biblionumber) )->[0];
+ my $items = $hold->biblio->items;
+ $item = $items->count ? $item->next : undef;
}
my $unblessed_hold = $hold->unblessed;
- $unblessed_hold->{barcode} = GetBarcodeFromItemnumber($item);
+
+ $unblessed_hold->{barcode} = $item ? $item->barcode : undef;
+
push @holds, $unblessed_hold;
}
return \@holds;
}
@loop_data = sort {$a->{subfield} cmp $b->{subfield} } @loop_data;
+my $item = Koha::Items->find($itemnumber); # We certainly want to fetch it earlier
+
# what's the next op ? it's what we are not in : an add if we're editing, otherwise, and edit.
$template->param(
biblionumber => $biblionumber,
item_header_loop => \@header_value_loop,
item => \@loop_data,
itemnumber => $itemnumber,
- barcode => GetBarcodeFromItemnumber($itemnumber),
+ barcode => $item ? $item->barcode : undef,
itemtagfield => $itemtagfield,
itemtagsubfield => $itemtagsubfield,
op => $nextop,
use JSON qw(to_json);
use C4::Circulation;
-use C4::Items qw(GetBarcodeFromItemnumber GetItem ModItem);
+use C4::Items qw(GetItem ModItem);
use C4::Context;
use C4::Auth qw(check_cookie_auth);
use Koha::Checkouts;
+use Koha::Items;
my $input = new CGI;
$override_limit = $override_limit ? $override_limit eq 'true' : undef;
$exempt_fine = $exempt_fine ? $exempt_fine eq 'true' : undef;
-my $barcode = GetBarcodeFromItemnumber($itemnumber);
+my $item = Koha::Items->find($itemnumber);
+
+my $barcode = $item ? $item->barcode : undef; # We certainly will want to return an error code
my $data;
$data->{itemnumber} = $itemnumber;