From ab1a88ddd37e4480475a190c2fe94af9c4eaba47 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch>
Date: Mon, 4 May 2015 15:17:04 +0200
Subject: [PATCH] [SIGNED-OFF] Bug 14136: Remove superfluous template
 parameters from members/member-flags.pl

This bug was triggered because intranet-error.log had entries like the following:
member-flags.pl: Use of uninitialized value $roadtype in concatenation (.) or string at /usr/share/kohaclone/members/member-flags.pl line 176.

To reproduce: Have a patron without roadtype and go to
Home > Patrons > Set permissions for ...

There are some template parameters that are not used in the template member-flags.tt ( $roadtype is used while preparing $address )

Unused template params are:
cardnumber
othernames
categorycode
category_type
categoryname
address
address2
city
state
zipcode
country
phone
phonepro
mobile
email
emailpro
branchcode
branchname
loop <--- this is used
is_child
activeBorrowerRelationship
RoutingSerials

To test:
- Verify that you get the warning above in intranet-error.log
- Verify that the parameters above are not used in the template member-flags.tt
- Apply patch
- Verify that setting permissions for patrons still works

Note: There are a lot of indenting issues in this file. This patch does not intend to resolve them.
Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
Warn exists, now removed. No errors
---
 members/member-flags.pl |   33 ++++-----------------------------
 1 file changed, 4 insertions(+), 29 deletions(-)

diff --git a/members/member-flags.pl b/members/member-flags.pl
index 68c52aa..60f9d37 100755
--- a/members/member-flags.pl
+++ b/members/member-flags.pl
@@ -171,36 +171,11 @@ if (C4::Context->preference('ExtendedPatronAttributes')) {
     );
 }
 
-# Computes full borrower address
-my $roadtype = C4::Koha::GetAuthorisedValueByCode( 'ROADTYPE', $bor->{streettype} );
-my $address = $bor->{'streetnumber'} . " $roadtype " . $bor->{'address'};
-
 $template->param(
-		borrowernumber => $bor->{'borrowernumber'},
-    cardnumber => $bor->{'cardnumber'},
-		surname => $bor->{'surname'},
-		firstname => $bor->{'firstname'},
-        othernames => $bor->{'othernames'},
-		categorycode => $bor->{'categorycode'},
-		category_type => $bor->{'category_type'},
-		categoryname => $bor->{'description'},
-        address => $address,
-		address2 => $bor->{'address2'},
-		city => $bor->{'city'},
-        state => $bor->{'state'},
-		zipcode => $bor->{'zipcode'},
-		country => $bor->{'country'},
-		phone => $bor->{'phone'},
-        phonepro => $bor->{'phonepro'},
-        mobile => $bor->{'mobile'},
-		email => $bor->{'email'},
-        emailpro => $bor->{'emailpro'},
-		branchcode => $bor->{'branchcode'},
-		branchname => GetBranchName($bor->{'branchcode'}),
-		loop => \@loop,
-		is_child        => ($bor->{'category_type'} eq 'C'),
-		activeBorrowerRelationship => (C4::Context->preference('borrowerRelationship') ne ''),
-        RoutingSerials => C4::Context->preference('RoutingSerials'),
+                  borrowernumber => $bor->{'borrowernumber'},
+                  surname        => $bor->{'surname'},
+                  firstname      => $bor->{'firstname'},
+                  loop           => \@loop,
 		);
 
     output_html_with_http_headers $input, $cookie, $template->output;
-- 
1.7.9.5