Bugzilla – Attachment 148755 Details for
Bug 28166
Optionally add MARC fields to authority search
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28166: Optionally add MARC fields to authority search
Bug-28166-Optionally-add-MARC-fields-to-authority-.patch (text/plain), 8.49 KB, created by
ByWater Sandboxes
on 2023-03-27 12:02:29 UTC
(
hide
)
Description:
Bug 28166: Optionally add MARC fields to authority search
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2023-03-27 12:02:29 UTC
Size:
8.49 KB
patch
obsolete
>From e7ed306d670805e9113ea6d95e27d5d1c1967d98 Mon Sep 17 00:00:00 2001 >From: Mark Hofstetter <mark@hofstetter.at> >Date: Mon, 27 Mar 2023 12:09:32 +0200 >Subject: [PATCH] Bug 28166: Optionally add MARC fields to authority search >MIME-Version: 1.0 >Content-Type: text/plain; charset=UTF-8 >Content-Transfer-Encoding: 8bit > >adds the same feature to Authority Search as in the "normal" Z39.50 search, to display >arbitrary marc fields in the search results > >1. apply patch >2. go to System preferences->Authorities preferences >3. the new option "AdditionalFieldsInZ3950ResultAuthSearch" shows up >4. enter the additional field numbers you want to see eg '001' >5. make an "Authority" search via Z39.50 >6. the new new column "Additional fields" will display >7. sign off ;-) > >Sponsored-by: Steiermärkische Landesbibliothek >Signed-off-by: Laura Escamilla <laura.escamilla@bywatersolutions.com> >--- > C4/Breeding.pm | 38 ++++++++++++++++++- > .../data/mysql/atomicupdate/bug_28166.pl | 17 +++++++++ > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../admin/preferences/authorities.pref | 4 ++ > .../modules/cataloguing/z3950_auth_search.tt | 16 ++++++++ > 5 files changed, 74 insertions(+), 2 deletions(-) > create mode 100755 installer/data/mysql/atomicupdate/bug_28166.pl > >diff --git a/C4/Breeding.pm b/C4/Breeding.pm >index 7b3dbc5874..aaa675b708 100644 >--- a/C4/Breeding.pm >+++ b/C4/Breeding.pm >@@ -342,10 +342,37 @@ sub _do_xslt_proc { > } > } > >+sub _add_rowdata { >+ my ($row, $record)=@_; >+ my %fetch= ( >+ title => 'biblio.title', >+ author => 'biblio.author', >+ isbn =>'biblioitems.isbn', >+ lccn =>'biblioitems.lccn', #LC control number (not call number) >+ edition =>'biblioitems.editionstatement' >+ ); >+ $fetch{date} = C4::Context->preference('marcflavour') eq "MARC21" ? 'biblio.copyrightdate' : 'biblioitems.publicationyear'; >+ >+ #foreach my $k (keys %fetch) { >+ # $row->{$k} = C4::Biblio::TransformMarcToKohaOneField( $fetch{$k}, $record ); >+ #} >+ $row->{date}//= $row->{date2}; >+ $row->{isbn}=_isbn_replace($row->{isbn}); >+ >+ $row = _add_custom_field_rowdata( >+ $row, >+ $record, >+ C4::Context->preference('AdditionalFieldsInZ3950ResultSearch')) >+ if C4::Context->preference('AdditionalFieldsInZ3950ResultSearch'); >+ return $row; >+} >+ > sub _add_custom_field_rowdata > { >- my ( $row, $record ) = @_; >- my $pref_newtags = C4::Context->preference('AdditionalFieldsInZ3950ResultSearch'); >+ # my ( $row, $record ) = @_; >+ # my $pref_newtags = C4::Context->preference('AdditionalFieldsInZ3950ResultSearch'); >+ # hks3 >+ my ( $row, $record, $pref_newtags ) = @_; > my $pref_flavour = C4::Context->preference('MarcFlavour'); > > $pref_newtags =~ s/^\s+|\s+$//g; >@@ -602,6 +629,13 @@ sub Z3950SearchAuth { > $row_data{heading} = $heading; > $row_data{authid} = $authid; > $row_data{heading_code} = $heading_authtype_code; >+ my $pref_newtags = >+ C4::Context->preference('AdditionalFieldsInZ3950ResultAuthSearch'); >+ if ($pref_newtags) { >+ my $row = {}; >+ $row = _add_custom_field_rowdata($row, $marcrecord, $pref_newtags); >+ $row_data{row} = $row; >+ } > push( @breeding_loop, \%row_data ); > } > else { >diff --git a/installer/data/mysql/atomicupdate/bug_28166.pl b/installer/data/mysql/atomicupdate/bug_28166.pl >new file mode 100755 >index 0000000000..1939efcd5f >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_28166.pl >@@ -0,0 +1,17 @@ >+use Modern::Perl; >+ >+return { >+ bug_number => "28166", >+ description => "Add system preference for additional columns for Z39.50 authority search results", >+ up => sub { >+ my ($args) = @_; >+ my ($dbh, $out) = @$args{qw(dbh out)}; >+ # Do you stuffs here >+ $dbh->do(q{INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES >+('AdditionalFieldsInZ3950ResultAuthSearch', '', NULL, 'Determines which MARC field/subfields are displayed in -Additional field- column in the result of an authority Z39.50 search', 'Free') >+}); >+ # Print useful stuff here >+ # sysprefs >+ say $out "Added new system preference 'AdditionalFieldsInZ3950ResultAuthSearch'"; >+ }, >+}; >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 98eced6bc0..391d07a07c 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -11,6 +11,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('AcqWarnOnDuplicateInvoice','0','','Warn librarians when they try to create a duplicate invoice','YesNo'), > ('ActionLogsTraceDepth', '0', '', 'Sets the maximum depth of the action logs stack trace', 'Integer'), > ('AdditionalContentsEditor','tinymce','tinymce|codemirror','Choose tool for editing News.', 'Choice'), >+('AdditionalFieldsInZ3950ResultAuthSearch', '', NULL, 'Determines which MARC field/subfields are displayed in -Additional field- column in the result of an authority Z39.50 search', 'Free'), > ('AdditionalFieldsInZ3950ResultSearch', '', NULL, 'Determines which MARC field/subfields are displayed in -Additional field- column in the result of a search Z3950', 'Free'), > ('AddressForFailedOverdueNotices', '', NULL, 'Destination email for failed overdue notices. If left empty then it will fallback to the first defined address in the following list: Library ReplyTo, Library Email, ReplytoDefault and KohaAdminEmailAddress', 'free'), > ('AddressFormat','us','us|de|fr','Choose format to display postal addresses', 'Choice'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >index a8a5244368..67fe6e4b44 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/authorities.pref >@@ -75,6 +75,10 @@ Authorities: > default: "Work cat." > type: textarea > class: code >+ - >+ - Display the MARC field/subfields >+ - pref: AdditionalFieldsInZ3950ResultAuthSearch >+ - " in the 'Additional fields' column of Z39.50 search results (use comma as delimiter e.g.: \"<code>001, 035$a</code>\")" > > Linker: > - >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt >index 7bf4cfa9b9..f7b438fe85 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/z3950_auth_search.tt >@@ -1,5 +1,6 @@ > [% USE raw %] > [% USE Asset %] >+[% USE Koha %] > [% SET footerjs = 1 %] > [% INCLUDE 'doc-head-open.inc' %] > [% IF ( opsearch ) %] >@@ -80,6 +81,9 @@ > <th>Server</th> > <th>Heading</th> > <th>Authority type</th> >+ [% IF Koha.Preference('AdditionalFieldsInZ3950ResultAuthSearch') %] >+ <th>Additional fields</th> >+ [% END %] > <th class="noExport">Actions</th> > </tr></thead> > <tbody>[% FOREACH breeding_loo IN breeding_loop %] >@@ -88,6 +92,18 @@ > <td>[% breeding_loo.server | html %]</td> > <td>[% breeding_loo.heading | html %]</td> > <td>[% breeding_loo.heading_code | html %]</td> >+ [% IF Koha.Preference('AdditionalFieldsInZ3950ResultAuthSearch') != '' %] >+ <td> >+ <dl> >+ [% FOREACH addnumberfield IN breeding_loo.row.addnumberfields %] >+ [% FOREACH string IN breeding_loo.row.$addnumberfield %] >+ <dt>[% addnumberfield | html %]:</dt> >+ <dd>[% string | html %]</dd> >+ [% END %] >+ [% END %] >+ </dl> >+ </td> >+ [% END %] > <td class="actions"> > <div class="btn-group dropup"> > <a class="btn btn-default btn-xs z3950actions" href="#">MARC</a><button class="btn-xs dropdown-toggle" data-toggle="dropdown"><span class="caret"></span></button> >-- >2.30.2
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 28166
:
120139
|
120154
|
120155
|
148749
|
148755
|
148778
|
150590
|
150594
|
150595
|
150596
|
150601
|
153431
|
156166
|
156167
|
156550
|
156551
|
157646
|
157647