[Koha-patches] [PATCH] bug_6488: Added trailing \n when parsing OpacHiddenItems to make YAML happy

Srdjan Jankovic srdjan at catalyst.net.nz
Tue Sep 6 04:08:28 CEST 2011


---
 C4/Items.pm |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/C4/Items.pm b/C4/Items.pm
index bc36dd1..0f098af 100644
--- a/C4/Items.pm
+++ b/C4/Items.pm
@@ -1531,6 +1531,7 @@ sub GetHiddenItemnumbers {
     my @resultitems;
 
     my $yaml = C4::Context->preference('OpacHiddenItems');
+    $yaml = "$yaml\n"; # YAML is anal on ending \n. Surplus does not hurt
     my $hidingrules;
     eval {
     	$hidingrules = YAML::Load($yaml);
@@ -1538,7 +1539,7 @@ sub GetHiddenItemnumbers {
     if ($@) {
     	warn "Unable to parse OpacHiddenItems syspref : $@";
     	return ();
-    } else {
+    }
     my $dbh = C4::Context->dbh;
 
 	# For each item
@@ -1563,9 +1564,7 @@ sub GetHiddenItemnumbers {
 	    }
 	}
 	return @resultitems;
-    }
-
- }
+}
 
 =head3 get_item_authorised_values
 
-- 
1.6.5



More information about the Koha-patches mailing list