From 76db14d111c50c0b861ece1497230a6654d866d1 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 --- C4/Biblio.pm | 22 +++++++++++-------- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 7 ++++++ .../en/modules/admin/preferences/cataloguing.pref | 6 ++++- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/C4/Biblio.pm b/C4/Biblio.pm index d64acfb..c874a1d 100644 --- a/C4/Biblio.pm +++ b/C4/Biblio.pm @@ -1719,16 +1719,20 @@ 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; + } + } } if ($note) { diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql index 2fb5bd4..54a41c0 100644 --- a/installer/data/mysql/sysprefs.sql +++ b/installer/data/mysql/sysprefs.sql @@ -395,3 +395,4 @@ INSERT INTO systempreferences (`variable`, `value`, `options`, `explanation`, `t ('PatronSelfRegistrationExpireTemporaryAccountsDelay', '0', NULL, 'If PatronSelfRegistrationDefaultCategory is enabled, this system preference controls how long a patron can have a temporary status before the account is deleted automatically. It is an integer value representing a number of days to wait before deleting a temporary patron account. Setting it to 0 disables the deleting of temporary accounts.', 'Integer'), ('PatronSelfRegistrationBorrowerMandatoryField', 'surname|firstname', NULL , 'Choose the mandatory fields for a patron''s account, when registering via the OPAC.', 'free'), ('PatronSelfRegistrationBorrowerUnwantedField', '', NULL , 'Name the fields you don''t want to display when registering a new patron via the OPAC.', 'free'); +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 cdc53cb..de08211 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -6285,6 +6285,13 @@ if (CheckVersion($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.11.00.XXX"; +if ( C4::Context->preference("Version") < TransformToNum($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 91f15c3..1b5d3ad 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 @@ -156,4 +156,8 @@ Cataloging: - pref: OpacSuppressionByIPRange class: short - (Leave blank if not used. Define a range like 192.168..) - + - + - 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) -- 1.7.2.5