From 992078f494c54643fa20b37f0c11b1392bf10323 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 3 Jun 2022 08:33:00 +0200 Subject: [PATCH] Bug 31320: Remove GetItemsInfo from virtualshelves/sendshelf.pl MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit And GetItemsLocationInfo from shelves.pl Bug 27272 is going to remove C4::Items::GetItemsInfo in favour of Koha::Items->search_ordered. Here we are going to deal with virtualshelves/sendshelf.pl Test plan: List items on the modified view and confirm that all the info is displayed correctly Signed-off-by: Owen Leonard Signed-off-by: Joonas Kylmälä Signed-off-by: Tomas Cohen Arazi --- .../en/modules/virtualshelves/sendshelf.tt | 8 +++++--- .../prog/en/modules/virtualshelves/shelves.tt | 18 ++++++++++++------ virtualshelves/sendshelf.pl | 5 ++--- virtualshelves/shelves.pl | 5 ++--- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt index 81567cb980..5ee9a72f06 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/sendshelf.tt @@ -1,4 +1,6 @@ [% USE raw %] +[% USE AuthorisedValues %] +[% USE Branches %] Your list: [% shelfname | $raw %] @@ -144,12 +146,12 @@ Your list: [% shelfname | $raw %] In online catalog: [% OPACBaseURL | $raw %]/cgi-bin/koha/opac-detail.pl?biblionumber=[% BIBLIO_RESULT.biblionumber | html %]

[% END %] - [% IF ( BIBLIO_RESULT.ITEM_RESULTS.size ) %] + [% IF ( BIBLIO_RESULT.ITEM_RESULTS.count ) %]

Items:

    [% FOREACH ITEM_RESULT IN BIBLIO_RESULT.ITEM_RESULTS %]
  • - [% ITEM_RESULT.branchname | $raw %] - [% ITEM_RESULT.location | $raw %] + [% Branches.GetName(ITEM_RESULT.holdingbranch) | $raw %] + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => ITEM_RESULT.location ) | html %] [% IF ITEM_RESULT.itemcallnumber %]([% ITEM_RESULT.itemcallnumber | $raw %])[% END %] [% ITEM_RESULT.barcode | $raw %]
  • [% END %] diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt index 356f801614..6984b804df 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/virtualshelves/shelves.tt @@ -2,6 +2,8 @@ [% USE Asset %] [% USE Koha %] [% USE KohaDates %] +[% USE AuthorisedValues %] +[% USE Branches %] [% SET footerjs = 1 %] [% INCLUDE 'doc-head-open.inc' %] @@ -315,7 +317,7 @@ [% IF ( itemsloo.notforloan ) %] <span class="noholdstext">No holds allowed</span> [% ELSE %] - [% IF ( itemsloo.ITEM_RESULTS.size ) %] + [% IF ( itemsloo.ITEM_RESULTS.count ) %] <a id="reserve_[% itemsloo.biblionumber | html %]" href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | html %]">Holds</a> [% IF ( holdfor ) %] <span class="holdforlink">| <a href="/cgi-bin/koha/reserve/request.pl?biblionumber=[% itemsloo.biblionumber | uri %]&findborrower=[% holdfor_patron.cardnumber | uri %]">Place hold for [% INCLUDE 'patron-title.inc' patron => holdfor_patron no_title => 1 %]</a></span>[% END %] [% ELSE %] @@ -334,12 +336,16 @@ <td>[% itemsloo.dateadded | $KohaDates%]</td> <td> <ul> - [% FOREACH result IN itemsloo.ITEM_RESULTS %] + [% FOREACH item IN itemsloo.ITEM_RESULTS %] <li> - [% result.holdingbranch | html %] - [% IF ( result.location_intranet ) %]<span class="shelvingloc">[% result.location_intranet | html %]</span>[% END %] - [% IF ( result.itemcallnumber ) %] - [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=%22[% result.itemcallnumber |uri %]%22">[% result.itemcallnumber | html %]</a>] + [% Branches.GetName(item.holdingbranch) | html %] + [% IF ( item.location ) %] + <span class="shelvingloc"> + [% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location', authorised_value => item.location ) | html %] + </span> + [% END %] + [% IF ( item.itemcallnumber ) %] + [<a href="/cgi-bin/koha/catalogue/search.pl?idx=callnum&q=%22[% item.itemcallnumber | uri %]%22">[% item.itemcallnumber | html %]</a>] [% END %] </li> [% END %] diff --git a/virtualshelves/sendshelf.pl b/virtualshelves/sendshelf.pl index e87092884c..0dd51b78ea 100755 --- a/virtualshelves/sendshelf.pl +++ b/virtualshelves/sendshelf.pl @@ -29,7 +29,6 @@ use C4::Biblio qw( GetMarcISBN GetMarcSubjects ); -use C4::Items qw( GetItemsInfo ); use C4::Output qw( output_html_with_http_headers output_and_exit @@ -83,13 +82,13 @@ if ($to_address) { my $marcauthorsarray = $biblio->get_marc_contributors; my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); - my @items = GetItemsInfo($biblionumber); + my $items = $biblio->items->search_ordered; $dat->{ISBN} = GetMarcISBN($record, $marcflavour); $dat->{MARCSUBJCTS} = $marcsubjctsarray; $dat->{MARCAUTHORS} = $marcauthorsarray; $dat->{'biblionumber'} = $biblionumber; - $dat->{ITEM_RESULTS} = \@items; + $dat->{ITEM_RESULTS} = $items; $dat->{HASAUTHORS} = $dat->{'author'} || @$marcauthorsarray; $iso2709 .= $record->as_usmarc(); diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl index eb5e77461f..fa92cfcd6e 100755 --- a/virtualshelves/shelves.pl +++ b/virtualshelves/shelves.pl @@ -28,7 +28,6 @@ use C4::Koha qw( GetNormalizedOCLCNumber GetNormalizedUPC ); -use C4::Items qw( GetItemsLocationInfo ); use C4::Members; use C4::Output qw( pagination_bar output_html_with_http_headers ); use C4::XSLT qw( XSLTParse4Display ); @@ -323,8 +322,8 @@ if ( $op eq 'view' ) { } # Getting items infos for location display - my @items_infos = &GetItemsLocationInfo( $biblionumber ); - $this_item->{'ITEM_RESULTS'} = \@items_infos; + my $items = $biblio->items; + $this_item->{'ITEM_RESULTS'} = $items; $this_item->{biblionumber} = $biblionumber; push @items, $this_item; } -- 2.39.5