LP 1984114: Use Patron Preferred Name in SIP2 responses
authorJason Stephenson <jason@sigio.com>
Tue, 9 Aug 2022 17:09:33 +0000 (13:09 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Fri, 28 Oct 2022 00:47:20 +0000 (20:47 -0400)
Use a patron's preferred first name, preferred second name, or
preferred family name in SIP2 responses.  If a preferred name field
has no value, then the corresponding regular name field will be used.

To test this patch, you can find a patron with a preferred name field
set and look them up using a Patron Status Request message (23) via
your favorite SIP2 client.  Before applying the patch, the name field
(AE) in the Patron Status Response message (24) will NOT use the
patron's preferred name(s).  After applying the patch and restarting
Evergreen on the server, you repeat the previous Patron Status
Request, and the response will now use the patron's preferred
name(s) in the name field.

Signed-off-by: Jason Stephenson <jason@sigio.com>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>

Open-ILS/src/perlmods/lib/OpenILS/SIP/Patron.pm

index 43824cf..e7ba27a 100644 (file)
@@ -249,9 +249,9 @@ sub name {
 sub format_name {
     my $u = shift;
     return sprintf('%s %s %s',
-                   ($u->first_given_name || ''),
-                   ($u->second_given_name || ''),
-                   ($u->family_name || ''));
+                   ($u->pref_first_given_name || $u->first_given_name || ''),
+                   ($u->pref_second_given_name || $u->second_given_name || ''),
+                   ($u->pref_family_name || $u->family_name || ''));
 }
 
 sub home_library {