@@ -, +, @@ and multiple 505$g 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(-) --- a/C4/Ris.pm +++ a/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"; --- a/installer/data/mysql/sysprefs.sql +++ a/installer/data/mysql/sysprefs.sql @@ -340,6 +340,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 RoutlingListNote 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'), --- a/installer/data/mysql/updatedatabase.pl +++ a/installer/data/mysql/updatedatabase.pl @@ -8551,6 +8551,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) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref +++ a/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 )" + - "
" + - "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] )" + - "
" + - "All values of repeating tags and subfields will be printed with the given RIS tag." --