Bug 27652 - Offer selections for preferences which ask for patron categories
Summary: Offer selections for preferences which ask for patron categories
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords: Manual
Depends on:
Blocks:
 
Reported: 2021-02-08 12:36 UTC by Owen Leonard
Modified: 2021-12-13 21:13 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement to system preferences lets you select patron categories from a dropdown list, instead of manually entering patron category codes. This prevents possible errors from manually entering incorrect codes. This is enabled for these system preferences: - PatronSelfRegistrationDefaultCategory (single option) - GoogleOpenIDConnectDefaultCategory (single option) - OPACHoldsIfAvailableAtPickup (multiple options) - BatchCheckouts (multiple options)
Version(s) released in:
21.05.00


Attachments
Bug 27652: Display patron's categories for sysprefs expecting them (9.51 KB, patch)
2021-02-09 16:33 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 27652: Display patron's categories for sysprefs expecting them (11.28 KB, patch)
2021-02-10 19:27 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27652: (follow-up) Correct typo in database update (1.10 KB, patch)
2021-02-10 19:27 UTC, Owen Leonard
Details | Diff | Splinter Review
Bug 27652: Display patron's categories for sysprefs expecting them (11.33 KB, patch)
2021-02-23 23:00 UTC, David Nind
Details | Diff | Splinter Review
Bug 27652: (follow-up) Correct typo in database update (1.15 KB, patch)
2021-02-23 23:00 UTC, David Nind
Details | Diff | Splinter Review
Bug 27652: Display patron's categories for sysprefs expecting them (11.39 KB, patch)
2021-03-07 18:26 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 27652: (follow-up) Correct typo in database update (1.20 KB, patch)
2021-03-07 18:26 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Owen Leonard 2021-02-08 12:36:39 UTC
We have several system preferences where the user is supposed to enter a patron category, but it's a text input. These should offer selections of existing patron categories to prevent data errors.

Ideally we'd have two ways to configure the preferences: As a single <select> ("choices" in the pref file) or multiple select ("multiple" in the pref file).

 PatronSelfRegistrationDefaultCategory - single
 GoogleOpenIDConnectDefaultCategory - single
 OPACHoldsIfAvailableAtPickup - multiple
 BatchCheckouts - multiple
Comment 1 Jonathan Druart 2021-02-09 16:33:42 UTC Comment hidden (obsolete)
Comment 2 Jonathan Druart 2021-02-09 16:34:13 UTC
Feel lazy today to write a test plan for that patch, but it seems to work correctly so far.
Comment 3 Owen Leonard 2021-02-09 18:37:49 UTC
Thanks Jonathan! I'll test and add a test plan.
Comment 4 Owen Leonard 2021-02-10 19:27:13 UTC
Created attachment 116687 [details] [review]
Bug 27652: Display patron's categories for sysprefs expecting them

This patch adds a new type of system preference entry option: patron
category. A preference with this type will show either a <select> with
patron categories to choose from or a multiple-select menu for choosing
one or more.

This prevents possible errors from incorrect category codes being
entered manually.

To test, apply the patch and run the database update.

- Go to Administration -> System preferences.
- Test each of the updated preferences to confirm that the available
  options are correct and that your selections are correctly saved.

  - Single category selections, PatronSelfRegistrationDefaultCategory
    and GoogleOpenIDConnectDefaultCategory. With each of these you
    should see a dropdown where you can select of all the existing
    patron categories.

  - Multiple selections, OPACHoldsIfAvailableAtPickup and
    BatchCheckouts: These preferences should have an option for
    selecting one or more system preferences at once.

- Test the pages affected by the updated system preferences:

- With BatchCheckouts enabled, confirm that the batch checkout page is
  correctly limited by patron category.

- Set the OPACHoldsIfAvailableAtPickup preference to "Don't allow" and
  select at least one patron category in the
  OPACHoldsIfAvailableAtPickupExceptions preference.
- Log in to the OPAC as a patron whose category was not selected in
  the OPACHoldsIfAvailableAtPickupExceptions preference.
- Try to place a hold on an item which is available at a library.
- When confirming the hold, the libraries where the item is available
  should be disabled in the "Pick up location" dropdown.
- Repeat the process as a patron whose category was selected in
  OPACHoldsIfAvailableAtPickupExceptions. There should be no disabled
  pickup locations.
Comment 5 Owen Leonard 2021-02-10 19:27:16 UTC
Created attachment 116688 [details] [review]
Bug 27652: (follow-up) Correct typo in database update

This patch adds a missing "SET" in the database update. Before:

   UPDATE systempreferences
   value=REPLACE(value, '|', ',')

Corrected:

   UPDATE systempreferences
   SET value=REPLACE(value, '|', ',')
Comment 6 David Nind 2021-02-23 23:00:37 UTC
Created attachment 117225 [details] [review]
Bug 27652: Display patron's categories for sysprefs expecting them

This patch adds a new type of system preference entry option: patron
category. A preference with this type will show either a <select> with
patron categories to choose from or a multiple-select menu for choosing
one or more.

This prevents possible errors from incorrect category codes being
entered manually.

To test, apply the patch and run the database update.

- Go to Administration -> System preferences.
- Test each of the updated preferences to confirm that the available
  options are correct and that your selections are correctly saved.

  - Single category selections, PatronSelfRegistrationDefaultCategory
    and GoogleOpenIDConnectDefaultCategory. With each of these you
    should see a dropdown where you can select of all the existing
    patron categories.

  - Multiple selections, OPACHoldsIfAvailableAtPickup and
    BatchCheckouts: These preferences should have an option for
    selecting one or more system preferences at once.

- Test the pages affected by the updated system preferences:

- With BatchCheckouts enabled, confirm that the batch checkout page is
  correctly limited by patron category.

- Set the OPACHoldsIfAvailableAtPickup preference to "Don't allow" and
  select at least one patron category in the
  OPACHoldsIfAvailableAtPickupExceptions preference.
- Log in to the OPAC as a patron whose category was not selected in
  the OPACHoldsIfAvailableAtPickupExceptions preference.
- Try to place a hold on an item which is available at a library.
- When confirming the hold, the libraries where the item is available
  should be disabled in the "Pick up location" dropdown.
- Repeat the process as a patron whose category was selected in
  OPACHoldsIfAvailableAtPickupExceptions. There should be no disabled
  pickup locations.

Signed-off-by: David Nind <david@davidnind.com>
Comment 7 David Nind 2021-02-23 23:00:40 UTC
Created attachment 117226 [details] [review]
Bug 27652: (follow-up) Correct typo in database update

This patch adds a missing "SET" in the database update. Before:

   UPDATE systempreferences
   value=REPLACE(value, '|', ',')

Corrected:

   UPDATE systempreferences
   SET value=REPLACE(value, '|', ',')

Signed-off-by: David Nind <david@davidnind.com>
Comment 8 Katrin Fischer 2021-03-07 16:10:22 UTC
I love this improvement, but I think I found a problem:

When you use select all it selects all checkboxes, but it saved to my database as 0. Tested with the BatchCheckouts preference. I did run the database update.
Comment 9 Katrin Fischer 2021-03-07 18:24:10 UTC
(In reply to Katrin Fischer from comment #8)
> I love this improvement, but I think I found a problem:
> 
> When you use select all it selects all checkboxes, but it saved to my
> database as 0. Tested with the BatchCheckouts preference. I did run the
> database update.

Scratch that - I looked at the wrong preference... and forgot to turn the feature on *sigh*
Comment 10 Katrin Fischer 2021-03-07 18:26:10 UTC
Created attachment 117892 [details] [review]
Bug 27652: Display patron's categories for sysprefs expecting them

This patch adds a new type of system preference entry option: patron
category. A preference with this type will show either a <select> with
patron categories to choose from or a multiple-select menu for choosing
one or more.

This prevents possible errors from incorrect category codes being
entered manually.

To test, apply the patch and run the database update.

- Go to Administration -> System preferences.
- Test each of the updated preferences to confirm that the available
  options are correct and that your selections are correctly saved.

  - Single category selections, PatronSelfRegistrationDefaultCategory
    and GoogleOpenIDConnectDefaultCategory. With each of these you
    should see a dropdown where you can select of all the existing
    patron categories.

  - Multiple selections, OPACHoldsIfAvailableAtPickup and
    BatchCheckouts: These preferences should have an option for
    selecting one or more system preferences at once.

- Test the pages affected by the updated system preferences:

- With BatchCheckouts enabled, confirm that the batch checkout page is
  correctly limited by patron category.

- Set the OPACHoldsIfAvailableAtPickup preference to "Don't allow" and
  select at least one patron category in the
  OPACHoldsIfAvailableAtPickupExceptions preference.
- Log in to the OPAC as a patron whose category was not selected in
  the OPACHoldsIfAvailableAtPickupExceptions preference.
- Try to place a hold on an item which is available at a library.
- When confirming the hold, the libraries where the item is available
  should be disabled in the "Pick up location" dropdown.
- Repeat the process as a patron whose category was selected in
  OPACHoldsIfAvailableAtPickupExceptions. There should be no disabled
  pickup locations.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 11 Katrin Fischer 2021-03-07 18:26:13 UTC
Created attachment 117893 [details] [review]
Bug 27652: (follow-up) Correct typo in database update

This patch adds a missing "SET" in the database update. Before:

   UPDATE systempreferences
   value=REPLACE(value, '|', ',')

Corrected:

   UPDATE systempreferences
   SET value=REPLACE(value, '|', ',')

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 12 Jonathan Druart 2021-03-09 16:20:00 UTC
Pushed to master for 21.05, thanks to everybody involved!
Comment 13 Fridolin Somers 2021-03-19 13:32:33 UTC
Enhancement not pushed to 20.11.x