LP1574141: minor code tweaks
authorGalen Charlton <gmc@equinoxinitiative.org>
Fri, 19 May 2017 02:28:49 +0000 (22:28 -0400)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 25 May 2017 13:18:13 +0000 (09:18 -0400)
- return the BAD_PARAMS event if client provides neither patron ID
  nor contact value
- more precisely identify missing parameters
- standardize indentation

Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm

index ba5868c..6cc2e8b 100644 (file)
@@ -4792,14 +4792,13 @@ sub mark_users_contact_invalid {
     return $e->die_event unless $e->checkauth;
     
     my $howfind = {};
-    if ($patron_id){
+    if (defined $patron_id && $patron_id ne "") {
         $howfind = {usr => $patron_id};
-    }
-    elsif ($contact){
+    } elsif (defined $contact && $contact ne "") {
         $howfind = {$contact_type => $contact};
-    }
-    else{ #Error out if no patron id set or no contact is set.
-        return $e->die_event;
+    } else {
+        # Error out if no patron id set or no contact is set.
+        return OpenILS::Event->new('BAD_PARAMS');
     }
  
     return OpenILS::Utils::BadContact->mark_users_contact_invalid(