[Koha-bugs] [Bug 20930] Validate and cache parsed YAML/JSON type system preferences

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Fri Jan 10 16:15:40 CET 2020


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20930

Jonathan Druart <jonathan.druart at bugs.koha-community.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|Signed Off                  |Failed QA
                 CC|                            |jonathan.druart at bugs.koha-c
                   |                            |ommunity.org

--- Comment #29 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
QA comments:
1. You remove the validation from GetHiddenItemnumbers and so assume that the
data in the pref is correct, but maybe wrong data exist in the DB prior to this
patch.
(Also, use YAML in C4::Items that is no longer needed)

2. I do not think we should not use YAML to convert the syspref's value to perl
struct.
For instance, "field: [value1, value2]" does not work, ie. the
ref($syspref_val) return an empty string (means it's a scalar):
To recreate, edit OpacHiddenItems with "field: [value1, value2]"
Apply:
diff --git a/C4/Items.pm b/C4/Items.pm
index 519ce41991..283def5e4c 100644
--- a/C4/Items.pm
+++ b/C4/Items.pm
@@ -1202,6 +1202,8 @@ sub GetHiddenItemnumbers {
     my @resultitems;

     my $hidingrules = C4::Context->preference('OpacHiddenItems');
+    warn $hidingrules;
+    warn ref($hidingrules);
     return () if !$hidingrules or ref($hidingrules) ne 'HASH';
     my $dbh = C4::Context->dbh;

Finally run:
use Koha::Items;                                                                
use C4::Items;                                                                  
my $items = Koha::Items->search->unblessed;                                     
C4::Items::GetHiddenItemnumbers({items => $items}); 

It displays:
field: [value1, value2] at /kohadevbox/koha/C4/Items.pm line 1205.
Warning: something's wrong at /kohadevbox/koha/C4/Items.pm line 1206.

3. "Error: your data might not have been saved", it is what I get when I
generate an invalid yaml, I do not get info about the line, or what the error
is.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list