https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42161 --- Comment #12 from David Nind <david@davidnind.com> --- Created attachment 209629 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=209629&action=edit Bug 42161: Fix OPAC attribute changes lost in identify_updated_extended_attributes When a patron edits their attributes in the OPAC, identify_updated_extended_attributes compares each stored attribute with the submitted ones. For an attribute type that has the same number of values stored and submitted, it checks that the stored value is among the submitted values, but it looked at the submitted values of all attribute types instead of only those of the type being checked. So if the old value of an attribute equalled the submitted value of any other attribute, the change was treated as "nothing changed" and was silently lost. The typical case is a patron who self-registered leaving two non-mandatory attributes blank: both are stored with an empty value, and setting one of them in the OPAC later is ignored because the other is still submitted as empty. If nothing else changed, no modification request is created at all. Only compare against the submitted values of the same attribute type. Test plan: 1. Create two patron attribute types, e.g. codes ONE and TWO, with "Display in OPAC" and "Editable in OPAC" ticked, and none of the mandatory options. 2. Set PatronSelfRegistration to 'Allow', make sure PatronSelfRegistrationDefaultCategory is set, and set OPACPatronDetails to 'Allow'. 3. In the OPAC, go to 'Create an account' and fill in the required details. Under 'Additional information' leave both ONE and TWO blank. Submit. 4. Log in to the OPAC as the new patron, using the password shown on the confirmation page. 5. In the 'Personal details' tab, enter a value for TWO only and submit the update request. 6. In the staff interface, go to 'Patrons requesting modifications' (members-update.pl) => Without the patch there is no request for the patron: the change to TWO was lost. => With the patch the request is listed, with TWO under 'Additional attributes and identifiers'. Approve it and check that the patron has the value for TWO. 7. Run $ prove t/db_dependent/Koha/Patron.t => The new tests in the identify_updated_extended_attributes subtest fail without the patch and pass with it. Sponsored-by: OpenFifth <https://openfifth.co.uk/> Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.