Bugzilla – Attachment 31677 Details for
Bug 12357
Enhancements to RIS and BibTeX exporting
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12357 [1] - Add ability to export arbitrary fields for RIS format
Bug-12357-1---Add-ability-to-export-arbitrary-fiel.patch (text/plain), 5.98 KB, created by
Kyle M Hall (khall)
on 2014-09-17 14:13:34 UTC
(
hide
)
Description:
Bug 12357 [1] - Add ability to export arbitrary fields for RIS format
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2014-09-17 14:13:34 UTC
Size:
5.98 KB
patch
obsolete
>From 438f18db05722ffe2e3751807a397c805fbc5ee8 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 3 Jun 2014 09:04:57 -0400 >Subject: [PATCH] Bug 12357 [1] - Add ability to export arbitrary fields for RIS format > >Some libraries would like to be able to add arbitrary fields to both the >RIS and BibTeX citation formats that a record can be saved as from the >staff intranet and public catalog. In addition, they would like to be >able to override the default record type and use Koha's itemtype as the >record type for those formats as well. > >Test Plan: >1) Apply this patch >2) Run updatedatabase.pl >3) Add the following to the new syspref RisExportAdditionalFields: >LC: 010$a >NT: [501$a, 505$g] >4) Find or create a record with an 010$a (lccn) field, a 501$a field > and multiple 505$g fields. >5) Locate the record in the catalog, choose "Save" and select RIS >6) Inspect the downloaded file, note the LC and multiple NT fields >--- > C4/Ris.pm | 29 ++++++++++++++++++++ > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 10 +++++++ > .../en/modules/admin/preferences/cataloguing.pref | 10 +++++++ > 4 files changed, 50 insertions(+), 0 deletions(-) > >diff --git a/C4/Ris.pm b/C4/Ris.pm >index d601c96..539d622 100644 >--- a/C4/Ris.pm >+++ b/C4/Ris.pm >@@ -287,6 +287,35 @@ sub marc2ris { > print_uri($record->field('856')); > } > >+ my $syspref = C4::Context->preference('RisExportAdditionalFields'); >+ if ($syspref) { >+ $syspref = "$syspref\n\n"; >+ my $yaml = eval { YAML::Load($syspref); }; >+ if ($@) { >+ warn "Unable to parse RisExportAdditionalFields : $@"; >+ } >+ else { >+ my $r; >+ foreach my $ris_tag ( keys %$yaml ) { >+ my @fields = >+ ref( $yaml->{$ris_tag} ) eq 'ARRAY' >+ ? @{ $yaml->{$ris_tag} } >+ : $yaml->{$ris_tag}; >+ for my $tag_subfield (@fields) { >+ my ( $f, $sf ) = split /\$/, $tag_subfield; >+ if ( $f && $sf ) { >+ foreach my $field ( $record->field($f) ) { >+ my @values = $field->subfield($sf); >+ foreach my $v (@values) { >+ print "$ris_tag - $v\r\n"; >+ } >+ } >+ } >+ } >+ } >+ } >+ } >+ > ## end RIS dataset > print "ER - \r\n"; > >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index faa9ff3..52904eb 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -343,6 +343,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('ReturnLog','1',NULL,'If ON, enables the circulation (returns) log','YesNo'), > ('ReturnToShelvingCart','0','','If set, when any item is \'checked in\', it\'s location code will be changed to CART.','YesNo'), > ('reviewson','1','','If ON, enables patron reviews of bibliographic records in the OPAC','YesNo'), >+('RisExportAdditionalFields', '', NULL , 'Define additional RIS tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.', 'textarea'), > ('RoutingListAddReserves','1','','If ON the patrons on routing lists are automatically added to holds on the issue.','YesNo'), > ('RoutingListNote','To change this note edit <a href=\"/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=RoutingListNote#jumped\">RoutlingListNote</a> system preference.','70|10','Define a note to be shown on all routing lists','Textarea'), > ('RoutingSerials','1',NULL,'If ON, serials routing is enabled','YesNo'), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index bfe5f71..5170605 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8751,6 +8751,16 @@ if ( CheckVersion($DBversion) ) { > SetVersion($DBversion); > } > >+$DBversion = "3.17.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do(q{ >+ INSERT INTO systempreferences (variable,value,options,explanation,type) >+ VALUES ('RisExportAdditionalFields', '', NULL , 'Define additional RIS tags to export from MARC records in YAML format as an associative array with either a marc tag/subfield combination as the value, or a list of tag/subfield combinations.', 'textarea') >+ }); >+ print "Upgrade to $DBversion done (Bug XXX - Add ability to export arbitrary MARC fields for RIS and BibTex)\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 cff02f7..49be897 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 >@@ -199,3 +199,13 @@ Cataloging: > yes: "do" > no: "don't" > - attempt to match aggressively by trying all variations of the ISBNs in the imported record as a phrase in the ISBN fields of already cataloged records. Note that this preference has no effect if UseQueryParser is on. >+ Exporting: >+ - >+ - Include following fields when exporting RIS, >+ - pref: RisExportAdditionalFields >+ type: textarea >+ - "Use one line per tag in the format RIS_TAG: TAG$SUBFIELD ( e.g. LC: 010$a )" >+ - "<br/>" >+ - "To specificy multiple marc tags/subfields as targets for a repeating RIS tag, use the following format: RIS_TAG: [TAG2$SUBFIELD1, TAG2$SUBFIELD2] ( e.g. XY: [501$a, 505$g] )" >+ - "<br/>" >+ - "All values of repeating tags and subfields will be printed with the given RIS tag." >-- >1.7.2.5
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 12357
:
28646
|
28647
|
28648
|
28649
|
28650
|
29291
|
29292
|
29293
|
29294
|
29295
|
29296
|
29297
|
31677
|
31678
|
31679
|
31680
|
33123
|
33124
|
33125
|
33126
|
35485
|
35487
|
35489
|
35826
|
35827
|
35828
|
38602
|
38604
|
39469
|
39471
|
39773
|
39774
|
39775
|
39776
|
39803
|
39804
|
39805
|
39806