Bug 25709: Rename systempreference to NotesToHide
authorNick Clemens <nick@bywatersolutions.com>
Mon, 6 Jul 2020 17:56:35 +0000 (17:56 +0000)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Wed, 29 Jul 2020 08:08:43 +0000 (10:08 +0200)
In an effort to use more inclusive language we have added a new coding guideline:
https://wiki.koha-community.org/wiki/Coding_Guidelines#TERM3:_Inclusive_Language

This patchset renames a syspref to be clearer and follow the guideline

To test:
1 - Apply patch and updatedatabase
2 - git grep NotesBlacklist
3 - Note all remaining occurrences are translations, db updates, and release notes
4 - Add a field (e.g. '520' ) to the NotesToHide systempreference
5 - View a record with a 520 field on the opac
6 - Confirm the field does not show in the 'Title notes' tab

Signed-off-by: Owen Leonard <oleonard@myacpl.org>

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>

C4/Biblio.pm
installer/data/mysql/atomicupdate/rename_preference_NotesToHide.perl [new file with mode: 0644]
installer/data/mysql/sysprefs.sql
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
t/Biblio/GetMarcNotes.t

index 0e0a309..41bdcc5 100644 (file)
@@ -1513,11 +1513,11 @@ sub GetMarcNotes {
         590 => 1
     );
 
-    my %blacklist = map { $_ => 1 }
-        split( /,/, C4::Context->preference('NotesBlacklist'));
+    my %hiddenlist = map { $_ => 1 }
+        split( /,/, C4::Context->preference('NotesToHide'));
     foreach my $field ( $record->field($scope) ) {
         my $tag = $field->tag();
-        next if $blacklist{ $tag };
+        next if $hiddenlist{ $tag };
         next if $opac && $maybe_private{$tag} && !$field->indicator(1);
         if( $marcflavour ne 'UNIMARC' && $field->subfield('u') ) {
             # Field 5XX$u always contains URI
diff --git a/installer/data/mysql/atomicupdate/rename_preference_NotesToHide.perl b/installer/data/mysql/atomicupdate/rename_preference_NotesToHide.perl
new file mode 100644 (file)
index 0000000..90a4e73
--- /dev/null
@@ -0,0 +1,5 @@
+$DBversion = 'XXX'; # will be replaced by the RM
+if( CheckVersion( $DBversion ) ) {
+    $dbh->do( "UPDATE systempreferences SET variable='NotesToHide' WHERE variable = 'NotesBlacklist'" );
+    NewVersion( $DBversion, 25709, "Rename systempreference to NotesToHide");
+}
index dbb1393..758a591 100644 (file)
@@ -335,7 +335,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
 ('noItemTypeImages','0',NULL,'If ON, disables itemtype images in the staff interface','YesNo'),
 ('NoRefundOnLostReturnedItemsAge','','','Do not refund lost item fees if item is lost for more than this number of days','Integer'),
 ('NoRenewalBeforePrecision','exact_time','date|exact_time','Calculate "No renewal before" based on date only or exact time of due date','Choice'),
-('NotesBlacklist','',NULL,'List of notes fields that should not appear in the title notes/description separator of details','free'),
+('NotesToHide','',NULL,'List of notes fields that should not appear in the title notes/description separator of details','free'),
 ('NotHighlightedWords','and|or|not',NULL,'List of words to NOT highlight when OpacHitHighlight is enabled','free'),
 ('NoticeBcc','','','Email address to bcc outgoing notices sent by email','free'),
 ('NoticeCSS','',NULL,'Notices CSS url.','free'),
index 475decf..343665c 100644 (file)
@@ -230,7 +230,7 @@ Cataloging:
             - "is the logged in user's library. The second tab will contain all other items."
         -
             - "Don't show"
-            - pref: NotesBlacklist
+            - pref: NotesToHide
               class: multi
             - "note fields in the 'Title notes' tab and in the 'Description' tab on the OPAC and staff interface detail pages. Use a comma to separate multiple fields. Examples: 500,502 (MARC21); 300,328 (UNIMARC)."
             - <br />
index bb55226..ccd368d 100755 (executable)
@@ -27,7 +27,7 @@ use C4::Biblio;
 
 subtest 'GetMarcNotes MARC21' => sub {
     plan tests => 11;
-    t::lib::Mocks::mock_preference( 'NotesBlacklist', '520' );
+    t::lib::Mocks::mock_preference( 'NotesToHide', '520' );
 
     my $record = MARC::Record->new;
     $record->append_fields(
@@ -55,7 +55,7 @@ subtest 'GetMarcNotes MARC21' => sub {
 
 subtest 'GetMarcNotes UNIMARC' => sub {
     plan tests => 3;
-    t::lib::Mocks::mock_preference( 'NotesBlacklist', '310' );
+    t::lib::Mocks::mock_preference( 'NotesToHide', '310' );
 
     my $record = MARC::Record->new;
     $record->append_fields(