Add output of phone numbers in NCIP::ILS::Evergreen->lookupuser.
authorJason Stephenson <jason@sigio.com>
Sat, 25 Oct 2014 16:48:33 +0000 (12:48 -0400)
committerJason Stephenson <jason@sigio.com>
Sat, 25 Oct 2014 16:48:33 +0000 (12:48 -0400)
Signed-off-by: Jason Stephenson <jason@sigio.com>

lib/NCIP/ILS/Evergreen.pm

index 4b444bd..db908a7 100644 (file)
@@ -1339,17 +1339,54 @@ sub handle_user_elements {
         }
 
         # Right now, we're only sharing email address if the user
-        # has it. We don't share phone numbers.
+        # has it.
         if ($user->email()) {
             my $address = NCIP::User::AddressInformation->new({UserAddressRoleType=>'Email Address'});
             $address->ElectronicAddress(
                 NCIP::ElectronicAddress->new({
-                    Type=>'Email Address',
+                    Type=>'mailto',
                     Data=>$user->email()
                 })
                 );
             push @$addresses, $address;
         }
+        # Auto-graphics asked for the phone numbers.
+        if ($user->day_phone()) {
+            my $address = NCIP::User::AddressInformation->new({UserAddressRoleType=>'Day Phone'});
+            $address->ElectronicAddress(
+                NCIP::ElectronicAddress->new(
+                    {
+                        Type=>'Day Phone',
+                        Data=>$user->day_phone()
+                    }
+                )
+            );
+            push @$adresses, $address;
+        }
+        if ($user->evening_phone()) {
+            my $address = NCIP::User::AddressInformation->new({UserAddressRoleType=>'Evening Phone'});
+            $address->ElectronicAddress(
+                NCIP::ElectronicAddress->new(
+                    {
+                        Type=>'Evening Phone',
+                        Data=>$user->evening_phone()
+                    }
+                )
+            );
+            push @$adresses, $address;
+        }
+        if ($user->other_phone()) {
+            my $address = NCIP::User::AddressInformation->new({UserAddressRoleType=>'Other Phone'});
+            $address->ElectronicAddress(
+                NCIP::ElectronicAddress->new(
+                    {
+                        Type=>'Other Phone',
+                        Data=>$user->other_phone()
+                    }
+                )
+            );
+            push @$adresses, $address;
+        }
 
         $optionalfields->UserAddressInformation($addresses);
     }