From 7307f63f4670bab9c03f8e49ce4815ac89b5eb36 Mon Sep 17 00:00:00 2001 From: Katrin Fischer Date: Thu, 15 Mar 2018 08:40:12 +0000 Subject: [PATCH] Bug 20400: Add routing list tab in OPAC This patch adds the base for the new feature: A list of the routling lists a patron appears on in the OPAC. To test: - Make sure RoutingSerials is not activated - Check patron account in OPAC - no tab should appear - Turn the preference on - the tab should appear now - Add some subscriptions and add your patron to the routing list - Check tab again - it should now show a list of the serials with links to the detail page in the OPAC --- .../opac-tmpl/bootstrap/en/includes/usermenu.inc | 9 +++ .../bootstrap/en/modules/opac-routing-lists.tt | 68 ++++++++++++++++++++++ opac/opac-routing-lists.pl | 68 ++++++++++++++++++++++ 3 files changed, 145 insertions(+) create mode 100644 koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-routing-lists.tt create mode 100644 opac/opac-routing-lists.pl diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc index 7d27f22..173be1f 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/usermenu.inc @@ -96,6 +96,15 @@ your lists [% END %] + [% IF Koha.Preference( 'RoutingSerials' ) == 1 %] + [% IF ( suggestionsview ) %] +
  • + [% ELSE %] +
  • + [% END %] + your routing lists
  • + [% END %] + [% IF Koha.Preference( 'useDischarge' ) == 1 %] [% IF ( dischargeview ) %]
  • diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-routing-lists.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-routing-lists.tt new file mode 100644 index 0000000..fa791a6 --- /dev/null +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-routing-lists.tt @@ -0,0 +1,68 @@ +[% USE Koha %] +[% USE KohaDates %] +[% INCLUDE 'doc-head-open.inc' %] +[% IF ( LibraryNameTitle ) %][% LibraryNameTitle %][% ELSE %]Koha online[% END %] catalog › Your routing lists +[% INCLUDE 'doc-head-close.inc' %] +[% BLOCK cssinclude %] + +[% END %] + + +[% INCLUDE 'bodytag.inc' bodyid='opac-account' bodyclass='scrollto' %] +[% INCLUDE 'masthead.inc' %] + +
    + + +
    +
    +
    + +
    +
    +
    + + +

    Routing lists

    + + [% IF ( subscriptionLoop ) %] + + + + + + + + + [% FOREACH subscription IN subscriptionLoop %] + [% IF ( subscripLoop.odd ) %][% ELSE %][% END %] + + + [% END %] + +
    Subscription title
    + + [% subscription.title %] + +
    + [% ELSE %] +

    You are currently not listed on any routing lists.

    + [% END %] +
    +
    +
    +
    +
    + +[% INCLUDE 'opac-bottom.inc' %] +[% BLOCK jsinclude %] +[% INCLUDE 'datatables.inc' %] + +[% END %] diff --git a/opac/opac-routing-lists.pl b/opac/opac-routing-lists.pl new file mode 100644 index 0000000..55e3878 --- /dev/null +++ b/opac/opac-routing-lists.pl @@ -0,0 +1,68 @@ +#!/usr/bin/perl + +# This file is part of Koha. +# +# Koha is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# Koha is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Koha; if not, see . + + +use Modern::Perl; +use CGI qw ( -utf8 ); +use C4::Members; +use C4::Auth; +use C4::Output; +use C4::Serials; +use Koha::Patrons; +use Koha::Subscriptions; + +my $query = new CGI; +my ( $template, $borrowernumber, $cookie ) = get_template_and_user( + { + template_name => "opac-routing-lists.tt", + query => $query, + type => "opac", + authnotrequired => 0, + debug => 1, + } +); + +my $patron = Koha::Patrons->find( $borrowernumber ); +my $category = $patron->category; +my $borrower= $patron->unblessed; +$borrower->{description} = $category->description; +$borrower->{category_type} = $category->category_type; +$template->param( BORROWER_INFO => $borrower ); + + +my $count; +my @borrowerSubscriptions; +($count, @borrowerSubscriptions) = GetSubscriptionsFromBorrower($borrowernumber ); +my @subscripLoop; + +foreach my $num_res (@borrowerSubscriptions) { + my %getSubscrip; + $getSubscrip{subscriptionid} = $num_res->{'subscriptionid'}; + $getSubscrip{title} = $num_res->{'title'}; + $getSubscrip{borrowernumber} = $num_res->{'borrowernumber'}; + my $subscription = Koha::Subscriptions->find( $num_res->{'subscriptionid'} ); + $getSubscrip{biblionumber} = $subscription->biblionumber(); + push( @subscripLoop, \%getSubscrip ); +} + +$template->param( + countSubscrip => scalar @subscripLoop, + subscriptionLoop => \@subscripLoop, + routinglistview => 1 +); + +output_html_with_http_headers $query, $cookie, $template->output, undef, { force_no_caching => 1 }; -- 2.1.4