From f45877d2529ce899c4fa9e31a2b24c9af1c46882 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sun, 17 Aug 2014 11:01:14 -0400 Subject: [PATCH] Add ElectronicAddress element. Signed-off-by: Jason Stephenson --- lib/NCIP/ElectronicAddress.pm | 48 +++++++++++++++++++++++ lib/NCIP/User/AddressInformation.pm | 13 +++++- templates/includes/LookupUserResponse.inc | 9 ++++- 3 files changed, 67 insertions(+), 3 deletions(-) create mode 100644 lib/NCIP/ElectronicAddress.pm diff --git a/lib/NCIP/ElectronicAddress.pm b/lib/NCIP/ElectronicAddress.pm new file mode 100644 index 0000000..08a316c --- /dev/null +++ b/lib/NCIP/ElectronicAddress.pm @@ -0,0 +1,48 @@ +# --------------------------------------------------------------- +# Copyright © 2014 Jason J.A. Stephenson +# +# This file is part of NCIPServer. +# +# NCIPServer 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 2 of the License, or +# (at your option) any later version. +# +# NCIPServer 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 NCIPServer. If not, see . +# --------------------------------------------------------------- +package NCIP::ElectronicAddress; + +use parent qw(Class::Accessor); + +=head1 NAME + +ElectronicAddress - As defined in Z39.83-1-2012 + +=head1 SYNOPSIS + + + +=head1 DESCRIPTION + +=head1 FIELDS + +=head2 Type + +Text string for the type of the electronic address, email, ip address, +phone number, etc. + +=head2 Data + +Text string for the actual address data. + +=cut + +NCIP::ElectronicAddress->mk_accessors(qw(Type Data)); + +1; diff --git a/lib/NCIP/User/AddressInformation.pm b/lib/NCIP/User/AddressInformation.pm index abf1c6a..c8886ff 100644 --- a/lib/NCIP/User/AddressInformation.pm +++ b/lib/NCIP/User/AddressInformation.pm @@ -32,18 +32,27 @@ AddressInformation - A user's Address Information =head1 FIELDS +Either one of PhysicalAddress or ElectronicAddress must be defined, +and they are mutually exclusive, i.e. if one has a value defined, the +other must be undefined. + =head2 UserAddressRoleType A text string to indicate the role of the address. =head2 PhysicalAddress -A physical address stored in a StructuredAddress. +A physical address stored in a NCIP::StructuredAddress. + +=head2 ElectronicAddress + +An electronic address or phone number stored in a +NCIP::ElectronicAddress. =cut NCIP::User::AddressInformation->mk_accessors( - qw(UserAddressRoleType PhysicalAddress) + qw(UserAddressRoleType PhysicalAddress ElectronicAddress) ); 1; diff --git a/templates/includes/LookupUserResponse.inc b/templates/includes/LookupUserResponse.inc index f9b64b1..fa2af36 100644 --- a/templates/includes/LookupUserResponse.inc +++ b/templates/includes/LookupUserResponse.inc @@ -39,7 +39,8 @@ [% IF data.UserOptionalFields.UserAddressInformation -%] [% FOREACH element IN data.UserOptionalFields.UserAddressInformation -%] - [% element.AddressRoleType %] + [% element.AddressRoleType | xml %] + [% IF element.PhysicalAddress -%] [% element.PhysicalAddress.Line1 | xml %] @@ -60,6 +61,12 @@ [% END -%] + [% ELSIF element.ElectronicAddress -%] + + [% element.ElectronicAddress.Type | xml %] + [% element.ElectronicAddress.Data | xml %] + + [% END -%] [% END -%] [% END -%] -- 2.43.2