From 9b9a7b670ccd9e1437a32697f81645af6b1e93bd Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 3 Jun 2022 08:20:17 +0200 Subject: [PATCH] Bug 31316: Remove GetItemsInfo from opac-sendbasket Bug 27272 is going to remove C4::Items::GetItemsInfo in favour of Koha::Items->search. Here we are going to deal with opac-sendbasket 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: Nick Clemens Signed-off-by: Tomas Cohen Arazi --- .../opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt | 8 +++++--- .../opac-tmpl/bootstrap/en/modules/opac-sendshelf.tt | 8 +++++--- opac/opac-sendbasket.pl | 8 ++------ opac/opac-sendshelf.pl | 7 ++----- 4 files changed, 14 insertions(+), 17 deletions(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt index 00f93e7e0a..38978d299a 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendbasket.tt @@ -1,6 +1,8 @@ [% USE raw %] [% USE HtmlToText %] [% USE Koha %] +[% USE AuthorisedValues %] +[% USE Branches %] Your cart @@ -143,12 +145,12 @@ Your cart 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/opac-tmpl/bootstrap/en/modules/opac-sendshelf.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelf.tt index be952e2399..168dce74be 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelf.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-sendshelf.tt @@ -1,4 +1,6 @@ [% USE raw %] +[% USE AuthorisedValues %] +[% USE Branches %] Your list : [% shelfname | $raw %] @@ -145,12 +147,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/opac/opac-sendbasket.pl b/opac/opac-sendbasket.pl index 9448f21552..1500446539 100755 --- a/opac/opac-sendbasket.pl +++ b/opac/opac-sendbasket.pl @@ -27,7 +27,6 @@ use Try::Tiny qw( catch try ); use C4::Biblio qw( GetMarcSubjects ); -use C4::Items qw( GetItemsInfo ); use C4::Auth qw( get_template_and_user ); use C4::Output qw( output_html_with_http_headers ); use C4::Templates; @@ -49,8 +48,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( my $bib_list = $query->param('bib_list') || ''; my $email_add = $query->param('email_add'); -my $dbh = C4::Context->dbh; - if ( $email_add ) { die "Wrong CSRF token" unless Koha::Token->new->check_csrf({ session_id => scalar $query->cookie('CGISESSID'), @@ -88,19 +85,18 @@ if ( $email_add ) { my $marcauthorsarray = $biblio->get_marc_contributors; my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); - my @items = GetItemsInfo( $biblionumber ); + my $items = $biblio->items->search_ordered->filter_by_visible_in_opac({ patron => $patron }); my $hasauthors = 0; if($dat->{'author'} || @$marcauthorsarray) { $hasauthors = 1; } - $dat->{MARCSUBJCTS} = $marcsubjctsarray; $dat->{MARCAUTHORS} = $marcauthorsarray; $dat->{HASAUTHORS} = $hasauthors; $dat->{'biblionumber'} = $biblionumber; - $dat->{ITEM_RESULTS} = \@items; + $dat->{ITEM_RESULTS} = $items; $iso2709 .= $record->as_usmarc(); diff --git a/opac/opac-sendshelf.pl b/opac/opac-sendshelf.pl index 817c1069a9..b9cec96b24 100755 --- a/opac/opac-sendshelf.pl +++ b/opac/opac-sendshelf.pl @@ -30,7 +30,6 @@ use C4::Biblio qw( GetMarcISBN GetMarcSubjects ); -use C4::Items qw( GetItemsInfo ); use C4::Output qw( output_html_with_http_headers ); use Koha::Biblios; use Koha::Email; @@ -56,8 +55,6 @@ my ( $template, $borrowernumber, $cookie ) = get_template_and_user ( my $shelfid = $query->param('shelfid'); my $email = $query->param('email'); -my $dbh = C4::Context->dbh; - my $shelf = Koha::Virtualshelves->find( $shelfid ); if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { if ( $email ) { @@ -97,13 +94,13 @@ if ( $shelf and $shelf->can_be_viewed( $borrowernumber ) ) { my $marcauthorsarray = $biblio->get_marc_contributors; my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour ); - my @items = GetItemsInfo( $biblionumber ); + my $items = $biblio->items->search_ordered->filter_by_visible_in_opac({ patron => $patron }); $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(); -- 2.39.5