From 63ef513c0fe02be3d2cf5212389ce0a1bf10745c Mon Sep 17 00:00:00 2001 From: Vitor FERNANDES Date: Wed, 28 Nov 2012 11:07:54 +0000 Subject: [PATCH] BUG 9162 - Add a system preference to set which notes fields appears on title notes/description separator Added a new system preference to control the fields to not appear in the separator. Change GetMarcNotes to use the system preference created to only appear the fields that aren't in the list, Signed-off-by: Kyle M Hall Signed-off-by: Jonathan Druart FIX some indentation in C4/Biblio.pm +FIX 1 end of parentheses in sysprefs.sql Signed-off-by: Jared Camins-Esakov --- C4/Biblio.pm | 20 +++++++++++-------- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 +++++++ .../admin/preferences/cataloguing.pref | 5 +++++ 4 files changed, 25 insertions(+), 8 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index d64acfb17b..7a9b7bb4a0 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1719,15 +1719,19 @@ sub GetMarcNotes { my $note = ""; my $tag = ""; my $marcnote; + my %blacklist = map { $_ => 1 } split(/,/,C4::Context->preference('NotesBlacklist')); foreach my $field ( $record->field($scope) ) { - my $value = $field->as_string(); - if ( $note ne "" ) { - $marcnote = { marcnote => $note, }; - push @marcnotes, $marcnote; - $note = $value; - } - if ( $note ne $value ) { - $note = $note . " " . $value; + my $tag = $field->tag(); + if (!$blacklist{$tag}) { + my $value = $field->as_string(); + if ( $note ne "" ) { + $marcnote = { marcnote => $note, }; + push @marcnotes, $marcnote; + $note = $value; + } + if ( $note ne $value ) { + $note = $note . " " . $value; + } } } diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 079ad47233..95d0e7d675 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -403,3 +403,4 @@ INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES(' INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HTML5MediaEnabled','not','Show a tab with a HTML5 media player for files catalogued in field 856','not|opac|staff|both','Choice'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('HTML5MediaExtensions','webm|ogg|ogv|oga|vtt','Media file extensions','','free'); INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('AllowHoldsOnPatronsPossessions', '1', 'Allow holds on records that patron have items of it',NULL,'YesNo'); +INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 235c2971ee..381631d65b 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6324,6 +6324,13 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.11.00.XXX"; +if ( CheckVersion($DBversion) ) { + $dbh->do("INSERT INTO systempreferences (variable,value,explanation,options,type) VALUES('NotesBlacklist','','List of notes fields that should not appear in the title notes/description separator of details',NULL,'free')"); + print "Upgrade to $DBversion done (Bug 9162 - Add a system preference to set which notes fields appears on title notes/description separator)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref index f2a16c67ec..09ec796ad5 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -167,3 +167,8 @@ Cataloging: homebranch: 'home branch' holdingbranch: 'holding branch' - 'is the branch of user logged in. The other tab contains other items.' + - + - Don't show these + - pref: NotesBlacklist + class: multi + - note fields in title notes separator (OPAC record details) and in the description separator (Staff client record details). The fields should appear separated with commas and according with the Koha MARC format (eg 3.. for UNIMARC, 5.. for MARC21) -- 2.39.5