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

[email protected] changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #67182|1                           |0
        is obsolete|                            |

--- Comment #5 from [email protected] ---
Comment on attachment 67182
  --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=67182
Bug 9495 - split NotesBlacklist in to two prefs for staff and OPAC

>From e37502012c17f4d000b0e8298124afea6cf23ea8 Mon Sep 17 00:00:00 2001
>From: Leire Diez <[email protected]>
>Date: Mon, 18 Sep 2017 13:10:49 +0200
>Subject: [PATCH] Bug 9495 - split NotesBlacklist in to two prefs for staff and
> OPAC
>
>Create the new preference NotesOPACBlacklist, it works like NotesBlacklist but 
>these fields will not appear in the OPAC detail and will appear in the staff
>
>Test plan:
>1) Add the fields to hide in the OPAC in the new preference NotesOPACBlacklist
>2) Check in the Opac detail if these fields don't appear
>3) Check in the staff detail if these fields appear
>
>Sponsored-by: Scanbit
>---
> C4/Biblio.pm                                       | 39 ++++++++++++++++++++++
> installer/data/mysql/sysprefs.sql                  |  1 +
> installer/data/mysql/updatedatabase.pl             |  9 +++++
> .../en/modules/admin/preferences/cataloguing.pref  |  5 +++
> opac/opac-detail.pl                                |  2 +-
> 5 files changed, 55 insertions(+), 1 deletion(-)
>
>diff --git a/C4/Biblio.pm b/C4/Biblio.pm
>index 12e6e7f..1ed6960 100644
>--- a/C4/Biblio.pm
>+++ b/C4/Biblio.pm
>@@ -1715,6 +1715,45 @@ sub GetMarcNotes {
>     return \@marcnotes;
> }
> 
>+=head2 GetOPACMarcNotes
>+
>+    $marcnotesarray = GetOPACMarcNotes( $record, $marcflavour );
>+
>+    Get all notes from the MARC record and returns them in an array.
>+    The notes are stored in different fields depending on MARC flavour.
>+    MARC21 field 555 gets special attention for the $u subfields.
>+
>+=cut
>+
>+sub GetOPACMarcNotes {
>+    my ( $record, $marcflavour ) = @_;
>+    if (!$record) {
>+        carp 'GetMarcNotes called on undefined record';
>+        return;
>+    }
>+
>+    my $scope = $marcflavour eq "UNIMARC"? '3..': '5..';
>+    my @marcnotes;
>+    my %blacklist = map { $_ => 1 }
>+        split( /,/, C4::Context->preference('NotesOPACBlacklist'));
>+    foreach my $field ( $record->field($scope) ) {
>+        my $tag = $field->tag();
>+        next if $blacklist{ $tag };
>+        if( $marcflavour ne 'UNIMARC' && $tag =~ /555/ ) {
>+            # Field 555$u contains URLs
>+            # We first push the regular subfields and all $u's separately
>+            # Leave further actions to the template
>+            push @marcnotes, { marcnote => $field->as_string('abcd') };
>+            foreach my $sub ( $field->subfield('u') ) {
>+                push @marcnotes, { marcnote => $sub };
>+            }
>+        } else {
>+            push @marcnotes, { marcnote => $field->as_string() };
>+        }
>+    }
>+    return \@marcnotes;
>+}
>+
> =head2 GetMarcSubjects
> 
>   $marcsubjcts = GetMarcSubjects($record,$marcflavour);
>diff --git a/installer/data/mysql/sysprefs.sql 
>b/installer/data/mysql/sysprefs.sql
>index 5155fe7..928d1ac 100644
>--- a/installer/data/mysql/sysprefs.sql
>+++ b/installer/data/mysql/sysprefs.sql
>@@ -280,6 +280,7 @@ INSERT INTO systempreferences ( `variable`, `value`, 
>`options`, `explanation`, `
> ('NorwegianPatronDBPassword','',NULL,'Password for communication with the 
> Norwegian national patron database.','Free'),
> ('NorwegianPatronDBSearchNLAfterLocalHit','0',NULL,'Search NL if a search has 
> already given one or more local hits?.','YesNo'),
> ('NotesBlacklist','',NULL,'List of notes fields that should not appear in the 
> title notes/description separator of details','free'),
>+('NotesOPACBlacklist','',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'),
>diff --git a/installer/data/mysql/updatedatabase.pl 
>b/installer/data/mysql/updatedatabase.pl
>index 698eb32..d5dd064 100755
>--- a/installer/data/mysql/updatedatabase.pl
>+++ b/installer/data/mysql/updatedatabase.pl
>@@ -14617,6 +14617,15 @@ if( CheckVersion( $DBversion ) ) {
>     SetVersion( $DBversion );
>     print "Upgrade to $DBversion done (Bug 18718 - Language selector in staff 
> header menu similar to OPAC )\n";
> }
>+$DBversion = '17.06.00.006';
>+if( CheckVersion( $DBversion ) ) {
>+    $dbh->do(q{
>+        INSERT INTO systempreferences 
>(variable,value,explanation,options,type) VALUES('NotesOPACBlacklist','','List 
>of notes fields that should not appear in the title notes/description 
>separator of details',NULL,'free')
>+        });
>+
>+    SetVersion( $DBversion );
>+    print "Upgrade to $DBversion done (Bug 9495 - split NotesBlacklist in to 
>two prefs for staff and OPAC )\n";
>+}
> 
> $DBversion = '17.06.00.006';
> if( CheckVersion( $DBversion ) ) {
>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 1aeadf9..06382d0 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
>@@ -202,6 +202,11 @@ Cataloging:
>               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)
>         -
>+            - Don't show these
>+            - pref: NotesOPACBlacklist
>+              class: multi
>+            - note fields in title notes separator (OPAC record details). The 
>fields should appear separated with commas and according with the Koha MARC 
>format (eg 3.. for UNIMARC, 5.. for MARC21)
>+        -
>             - pref: AcquisitionDetails
>               choices:
>                   yes: Display
>diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl
>index 8252e50..5459c2b 100755
>--- a/opac/opac-detail.pl
>+++ b/opac/opac-detail.pl
>@@ -748,7 +748,7 @@ if (!C4::Context->preference("OPACXSLTDetailsDisplay") ) {
>     );
> }
> 
>-my $marcnotesarray   = GetMarcNotes   ($record,$marcflavour);
>+my $marcnotesarray   = GetOPACMarcNotes   ($record,$marcflavour);
> my $subtitle         = GetRecordValue('subtitle', $record, 
> GetFrameworkCode($biblionumber));
> 
>     $template->param(
>-- 
>2.1.4

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to