Bug 35796

Summary: Patron password expiration date lost when patron edited by superlibrarian
Product: Koha Reporter: Christopher Brannon <cbrannon>
Component: PatronsAssignee: Lucas Gass (lukeg) <lucas>
Status: CLOSED FIXED QA Contact: Marcel de Rooy <m.de.rooy>
Severity: major    
Priority: P5 - low CC: andrew, bugzilla, fridolin.somers, gmcharlt, kyle.m.hall, lucas, m.de.rooy, nick, rcoert
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36288
GIT URL: Change sponsored?: ---
Patch complexity: Trivial patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.04,23.05.10
Circulation function:
Attachments: Bug 35796: Properly set patron_expiration value
Bug 35796: Properly set patron_expiration value
Bug 35796: Properly set patron_expiration value

Description Christopher Brannon 2024-01-12 16:43:41 UTC
1) Set an expiration on the password in a patron account and save.
2) Go to patron details (moremember.pl) and confirm the password has an expiration.
3) Edit the patron account without touching anything and save the account.
4) Go back to patron details (moremember.pl) and note that the expiration on the password has been removed.

Koha needs to retain the expiration date unless it has been purposely altered or removed.
Comment 1 Andrew Fuerste-Henry 2024-03-08 21:02:52 UTC
We just noticed some missing password expiration dates and I think I see what's happening. It's important to note that the password expiration date is field is only shown and editable in the patron record if one is a superlibrarian.

To recreate:
- have a patron with a password expiration date
- log into Koha on an account that can search and edit patrons but is not a superlibrarian
- Edit the patron, confirm that password expiration date is included in the edit form, save your changes
- confirm your patron still has a password expiration date

- log into Koha as a superlibrarian
- Edit the patron, confirm the password expiration date field is included in the patron edit form, but loads without a value. Do not add a date or click into this field.
- Save the patron
- confirm the patron no longer has a password expiration date

I'm not sure why the expiration date value doesn't load when editing a patron, it appears that it is intended to:  
https://github.com/Koha-Community/Koha/blob/4032da3f964f438e913ed19d40b0b73aa4bd2533/koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt#L1347
Comment 2 Andrew Fuerste-Henry 2024-03-08 21:17:54 UTC
Filed Bug 36288 for the fact that BorrowerUnwantedField doesn't hide password expiration.
Comment 3 Lucas Gass (lukeg) 2024-03-08 21:33:46 UTC
Created attachment 162983 [details] [review]
Bug 35796: Properly set patron_expiration value

To test:
1) Set an expiration on the password in a patron account and save.
2) Go to patron details (moremember.pl) and confirm the password has an expiration.
3) Edit the patron account without touching anything and save the account.
4) Go back to patron details (moremember.pl) and note that the expiration on the password has been removed.
5) APPLY PATCH
6) Try 1 - 4 again except this time password expiration is not removed.
Comment 4 Lucas Gass (lukeg) 2024-03-08 21:34:33 UTC
Trivial fix but this bug can result in some data loss, correctly set as major.
Comment 5 ByWater Sandboxes 2024-03-08 21:49:24 UTC
Created attachment 162988 [details] [review]
Bug 35796: Properly set patron_expiration value

To test:
1) Set an expiration on the password in a patron account and save.
2) Go to patron details (moremember.pl) and confirm the password has an expiration.
3) Edit the patron account without touching anything and save the account.
4) Go back to patron details (moremember.pl) and note that the expiration on the password has been removed.
5) APPLY PATCH
6) Try 1 - 4 again except this time password expiration is not removed.

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>
Comment 6 Marcel de Rooy 2024-03-15 08:06:36 UTC
Created attachment 163170 [details] [review]
Bug 35796: Properly set patron_expiration value

To test:
1) Set an expiration on the password in a patron account and save.
2) Go to patron details (moremember.pl) and confirm the password has an expiration.
3) Edit the patron account without touching anything and save the account.
4) Go back to patron details (moremember.pl) and note that the expiration on the password has been removed.
5) APPLY PATCH
6) Try 1 - 4 again except this time password expiration is not removed.

Signed-off-by: Andrew Fuerste-Henry <andrewfh@dubcolib.org>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 7 Katrin Fischer 2024-03-15 08:40:10 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 8 Fridolin Somers 2024-03-18 09:10:07 UTC
Pushed to 23.11.x for 23.11.04
Comment 9 Lucas Gass (lukeg) 2024-03-19 21:38:40 UTC
Backported to 23.05.x for upcoming 23.05.10