From 24993cc1a3df9e0b051ff37fa391a3c290c8c46e Mon Sep 17 00:00:00 2001 From: Chris Cormack Date: Fri, 3 Jan 2014 11:04:01 +1300 Subject: [PATCH] Tidying up output, removing blank lines --- lib/NCIP/Handler.pm | 6 +++++- lib/NCIP/Handler/LookupUser.pm | 7 ++++++- templates/includes/LookupUserResponse.inc | 16 +++++++++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/lib/NCIP/Handler.pm b/lib/NCIP/Handler.pm index bf1d7c7..713967c 100644 --- a/lib/NCIP/Handler.pm +++ b/lib/NCIP/Handler.pm @@ -41,7 +41,11 @@ sub render_output { my $vars = shift; my $template = Template->new( - { INCLUDE_PATH => $self->templates, } ); + { + INCLUDE_PATH => $self->templates, + POST_CHOMP => 1 + } + ); my $output; $template->process( $templatename, $vars, \$output ); return $output; diff --git a/lib/NCIP/Handler/LookupUser.pm b/lib/NCIP/Handler/LookupUser.pm index d766122..891eedb 100644 --- a/lib/NCIP/Handler/LookupUser.pm +++ b/lib/NCIP/Handler/LookupUser.pm @@ -36,8 +36,13 @@ sub handle { my $user = NCIP::User->new( { userid => $user_id->textContent(), ils => $self->ils } ); $user->initialise(); - my $root = $xmldoc->documentElement(); + + # if we have blank user, we need to return that + # and can skip looking for elementtypes + + my $root = $xmldoc->documentElement(); my @elements = $root->findnodes('LookupUser/UserElementType/Value'); + #set up the variables for our template my $vars; $vars->{'messagetype'} = 'LookupUserResponse'; diff --git a/templates/includes/LookupUserResponse.inc b/templates/includes/LookupUserResponse.inc index ec03c40..f6ce676 100644 --- a/templates/includes/LookupUserResponse.inc +++ b/templates/includes/LookupUserResponse.inc @@ -1,3 +1,17 @@ + [% FOREACH element IN elements %] - [% element.textContent %] + [% IF element.textContent == 'User Address Information' %] + + [% END %] + [% IF element.textContent == 'Name Information' %] + + + + [% user.userdata.firstname %] + [% user.userdata.surname %] + + + + [% END %] [% END %] + -- 2.43.2