From c2eb7d12fc491d15217995340b37e35565dd57d6 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Tue, 10 Apr 2012 23:34:24 -0400 Subject: [PATCH] TPAC: Prevent unitialized variable warnings in My Account Viewing a user's account preferences would trigger two uninitialized variable warnings if the corresponding org unit settings were not set. Signed-off-by: Dan Scott --- .../lib/OpenILS/WWW/EGCatLoader/Account.pm | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 7399f34..c7d9135 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -108,12 +108,12 @@ sub load_myopac_prefs { my $user = $self->ctx->{user}; my $lock_usernames = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'opac.lock_usernames'); - if($lock_usernames == 1) { + if(defined($lock_usernames) and $lock_usernames == 1) { # Policy says no username changes $self->ctx->{username_change_disallowed} = 1; } else { my $username_unlimit = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'opac.unlimit_usernames'); - if($username_unlimit != 1) { + if(defined($username_unlimit) and $username_unlimit != 1) { my $regex_check = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'opac.barcode_regex'); if(!$regex_check) { # Default is "starts with a number" @@ -1490,14 +1490,14 @@ sub load_myopac_update_username { my $allow_change = 1; my $regex_check; my $lock_usernames = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'opac.lock_usernames'); - if($lock_usernames == 1) { + if(defined($lock_usernames) and $lock_usernames == 1) { # Policy says no username changes $allow_change = 0; } else { # We want this further down. $regex_check = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'opac.barcode_regex'); my $username_unlimit = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'opac.unlimit_usernames'); - if($username_unlimit != 1) { + if(defined($username_unlimit) and $username_unlimit != 1) { if(!$regex_check) { # Default is "starts with a number" $regex_check = '^\d+'; -- 1.7.2.5