Bug 36453 - BlockExpiredPatronOpacActions should allow multiple actions options
Summary: BlockExpiredPatronOpacActions should allow multiple actions options
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: OPAC (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Pedro Amorim
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on: 26297
Blocks: 38492 34597
  Show dependency treegraph
 
Reported: 2024-03-28 11:02 UTC by Pedro Amorim
Modified: 2024-11-20 10:41 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement improves the BlockExpiredPatronOpacActions system preference to allow the specification of which OPAC actions are blocked for expired patrons. Prior to this enhancement, this system preference functioned as a simple "on" or "off" switch, where having it 'on' blocked both 'placing holds' and 'renewing an item' for expired patrons on the OPAC.
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 36453: DB and data changes (6.98 KB, patch)
2024-03-28 11:22 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: [DO NOT PUSH] DBIC schema files (1.97 KB, patch)
2024-03-28 11:22 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: effective_BlockExpiredPatronOpacActions_contains method (2.64 KB, patch)
2024-03-28 11:22 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: Update old occurrences of effective_BlockExpiredPatronOpacActions (7.23 KB, patch)
2024-03-28 11:22 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: Categories admin page: (12.08 KB, patch)
2024-03-28 11:23 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: BlockExpiredPatronOpacActions system preference (1.40 KB, patch)
2024-03-28 11:23 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: Update tests (8.59 KB, patch)
2024-03-28 11:23 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: DB and data changes (7.03 KB, patch)
2024-04-11 15:10 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 36453: [DO NOT PUSH] DBIC schema files (2.02 KB, patch)
2024-04-11 15:10 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 36453: effective_BlockExpiredPatronOpacActions_contains method (2.69 KB, patch)
2024-04-11 15:10 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 36453: Update old occurrences of effective_BlockExpiredPatronOpacActions (7.29 KB, patch)
2024-04-11 15:10 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 36453: Categories admin page: (12.14 KB, patch)
2024-04-11 15:10 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 36453: BlockExpiredPatronOpacActions system preference (1.46 KB, patch)
2024-04-11 15:11 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 36453: Update tests (8.65 KB, patch)
2024-04-11 15:11 UTC, Arthur Suzuki
Details | Diff | Splinter Review
Bug 36453: (QA follow-up): Cosmetic fixes (5.61 KB, patch)
2024-04-23 15:53 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: (QA follow-up): Cosmetic fixes (7.30 KB, patch)
2024-04-23 16:14 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: (QA follow-up): Update api spec (2.30 KB, patch)
2024-04-24 11:31 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: DB and data changes (7.10 KB, patch)
2024-06-05 16:07 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: [DO NOT PUSH] DBIC schema files (2.09 KB, patch)
2024-06-05 16:07 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: effective_BlockExpiredPatronOpacActions_contains method (2.76 KB, patch)
2024-06-05 16:07 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: Update old occurrences of effective_BlockExpiredPatronOpacActions (7.38 KB, patch)
2024-06-05 16:07 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: Categories admin page: (12.21 KB, patch)
2024-06-05 16:07 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: BlockExpiredPatronOpacActions system preference (1.52 KB, patch)
2024-06-05 16:07 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: Update tests (8.71 KB, patch)
2024-06-05 16:07 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: (QA follow-up): Cosmetic fixes (7.37 KB, patch)
2024-06-05 16:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: (QA follow-up): Update api spec (2.36 KB, patch)
2024-06-05 16:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: (QA follow-up) Modernise database update (4.86 KB, patch)
2024-06-05 16:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: DB and data changes (7.10 KB, patch)
2024-06-05 16:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: [DO NOT PUSH] DBIC schema files (2.09 KB, patch)
2024-06-05 16:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: effective_BlockExpiredPatronOpacActions_contains method (2.76 KB, patch)
2024-06-05 16:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: Update old occurrences of effective_BlockExpiredPatronOpacActions (7.38 KB, patch)
2024-06-05 16:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: Categories admin page: (12.21 KB, patch)
2024-06-05 16:08 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: BlockExpiredPatronOpacActions system preference (1.52 KB, patch)
2024-06-05 16:09 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: Update tests (8.71 KB, patch)
2024-06-05 16:09 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: (QA follow-up) Cosmetic fixes (7.37 KB, patch)
2024-06-05 16:09 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: (QA follow-up) Update api spec (2.36 KB, patch)
2024-06-05 16:09 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: (QA follow-up) Modernise database update (4.86 KB, patch)
2024-06-05 16:09 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 36453: (QA follow-up) Address upgraded instances (2.38 KB, patch)
2024-07-03 10:39 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36453: (QA follow-up) Use varchar instead of mediumtext (3.35 KB, patch)
2024-07-03 10:39 UTC, Pedro Amorim
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Pedro Amorim 2024-03-28 11:02:02 UTC

    
Comment 1 Pedro Amorim 2024-03-28 11:22:51 UTC
Created attachment 164042 [details] [review]
Bug 36453: DB and data changes

- kohastructure.sql updates
- atomicupdate file
- Mandatory data installer updates
Comment 2 Pedro Amorim 2024-03-28 11:22:54 UTC
Created attachment 164043 [details] [review]
Bug 36453: [DO NOT PUSH] DBIC schema files
Comment 3 Pedro Amorim 2024-03-28 11:22:56 UTC
Created attachment 164044 [details] [review]
Bug 36453: effective_BlockExpiredPatronOpacActions_contains method

effective_BlockExpiredPatronOpacActions
is now
effective_BlockExpiredPatronOpacActions_contains

This method has been updated to now consider an action param.
Returns true if the given action is to be blocked to expired
patrons or not.
Comment 4 Pedro Amorim 2024-03-28 11:22:59 UTC
Created attachment 164045 [details] [review]
Bug 36453: Update old occurrences of effective_BlockExpiredPatronOpacActions

Check for 'renew' when appropriate
Check for 'hold' when appropriate

The following command must return nothing before this is pushed to
master:
git grep "\beffective_BlockExpiredPatronOpacActions\b"
Comment 5 Pedro Amorim 2024-03-28 11:23:01 UTC
Created attachment 164046 [details] [review]
Bug 36453: Categories admin page:

Account for multiple values param
Input is now multipleselect select
JavaScript
Staff CSS updates to account for multiselect dropdown in categories admin page
Comment 6 Pedro Amorim 2024-03-28 11:23:04 UTC
Created attachment 164047 [details] [review]
Bug 36453: BlockExpiredPatronOpacActions system preference

The sys pref now allows multipleselect values instead of YesNo
Comment 7 Pedro Amorim 2024-03-28 11:23:06 UTC
Created attachment 164048 [details] [review]
Bug 36453: Update tests

Address new new version of system pref
Address new version of categories DB table BlockExpiredPatronOpacActions column

Test plan, k-t-d, BEFORE applying patch:
1) Edit some patron categories, visit:
/cgi-bin/koha/admin/categories.pl
2) Set different values for the "Block expired patrons" input config
Set a category to block
Set a category to don't block
Set a category to follow the syspref
3) Take note of the current value of the BlockExpiredPatronOpacActions sys pref

Apply patch, then run the following commands
- koha-plack --restart kohadev
- yarn css:build
- run updatedatabase

4) Visit the patron categories you edited before, make sure they all have the correct values for the new config type
5) Check the BlockExpiredPatronOpacActions sys pref and make sure the new value is correct according to what was before
6) Add a new patron of one of the above categories, test that:
If 'hold' is a blocked action, patron is unable to place a hold in OPAC
If 'renew' is a blocked action, patron is unable to renew in OPAC
If 'follow sys pref' is the option, check that a patron may place a hold or renew an item according to the BlockExpiredPatronOpacActions sys pref value

prove t/db_dependent/Circulation.t
prove t/db_dependent/ILSDI_Services.t
prove t/db_dependent/Koha/Object.t
prove t/db_dependent/Koha/Patron/Categories.t
Comment 8 Pedro Amorim 2024-03-28 11:23:32 UTC
The following command must return nothing before this is pushed to
master:
git grep "\beffective_BlockExpiredPatronOpacActions\b"
Comment 9 Arthur Suzuki 2024-04-11 15:08:21 UTC
2cents :
The "specific action" label on patrons category configuration is a bit ambiguous.
I wouldn't know if the selected actions are the blocked ones or allowed ones.
Might be better to call that "block specific actions".

Also the input field seems to have a slight CSS issue, it's not wide enough so we can read the selected value without clicking on it.
Tried both Firefox and Chromium with same results.
Choosing "Follow system preferences" make it wider than both of the other choices which is a bit weird but not much annoying actually.

Also, since the syspref is changed, the "comment" or label of the syspref makes no sense anymore.
Used to be "[block|don't block] expired patrons from blablabla"
Should now be something like "decide which actions are blocked for expired patrons"

tried with a patron the different values from the syspref, works.
the values from the category do actually override the syspref, works.

a couple of very small cosmetic things could be enhanced but still signing off because the functionality just works fine and is great :)
Comment 10 Arthur Suzuki 2024-04-11 15:10:44 UTC
Created attachment 164762 [details] [review]
Bug 36453: DB and data changes

- kohastructure.sql updates
- atomicupdate file
- Mandatory data installer updates

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 11 Arthur Suzuki 2024-04-11 15:10:47 UTC
Created attachment 164763 [details] [review]
Bug 36453: [DO NOT PUSH] DBIC schema files

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 12 Arthur Suzuki 2024-04-11 15:10:50 UTC
Created attachment 164764 [details] [review]
Bug 36453: effective_BlockExpiredPatronOpacActions_contains method

effective_BlockExpiredPatronOpacActions
is now
effective_BlockExpiredPatronOpacActions_contains

This method has been updated to now consider an action param.
Returns true if the given action is to be blocked to expired
patrons or not.

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 13 Arthur Suzuki 2024-04-11 15:10:53 UTC
Created attachment 164765 [details] [review]
Bug 36453: Update old occurrences of effective_BlockExpiredPatronOpacActions

Check for 'renew' when appropriate
Check for 'hold' when appropriate

The following command must return nothing before this is pushed to
master:
git grep "\beffective_BlockExpiredPatronOpacActions\b"

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 14 Arthur Suzuki 2024-04-11 15:10:57 UTC
Created attachment 164766 [details] [review]
Bug 36453: Categories admin page:

Account for multiple values param
Input is now multipleselect select
JavaScript
Staff CSS updates to account for multiselect dropdown in categories admin page

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 15 Arthur Suzuki 2024-04-11 15:11:00 UTC
Created attachment 164767 [details] [review]
Bug 36453: BlockExpiredPatronOpacActions system preference

The sys pref now allows multipleselect values instead of YesNo

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 16 Arthur Suzuki 2024-04-11 15:11:03 UTC
Created attachment 164768 [details] [review]
Bug 36453: Update tests

Address new new version of system pref
Address new version of categories DB table BlockExpiredPatronOpacActions column

Test plan, k-t-d, BEFORE applying patch:
1) Edit some patron categories, visit:
/cgi-bin/koha/admin/categories.pl
2) Set different values for the "Block expired patrons" input config
Set a category to block
Set a category to don't block
Set a category to follow the syspref
3) Take note of the current value of the BlockExpiredPatronOpacActions sys pref

Apply patch, then run the following commands
- koha-plack --restart kohadev
- yarn css:build
- run updatedatabase

4) Visit the patron categories you edited before, make sure they all have the correct values for the new config type
5) Check the BlockExpiredPatronOpacActions sys pref and make sure the new value is correct according to what was before
6) Add a new patron of one of the above categories, test that:
If 'hold' is a blocked action, patron is unable to place a hold in OPAC
If 'renew' is a blocked action, patron is unable to renew in OPAC
If 'follow sys pref' is the option, check that a patron may place a hold or renew an item according to the BlockExpiredPatronOpacActions sys pref value

prove t/db_dependent/Circulation.t
prove t/db_dependent/ILSDI_Services.t
prove t/db_dependent/Koha/Object.t
prove t/db_dependent/Koha/Patron/Categories.t

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Comment 17 Pedro Amorim 2024-04-23 15:53:57 UTC Comment hidden (obsolete)
Comment 18 Pedro Amorim 2024-04-23 15:55:39 UTC
Thank you Arthur for testing and your review.
I agree with all your comments and I have followed up on the QA follow-up patch.
Thanks!
Comment 19 Pedro Amorim 2024-04-23 16:14:13 UTC
Created attachment 165414 [details] [review]
Bug 36453: (QA follow-up): Cosmetic fixes

This is a squash of several improvements:
- Override weird blue color being applied from MultipleSelect when all options from an optgroup are selected;
- Fix input width depending on selected value. Now it should always be same width regardless;
- Updated the system preference UI wording to reflect new behavior;
- Updated UI labels in the patron category edit page to enforce that the actions being selected are "actions to be blocked"
- Corrected sysprefs.sql entry
Comment 20 Pedro Amorim 2024-04-24 09:25:00 UTC
Adding bug 26297 as a dependency. Work here needs to update BlockExpiredPatronOpacActions in the patron categories REST API spec added by bug 26297.
Comment 21 Pedro Amorim 2024-04-24 11:31:01 UTC
Created attachment 165454 [details] [review]
Bug 36453: (QA follow-up): Update api spec

Access {staff_url}/api/v1/patron_categories and notice all is as expected
Update some patron category's blocked expired patron OPAC actions and access the endpoint again, notice it's okay.

Updated API tests to include to_api confirming attributes are rendered correctly:
prove t/db_dependent/api/v1/patron_categories
Comment 22 Martin Renvoize (ashimema) 2024-06-05 16:07:39 UTC
Created attachment 167461 [details] [review]
Bug 36453: DB and data changes

- kohastructure.sql updates
- atomicupdate file
- Mandatory data installer updates

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 23 Martin Renvoize (ashimema) 2024-06-05 16:07:42 UTC
Created attachment 167462 [details] [review]
Bug 36453: [DO NOT PUSH] DBIC schema files

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 24 Martin Renvoize (ashimema) 2024-06-05 16:07:45 UTC
Created attachment 167463 [details] [review]
Bug 36453: effective_BlockExpiredPatronOpacActions_contains method

effective_BlockExpiredPatronOpacActions
is now
effective_BlockExpiredPatronOpacActions_contains

This method has been updated to now consider an action param.
Returns true if the given action is to be blocked to expired
patrons or not.

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 25 Martin Renvoize (ashimema) 2024-06-05 16:07:48 UTC
Created attachment 167464 [details] [review]
Bug 36453: Update old occurrences of effective_BlockExpiredPatronOpacActions

Check for 'renew' when appropriate
Check for 'hold' when appropriate

The following command must return nothing before this is pushed to
master:
git grep "\beffective_BlockExpiredPatronOpacActions\b"

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 26 Martin Renvoize (ashimema) 2024-06-05 16:07:51 UTC
Created attachment 167465 [details] [review]
Bug 36453: Categories admin page:

Account for multiple values param
Input is now multipleselect select
JavaScript
Staff CSS updates to account for multiselect dropdown in categories admin page

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 27 Martin Renvoize (ashimema) 2024-06-05 16:07:54 UTC
Created attachment 167466 [details] [review]
Bug 36453: BlockExpiredPatronOpacActions system preference

The sys pref now allows multipleselect values instead of YesNo

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 28 Martin Renvoize (ashimema) 2024-06-05 16:07:57 UTC
Created attachment 167467 [details] [review]
Bug 36453: Update tests

Address new new version of system pref
Address new version of categories DB table BlockExpiredPatronOpacActions column

Test plan, k-t-d, BEFORE applying patch:
1) Edit some patron categories, visit:
/cgi-bin/koha/admin/categories.pl
2) Set different values for the "Block expired patrons" input config
Set a category to block
Set a category to don't block
Set a category to follow the syspref
3) Take note of the current value of the BlockExpiredPatronOpacActions sys pref

Apply patch, then run the following commands
- koha-plack --restart kohadev
- yarn css:build
- run updatedatabase

4) Visit the patron categories you edited before, make sure they all have the correct values for the new config type
5) Check the BlockExpiredPatronOpacActions sys pref and make sure the new value is correct according to what was before
6) Add a new patron of one of the above categories, test that:
If 'hold' is a blocked action, patron is unable to place a hold in OPAC
If 'renew' is a blocked action, patron is unable to renew in OPAC
If 'follow sys pref' is the option, check that a patron may place a hold or renew an item according to the BlockExpiredPatronOpacActions sys pref value

prove t/db_dependent/Circulation.t
prove t/db_dependent/ILSDI_Services.t
prove t/db_dependent/Koha/Object.t
prove t/db_dependent/Koha/Patron/Categories.t

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 29 Martin Renvoize (ashimema) 2024-06-05 16:08:00 UTC
Created attachment 167468 [details] [review]
Bug 36453: (QA follow-up): Cosmetic fixes

This is a squash of several improvements:
- Override weird blue color being applied from MultipleSelect when all options from an optgroup are selected;
- Fix input width depending on selected value. Now it should always be same width regardless;
- Updated the system preference UI wording to reflect new behavior;
- Updated UI labels in the patron category edit page to enforce that the actions being selected are "actions to be blocked"
- Corrected sysprefs.sql entry

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 30 Martin Renvoize (ashimema) 2024-06-05 16:08:03 UTC
Created attachment 167469 [details] [review]
Bug 36453: (QA follow-up): Update api spec

Access {staff_url}/api/v1/patron_categories and notice all is as expected
Update some patron category's blocked expired patron OPAC actions and access the endpoint again, notice it's okay.

Updated API tests to include to_api confirming attributes are rendered correctly:
prove t/db_dependent/api/v1/patron_categories

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 31 Martin Renvoize (ashimema) 2024-06-05 16:08:06 UTC
Created attachment 167470 [details] [review]
Bug 36453: (QA follow-up) Modernise database update

This patch adds the colored output expected for 24.11.x onward database
updates.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 32 Martin Renvoize (ashimema) 2024-06-05 16:08:45 UTC
Created attachment 167471 [details] [review]
Bug 36453: DB and data changes

- kohastructure.sql updates
- atomicupdate file
- Mandatory data installer updates

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 33 Martin Renvoize (ashimema) 2024-06-05 16:08:48 UTC
Created attachment 167472 [details] [review]
Bug 36453: [DO NOT PUSH] DBIC schema files

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 34 Martin Renvoize (ashimema) 2024-06-05 16:08:51 UTC
Created attachment 167473 [details] [review]
Bug 36453: effective_BlockExpiredPatronOpacActions_contains method

effective_BlockExpiredPatronOpacActions
is now
effective_BlockExpiredPatronOpacActions_contains

This method has been updated to now consider an action param.
Returns true if the given action is to be blocked to expired
patrons or not.

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 35 Martin Renvoize (ashimema) 2024-06-05 16:08:54 UTC
Created attachment 167474 [details] [review]
Bug 36453: Update old occurrences of effective_BlockExpiredPatronOpacActions

Check for 'renew' when appropriate
Check for 'hold' when appropriate

The following command must return nothing before this is pushed to
master:
git grep "\beffective_BlockExpiredPatronOpacActions\b"

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 36 Martin Renvoize (ashimema) 2024-06-05 16:08:57 UTC
Created attachment 167475 [details] [review]
Bug 36453: Categories admin page:

Account for multiple values param
Input is now multipleselect select
JavaScript
Staff CSS updates to account for multiselect dropdown in categories admin page

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 37 Martin Renvoize (ashimema) 2024-06-05 16:09:00 UTC
Created attachment 167476 [details] [review]
Bug 36453: BlockExpiredPatronOpacActions system preference

The sys pref now allows multipleselect values instead of YesNo

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 38 Martin Renvoize (ashimema) 2024-06-05 16:09:03 UTC
Created attachment 167477 [details] [review]
Bug 36453: Update tests

Address new new version of system pref
Address new version of categories DB table BlockExpiredPatronOpacActions column

Test plan, k-t-d, BEFORE applying patch:
1) Edit some patron categories, visit:
/cgi-bin/koha/admin/categories.pl
2) Set different values for the "Block expired patrons" input config
Set a category to block
Set a category to don't block
Set a category to follow the syspref
3) Take note of the current value of the BlockExpiredPatronOpacActions sys pref

Apply patch, then run the following commands
- koha-plack --restart kohadev
- yarn css:build
- run updatedatabase

4) Visit the patron categories you edited before, make sure they all have the correct values for the new config type
5) Check the BlockExpiredPatronOpacActions sys pref and make sure the new value is correct according to what was before
6) Add a new patron of one of the above categories, test that:
If 'hold' is a blocked action, patron is unable to place a hold in OPAC
If 'renew' is a blocked action, patron is unable to renew in OPAC
If 'follow sys pref' is the option, check that a patron may place a hold or renew an item according to the BlockExpiredPatronOpacActions sys pref value

prove t/db_dependent/Circulation.t
prove t/db_dependent/ILSDI_Services.t
prove t/db_dependent/Koha/Object.t
prove t/db_dependent/Koha/Patron/Categories.t

Signed-off-by: Arthur Suzuki <arthur.suzuki@biblibre.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 39 Martin Renvoize (ashimema) 2024-06-05 16:09:06 UTC
Created attachment 167478 [details] [review]
Bug 36453: (QA follow-up) Cosmetic fixes

This is a squash of several improvements:
- Override weird blue color being applied from MultipleSelect when all options from an optgroup are selected;
- Fix input width depending on selected value. Now it should always be same width regardless;
- Updated the system preference UI wording to reflect new behavior;
- Updated UI labels in the patron category edit page to enforce that the actions being selected are "actions to be blocked"
- Corrected sysprefs.sql entry

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 40 Martin Renvoize (ashimema) 2024-06-05 16:09:09 UTC
Created attachment 167479 [details] [review]
Bug 36453: (QA follow-up) Update api spec

Access {staff_url}/api/v1/patron_categories and notice all is as expected
Update some patron category's blocked expired patron OPAC actions and access the endpoint again, notice it's okay.

Updated API tests to include to_api confirming attributes are rendered correctly:
prove t/db_dependent/api/v1/patron_categories

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 41 Martin Renvoize (ashimema) 2024-06-05 16:09:13 UTC
Created attachment 167480 [details] [review]
Bug 36453: (QA follow-up) Modernise database update

This patch adds the colored output expected for 24.11.x onward database
updates.

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 42 Martin Renvoize (ashimema) 2024-06-05 16:11:00 UTC
Great work.. whilst the method name is a little scary I'm happy this is already a big improvement and I couldn't come up with a better name.

Down the line I'd love to see more cleanup like the two methods in Patron::Category merged and the method name somehow clarified/reduced... 

Passing QA
Comment 43 Martin Renvoize (ashimema) 2024-06-11 09:44:51 UTC
Thanks for all the hard work!

Pushed to main for the next 24.11.00 release as RM Assistant
Comment 44 Tomás Cohen Arazi (tcohen) 2024-07-02 14:14:31 UTC
Hi all. This broke MySQL 8 support, as it is setting a default value for a MEDIUM column, which is not allowed.

Steps to reproduce:

```shell
ktd down
DB_IMAGE=mysql:8.0 ktd up
```

and you get:

```
C4::Installer::load_sql returned the following errors while attempting to load /kohadevbox/koha/installer/data/mysql/kohastructure.sql:
DBD::mysql::st execute failed: BLOB, TEXT, GEOMETRY or JSON column 'BlockExpiredPatronOpacActions' can't have a default value at /usr/share/perl5/DBIx/RunSQL.pm line 290, <$args{...}> line 1.
Something went wrong loading file /kohadevbox/koha/installer/data/mysql/kohastructure.sql ([SQL ERROR]: CREATE TABLE `categories` (
...
```
Comment 45 Tomás Cohen Arazi (tcohen) 2024-07-02 14:15:40 UTC
(In reply to Tomás Cohen Arazi from comment #44)
> Hi all. This broke MySQL 8 support, as it is setting a default value for a
> MEDIUM column, which is not allowed.

I propose we change it to NULL, and make the code take NULL => follow_syspref_BlockExpiredPatronOpacActions behavior.
Comment 46 Katrin Fischer 2024-07-02 14:18:24 UTC
Maybe we could also reconsider the datatype? Not sure what datatype would allow defaults, but since we only want to store a few things we do probably have a lot of other options.
Comment 47 Pedro Amorim 2024-07-02 15:03:20 UTC
Can try and test this in a bit, can't remember why the choice for mediumtext but I wonder if just changing it to varchar(255) would fix the issue?
Comment 48 Pedro Amorim 2024-07-03 10:39:51 UTC
Created attachment 168435 [details] [review]
Bug 36453: (QA follow-up) Address upgraded instances

To test:
1) Apply only this patch, skipping the next one (patch 'Use varchar instead of mediumtext')
2) Run ktd up with default DBMS mariadb:10.5: ktd up
3) Confirm the database state is wrong:
  DESC categories BlockExpiredPatronOpacActions;
  ^ This should return type = mediumtext
4) Run updatedatabase, make sure green success message shows
  Running the above query again will show type = varchar(128)
5) Run updatedatabase again, notice blue info message notifies its already varchar
Comment 49 Pedro Amorim 2024-07-03 10:39:55 UTC
Created attachment 168436 [details] [review]
Bug 36453: (QA follow-up) Use varchar instead of mediumtext

Test plan:
1) ktd down
2) DB_IMAGE=mysql:8.0 ktd up
3) Should now work with no issues
Comment 50 Katrin Fischer 2024-07-18 15:27:52 UTC
Please switch back to PQA when a follow-up is added - this way I can't miss it :)
Comment 51 Katrin Fischer 2024-07-18 15:34:38 UTC
I think we might have got away with changing the kohastructure and the first database update, as noone should be running on main... but this of course is the safest way of doing it. :)
Comment 52 Katrin Fischer 2024-07-18 15:39:22 UTC
Pushed follow-up patches to main.
Comment 53 Pedro Amorim 2024-07-18 15:47:36 UTC
(In reply to Katrin Fischer from comment #50)
> Please switch back to PQA when a follow-up is added - this way I can't miss
> it :)

Ooops.

(In reply to Katrin Fischer from comment #51)
> I think we might have got away with changing the kohastructure and the first
> database update, as noone should be running on main... but this of course is
> the safest way of doing it. :)

Agreed. But I think the additional atomic update covers all our basis and further helps ensure this does not come up again for anyone.
Removed 'additional_work_needed'.
Comment 54 Lucas Gass (lukeg) 2024-07-18 19:17:15 UTC
This seems like an enhancement to me and I'm reluctant to backport it to 24.05.x. Feel free to tell me I'm wrong.
Comment 55 Katrin Fischer 2024-07-18 21:23:13 UTC
Multiple database changes and also some failing tests we need to look into - not for backporting.
Comment 56 Pedro Amorim 2024-07-19 08:22:47 UTC
(In reply to Katrin Fischer from comment #55)
> Multiple database changes and also some failing tests we need to look into -
> not for backporting.

Agreed. What tests are failing as a result of this? Let me know, I'll find the time to look into it.
Comment 57 Jonathan Druart 2024-11-18 14:26:09 UTC
.js file is using _("") when __("") must be used. I am suspecting some strings to not be picked by the translation script.
Comment 58 Pedro Amorim 2024-11-20 10:41:55 UTC
(In reply to Jonathan Druart from comment #57)
> .js file is using _("") when __("") must be used. I am suspecting some
> strings to not be picked by the translation script.

Opened bug 38492