Bug 35635 - Expand patron attribute type mandatory field
Summary: Expand patron attribute type mandatory field
Status: Passed QA
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Lucas Gass (lukeg)
QA Contact: Jonathan Druart
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-21 21:20 UTC by Lucas Gass (lukeg)
Modified: 2025-01-17 09:34 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement expands the patron attribute type "Mandatory" field, allowing for different configurations for the OPAC and the staff interface.
Version(s) released in:
Circulation function:


Attachments
Bug 35635: DB Updates (2.86 KB, patch)
2024-06-05 22:17 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 35635: DO NOT PUSH - Schema updates (1.28 KB, patch)
2024-06-05 22:17 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 35635: Split mandatory field into mandatory and opac_mandatory (6.91 KB, patch)
2024-06-05 22:17 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 35635: Add opac_mandatory to patron attribute table (2.03 KB, patch)
2024-06-06 13:27 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 35635: Add opac_mandatory to patron attribute table (3.03 KB, patch)
2024-06-06 13:37 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 35635: DB Updates (2.90 KB, patch)
2024-06-11 19:45 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 35635: DO NOT PUSH - Schema updates (1.33 KB, patch)
2024-06-11 19:45 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 35635: Split mandatory field into mandatory and opac_mandatory (6.96 KB, patch)
2024-06-11 19:45 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 35635: Add opac_mandatory to patron attribute table (3.09 KB, patch)
2024-06-11 19:45 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 35635: (QA follow-up): fix terminology (1.37 KB, patch)
2024-11-24 17:30 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 35635: (follow-up) Fix DBRev (1.60 KB, patch)
2024-12-02 18:13 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 35635: (QA follow-up): fix terminology (2.21 KB, patch)
2024-12-17 20:42 UTC, Victor Grousset/tuxayo
Details | Diff | Splinter Review
Bug 35635: (follow-up): Mark madatory field as staff interface/OPAC (1.05 KB, patch)
2024-12-20 21:46 UTC, Lucas Gass (lukeg)
Details | Diff | Splinter Review
Bug 35635: DB Updates (2.98 KB, patch)
2025-01-16 09:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 35635: DO NOT PUSH - Schema updates (1.40 KB, patch)
2025-01-16 09:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 35635: Split mandatory field into mandatory and opac_mandatory (7.04 KB, patch)
2025-01-16 09:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 35635: Add opac_mandatory to patron attribute table (3.16 KB, patch)
2025-01-16 09:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 35635: (follow-up) Fix DBRev (1.67 KB, patch)
2025-01-16 09:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 35635: (QA follow-up): fix terminology (2.28 KB, patch)
2025-01-16 09:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 35635: (follow-up): Mark madatory field as staff interface/OPAC (1.12 KB, patch)
2025-01-16 09:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 35635: Flag opac_mandatory as boolean (1009 bytes, patch)
2025-01-16 09:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 35635: Fix server-side check (999 bytes, patch)
2025-01-16 09:43 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 35635: Adjust atomic update (1.98 KB, patch)
2025-01-16 09:45 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Lucas Gass (lukeg) 2023-12-21 21:20:44 UTC
Within Patron attribute types there is a checkbox to make the attribute mandatory. 

Some libraries need to be able to make patron attribute types mandatory on the OPAC but not the staff interface, or vise versa.
Comment 1 Lucas Gass (lukeg) 2024-06-05 22:17:05 UTC
Created attachment 167500 [details] [review]
Bug 35635: DB Updates
Comment 2 Lucas Gass (lukeg) 2024-06-05 22:17:07 UTC
Created attachment 167501 [details] [review]
Bug 35635: DO NOT PUSH - Schema updates
Comment 3 Lucas Gass (lukeg) 2024-06-05 22:17:10 UTC
Created attachment 167502 [details] [review]
Bug 35635: Split mandatory field into mandatory and opac_mandatory
Comment 4 Lucas Gass (lukeg) 2024-06-06 13:27:18 UTC
Created attachment 167546 [details] [review]
Bug 35635: Add opac_mandatory to patron attribute table
Comment 5 Lucas Gass (lukeg) 2024-06-06 13:37:15 UTC
Created attachment 167548 [details] [review]
Bug 35635: Add opac_mandatory to patron attribute table

To test:
1. Before applying the patch go to Adminstration > Patron attribute types
2. Create or modify some attributes to be mandatory and some to not be mandatory.
3. APPLY PATCH, updatedatabase, restart_all
4. Go back to Adminstration > Patron attribute types. The patron attributes that were made mandatory should now also have the opac_mandatory field checked.
5. Make sure that you can change the correctly save the new "OPAC mandatory:" field.
6. If the 'Display in OPAC:' field is unchecked the 'OPAC mandatory:' checkbox should be disabled.
7. Mark some patron attributes as 'OPAC mandatory:'.
8. Go to the OPAC self reg page, the field should be required.
9. BAck on Adminstration > Patron attribute types check some attributes as 'OPAC mandatory:' and 'Editable in OPAC:'.
10. As a logged in OPAC user go to "Personal details" and make sure the attribute is required.
11. For the same attriubute as step 9-10 , mark as NOT 'Editable in OPAC:'. Make sure you can still save the form on the OPAC "Personal details" page.
Comment 6 Brendan Lawlor 2024-06-11 19:45:10 UTC
Created attachment 167643 [details] [review]
Bug 35635: DB Updates

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 7 Brendan Lawlor 2024-06-11 19:45:12 UTC
Created attachment 167644 [details] [review]
Bug 35635: DO NOT PUSH - Schema updates

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 8 Brendan Lawlor 2024-06-11 19:45:14 UTC
Created attachment 167645 [details] [review]
Bug 35635: Split mandatory field into mandatory and opac_mandatory

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 9 Brendan Lawlor 2024-06-11 19:45:16 UTC
Created attachment 167646 [details] [review]
Bug 35635: Add opac_mandatory to patron attribute table

To test:
1. Before applying the patch go to Adminstration > Patron attribute types
2. Create or modify some attributes to be mandatory and some to not be mandatory.
3. APPLY PATCH, updatedatabase, restart_all
4. Go back to Adminstration > Patron attribute types. The patron attributes that were made mandatory should now also have the opac_mandatory field checked.
5. Make sure that you can change the correctly save the new "OPAC mandatory:" field.
6. If the 'Display in OPAC:' field is unchecked the 'OPAC mandatory:' checkbox should be disabled.
7. Mark some patron attributes as 'OPAC mandatory:'.
8. Go to the OPAC self reg page, the field should be required.
9. BAck on Adminstration > Patron attribute types check some attributes as 'OPAC mandatory:' and 'Editable in OPAC:'.
10. As a logged in OPAC user go to "Personal details" and make sure the attribute is required.
11. For the same attriubute as step 9-10 , mark as NOT 'Editable in OPAC:'. Make sure you can still save the form on the OPAC "Personal details" page.

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>
Comment 10 Brendan Lawlor 2024-06-11 19:49:24 UTC
Testing notes:
Everything worked according to the test plan, but one small clarification for steps #7 and 8 is that for the attributes to be on the self reg page I also had to  check 'Editable in OPAC' for the attribute to appear on the self reg page.
Comment 11 Victor Grousset/tuxayo 2024-11-24 17:30:56 UTC
Created attachment 174962 [details] [review]
Bug 35635: (QA follow-up): fix terminology
Comment 12 Victor Grousset/tuxayo 2024-11-24 17:31:34 UTC
Comment on attachment 167646 [details] [review]
Bug 35635: Add opac_mandatory to patron attribute table

Review of attachment 167646 [details] [review]:
-----------------------------------------------------------------

::: koha-tmpl/intranet-tmpl/prog/en/modules/admin/patron-attr-types.tt
@@ +333,3 @@
>                <th>Library limitation</th>
>                <th>Authorized value category</th>
>                <th>Mandatory</th>

Looks like this should be changed to say it's about the staff interface.
Comment 13 Victor Grousset/tuxayo 2024-11-24 17:36:10 UTC
db rev isn't updating the COMMENT for the "mandatory" column when in the kohastructure, it is changed.
That comment ends up in Koha/Schema/Result so depending if the RM and RMaint runs dbic after a doing a databaseupdate or starting KTD they will end up with different POD in the schema files and a different checksum. Which will raise a warning latter for them or someone else.
So even COMMENTs need to be in sync between a clean install and an upgraded install.

About clean install vs upgraded install the column opac_mandatory has a divergence on it's COMMENT too: "on the OPAC" vs "in the OPAC"
And "NOT NULL" is only present on of the two scenarios.
Comment 14 Victor Grousset/tuxayo 2024-11-24 22:34:03 UTC
> and a different checksum. Which will raise a warning latter for them or someone else.


The checksum check won't trip actually. It's ok in this scenario. There will still be unexpected schema class changes when running dbic later.
Comment 15 Lucas Gass (lukeg) 2024-12-02 18:13:51 UTC
Created attachment 175059 [details] [review]
Bug 35635: (follow-up) Fix DBRev
Comment 16 Victor Grousset/tuxayo 2024-12-17 20:42:53 UTC
Created attachment 175635 [details] [review]
Bug 35635: (QA follow-up): fix terminology
Comment 17 Victor Grousset/tuxayo 2024-12-17 23:08:35 UTC
Thanks for the follow-up.

Sorry there is still this remaining:

> And "NOT NULL" is only present on one of the two scenarios.


And comment 12 but it was confusing:
<th>Mandatory - OPAC</th> was added.
But just above there is <th>Mandatory</th>
Which looks like it should be changed to say it's about the staff interface. To avoid confusion which in the worst case could raise doubts about "Mandatory" being about both staff interface and OPAC.
Comment 18 Victor Grousset/tuxayo 2024-12-17 23:09:08 UTC
Follow-up updated for another terminology issue.
Comment 19 Lucas Gass (lukeg) 2024-12-20 21:46:11 UTC
Created attachment 175858 [details] [review]
Bug 35635: (follow-up): Mark madatory field as staff interface/OPAC
Comment 20 Jonathan Druart 2025-01-16 09:40:06 UTC
1. You need that in Koha/Schema/Result/BorrowerAttributeType.pm
     '+mandatory'                 => { is_boolean => 1 },
+    '+opac_mandatory'            => { is_boolean => 1 },

The QA script caught it

2. It does not work at all, if mandatory staff-side but not opac-side, opac-memberentry displays "You have not filled out all required fields. Please fill in all missing fields and resubmit."
Comment 21 Jonathan Druart 2025-01-16 09:43:25 UTC
Created attachment 176595 [details] [review]
Bug 35635: DB Updates

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 22 Jonathan Druart 2025-01-16 09:43:29 UTC
Created attachment 176596 [details] [review]
Bug 35635: DO NOT PUSH - Schema updates

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 23 Jonathan Druart 2025-01-16 09:43:32 UTC
Created attachment 176597 [details] [review]
Bug 35635: Split mandatory field into mandatory and opac_mandatory

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 24 Jonathan Druart 2025-01-16 09:43:35 UTC
Created attachment 176598 [details] [review]
Bug 35635: Add opac_mandatory to patron attribute table

To test:
1. Before applying the patch go to Adminstration > Patron attribute types
2. Create or modify some attributes to be mandatory and some to not be mandatory.
3. APPLY PATCH, updatedatabase, restart_all
4. Go back to Adminstration > Patron attribute types. The patron attributes that were made mandatory should now also have the opac_mandatory field checked.
5. Make sure that you can change the correctly save the new "OPAC mandatory:" field.
6. If the 'Display in OPAC:' field is unchecked the 'OPAC mandatory:' checkbox should be disabled.
7. Mark some patron attributes as 'OPAC mandatory:'.
8. Go to the OPAC self reg page, the field should be required.
9. BAck on Adminstration > Patron attribute types check some attributes as 'OPAC mandatory:' and 'Editable in OPAC:'.
10. As a logged in OPAC user go to "Personal details" and make sure the attribute is required.
11. For the same attriubute as step 9-10 , mark as NOT 'Editable in OPAC:'. Make sure you can still save the form on the OPAC "Personal details" page.

Signed-off-by: Brendan Lawlor <blawlor@clamsnet.org>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 25 Jonathan Druart 2025-01-16 09:43:38 UTC
Created attachment 176599 [details] [review]
Bug 35635: (follow-up) Fix DBRev

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 26 Jonathan Druart 2025-01-16 09:43:41 UTC
Created attachment 176600 [details] [review]
Bug 35635: (QA follow-up): fix terminology

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 27 Jonathan Druart 2025-01-16 09:43:44 UTC
Created attachment 176601 [details] [review]
Bug 35635: (follow-up): Mark madatory field as staff interface/OPAC

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 28 Jonathan Druart 2025-01-16 09:43:47 UTC
Created attachment 176602 [details] [review]
Bug 35635: Flag opac_mandatory as boolean

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 29 Jonathan Druart 2025-01-16 09:43:50 UTC
Created attachment 176603 [details] [review]
Bug 35635: Fix server-side check

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 30 Jonathan Druart 2025-01-16 09:45:19 UTC
Created attachment 176604 [details] [review]
Bug 35635: Adjust atomic update

So that we don't do anything if the new column exists already.