Bug 8057 - Error when adding a patron with email address
authorKyle M Hall <kyle@bywatersolutions.com>
Tue, 8 May 2012 19:49:10 +0000 (15:49 -0400)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 22 May 2012 10:17:49 +0000 (12:17 +0200)
Caused by code assuming a the variable $err is a hashref
when it is only a hashref if there is an error.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
members/memberentry.pl

index 2d8cace..c8a6be1 100755 (executable)
@@ -354,7 +354,7 @@ if ((!$nok) and $nodouble and ($op eq 'insert' or $op eq 'save')){
                 };
                 if ( $@ ) {
                     $template->param(error_alert => $@);
-                } elsif ( defined $err->{error} and $err->{error} eq "no_email" ) {
+                } elsif ( ref($err) eq "HASH" && defined $err->{error} and $err->{error} eq "no_email" ) {
                     $template->{VARS}->{'error_alert'} = "no_email";
                 } else {
                     $template->{VARS}->{'info_alert'} = 1;