Lines 22-30
use C4::Context;
Link Here
|
22 |
use C4::Koha; |
22 |
use C4::Koha; |
23 |
use C4::Members; |
23 |
use C4::Members; |
24 |
use C4::Reserves; |
24 |
use C4::Reserves; |
25 |
use C4::Items qw( GetBarcodeFromItemnumber GetItemnumbersForBiblio); |
25 |
use C4::Items qw( GetItemnumbersForBiblio); |
26 |
use C4::Auth qw(checkpw); |
26 |
use C4::Auth qw(checkpw); |
27 |
|
27 |
|
|
|
28 |
use Koha::Items; |
28 |
use Koha::Libraries; |
29 |
use Koha::Libraries; |
29 |
use Koha::Patrons; |
30 |
use Koha::Patrons; |
30 |
|
31 |
|
Lines 315-321
sub hold_items {
Link Here
|
315 |
my $self = shift; |
316 |
my $self = shift; |
316 |
my $item_arr = $self->x_items('hold_items', @_); |
317 |
my $item_arr = $self->x_items('hold_items', @_); |
317 |
foreach my $item (@{$item_arr}) { |
318 |
foreach my $item (@{$item_arr}) { |
318 |
$item->{barcode} = GetBarcodeFromItemnumber($item->{itemnumber}); |
319 |
my $item_obj = Koha::Items->find($item->{itemnumber}); |
|
|
320 |
$item_arr->{barcode} = $item_obj ? $item_obj->barcode : undef; |
319 |
} |
321 |
} |
320 |
return $item_arr; |
322 |
return $item_arr; |
321 |
} |
323 |
} |
Lines 483-497
sub _get_outstanding_holds {
Link Here
|
483 |
while ( my $hold = $holds->next ) { |
485 |
while ( my $hold = $holds->next ) { |
484 |
my $item; |
486 |
my $item; |
485 |
if ($hold->itemnumber) { |
487 |
if ($hold->itemnumber) { |
486 |
$item = $hold->itemnumber; |
488 |
$item = $hold->item; |
487 |
} |
489 |
} |
488 |
else { |
490 |
else { |
489 |
# We need to return a barcode for the biblio so the client |
491 |
# We need to return a barcode for the biblio so the client |
490 |
# can request the biblio info |
492 |
# can request the biblio info |
491 |
$item = ( GetItemnumbersForBiblio($hold->biblionumber) )->[0]; |
493 |
my $items = $hold->biblio->items; |
|
|
494 |
$item = $items->count ? $item->next : undef; |
492 |
} |
495 |
} |
493 |
my $unblessed_hold = $hold->unblessed; |
496 |
my $unblessed_hold = $hold->unblessed; |
494 |
$unblessed_hold->{barcode} = GetBarcodeFromItemnumber($item); |
497 |
|
|
|
498 |
$unblessed_hold->{barcode} = $item ? $item->barcode : undef; |
499 |
|
495 |
push @holds, $unblessed_hold; |
500 |
push @holds, $unblessed_hold; |
496 |
} |
501 |
} |
497 |
return \@holds; |
502 |
return \@holds; |