Bug 17548: Fix step 1 of memberentry
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Fri, 4 Nov 2016 09:19:01 +0000 (09:19 +0000)
committerKyle M Hall <kyle@bywatersolutions.com>
Mon, 7 Nov 2016 16:33:10 +0000 (16:33 +0000)
This bug has been highlighted by bug 15407.

The date limit check on the category code did not work on step 1. But
after bug 15407 the script crashes with
  Can't call method "dateofbirthrequired" on an undefined value at
  /home/vagrant/kohaclone/members/memberentry.pl line 311.

Test plan:
- Edit "step 1" information of a patron (first 'Edit' on a patron detail
page).
- Save
=> Without this patch it BOOMs
=> With this patch, the info should be correctly saved

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
members/memberentry.pl

index d2f462f..95d2af0 100755 (executable)
@@ -307,7 +307,7 @@ if ($op eq 'save' || $op eq 'insert'){
 
     if ( $newdata{dateofbirth} ) {
         my $age = GetAge($newdata{dateofbirth});
-        my $borrowercategory = Koha::Patron::Categories->find($newdata{categorycode});
+        my $borrowercategory = Koha::Patron::Categories->find($categorycode);
         my ($low,$high) = ($borrowercategory->dateofbirthrequired, $borrowercategory->upperagelimit);
         if (($high && ($age > $high)) or ($age < $low)) {
             push @errors, 'ERROR_age_limitations';