TPAC: Prevent unitialized variable warnings in My Account (repair)
authorBill Erickson <berick@esilibrary.com>
Thu, 3 May 2012 20:36:38 +0000 (16:36 -0400)
committerDan Scott <dan@coffeecode.net>
Sun, 3 Jun 2012 01:28:21 +0000 (21:28 -0400)
The logic in the second IF test was slightly altered by the fix.  An
undef value for username_unlimit should result in executing the block.
Since org setting values are stored as real boolean values, I simplified
the test to a simple if(!username_unlimit) test.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Dan Scott <dan@coffeecode.net>

Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm

index c7d9135..2346542 100644 (file)
@@ -113,7 +113,7 @@ sub load_myopac_prefs {
         $self->ctx->{username_change_disallowed} = 1;
     } else {
         my $username_unlimit = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'opac.unlimit_usernames');
-        if(defined($username_unlimit) and $username_unlimit != 1) {
+        if(!$username_unlimit) {
             my $regex_check = $self->ctx->{get_org_setting}->($e->requestor->home_ou, 'opac.barcode_regex');
             if(!$regex_check) {
                 # Default is "starts with a number"
@@ -1497,7 +1497,7 @@ sub load_myopac_update_username {
         # 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(defined($username_unlimit) and $username_unlimit != 1) {
+        if(!$username_unlimit) {
             if(!$regex_check) {
                 # Default is "starts with a number"
                 $regex_check = '^\d+';