Bug 36521 - Checkbox preferences should be allowed to be submitted empty
Summary: Checkbox preferences should be allowed to be submitted empty
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Pedro Amorim
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks: 35604
  Show dependency treegraph
 
Reported: 2024-04-04 12:46 UTC by Pedro Amorim
Modified: 2024-04-05 09:53 UTC (History)
6 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


Attachments
Bug 36521: Checkbox preferences should be allowed to be submitted empty (2.85 KB, patch)
2024-04-04 12:47 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36521: Checkbox preferences should be allowed to be submitted empty (2.82 KB, patch)
2024-04-04 12:47 UTC, Pedro Amorim
Details | Diff | Splinter Review
Bug 36521: Checkbox preferences should be allowed to be submitted empty (2.89 KB, patch)
2024-04-04 14:59 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 Pedro Amorim 2024-04-04 12:46:13 UTC

    
Comment 1 Pedro Amorim 2024-04-04 12:47:09 UTC Comment hidden (obsolete)
Comment 2 Pedro Amorim 2024-04-04 12:47:52 UTC
Created attachment 164421 [details] [review]
Bug 36521: Checkbox preferences should be allowed to be submitted empty

Visit:
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=i18n_l10n

Uncheck English on both 'language' and 'OPACLanguages'. Save.
Notice "Nothing to save" shows.
Apply patch. Repeat. Notice you can now save with all options empty.

To my knowledge, these 2 language preferences are the only checkbox preferences of this kind (correct me
if I'm wrong please).

I need to add a new system preference for bug 35604 listing all installed ILL backends so the user
may enable or disable each of the backends.
I want that particular system preference to be disabled as a whole if all backends are unchecked, but I was unable
to uncheck all before this patch.

I understand that for languages checkboxes specifically not allowing everything to be empty may make sense (at least
one language should be enabled, after all). But these languages checkbox preferences should be the exception, not the rule,
for this behaviour.
Comment 3 Jonathan Druart 2024-04-04 13:08:41 UTC
(In reply to Pedro Amorim from comment #2)
> To my knowledge, these 2 language preferences are the only checkbox
> preferences of this kind (correct me
> if I'm wrong please).

There is this patch in the queue
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=163699

But I don't think they will conflict.
Comment 4 Pedro Amorim 2024-04-04 14:04:00 UTC
Thanks Joubu, I was not aware of that.
I think there certainly may be some overlap there with what I'm doing in bug 35604 in regards to multiple checkboxes being sortable, although I've had to create my own 'ill_backends' system preference type (because the options I need are dynamically loaded depending on what backends are installed, not from hardcoded option values coming from a *.pref file).

I'll definitely look at bug 29948 in the near future, probably rebase my work on that and see what can be reused/improved.
Comment 5 Jonathan Druart 2024-04-04 14:43:19 UTC
Found a bug:
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=&op=search&searchfield=lang

language and opaclanguage have "English"
Deselect English for language, save OK
Deselect English for opaclanguage, save => "Nothing to save" FAIL
Comment 6 Jonathan Druart 2024-04-04 14:59:44 UTC
Created attachment 164427 [details] [review]
Bug 36521: Checkbox preferences should be allowed to be submitted empty

Visit:
http://localhost:8081/cgi-bin/koha/admin/preferences.pl?tab=i18n_l10n

Uncheck English on both 'language' and 'OPACLanguages'. Save.
Notice "Nothing to save" shows.
Apply patch. Repeat. Notice you can now save with all options empty.

To my knowledge, these 2 language preferences are the only checkbox preferences of this kind (correct me
if I'm wrong please).

I need to add a new system preference for bug 35604 listing all installed ILL backends so the user
may enable or disable each of the backends.
I want that particular system preference to be disabled as a whole if all backends are unchecked, but I was unable
to uncheck all before this patch.

I understand that for languages checkboxes specifically not allowing everything to be empty may make sense (at least
one language should be enabled, after all). But these languages checkbox preferences should be the exception, not the rule,
for this behaviour.

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2024-04-04 14:59:59 UTC
(In reply to Jonathan Druart from comment #5)
> Found a bug:
> http://localhost:8081/cgi-bin/koha/admin/preferences.
> pl?tab=&op=search&searchfield=lang
> 
> language and opaclanguage have "English"
> Deselect English for language, save OK
> Deselect English for opaclanguage, save => "Nothing to save" FAIL

Cache was not cleared, sorry!
Comment 8 Jonathan Druart 2024-04-04 15:00:16 UTC
Trivial, bad bug, passing QA.
Comment 9 Katrin Fischer 2024-04-05 09:53:28 UTC
Pushed for 24.05!

Well done everyone, thank you!