From 09b84ef386e07de6fb07400a450b87e114e90325 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Thu, 1 Aug 2019 11:15:27 +0200 Subject: [PATCH] Bug 24364: Display item holding library in opac issues Test plan: 1) Create a SHOW_LIB patron attribute type, with YES_NO as authorized value category. (Administration -> Patron attribute types -> New patron attribute type) Check 'Display in OPAC' and 'Editable in OPAC' if you want users to be able to toggle library display themselves. 2) Set the SHOW_LIB attribute to yes for a given patron. 3) Check that the library is displayed in this patron's opac issues. ('Your summary' -> 'Checked out' and 'Overdue' tabs) --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt | 16 ++++++++++++++++ opac/opac-user.pl | 12 ++++++++++++ 2 files changed, 28 insertions(+) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt index 96c494c..845bb96 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-user.tt @@ -198,6 +198,9 @@ Barcode [% END %] Call no. + [% IF ( show_library ) %] + Library + [% END %] [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %] Renew [% END %] @@ -293,6 +296,12 @@ Call no.: [% ISSUE.itemcallnumber | html %] + [% IF ( show_library ) %] + + Library: + [% ISSUE.library | html %] + + [% END %] [% IF ( OpacRenewalAllowed && !( logged_in_user.is_expired && logged_in_user.category.effective_BlockExpiredPatronOpacActions ) ) %] [% IF ISSUE.renewed %]Renewed!
[% END %] @@ -498,6 +507,7 @@ [% UNLESS ( item_level_itypes ) %]Item type [% END %] [% IF ( show_barcode ) %]Barcode[% END %] Call no. + [% IF ( show_library ) %]Library[% END %] Due [% IF ( OpacRenewalAllowed ) %] Renew @@ -568,6 +578,12 @@ Call no.: [% OVERDUE.itemcallnumber | html %] + [% IF ( show_library ) %] + + Library: + [% OVERDUE.library | html %] + + [% END %] Date due: diff --git a/opac/opac-user.pl b/opac/opac-user.pl index 6c55ad2..c9a7cb1 100755 --- a/opac/opac-user.pl +++ b/opac/opac-user.pl @@ -46,6 +46,7 @@ use Koha::Patron::Discharge; use Koha::Patrons; use constant ATTRIBUTE_SHOW_BARCODE => 'SHOW_BCODE'; +use constant ATTRIBUTE_SHOW_LIBRARY => 'SHOW_LIB'; use Scalar::Util qw(looks_like_number); use Date::Calc qw( @@ -255,6 +256,9 @@ if ( $pending_checkouts->count ) { # Useless test } $issue->{biblio_object} = Koha::Biblios->find($issue->{biblionumber}); + my $item = Koha::Items->find($issue->{'itemnumber'}); + my $library = Koha::Libraries->find($item->holdingbranch); + $issue->{'library'} = $library->branchname; push @issuedat, $issue; $count++; @@ -296,6 +300,14 @@ if ($show_barcode) { } $template->param( show_barcode => 1 ) if $show_barcode; +my $show_library = Koha::Patron::Attribute::Types->search( + { code => ATTRIBUTE_SHOW_LIBRARY } )->count; +if ($show_library) { + my $patron_show_library = GetBorrowerAttributeValue($borrowernumber, ATTRIBUTE_SHOW_LIBRARY); + undef $show_library if defined($patron_show_library) && !$patron_show_library; +} +$template->param( show_library => 1 ) if $show_library; + # now the reserved items.... my $reserves = Koha::Holds->search( { borrowernumber => $borrowernumber } ); -- 2.7.4