Bug 38974 - Error when submitting patron update from the OPAC Can't call method "dateofbirthrequired" on an undefined value
Summary: Error when submitting patron update from the OPAC Can't call method "dateofbi...
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low major
Assignee: Andreas Jonsson
QA Contact: Marcel de Rooy
URL:
Keywords: rel_24_11_candidate
Depends on:
Blocks:
 
Reported: 2025-01-27 12:52 UTC by Owen Leonard
Modified: 2025-06-27 14:22 UTC (History)
4 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This fixes updating personal details in the OPAC. A 500 error was shown if the "Patron category (categorycode)" was selected in the PatronSelfModificationBorrowerUnwantedField system preference and the date of birth field was changed or previously empty.
Version(s) released in:
25.11.00,25.05.01
Circulation function:


Attachments
Bug 38974: Fix error in OPAC patron update (1.18 KB, patch)
2025-05-22 09:12 UTC, Andreas Jonsson
Details | Diff | Splinter Review
Bug 38974: Fix error in OPAC patron update (1.23 KB, patch)
2025-05-22 22:49 UTC, David Nind
Details | Diff | Splinter Review
Bug 38974: Fix error in OPAC patron update (1.33 KB, patch)
2025-06-06 07:52 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2025-01-27 12:52:20 UTC
I'm seeing an error in main when submitting a patron update from the OPAC. It seems to happen only when the submission includes a date of birth value.

It happens when adding a new date of birth value (previously empty), when submitting a change to the date of birth value, or when submitting the form without changing the date of birth field. It doesn't seem to be connected to the dateofbirth system preference choice.

Can't call method "dateofbirthrequired" on an undefined value at /kohadevbox/koha/opac/opac-memberentry.pl line 539
Comment 1 Andreas Jonsson 2025-05-22 09:12:20 UTC
Created attachment 182722 [details] [review]
Bug 38974: Fix error in OPAC patron update

Test plan:

1) Make sure Patron category is checked in the system preference PatronSelfModificationBorrowerUnwantedField
2) Log in to the opac
3) Go to "Personal details"
4) Select any value for "Date of birth"
5) Click save
6) This must not yield error 500. (But may be a successful save or a validation error).
Comment 2 David Nind 2025-05-22 22:49:32 UTC
Created attachment 182746 [details] [review]
Bug 38974: Fix error in OPAC patron update

Test plan:

1) Make sure Patron category is checked in the system preference PatronSelfModificationBorrowerUnwantedField
2) Log in to the opac
3) Go to "Personal details"
4) Select any value for "Date of birth"
5) Click save
6) This must not yield error 500. (But may be a successful save or a validation error).

Signed-off-by: David Nind <david@davidnind.com>
Comment 3 David Nind 2025-05-22 22:53:28 UTC
Testing notes (using KTD):
1. The "Patron category (categorycode)" field to select for PatronSelfModificationBorrowerUnwantedField is about three quarters of the way down the list on the left-hand side.
Comment 4 Marcel de Rooy 2025-06-06 07:50:46 UTC
Please fill assignee field when taking a bug.
Comment 5 Marcel de Rooy 2025-06-06 07:51:49 UTC
Looks like this is affected too by this change:

    if ( $borrower->{'password'} ) {
        my ( $is_valid, $error ) = Koha::AuthUtils::is_password_valid(
            $borrower->{password},
            Koha::Patron::Categories->find(
                $borrower->{categorycode} || C4::Context->preference('PatronSelfRegistrationDefaultCategory')

And should be more correct now (when updating).
Comment 6 Marcel de Rooy 2025-06-06 07:52:59 UTC
Created attachment 183053 [details] [review]
Bug 38974: Fix error in OPAC patron update

Test plan:

1) Make sure Patron category is checked in the system preference PatronSelfModificationBorrowerUnwantedField
2) Log in to the opac
3) Go to "Personal details"
4) Select any value for "Date of birth"
5) Click save
6) This must not yield error 500. (But may be a successful save or a validation error).

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Lucas Gass (lukeg) 2025-06-06 15:43:37 UTC
Nice work everyone!

Pushed to main for 25.11
Comment 8 Paul Derscheid 2025-06-22 21:46:58 UTC
Nice work everyone!

Pushed to 25.05.x for 25.05.03