From 0370e0dcd2585c3de0245718c6da43ad86f82ae8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 6 Nov 2019 19:16:57 +0100 Subject: [PATCH] Bug 23590: Clean TT variables for patrons MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Just a bit of cleaning Sponsored-by: BULAC - http://www.bulac.fr/ Signed-off-by: Séverine QUEUNE Signed-off-by: Katrin Fischer Signed-off-by: Martin Renvoize --- .../prog/en/modules/suggestion/suggestion.tt | 34 +++++++++---------- suggestion/suggestion.pl | 23 +++---------- 2 files changed, 22 insertions(+), 35 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt index 09bc0534bc..4d3bda832a 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/suggestion/suggestion.tt @@ -171,9 +171,9 @@ [% tp('purchase suggestion created by', 'Created by:') | html %] [% suggesteddate | $KohaDates %] - [% IF ( suggestedby_borrowernumber ) %] - [% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %]) - [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %]) + [% IF ( suggestedby_patron.borrowernumber ) %] + [% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %]) + [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %]) [% END %] @@ -181,9 +181,9 @@ Managed by: [% manageddate | $KohaDates %] - [% IF ( managedby_borrowernumber ) %] - [% managedby_surname | html %], [% managedby_firstname | html %] ([% suggestedby_cardnumber | html %]) - [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %]) + [% IF ( managedby_patron.borrowernumber ) %] + [% managedby_patron.surname | html %], [% managedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %]) + [% Branches.GetName( managedby_patron.branchcode ) | html %] ([% managedby_patron.category.description | html %]) [% END %] @@ -191,9 +191,9 @@ Accepted on: [% accepteddate | $KohaDates %] - [% IF ( acceptedby_borrowernumber ) %] - [% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %]) - [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %]) + [% IF ( acceptedby_patron.borrowernumber ) %] + [% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %]) + [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %]) [% END %] @@ -368,13 +368,13 @@ [% INCLUDE 'date-format.inc' %] - [% IF ( suggestedby_borrowernumber ) %][% suggestedby_surname | html %], [% suggestedby_firstname | html %] ([% suggestedby_cardnumber | html %]) [% Branches.GetName( suggestedby_branchcode ) | html %] ([% suggestedby_description | html %])[% END %] + [% IF ( suggestedby_patron.borrowernumber ) %][% suggestedby_patron.surname | html %], [% suggestedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %]) [% Branches.GetName( suggestedby_patron.branchcode ) | html %] ([% suggestedby_patron.category.description | html %])[% END %] [% INCLUDE 'date-format.inc' %] - [% IF ( acceptedby_borrowernumber ) %][% acceptedby_surname | html %], [% acceptedby_firstname | html %] ([% suggestedby_cardnumber | html %]) [% Branches.GetName( acceptedby_branchcode ) | html %] ([% acceptedby_description | html %])[% END %] + [% IF ( acceptedby_patron.borrowernumber ) %][% acceptedby_patron.surname | html %], [% acceptedby_patron.firstname | html %] ([% suggestedby_patron.cardnumber | html %]) [% Branches.GetName( acceptedby_patron.branchcode ) | html %] ([% acceptedby_patron.category.description | html %])[% END %] @@ -389,12 +389,12 @@ You - [% IF managedby_borrowernumber && logged_in_user.borrowernumber != managedby_borrowernumber %] - | Previously was [% INCLUDE 'patron-title.inc' patron=managedby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( managedby_branchcode ) | html %] ([% managedby_description | html %]) + [% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %] + | Previously was [% INCLUDE 'patron-title.inc' patron=managedby_patron hide_patron_infos_if_needed=1 %] [% Branches.GetName( managedby_patron.branchcode ) | html %] ([% managedby_patron.category.description | html %]) [% END %]
Select manager - [% IF managedby_borrowernumber && logged_in_user.borrowernumber != managedby_borrowernumber %] + [% IF managedby_patron.borrowernumber && logged_in_user.borrowernumber != managedby_patron.borrowernumber %] Keep existing manager [% END %] @@ -1034,12 +1034,12 @@ $("#managedby_name").empty(); $("#managedby").val(''); - var borrowername = "[% managedby_firstname | html %] [% managedby_surname | html %]"; + var borrowername = "[% managedby_patron.firstname | html %] [% managedby_patron.surname | html %]"; var managerlink = '' + + '?borrowernumber=[% managedby_patron.borrowernumber | html %]">' + borrowername + ''; $('#managedby_name').html(managerlink); - $('#managedby').val([% managedby_borrowernumber | html %]); + $('#managedby').val([% managedby_patron.borrowernumber | html %]); }); }); diff --git a/suggestion/suggestion.pl b/suggestion/suggestion.pl index 723ccecaad..b1c9af8b2c 100755 --- a/suggestion/suggestion.pl +++ b/suggestion/suggestion.pl @@ -328,25 +328,12 @@ if ($op=~/else/) { ); } -foreach my $element ( qw(managedby suggestedby acceptedby) ) { -# $debug || warn $$suggestion_ref{$element}; - if ($$suggestion_ref{$element}){ - my $patron = Koha::Patrons->find( $$suggestion_ref{$element} ); - my $category = $patron->category; - $template->param( - $element."_patron"=> $patron, - $element."_borrowernumber"=>$patron->borrowernumber, - $element."_firstname"=>$patron->firstname, - $element."_surname"=>$patron->surname, - $element."_cardnumber"=>$patron->cardnumber, - $element."_branchcode"=>$patron->branchcode, - $element."_description"=>$category->description, - $element."_category_type"=>$category->category_type, - ); - } -} $template->param( - %$suggestion_ref, + "${_}_patron" => scalar Koha::Patrons->find( $suggestion_ref->{$_} ) ) + for qw(managedby suggestedby acceptedby); + +$template->param( + %$suggestion_ref, "op_$op" => 1, "op" =>$op, ); -- 2.39.5