Bug 33567 - Remove fallback for Reference_NFL_statuses in C4/XSLT module
Summary: Remove fallback for Reference_NFL_statuses in C4/XSLT module
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Marcel de Rooy
QA Contact: Testopia
URL:
Keywords:
Depends on: 21260
Blocks:
  Show dependency treegraph
 
Reported: 2023-04-20 06:44 UTC by Marcel de Rooy
Modified: 2023-12-28 20:42 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00


Attachments
Bug 33567: Empty NFL_statuses pref in unit test (1.72 KB, patch)
2023-04-20 07:03 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33567: Remove hardcoded fallback in module (1.11 KB, patch)
2023-04-20 07:03 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33567: Add a dbrev for installation with empty pref (1.64 KB, patch)
2023-04-20 07:03 UTC, Marcel de Rooy
Details | Diff | Splinter Review
Bug 33567: Empty NFL_statuses pref in unit test (1.75 KB, patch)
2023-05-09 10:23 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33567: Remove hardcoded fallback in module (1.14 KB, patch)
2023-05-09 10:23 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 33567: Add a dbrev for installation with empty pref (1.68 KB, patch)
2023-05-09 10:23 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 Marcel de Rooy 2023-04-20 06:44:56 UTC
C4/XSLT contains this line:

my $ref_status = C4::Context->preference('Reference_NFL_Statuses') || '1|2';

This is a kind of undocumented fallback (that I introduced myself).
We should either add this to the pref text or just do what is kind of intuitively expected: if the pref is empty, move all items to Not available.

Note that the installer creates the pref by default with 1|2. So this might be a quite theoretical change for most.
Comment 1 Marcel de Rooy 2023-04-20 07:03:48 UTC
Created attachment 149921 [details] [review]
Bug 33567: Empty NFL_statuses pref in unit test

This test should fail now, since it would trigger the hardcoded
fallback in the XSLT module.

Test plan:
Run t/db_dependent/XSLT.t
Should fail.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Marcel de Rooy 2023-04-20 07:03:50 UTC
Created attachment 149922 [details] [review]
Bug 33567: Remove hardcoded fallback in module

Test plan:
Run t/db_dependent/XSLT.t again
Should pass now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 3 Marcel de Rooy 2023-04-20 07:03:52 UTC
Created attachment 149923 [details] [review]
Bug 33567: Add a dbrev for installation with empty pref

To keep current behavior, we can copy the removed fallback
into the syspref value in case someone might have cleared the pref.

Note: We are not restoring deleted prefs here; that is a data problem
outside the scope of this report. A regular installation should always
have this pref.

Test plan:
Run updatedatabase.pl
Bonus: Clear the pref Reference_NFL_Statuses and run again, verify that
the pref has changed.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 4 Marcel de Rooy 2023-04-20 07:04:11 UTC
Architectural/trivial: self SO
Comment 5 Jonathan Druart 2023-05-09 10:23:11 UTC
Created attachment 150837 [details] [review]
Bug 33567: Empty NFL_statuses pref in unit test

This test should fail now, since it would trigger the hardcoded
fallback in the XSLT module.

Test plan:
Run t/db_dependent/XSLT.t
Should fail.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 6 Jonathan Druart 2023-05-09 10:23:13 UTC
Created attachment 150838 [details] [review]
Bug 33567: Remove hardcoded fallback in module

Test plan:
Run t/db_dependent/XSLT.t again
Should pass now.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 7 Jonathan Druart 2023-05-09 10:23:16 UTC
Created attachment 150839 [details] [review]
Bug 33567: Add a dbrev for installation with empty pref

To keep current behavior, we can copy the removed fallback
into the syspref value in case someone might have cleared the pref.

Note: We are not restoring deleted prefs here; that is a data problem
outside the scope of this report. A regular installation should always
have this pref.

Test plan:
Run updatedatabase.pl
Bonus: Clear the pref Reference_NFL_Statuses and run again, verify that
the pref has changed.

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 8 Marcel de Rooy 2023-05-09 11:02:21 UTC
(In reply to Jonathan Druart from comment #7)
> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

Thx.
Comment 9 Tomás Cohen Arazi 2023-05-12 14:21:19 UTC
Pushed to master for 23.05.

Nice work everyone, thanks!
Comment 10 Matt Blenkinsop 2023-05-15 10:45:08 UTC
Enhancement - not backporting to 22.11.x