From ca2eaf5eb2986add3eb32b0723f89397fc5fbc74 Mon Sep 17 00:00:00 2001 From: Katrin Fischer <katrin.fischer.83@web.de> Date: Fri, 16 Mar 2018 09:57:06 +0100 Subject: [PATCH] Bug 20456: Switch routling list tab in staff to use Koha::Object Bug 20400 added a routing list tab to the patron account in the OPAC using Koha::Object. This patch switches the routing list tab in the patron account in intranet over to the new code. It also adds an additional column showing the position of the patron on the routing list and fixes the search. To test: - Create some subscriptions with routing lists - Take a look at the patron accounts of several patrons having - no entries on routing lists - 1 entry on a routing list - entries on several routing lists - Make sure the display works correctly. - Search for a subscription and make sure search works. --- .../prog/en/modules/members/routing-lists.tt | 78 +++++++++++----------- members/routing-lists.pl | 17 +---- 2 files changed, 42 insertions(+), 53 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt index 90c059e..5313441 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/routing-lists.tt @@ -21,60 +21,62 @@ <!-- Search Bar --> <p class="tip">Search subscriptions:</p> -<form action="/cgi-bin/koha/serials/serials-home.pl" method="get">[% IF ( routing ) %]<input type="hidden" name="routing" value="[% routing %]" />[% END %]<input type="hidden" name="searched" value="1" /> <label for="ISSN_filter">ISSN:</label> <input type="text" size="10" maxlength="11" name="ISSN_filter" id="ISSN_filter" value="[% ISSN_filter %]" /> <label for="title_filter">Title:</label> <input type="text" size="20" maxlength="40" name="title_filter" id="title_filter" value="[% title_filter %]" /><input type="submit" value="Search" class="submit" /> +<form action="/cgi-bin/koha/serials/serials-search.pl" method="get">[% IF ( routing ) %]<input type="hidden" name="routing" value="[% routing %]" />[% END %]<input type="hidden" name="searched" value="1" /> <label for="ISSN_filter">ISSN:</label> <input type="text" size="10" maxlength="11" name="ISSN_filter" id="ISSN_filter" value="[% ISSN_filter %]" /> <label for="title_filter">Title:</label> <input type="text" size="20" maxlength="40" name="title_filter" id="title_filter" value="[% title_filter %]" /><input type="submit" value="Search" class="submit" /> </form> <!-- Search Bar End --> <h1> -[% IF ( countSubscrip ) %] -[% countSubscrip %] Subscription routing list(s) +[% UNLESS ( routinglists ) %] +0 subscription routing lists +[% ELSIF ( routinglists.size() == 1 ) %] +[% routinglists.size() %] subscription routing list [% ELSE %] -0 Subscription routing lists +[% routinglists.size() %] subscription routing lists [% END %] </h1> <div id="subscriptions"> -[% IF ( subscripLoop ) %] -<table id="subscriptiont"> - <thead> - <tr> - <th>Subscription title</th> - <th>Routing list</th> - </tr> - </thead> - <tbody> -[% FOREACH subscripLoop IN subscripLoop %] -<tr> - <td> - <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% subscripLoop.subscriptionid %]"><strong> - [% subscripLoop.title %] - </strong> + +[% IF ( routinglists ) %] + <table id="subscriptiont"> + <thead> + <tr> + <th>Subscription title</th> + <th>Position</th> + <th>Routing list</th> + </tr> + </thead> + <tbody> + [% FOREACH routinglist IN routinglists %] + <tr> + <td> + <a href="/cgi-bin/koha/serials/subscription-detail.pl?subscriptionid=[% routinglist.subscription.subscriptionid %]"> + [% routinglist.subscription.biblio.title %] </a> - </td> - <td> - <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% subscripLoop.subscriptionid %]"><strong> - Edit routing list - </strong> + </td> + <td> + [% routinglist.ranking %] + </td> + <td> + <a href="/cgi-bin/koha/serials/routing.pl?subscriptionid=[% routinglist.subscription.subscriptionid %]"> + Edit routing list </a> - <input type="hidden" name="biblionumber" value="[% biblionumber %]" /> - <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber %]" /> - </td> - </tr> - [% END %] - </tbody> - </table> - </form> - [% ELSE %] - <p>Patron does not belong to any subscription routing lists.</p> - <input type="hidden" name="biblionumber" value="[% biblionumber %]" /> + <input type="hidden" name="biblionumber" value="[% routinglist.subscription.biblionumber %]" /> <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber %]" /> - [% END %] + </td> + </tr> + [% END %] + </tbody> + </table> +[% ELSE %] + <p>Patron does not belong to any subscription routing lists.</p> + <input type="hidden" name="biblionumber" value="[% routinglist.subscription.biblionumber %]" /> + <input type="hidden" name="borrowernumber" value="[% patron.borrowernumber %]" /> +[% END %] </div> - - </div> </div> diff --git a/members/routing-lists.pl b/members/routing-lists.pl index 793317d..17f1980 100755 --- a/members/routing-lists.pl +++ b/members/routing-lists.pl @@ -51,23 +51,10 @@ my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in" my $patron = Koha::Patrons->find( $borrowernumber ); output_and_exit_if_error( $query, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } ); -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'}; - push( @subscripLoop, \%getSubscrip ); -} +my @routinglists = $patron->get_routinglists(); $template->param( - countSubscrip => scalar @subscripLoop, - subscripLoop => \@subscripLoop, - routinglistview => 1 + routinglists => \@routinglists, ); $template->param( -- 2.1.4