$template_params->{messages} = $messages;
my $item = Koha::Items->find({ barcode => $barcode });
- my $biblio = $item->biblio;
+ my ( $biblio, $mss );
- my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.notforloan', authorised_value => { not => undef } });
- $template_params->{authvalcode_notforloan} = $mss->count ? $mss->next->authorised_value : undef;
+ if ( $item ) {
+ $biblio = $item->biblio;
+ my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.notforloan', authorised_value => { not => undef } });
+ $template_params->{authvalcode_notforloan} = $mss->count ? $mss->next->authorised_value : undef;
+ }
# Fix for bug 7494: optional checkout-time fallback search for a book
);
}
- $template->param(
- itembiblionumber => $biblio->biblionumber
- );
-
# FIXME If the issue is confirmed, we launch another time checkouts->count, now display the issue count after issue
$patron = Koha::Patrons->find( $borrowernumber );
if ( $item ) {
$template_params->{item} = $item;
$template_params->{biblio} = $biblio;
+ $template_params->{itembiblionumber} = $biblio->biblionumber;
}
push @$checkout_infos, $template_params;
}
$barcode = barcodedecode($barcode) if C4::Context->preference('itemBarcodeInputFilter');
my $item = Koha::Items->find({ barcode => $barcode });
- # Check if we should display a checkin message, based on the the item
- # type of the checked in item
- my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
- if ( $itemtype && $itemtype->checkinmsg ) {
- $template->param(
- checkinmsg => $itemtype->checkinmsg,
- checkinmsgtype => $itemtype->checkinmsgtype,
- );
- }
+ if ( $item ) {
+ # Check if we should display a checkin message, based on the the item
+ # type of the checked in item
+ my $itemtype = Koha::ItemTypes->find( $item->effective_itemtype );
+ if ( $itemtype && $itemtype->checkinmsg ) {
+ $template->param(
+ checkinmsg => $itemtype->checkinmsg,
+ checkinmsgtype => $itemtype->checkinmsgtype,
+ );
+ }
- # make sure return branch respects home branch circulation rules, default to homebranch
- my $hbr = GetBranchItemRule($item->homebranch, $itemtype ? $itemtype->itemtype : undef )->{'returnbranch'} || "homebranch";
- $returnbranch = $item->$hbr;
+ # make sure return branch respects home branch circulation rules, default to homebranch
+ my $hbr = GetBranchItemRule($item->homebranch, $itemtype ? $itemtype->itemtype : undef )->{'returnbranch'} || "homebranch";
+ $returnbranch = $item->$hbr;
- my $materials = $item->materials;
- my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials });
- $materials = $descriptions->{lib} // $materials;
+ my $materials = $item->materials;
+ my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({frameworkcode => '', kohafield =>'items.materials', authorised_value => $materials });
+ $materials = $descriptions->{lib} // $materials;
- my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } );
+ my $issue = Koha::Checkouts->find( { itemnumber => $itemnumber } );
- my $biblio = $item->biblio;
- $template->param(
- title => $biblio->title,
- homebranch => $item->homebranch,
- holdingbranch => $item->holdingbranch,
- returnbranch => $returnbranch,
- author => $biblio->author,
- itembarcode => $item->barcode,
- itemtype => $item->effective_itemtype,
- ccode => $item->ccode,
- itembiblionumber => $biblio->biblionumber,
- biblionumber => $biblio->biblionumber,
- borrower => $borrower,
- additional_materials => $materials,
- issue => $issue,
- );
+ my $biblio = $item->biblio;
+ $template->param(
+ title => $biblio->title,
+ homebranch => $item->homebranch,
+ holdingbranch => $item->holdingbranch,
+ returnbranch => $returnbranch,
+ author => $biblio->author,
+ itembarcode => $item->barcode,
+ itemtype => $item->effective_itemtype,
+ ccode => $item->ccode,
+ itembiblionumber => $biblio->biblionumber,
+ biblionumber => $biblio->biblionumber,
+ borrower => $borrower,
+ additional_materials => $materials,
+ issue => $issue,
+ );
+ } # FIXME else we should not call AddReturn but set BadBarcode directly instead
my %input = (
counter => 0,
barcode => $barcode,
);
+
# do the return
( $returned, $messages, $issue, $borrower ) =
AddReturn( $barcode, $userenv_branch, $exemptfine, $dropboxmode, $return_date_override, $dropboxdate );