Bug 26355

Summary: Allow patrons to self-renew through the OPAC
Product: Koha Reporter: Christopher Brannon <cbrannon>
Component: PatronsAssignee: Matt Blenkinsop <matt.blenkinsop>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: acampbell, barbara.johnson, bugzilla, clackman, dcook, esther.melander, george, gmcharlt, hdunne-howrie, hebah, jaki.frisina, kelly, kkrueger, kyle, lisette, m.de.rooy, madamyk, margaret, martin.renvoize, matt.blenkinsop, mfuerst, rcoert, sally.healey, sfletcher
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=25063
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=28688
GIT URL: Initiative type: ---
Sponsorship status: --- Comma delimited list of Sponsors:
Crowdfunding goal: 0 Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on:    
Bug Blocks: 25063, 26357    
Attachments: Bug 26355: Add new columns to the patron categories and attributes tables
Bug 26355: DBIC files
Bug 26355: Update API specs for categories
Bug 26355: Add the new category and attribute columns to the UI
Bug 26355: Add a Vue island for the self renewal modal
Bug 26355: Add an endpoint and class methods to handle patron renewal
Bug 26355: Update opac-user and opac-memberentry to support the renewal workflow
Bug 26355: Add unit and API tests
Bug 26355: Add cypress tests
Bug 26355: Add cypress tests
Bug 26355: Add new columns to the patron categories and attributes tables
Bug 26355: DBIC files
Bug 26355: Update API specs for categories
Bug 26355: Add the new category and attribute columns to the UI
Bug 26355: Add a Vue island for the self renewal modal
Bug 26355: Add an endpoint and class methods to handle patron renewal
Bug 26355: Update opac-user and opac-memberentry to support the renewal workflow
Bug 26355: Add unit and API tests

Description Christopher Brannon 2020-09-02 15:01:53 UTC
Allow patrons renewal reminders to link to the patron modification requests, asking them to review their information and make any any necessary updates if necessary, but acknowledging that the information is up to date.

Create a check-box stating that they have reviewed all their information, and it is accurate and up to date (if no changes are made).  Perhaps this check-box only shows when their account is due for renewal.
Comment 1 Christopher Brannon 2020-09-02 15:04:05 UTC
I suggest this being an option, because some libraries might require fees or a view of a current ID before renewing.

Maybe the option can include whether certain patron categories allow self renewal.
Comment 2 Lisette Scheer 2020-09-02 15:27:36 UTC
*** Bug 26358 has been marked as a duplicate of this bug. ***
Comment 3 Martha Fuerst 2020-09-02 15:52:50 UTC
We're also interested in this enhancement.
Comment 4 Martha Fuerst 2020-09-02 15:58:25 UTC
I'd also like the option to be able to review the request for renewal before granting it. Seems like a reasonable option for a potential syspref.
Comment 5 Christopher Brannon 2020-09-02 16:03:01 UTC
(In reply to Martha Fuerst from comment #4)
> I'd also like the option to be able to review the request for renewal before
> granting it. Seems like a reasonable option for a potential syspref.

Martha, see https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=26357, which depends on this bug.
Comment 6 Jaki 2020-12-31 14:57:43 UTC
We would love to see this as the majority of our emails for the past few months have been patrons requesting to renew their accounts. If they could do it themselves without going through us, that would be great!
Comment 7 George Williams (NEKLS) 2021-12-09 17:25:52 UTC
+1
Comment 8 Sarah Fletcher 2021-12-09 17:45:35 UTC
NCW Libraries is extremely interested in this enhancement as well! It would save us a lot of staff time.
Comment 9 Christopher Brannon 2022-02-28 16:47:02 UTC
A more detailed workflow was requested for this idea.  So, here it is.

1. A setting is created to determine if self renewals will be allowed, and if so, what patron categories and patron home libraries will allow this (using the dropdown checkbox method for each).  Additionally, an option in this setting to set whether new patron categories or libraries added after this setting is set will default to enabled or disabled.

2. A setting is created to determine if renewals with no changes can be automatic.  If so, once the patron submits the form with no changes, other than the checkbox, the account is renewed, and the request is recorded as a modification request, but already approved (with notation in the log or table noting that this was a renewal).

3. A setting is created to determine if renewals with fines can be automatic.  Similar method as #1.

4. Notification goes out to patron that their account will expire soon.  We provide a link in the notification, and other places on the OPAC where that reminder shows, that links to the patron modification request page (opac-memberentry.pl) (I would suggest this be renamed to something like opac-membermodifications.pl, for consistancy, but this is arbitrary).

5. Specific definable instructions are displayed at the top of the page if the patron account is close to expiration (as defined in MembershipExpiryDaysNotice).  I will refer to this as the renewal period from this point out.

6. A new checkbox appears and is required during the renewal period which a patron must check in order to submit.  The checkbox states that they have reviewed the information above, and everything is up-to-date or modified as needed.  This is needed so that we know they are looking things over (as much as we can tell) and if there are no changes, we at least know why the modification was submitted (if needing staff intervention).

7. Modification requests for renewals with or without field changes that require moderation should show along with other regular modification requests, but show a renewal badge in the request table, but otherwise function as usual.

8. The "Patrons requesting modifications" description on the staff home page (mnainpage.pl) and patron search page (members-home.pl) should be relabeled as "Patron modification/renewal requests".

I think this is a fairly good plan.  If anyone sees any flaws in this plan, or other needed elements, please speak up.
Comment 10 Sally 2023-06-16 11:50:46 UTC
This would be really useful.
Comment 11 Kristi Krueger 2023-08-25 14:33:32 UTC
This sounds like it would benefit many systems! Making it easier for patrons to keep their account active is a great goal.
Comment 12 Christopher Brannon 2023-09-15 17:18:40 UTC
Maybe this could get some traction, now that bug 28688 has been developed?
Comment 13 Rebecca Coert 2024-10-09 20:18:56 UTC
This would be very useful!  +1
Comment 14 Lisette Scheer 2025-08-05 13:51:30 UTC
*** Bug 37621 has been marked as a duplicate of this bug. ***
Comment 15 Lisette Scheer 2025-08-05 13:51:37 UTC
*** Bug 37514 has been marked as a duplicate of this bug. ***
Comment 16 Matt Blenkinsop 2026-01-21 14:26:45 UTC
Created attachment 191781 [details] [review]
Bug 26355: Add new columns to the patron categories and attributes tables
Comment 17 Matt Blenkinsop 2026-01-21 14:26:48 UTC
Created attachment 191782 [details] [review]
Bug 26355: DBIC files
Comment 18 Matt Blenkinsop 2026-01-21 14:26:51 UTC
Created attachment 191783 [details] [review]
Bug 26355: Update API specs for categories

Adds the new db columns to the category specs and adds a POST endpoint for patron categories.
Also adds a check for self renewal eligibility to the patron definition
Comment 19 Matt Blenkinsop 2026-01-21 14:26:54 UTC
Created attachment 191784 [details] [review]
Bug 26355: Add the new category and attribute columns to the UI
Comment 20 Matt Blenkinsop 2026-01-21 14:26:58 UTC
Created attachment 191785 [details] [review]
Bug 26355: Add a Vue island for the self renewal modal
Comment 21 Matt Blenkinsop 2026-01-21 14:27:01 UTC
Created attachment 191786 [details] [review]
Bug 26355: Add an endpoint and class methods to handle patron renewal
Comment 22 Matt Blenkinsop 2026-01-21 14:27:04 UTC
Created attachment 191787 [details] [review]
Bug 26355: Update opac-user and opac-memberentry to support the renewal workflow

This is part of a sponsored piece of development from one of our customers. There was a specification of requirements but I was conscious of the ideas already discussed on this bug and wanted to try and develop a solution that would balance both sets of requirements. The concept works as follows:
- Self-renewal can be enabled and controlled at a category level
    - The window within which it is available is customisable (both pre and post-expiry)
        - Defaults to the NotifyBorrowerDeparture syspref
    - The amount in fines that block self-renewal is customisable
        - Defaults to the category level charges and then the noissescharge preference
    - The message to display if renewal fails is customisable
- Libraries can also add additional verification steps. This was a requirement for our customer and to enable it I’ve opted to use Patron attribute types because these are already configurable by category and library. This means you can add additional verification questions such as ‘Do you still live within X miles of the library?”
- The self-renewal process will also respect the OPACPatronDetails and AutoApprovePatronProfileSettings sysprefs. If OPACPatronDetails is enabled, the renewal will redirect the patron to the OPAC details form and ask them to confirm their details are still correct. Any changes will be logged as patron modifications and approved in line with the auto approval syspref
- Renewal happens regardless of whether OPACPatronDetails is enabled, only the details changes are logged as modification requests
- Notifications are sent to the patron in line with their messaging preferences

Test plan:
1. Apply all patches and reset_all
2. In the intranet, navigate to patron categories and edit the ‘Patron’ category
3. Scroll to the bottom, there should be a section called ‘Account expiry and self-renewal’
4. Set ‘Allow self-renewal’ to Yes
5. Set Self-renewal availability period to be 10 days
6. Set Self-renewal availability post-expiry’ to also be 10 days and save
7. In system preferences, set the OPACPatronDetails preference to ‘Don’t allow’
8. Choose a patron that has the ‘Patron’ type category
9. Edit that patron so that you can log into the OPAC and set their expiry date to be yesterday’s date
10. Log into the OPAC as that patron (it may be easiest to do this in incognito as we will be swapping between the intranet and OPAC throughout the test plan and it will remove the need to keep logging out and in)
11. You should see a message that says “You are eligible for self-renewal. Please click here to renew your account.”
12. Click that link - you will be presented with a modal that says “Are you sure you want to renew your account?”
13. Click “Close” - we don’t want to complete renewal yet as there is more functionality available to test
14. Navigate to the patron category again, set ‘Self-renewal availability post-expiry’ to be 0
15. Refresh the OPAC, the self-renewal link should not be there as we are now outside the patron self-renewal window
16. Undo that change in the patron category, the link should reappear when refreshing the OPAC
17. Now set the patron’s expiry date to be tomorrow
18. In the category, set ‘Self-renewal availability period’ to 0
19. Refresh the OPAC, it should still show the link as it is defaulting to NotifyBorrowerDeparture
20. Set NotifyBorrowerDeparture to 0
21. Refresh the OPAC, the link should vanish
22. In the category, restore ‘Self-renewal availability period’ to 10 days
23. Refresh the OPAC, the link should reappear
24. In the intranet, set the patron to be debarred using a manual restriction
25. In the OPAC refresh the page - self-renewal should no longer be available
26. Remove the restriction - the renewal link will be visible again
27. Set a fine on the patron record of 6 USD
28. Refresh the OPAC, the self-renewal link will be gone because we are over the global ‘noissuescharge’ preference value of 5
29. In the category, set ‘Checkout charge limit’ to 7
30. Refresh the OPAC, the link will be visible because we are now under the category charge
31. Add an additional fine of 2 to the patron account
32. Refresh the OPAC, the self-renewal link is gone
33. In the category, set ‘Self-renewal charge limit’ to be 10
34. Refresh the OPAC, the link will be visible again
35. In the category, set ‘Self-renewal failure message’ to be whatever you want
36. In the OPAC, refresh the page and then click into the self-renewal process
37. This time, click “No” - you should see the failure message you have just set
38. Click “Close” and refresh the page to reset this message
39. In the Intranet, navigate to Admin > Patron attribute types
40. Click to create a new attribute
41. The code isn’t important here but we do need a description - this can be anything for the plan, for example “Do you still live locally to this library?”
42. Tick the new checkbox - Self-renewal verification check
43. Create a second attribute, this time set the description to something like “We don’t want to see this one!”. Do NOT click the self-renewal checkbox this time
44. In the OPAC, refresh the page and then click the renewal link again
45. You should be met with the modal, this time asking the verification question we just set up in the patron attributes
46. Click “Yes” - you should see the “Are you sure you want to renew your account?” message again
47. The second attribute that we set up without the self-renewal checkbox selected should not appear
48. This time when prompted with the “Are you sure” message, click “Yes”
49. The page should refresh and display a confirmation with the new expiry date.
50. In the intranet, view the patron’s record - the date should have been updated
51. In the Modification log tab, there should be a log entry for “Membership renewed”
52. Change the patron’s expiry date again, this time to be yesterday’s date
53. In the OPAC, click on “Personal detail”, the new expiry date should show there
54. Now set the OPACPatronDetails syspref to be “Allow”
55. Click on “Summary” again, the self-renewal link should be there again
56. Click into the self-renewal process and click “Yes” on your verification step
57. This time you should be met with a message that says “Confirm your account details”
58. Click “Continue” - you will be redirected to the OPAC details form
59. There should be a message at the top that says “Please verify your details to proceed with your self-renewal.”
60. Update a field somewhere on the patron form
61. Scroll to the bottom - the button should say “Submit renewal request”
62. Click this button
63. You will be shown the renewal confirmation message
64. In the intranet, on the homepage you should now see a modification request
65. Check the request, it should match the fields you changed - don’t approve or deny for now
66. Set ‘AutoApprovePatronProfileSettings’ in sysprefs to “Enable”
67. Reset your patron’s expiry date to today’s date
68. In the OPAC, click into Personal details and then back into Summary again (we need to do this to remove the success parameter from the URL)
69. The renewal link will be visible again - go through the process again
70. On the form, you should see an alert that you have already sent a modification request
71. This time, change a different field to the previous attempt
72. Submit the form
73. In the intranet there should be no modification this time and the change should be visible in the patron record as it has been automatically approved and handled as per the syspref
74. prove t/db_dependent/Koha/Patron.t
75. prove t/db_dependent/api/v1/patrons_self_renewal.t
76. yarn cypress run --spec t/cypress/integration/Islands/SelfRenewal.ts
77. Sign off!

Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/>
Sponsored-by: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/>
Sponsored-by: LibraryOn
Comment 23 Matt Blenkinsop 2026-01-21 14:27:08 UTC
Created attachment 191788 [details] [review]
Bug 26355: Add unit and API tests
Comment 24 Matt Blenkinsop 2026-01-21 14:27:12 UTC
Created attachment 191789 [details] [review]
Bug 26355: Add cypress tests
Comment 25 Matt Blenkinsop 2026-01-21 14:29:06 UTC
Further thing to note - the patches also expose a 'self_renewal_available' property through the patron API so that external discovery systems can see whether a patron can self-renew
Comment 26 OpenFifth Sandboxes 2026-02-04 10:50:46 UTC
Created attachment 192440 [details] [review]
Bug 26355: Add cypress tests

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Comment 27 Matt Blenkinsop 2026-02-04 10:56:50 UTC
Created attachment 192441 [details] [review]
Bug 26355: Add new columns to the patron categories and attributes tables

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Comment 28 Matt Blenkinsop 2026-02-04 10:56:53 UTC
Created attachment 192442 [details] [review]
Bug 26355: DBIC files

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Comment 29 Matt Blenkinsop 2026-02-04 10:56:57 UTC
Created attachment 192443 [details] [review]
Bug 26355: Update API specs for categories

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Adds the new db columns to the category specs and adds a POST endpoint for patron categories.
Also adds a check for self renewal eligibility to the patron definition
Comment 30 Matt Blenkinsop 2026-02-04 10:57:00 UTC
Created attachment 192444 [details] [review]
Bug 26355: Add the new category and attribute columns to the UI

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Comment 31 Matt Blenkinsop 2026-02-04 10:57:06 UTC
Created attachment 192445 [details] [review]
Bug 26355: Add a Vue island for the self renewal modal

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Comment 32 Matt Blenkinsop 2026-02-04 10:57:09 UTC
Created attachment 192446 [details] [review]
Bug 26355: Add an endpoint and class methods to handle patron renewal

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Comment 33 Matt Blenkinsop 2026-02-04 10:57:13 UTC
Created attachment 192447 [details] [review]
Bug 26355: Update opac-user and opac-memberentry to support the renewal workflow

This is part of a sponsored piece of development from one of our customers. There was a specification of requirements but I was conscious of the ideas already discussed on this bug and wanted to try and develop a solution that would balance both sets of requirements. The concept works as follows:
- Self-renewal can be enabled and controlled at a category level
    - The window within which it is available is customisable (both pre and post-expiry)
        - Defaults to the NotifyBorrowerDeparture syspref
    - The amount in fines that block self-renewal is customisable
        - Defaults to the category level charges and then the noissescharge preference
    - The message to display if renewal fails is customisable
- Libraries can also add additional verification steps. This was a requirement for our customer and to enable it I’ve opted to use Patron attribute types because these are already configurable by category and library. This means you can add additional verification questions such as ‘Do you still live within X miles of the library?”
- The self-renewal process will also respect the OPACPatronDetails and AutoApprovePatronProfileSettings sysprefs. If OPACPatronDetails is enabled, the renewal will redirect the patron to the OPAC details form and ask them to confirm their details are still correct. Any changes will be logged as patron modifications and approved in line with the auto approval syspref
- Renewal happens regardless of whether OPACPatronDetails is enabled, only the details changes are logged as modification requests
- Notifications are sent to the patron in line with their messaging preferences

Test plan:
1. Apply all patches and reset_all
2. In the intranet, navigate to patron categories and edit the ‘Patron’ category
3. Scroll to the bottom, there should be a section called ‘Account expiry and self-renewal’
4. Set ‘Allow self-renewal’ to Yes
5. Set Self-renewal availability period to be 10 days
6. Set Self-renewal availability post-expiry’ to also be 10 days and save
7. In system preferences, set the OPACPatronDetails preference to ‘Don’t allow’
8. Choose a patron that has the ‘Patron’ type category
9. Edit that patron so that you can log into the OPAC and set their expiry date to be yesterday’s date
10. Log into the OPAC as that patron (it may be easiest to do this in incognito as we will be swapping between the intranet and OPAC throughout the test plan and it will remove the need to keep logging out and in)
11. You should see a message that says “You are eligible for self-renewal. Please click here to renew your account.”
12. Click that link - you will be presented with a modal that says “Are you sure you want to renew your account?”
13. Click “Close” - we don’t want to complete renewal yet as there is more functionality available to test
14. Navigate to the patron category again, set ‘Self-renewal availability post-expiry’ to be 0
15. Refresh the OPAC, the self-renewal link should not be there as we are now outside the patron self-renewal window
16. Undo that change in the patron category, the link should reappear when refreshing the OPAC
17. Now set the patron’s expiry date to be tomorrow
18. In the category, set ‘Self-renewal availability period’ to 0
19. Refresh the OPAC, it should still show the link as it is defaulting to NotifyBorrowerDeparture
20. Set NotifyBorrowerDeparture to 0
21. Refresh the OPAC, the link should vanish
22. In the category, restore ‘Self-renewal availability period’ to 10 days
23. Refresh the OPAC, the link should reappear
24. In the intranet, set the patron to be debarred using a manual restriction
25. In the OPAC refresh the page - self-renewal should no longer be available
26. Remove the restriction - the renewal link will be visible again
27. Set a fine on the patron record of 6 USD
28. Refresh the OPAC, the self-renewal link will be gone because we are over the global ‘noissuescharge’ preference value of 5
29. In the category, set ‘Checkout charge limit’ to 7
30. Refresh the OPAC, the link will be visible because we are now under the category charge
31. Add an additional fine of 2 to the patron account
32. Refresh the OPAC, the self-renewal link is gone
33. In the category, set ‘Self-renewal charge limit’ to be 10
34. Refresh the OPAC, the link will be visible again
35. In the category, set ‘Self-renewal failure message’ to be whatever you want
36. In the OPAC, refresh the page and then click into the self-renewal process
37. This time, click “No” - you should see the failure message you have just set
38. Click “Close” and refresh the page to reset this message
39. In the Intranet, navigate to Admin > Patron attribute types
40. Click to create a new attribute
41. The code isn’t important here but we do need a description - this can be anything for the plan, for example “Do you still live locally to this library?”
42. Tick the new checkbox - Self-renewal verification check
43. Create a second attribute, this time set the description to something like “We don’t want to see this one!”. Do NOT click the self-renewal checkbox this time
44. In the OPAC, refresh the page and then click the renewal link again
45. You should be met with the modal, this time asking the verification question we just set up in the patron attributes
46. Click “Yes” - you should see the “Are you sure you want to renew your account?” message again
47. The second attribute that we set up without the self-renewal checkbox selected should not appear
48. This time when prompted with the “Are you sure” message, click “Yes”
49. The page should refresh and display a confirmation with the new expiry date.
50. In the intranet, view the patron’s record - the date should have been updated
51. In the Modification log tab, there should be a log entry for “Membership renewed”
52. Change the patron’s expiry date again, this time to be yesterday’s date
53. In the OPAC, click on “Personal detail”, the new expiry date should show there
54. Now set the OPACPatronDetails syspref to be “Allow”
55. Click on “Summary” again, the self-renewal link should be there again
56. Click into the self-renewal process and click “Yes” on your verification step
57. This time you should be met with a message that says “Confirm your account details”
58. Click “Continue” - you will be redirected to the OPAC details form
59. There should be a message at the top that says “Please verify your details to proceed with your self-renewal.”
60. Update a field somewhere on the patron form
61. Scroll to the bottom - the button should say “Submit renewal request”
62. Click this button
63. You will be shown the renewal confirmation message
64. In the intranet, on the homepage you should now see a modification request
65. Check the request, it should match the fields you changed - don’t approve or deny for now
66. Set ‘AutoApprovePatronProfileSettings’ in sysprefs to “Enable”
67. Reset your patron’s expiry date to today’s date
68. In the OPAC, click into Personal details and then back into Summary again (we need to do this to remove the success parameter from the URL)
69. The renewal link will be visible again - go through the process again
70. On the form, you should see an alert that you have already sent a modification request
71. This time, change a different field to the previous attempt
72. Submit the form
73. In the intranet there should be no modification this time and the change should be visible in the patron record as it has been automatically approved and handled as per the syspref
74. prove t/db_dependent/Koha/Patron.t
75. prove t/db_dependent/api/v1/patrons_self_renewal.t
76. yarn cypress run --spec t/cypress/integration/Islands/SelfRenewal.ts
77. Sign off!

Sponsored-by: Westminster City Council <https://www.westminster.gov.uk/>
Sponsored-by: Royal Borough of Kensington and Chelsea <https://www.rbkc.gov.uk/>
Sponsored-by: LibraryOn

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Comment 34 Matt Blenkinsop 2026-02-04 10:57:18 UTC
Created attachment 192448 [details] [review]
Bug 26355: Add unit and API tests

Signed-off-by: Hannah Dunne-Howrie <hdunne-howrie@westminster.gov.uk>
Comment 35 Matt Blenkinsop 2026-02-04 10:58:53 UTC
Sandbox sign-off doesn't seem to have worked correctly, only one commit was attached and the bug status wasn't changed. I've added SO lines to the rest of the commits and added them on Hannah's behalf