From 15b5e1d70bf6e4889af7927c9c06ffd29c745362 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 15 Mar 2017 16:02:31 -0300 Subject: [PATCH] Bug 18276: Remove GetBiblioFromItemNumber - circulation pages Test plan: 1. Checkout items in a batch The information displayed should be ok (title, subtitles, author, itemnotes, barcode) 2. Checkout an item using the standard checkout page You should correctly see the information of the item that has been checked out (title and author) --- circ/circulation.pl | 26 +++++++++++----------- .../prog/en/modules/circ/circulation.tt | 2 +- .../en/modules/circ/circulation_batch_checkouts.tt | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/circ/circulation.pl b/circ/circulation.pl index ebb8d8b..895d61c 100755 --- a/circ/circulation.pl +++ b/circ/circulation.pl @@ -49,6 +49,7 @@ use Koha::Patron::Debarments qw(GetDebarments); use Koha::DateUtils; use Koha::Database; use Koha::BiblioFrameworks; +use Koha::Items; use Koha::Patron::Messages; use Koha::Patron::Images; use Koha::SearchEngine; @@ -329,10 +330,10 @@ if (@$barcodes) { $template_params->{alert} = $alerts; $template_params->{messages} = $messages; - # Get the item title for more information - my $getmessageiteminfo = GetBiblioFromItemNumber(undef,$barcode); + my $item = Koha::Items->find({ barcode => $barcode }); + my $biblio = $item->biblio; - my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $getmessageiteminfo->{frameworkcode}, kohafield => 'items.notforloan', authorised_value => { not => undef } }); + 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 @@ -376,22 +377,21 @@ if (@$barcodes) { $blocker = 1; } } - my $iteminfo = GetBiblioFromItemNumber(undef, $barcode); if( !$blocker || $force_allow_issue ){ my $confirm_required = 0; unless($issueconfirmed){ # Get the item title for more information - my $materials = $iteminfo->{'materials'}; - my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $getmessageiteminfo->{frameworkcode}, kohafield => 'items.materials', authorised_value => $materials }); + my $materials = $item->materials; + my $descriptions = Koha::AuthorisedValues->get_description_by_koha_field({ frameworkcode => $biblio->frameworkcode, kohafield => 'items.materials', authorised_value => $materials }); $materials = $descriptions->{lib} // $materials; $template_params->{additional_materials} = $materials; - $template_params->{itemhomebranch} = $iteminfo->{'homebranch'}; + $template_params->{itemhomebranch} = $item->homebranch; # pass needsconfirmation to template if issuing is possible and user hasn't yet confirmed. foreach my $needsconfirmation ( keys %$question ) { $template_params->{$needsconfirmation} = $$question{$needsconfirmation}; - $template_params->{getTitleMessageIteminfo} = $iteminfo->{'title'}; - $template_params->{getBarcodeMessageIteminfo} = $iteminfo->{'barcode'}; + $template_params->{getTitleMessageIteminfo} = $biblio->title; + $template_params->{getBarcodeMessageIteminfo} = $item->barcode; $template_params->{NEEDSCONFIRMATION} = 1; $template_params->{onsite_checkout} = $onsite_checkout; $confirm_required = 1; @@ -413,7 +413,7 @@ if (@$barcodes) { } $template->param( - itembiblionumber => $getmessageiteminfo->{'biblionumber'} + itembiblionumber => $biblio->biblionumber ); @@ -421,9 +421,9 @@ if (@$barcodes) { $patron = Koha::Patrons->find( $borrowernumber ); $template_params->{issuecount} = $patron->checkouts->count; - if ( $iteminfo ) { - $iteminfo->{subtitle} = GetRecordValue('subtitle', GetMarcBiblio($iteminfo->{biblionumber}), GetFrameworkCode($iteminfo->{biblionumber})); - $template_params->{item} = $iteminfo; + if ( $item ) { + $template_params->{item} = $item; + $template_params->{biblio} = $biblio; } push @$checkout_infos, $template_params; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt index e133b95..e4da8ce 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation.tt @@ -287,7 +287,7 @@ $(document).ready(function() { [% END %] [% IF PREVISSUE %] -
  • Patron has previously checked out this title: [% item.title %] [% IF item.author %] by [% item.author %][% END %]. Check out anyway?
  • +
  • Patron has previously checked out this title: [% biblio.title %] [% IF biblio.author %] by [% biblio.author %][% END %]. Check out anyway?
  • [% END %] [% IF BIBLIO_ALREADY_ISSUED %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt index 3fd88e3..1fc917f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/circ/circulation_batch_checkouts.tt @@ -134,7 +134,7 @@ $(document).ready(function() { [% END %] [% checkout_info.barcode %] - [% checkout_info.item.title |html %][% FOREACH subtitl IN checkout_info.item.subtitle %] [% subtitl.subfield %][% END %][% IF checkout_info.item.author %], by [% checkout_info.item.author %][% END %][% IF ( checkout_info.itme.itemnotes ) %]- [% checkout_info.item.itemnotes %][% END %] [% checkout_info.item.barcode %] + [% checkout_info.biblio.title |html %][% FOREACH subtitle IN checkout_info.biblio.subtitles %] [% subtitle.subfield %][% END %][% IF checkout_info.biblio.author %], by [% checkout_info.biblio.author %][% END %][% IF ( checkout_info.item.itemnotes ) %]- [% checkout_info.item.itemnotes %][% END %] [% checkout_info.item.barcode %] [% IF checkout_info.NEEDSCONFIRMATION %] -- 2.9.3