Bug 33567

Summary: Remove fallback for Reference_NFL_statuses in C4/XSLT module
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: Architecture, internals, and plumbingAssignee: Marcel de Rooy <m.de.rooy>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, matt.blenkinsop
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=30352
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
23.05.00
Bug Depends on: 21260    
Bug Blocks:    
Attachments: Bug 33567: Empty NFL_statuses pref in unit test
Bug 33567: Remove hardcoded fallback in module
Bug 33567: Add a dbrev for installation with empty pref
Bug 33567: Empty NFL_statuses pref in unit test
Bug 33567: Remove hardcoded fallback in module
Bug 33567: Add a dbrev for installation with empty pref

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