https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=43710
--- Comment #3 from David Nind <[email protected]> --- Created attachment 208909 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=208909&action=edit Bug 43710: OPAC self-registration: catch MissingMandatoryExtendedAttribute instead of crashing with a 500 If a patron attribute type is configured with mandatory=1 and opac_editable=1 but opac_mandatory=0, the OPAC self-registration form (opac-memberentry.pl) never requires it from the patron (its own CheckMandatoryAttributes only checks opac_mandatory), but Koha::Patron->extended_attributes()'s internal mandatory check uses mandatory + opac_editable, ignoring opac_mandatory entirely. If the patron leaves that field blank, extended_attributes() throws Koha::Exceptions::Patron::MissingMandatoryExtendedAttribute, which was not caught here, producing an uncaught-exception 500. By the time this call runs, the Koha::Patron row has already been created and stored; the exception only affects saving extended attributes, and that save is wrapped in a DBIx::Class txn_do, so a failure rolls back cleanly (no partially-saved attributes). Since the account itself is valid, abort the attribute save on this specific misconfiguration, log a warning for library staff, and let registration complete normally rather than failing the whole request. Other exception types are re-thrown unchanged. Steps to follow: 1. Administration > Patron attribute types: create (or edit) an attribute type with Mandatory checked, OPAC editable checked, and OPAC mandatory NOT checked. 2. Register a new patron via the OPAC self-registration form (with PatronSelfRegistrationVerifyByEmail disabled), leaving that attribute blank. Confirm the registration crashes with an uncaught-exception 500 — bug confirmed. 3. Apply this patch and restart Plack if running under it. 4. Repeat step 2. Confirm registration completes normally (the "Registration complete" page is shown) instead of a 500, and check the Plack/error log for the new warning identifying the misconfigured attribute type. 5. Edit the attribute type to also check OPAC mandatory, repeat registration with the field filled in, and confirm it saves correctly — no regression for the normal case. Signed-off-by: Adolfo Rodríguez <[email protected]> Co-Authored-By: Claude Sonnet 5 <[email protected]> -- You are receiving this mail because: You are watching all bug changes. _______________________________________________ Koha-bugs mailing list -- [email protected] To unsubscribe send an email to [email protected] website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
