Bugzilla – Attachment 67618 Details for
Bug 9495
Split NotesToHide in to two prefs for staff and OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 9495 - split NotesBlacklist in to two prefs for staff and OPAC
Bug-9495---split-NotesBlacklist-in-to-two-prefs-fo.patch (text/plain), 6.22 KB, created by
Alex Buckley
on 2017-10-04 22:49:46 UTC
(
hide
)
Description:
Bug 9495 - split NotesBlacklist in to two prefs for staff and OPAC
Filename:
MIME Type:
Creator:
Alex Buckley
Created:
2017-10-04 22:49:46 UTC
Size:
6.22 KB
patch
obsolete
>From 77688e427dbb3276a523c5e4744b545702b3ad66 Mon Sep 17 00:00:00 2001 >From: Leire Diez <leire@scanbit.net> >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 > >Followed test plan, patch worked as described. Also ran QA test tools >which passed modified files > >Signed-off-by: Alex Buckley <alexbuckley@catalyst.net.nz> >--- > 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 baaa325..c3c0307 100644 >--- a/C4/Biblio.pm >+++ b/C4/Biblio.pm >@@ -1720,6 +1720,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 bc08b5a..436b840 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -281,6 +281,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 ea42dab..40938cf 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 9adefc7..d052dcf 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 >@@ -206,6 +206,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 cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 9495
:
67182
|
67183
| 67618 |
67619