@@ -, +, @@ record's itemtype code --- C4/Record.pm | 14 +++++++++++++- installer/data/mysql/sysprefs.sql | 1 + installer/data/mysql/updatedatabase.pl | 5 +++++ .../en/modules/admin/preferences/cataloguing.pref | 8 +++++++- 4 files changed, 26 insertions(+), 2 deletions(-) --- a/C4/Record.pm +++ a/C4/Record.pm @@ -707,7 +707,19 @@ sub marc2bibtex { ); } - $tex .= "\@book{"; + if ( C4::Context->preference('RisUseItemtypeAsType') ) { + my $s = GetMarcSubfieldStructureFromKohaField('biblioitems.itemtype'); + my $type = $record->subfield( $s->{tagfield}, $s->{tagsubfield} ); + if ( $type ) { + warn "TYPE: $type"; + $tex .= '@' . $type . '{'; + } else { + $tex .= "\@book{"; + } + } + else { + $tex .= "\@book{"; + } $tex .= join(",\n", $id, map { $bh{$_} ? qq(\t$_ = {$bh{$_}}) : () } keys %bh); $tex .= "\n"; --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -65,6 +65,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'), --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -8568,6 +8568,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); } --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref @@ -210,12 +210,18 @@ Cataloging: - "
" - "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 )" - "
" - - "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] )" - "
" - "All values of repeating tags and subfields will be printed with the given RIS tag." - --