From ca2eaf5eb2986add3eb32b0723f89397fc5fbc74 Mon Sep 17 00:00:00 2001 From: Katrin Fischer 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 subscriptions:

-
[% IF ( routing ) %][% END %] +[% IF ( routing ) %][% END %]

-[% 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 %]

-[% IF ( subscripLoop ) %] - - - - - - - - -[% FOREACH subscripLoop IN subscripLoop %] - - + + [% END %] + +
Subscription titleRouting list
- - [% subscripLoop.title %] - + +[% IF ( routinglists ) %] + + + + + + + + + + [% FOREACH routinglist IN routinglists %] + + - + + - - [% END %] - -
Subscription titlePositionRouting list
+ + [% routinglist.subscription.biblio.title %] - - - Edit routing list - + + [% routinglist.ranking %] + + + Edit routing list - - -
- - [% ELSE %] -

Patron does not belong to any subscription routing lists.

- + - [% END %] +
+[% ELSE %] +

Patron does not belong to any subscription routing lists.

+ + +[% END %]
- - 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