From: Jason Stephenson Date: Thu, 15 Jun 2017 18:11:41 +0000 (-0400) Subject: LP 1698176: Return undef with die event in Actor.pm _add_patron function. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=a4f8c22dbd8c1c4009d759b5491f0f9e0f65cfc0;p=contrib%2FConifer.git LP 1698176: Return undef with die event in Actor.pm _add_patron function. If the CStoreEditor create_actor_user call fails in the _add_patron helper function in OpenILS/Application/Actor.pm, the CStorEditor's die_event is returned as a scalar value. The caller expects a list return with two values: the user object in index 0 and the event, if any, in index 1. Returning just the event causes the caller to use the event as if it were the user object. This leads to a different error message later in the code: Can't call method "billing_address" on unblessed reference at /path/to/perlib/OpenILS/Application/Actor.pm line 743. This commit changes the return value in the event of a database insert failure to be the two member list as expected by the caller with undef in index 0 and the die_event in index 1. This returns the proper error message to the client. Signed-off-by: Jason Stephenson Signed-off-by: Cesar Velez --- diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm index 0e936cfbd8..47576b1142 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Actor.pm @@ -591,7 +591,7 @@ sub _add_patron { # do a dance to get the password hashed securely my $saved_password = $patron->passwd; $patron->passwd(''); - $e->create_actor_user($patron) or return $e->die_event; + $e->create_actor_user($patron) or return (undef, $e->die_event); modify_migrated_user_password($e, $patron->id, $saved_password); my $id = $patron->id; # added by CStoreEditor