Bug 13602: (QA followup) take advantage of the defined-or operator
authorTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 9 Feb 2015 16:32:50 +0000 (13:32 -0300)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 9 Feb 2015 16:32:50 +0000 (13:32 -0300)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
members/memberentry.pl

index 12d95c0..4638508 100755 (executable)
@@ -328,9 +328,10 @@ if ($op eq 'save' || $op eq 'insert'){
       }
     }
   }
-  # Check if the userid is unique. Userid might not always be present in the edited values list when editing certain sub-forms, so we need to dig for it a bit.
-  my $userid = $newdata{'userid'};
-  $userid = $borrower_data->{userid} unless $userid; #Get the userid straight from the DB
+  # Check if the 'userid' is unique. 'userid' might not always be present in
+  # the edited values list when editing certain sub-forms. Get it straight
+  # from the DB if absent.
+  my $userid = $newdata{ userid } // $borrower_data->{ userid };
   unless (Check_Userid($userid,$borrowernumber)) {
     push @errors, "ERROR_login_exist";
   }