Koha/members/routing-lists.pl
Katrin Fischer ecc3a55917 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.

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
2018-06-22 15:02:46 +00:00

68 lines
2.1 KiB
Perl
Executable file

#!/usr/bin/perl
# Copyright 2012 Prosentient Systems
#
# 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 <http://www.gnu.org/licenses>.
use Modern::Perl;
use CGI qw ( -utf8 );
use C4::Output;
use C4::Auth qw/:DEFAULT/;
use C4::Members;
use C4::Members::Attributes qw(GetBorrowerAttributes);
use C4::Context;
use C4::Serials;
use Koha::Patrons;
use CGI::Session;
my $query = new CGI;
my ( $template, $loggedinuser, $cookie ) = get_template_and_user (
{
template_name => 'members/routing-lists.tt',
query => $query,
type => "intranet",
authnotrequired => 0,
flagsrequired => { circulate => 'circulate_remaining_permissions' },
}
);
my $findborrower = $query->param('findborrower');
$findborrower =~ s|,| |g;
my $borrowernumber = $query->param('borrowernumber');
my $branch = C4::Context->userenv->{'branch'};
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 } );
$template->param(
patron => $patron,
findborrower => $findborrower,
branch => $branch, # FIXME This is confusing
);
if (C4::Context->preference('ExtendedPatronAttributes')) {
my $attributes = GetBorrowerAttributes($borrowernumber);
$template->param(
ExtendedPatronAttributes => 1,
extendedattributes => $attributes
);
}
output_html_with_http_headers $query, $cookie, $template->output;