Bugzilla – Attachment 33126 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 [4] - Add ability to use record level itemtype for BibTeX export type
Bug-12357-4---Add-ability-to-use-record-level-item.patch (text/plain), 5.79 KB, created by
Frédéric Demians
on 2014-11-01 18:26:59 UTC
(
hide
)
Description:
Bug 12357 [4] - Add ability to use record level itemtype for BibTeX export type
Filename:
MIME Type:
Creator:
Frédéric Demians
Created:
2014-11-01 18:26:59 UTC
Size:
5.79 KB
patch
obsolete
>From 3b6a94385eb8d1327dfbc28aa0b02ede8b15500c Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Tue, 3 Jun 2014 09:29:53 -0400 >Subject: [PATCH] Bug 12357 [4] - Add ability to use record level itemtype for > BibTeX export type > >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 >3) Enable the new system preference BibUseItemtypeAsType >4) Choose a record that has a set biblio level itemtype >5) Save this record as BIBTEX >6) View the record, note that instead of @BOOK, the type is your > record's itemtype code > >Signed-off-by: Frederic Demians <f.demians@tamil.fr> > >Similar to RIS [2] patch. Functionnal. >--- > C4/Record.pm | 15 ++++++++++++++- > installer/data/mysql/sysprefs.sql | 1 + > installer/data/mysql/updatedatabase.pl | 5 +++++ > .../prog/en/modules/admin/preferences/cataloguing.pref | 8 +++++++- > 4 files changed, 27 insertions(+), 2 deletions(-) > >diff --git a/C4/Record.pm b/C4/Record.pm >index 4a2c924..52cc738 100644 >--- a/C4/Record.pm >+++ b/C4/Record.pm >@@ -707,7 +707,20 @@ sub marc2bibtex { > ); > } > >- $tex .= "\@book{"; >+ if ( C4::Context->preference('RisUseItemtypeAsType') ) { >+ my $s = GetMarcSubfieldStructureFromKohaField('biblioitems.itemtype'); >+ my $type = $record->subfield( $s->{tagfield}, $s->{tagsubfield} ); >+ if ($type) { >+ $tex .= '@' . $type . '{'; >+ } >+ else { >+ $tex .= "\@book{"; >+ } >+ } >+ else { >+ $tex .= "\@book{"; >+ } >+ > my @elt; > for ( my $i = 0 ; $i < scalar( @bh ) ; $i = $i + 2 ) { > next unless $bh[$i+1]; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 50b428b..6a2f566 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -66,6 +66,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('BiblioAddsAuthorities','0',NULL,'If ON, adding a new biblio will check for an existing authority record and create one on the fly if one doesn\'t exist','YesNo'), > ('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'), > ('BibtexExportAdditionalFields', '', NULL , 'Define additional BibTex 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'), >+('BibtexUseItemtypeAsType', '0', NULL , 'Use biblio.itemtype for BibTeX export type if set', 'YesNo'), > ('BlockExpiredPatronOpacActions','1',NULL,'Set whether an expired patron can perform opac actions such as placing holds or renew books, can be overridden on a per patron-type basis','YesNo'), > ('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'), > ('BorrowerMandatoryField','surname|cardnumber',NULL,'Choose the mandatory fields for a patron\'s account','free'), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index 3aabb2c..c47d97b 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -8969,6 +8969,11 @@ if ( CheckVersion($DBversion) ) { > VALUES ('BibtexExportAdditionalFields', '', NULL , 'Define additional BibTex 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') > }); > >+ $dbh->do(q{ >+ INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES >+ ('BibtexUseItemtypeAsType', '0', NULL , 'Use biblio.itemtype for BibTeX export type if set', 'YesNo') >+ }); >+ > print "Upgrade to $DBversion done (Bug XXX - Add ability to export arbitrary MARC fields for RIS and BibTex)\n"; > SetVersion($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 fc8d27e..f13f4d5 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 >@@ -210,12 +210,18 @@ Cataloging: > - "<br/>" > - "All values of repeating tags and subfields will be printed with the given BibTeX tag." > - >+ - pref: BibtexUseItemtypeAsType >+ choices: >+ yes: "Do" >+ no: "Do not" >+ - use the record level itemtype code for the record type if it is set. If it is not set, the default of @book will be used. >+ - > - 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] )" >+ - "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. NT: [501$a, 505$g] )" > - "<br/>" > - "All values of repeating tags and subfields will be printed with the given RIS tag." > - >-- >2.1.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 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