Bug 36371 - Patron attributes will not show in brief info if value is 0
Summary: Patron attributes will not show in brief info if value is 0
Status: Pushed to oldstable
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal
Assignee: Brendan Lawlor
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-20 14:26 UTC by Andrew Fuerste-Henry
Modified: 2024-05-28 16:03 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
24.05.00,23.11.06,23.05.12
Circulation function:


Attachments
Bug 36371: Check if patron attribute is defined in circ-menu.inc (2.24 KB, patch)
2024-03-22 17:48 UTC, Brendan Lawlor
Details | Diff | Splinter Review
Bug 36371: Check if patron attribute is defined in circ-menu.inc (2.30 KB, patch)
2024-03-22 17:54 UTC, Andrew Fuerste-Henry
Details | Diff | Splinter Review
Bug 36371: Check if patron attribute is defined in circ-menu.inc (2.36 KB, patch)
2024-03-22 18:58 UTC, Nick Clemens (kidclamp)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Fuerste-Henry 2024-03-20 14:26:57 UTC
A patron attribute will not show in the patron brief information if the value for that attribute is 0. This presents an issue for attributes using the YES_NO authorised value, which stores as 1/0.

To recreate:
1 - create a patron attribute: check "display in patron's brief info" and tie to the YES_NO authorised value
2 - Find a patron, set your attribute to Yes
3 - Confirm you see the attribute and its value both in the "Additional attributes and identifiers" section of the patron detail page and in the patron brief info area
4 - Set your attribute to No
5 - Confirm you see the attribute and its value in "Additional attributes and identifiers" but it no longer shows in the brief info

6 - Edit your YES_NO authorised value so the codes are Y for Yes and N for No
7 - Find a new patron, repeat steps 2-5, confirm that your No value does show in brief info when the code is N rather than 0
Comment 1 Brendan Lawlor 2024-03-22 17:48:19 UTC
Created attachment 163731 [details] [review]
Bug 36371: Check if patron attribute is defined in circ-menu.inc

This patch changes the conditional that determines if a patron attribute is displayed in the patron brief info. Instead of checking the value of the attribute we should check if the attribute is defined.

To test:
1. Create a patron attribute, eg. party_mode, check 'display in patron's brief info' and tie to the YES_NO authorised value.
2. Find a patron and set your attribute to Yes
3. Confirm you see the attribute and its value both in the "Additional attributes and identifiers" section of the patron detail page and in the patron brief info area
4. Set your attribute to No
5. Confirm you see the attribute and its value in "Additional attributes and identifiers" but it no longer shows in the brief info
6. Apply patch and restart_all
7. Notice that your attribute now displays in the brief info, such as Party mode: No
8. Set the attribute to the first empty option
9. Check the patron record brief info to confirm that the attribute does not display when the value is empty.
Comment 2 Andrew Fuerste-Henry 2024-03-22 17:54:15 UTC
Created attachment 163732 [details] [review]
Bug 36371: Check if patron attribute is defined in circ-menu.inc

This patch changes the conditional that determines if a patron attribute is displayed in the patron brief info. Instead of checking the value of the attribute we should check if the attribute is defined.

To test:
1. Create a patron attribute, eg. party_mode, check 'display in patron's brief info' and tie to the YES_NO authorised value.
2. Find a patron and set your attribute to Yes
3. Confirm you see the attribute and its value both in the "Additional attributes and identifiers" section of the patron detail page and in the patron brief info area
4. Set your attribute to No
5. Confirm you see the attribute and its value in "Additional attributes and identifiers" but it no longer shows in the brief info
6. Apply patch and restart_all
7. Notice that your attribute now displays in the brief info, such as Party mode: No
8. Set the attribute to the first empty option
9. Check the patron record brief info to confirm that the attribute does not display when the value is empty.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Comment 3 Nick Clemens (kidclamp) 2024-03-22 18:58:02 UTC
Created attachment 163737 [details] [review]
Bug 36371: Check if patron attribute is defined in circ-menu.inc

This patch changes the conditional that determines if a patron attribute is displayed in the patron brief info. Instead of checking the value of the attribute we should check if the attribute is defined.

To test:
1. Create a patron attribute, eg. party_mode, check 'display in patron's brief info' and tie to the YES_NO authorised value.
2. Find a patron and set your attribute to Yes
3. Confirm you see the attribute and its value both in the "Additional attributes and identifiers" section of the patron detail page and in the patron brief info area
4. Set your attribute to No
5. Confirm you see the attribute and its value in "Additional attributes and identifiers" but it no longer shows in the brief info
6. Apply patch and restart_all
7. Notice that your attribute now displays in the brief info, such as Party mode: No
8. Set the attribute to the first empty option
9. Check the patron record brief info to confirm that the attribute does not display when the value is empty.

Signed-off-by: Andrew Fuerste Henry <andrewfh@dubcolib.org>
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 4 Katrin Fischer 2024-03-25 08:54:30 UTC
Pushed for 24.05!

Well done everyone, thank you!
Comment 5 Fridolin Somers 2024-05-23 08:30:45 UTC
Pushed to 23.11.x for 23.11.06
Comment 6 Lucas Gass (lukeg) 2024-05-28 16:03:00 UTC
Backported to 23.05.x for upcoming 23.05.12