From 0e8eaa8475f20df5d275610259417a21c0d4ef1a Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 2 Jun 2022 11:26:31 +0200 Subject: [PATCH] Bug 27272: catalogue/detail --- catalogue/detail.pl | 19 +++++++++++++++---- .../prog/en/modules/catalogue/detail.tt | 11 ++++++----- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/catalogue/detail.pl b/catalogue/detail.pl index ab44b85fd6a..2d1ae500069 100755 --- a/catalogue/detail.pl +++ b/catalogue/detail.pl @@ -160,9 +160,19 @@ $template->param( my $itemtypes = { map { $_->{itemtype} => $_ } @{ Koha::ItemTypes->search_with_localization->unblessed } }; -my $dbh = C4::Context->dbh; - -my $all_items = $biblio->items; +my $all_items = $biblio->items( + {}, + { + # FIXME A different order is expected if at least one items.serial is true + order_by => [ + 'homebranch.branchname', + 'me.enumchron', + \"LDAP( me.copynumber, 8, '0' )", + -asc => 'me.dateacessioned' + ], + join => ['homebranch'] + } +); my @items; my $patron = Koha::Patrons->find( $borrowernumber ); while ( my $item = $all_items->next ) { @@ -351,7 +361,7 @@ foreach my $item (@items) { # FIXME The following must be Koha::Item->serial my $serial_item = Koha::Serial::Items->find($item->itemnumber); if ( $serial_item ) { - $item_info->{serial} = $serial_item->serialid; # FIXME Not returning a Koha::Object! + $item_info->{serial} = $serial_item; $itemfields{publisheddate} = 1; } @@ -425,6 +435,7 @@ foreach my $item (@items) { if ( not C4::Context->IsSuperLibrarian() and $userenv->{branch} ne $item->homebranch ) { $item_info->{cannot_be_edited} = 1; + $item_info->{not_same_branch} = 1; } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt index 8fde562c867..067cb17ca8f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt @@ -445,7 +445,7 @@ Note that permanent location is a code, and location may be an authval. [% ELSE %] Checked out [% END %] - [% UNLESS ( item.NOTSAMEBRANCH ) %] + [% UNLESS ( item.not_same_branch) %] [% IF item.checkout.onsite_checkout %] by [% ELSE %] @@ -495,10 +495,11 @@ Note that permanent location is a code, and location may be an authval. [% END %] [% END %] - [% IF ( item.itemnotforloan || item.notforloan_per_itemtype ) %] + [% IF ( item.notforloan || item.itemtype.notforloan ) %] Not for loan - [% IF ( item.notforloanvalue ) %] - ([% item.notforloanvalue | html %]) + [% SET not_for_loan_description = AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.notforloan', authorised_value => item.notforloan ) %] + [% IF not_for_loan_description %] + ([% not_for_loan_description | html %]) [% END %] [% END %] @@ -529,7 +530,7 @@ Note that permanent location is a code, and location may be an authval. [% END %] [% IF ( item.restricted ) %] - ([% item.restrictedvalue | html %]) + ([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.restricted', authorised_value => item.restricted ) | html %]) [% END %] [% item.datelastseen | $KohaDates %] -- 2.25.1