View | Details | Raw Unified | Return to bug 12357
Collapse All | Expand All

(-)a/C4/Record.pm (-1 / +33 lines)
Lines 714-720 sub marc2bibtex { Link Here
714
        push @elt, qq|\t$bh[$i] = {$bh[$i+1]}|;
714
        push @elt, qq|\t$bh[$i] = {$bh[$i+1]}|;
715
    }
715
    }
716
    $tex .= join(",\n", $id, @elt);
716
    $tex .= join(",\n", $id, @elt);
717
    $tex .= "\n}\n";
717
    $tex .= "\n";
718
719
    my $syspref = C4::Context->preference('BibtexExportAdditionalFields');
720
    if ($syspref) {
721
        $syspref = "$syspref\n\n";
722
        my $yaml = eval { YAML::Load($syspref); };
723
        if ($@) {
724
            warn "Unable to parse BibtexExportAdditionalFields : $@";
725
        }
726
        else {
727
            my $r;
728
            foreach my $bibtex_tag ( keys %$yaml ) {
729
                my @fields =
730
                  ref( $yaml->{$bibtex_tag} ) eq 'ARRAY'
731
                  ? @{ $yaml->{$bibtex_tag} }
732
                  : $yaml->{$bibtex_tag};
733
734
                for my $tag_subfield (@fields) {
735
                    my ( $f, $sf ) = split /\$/, $tag_subfield;
736
                    if ( $f && $sf ) {
737
                        foreach my $field ( $record->field($f) ) {
738
                            my @values = $field->subfield($sf);
739
                            foreach my $v (@values) {
740
                                $tex .= qq(\t$bibtex_tag = {$v}\n);
741
                            }
742
                        }
743
                    }
744
                }
745
            }
746
        }
747
    }
748
749
    $tex .= "}\n";
718
750
719
    return $tex;
751
    return $tex;
720
}
752
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 65-70 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
65
('BasketConfirmations','1','always ask for confirmation.|do not ask for confirmation.','When closing or reopening a basket,','Choice'),
65
('BasketConfirmations','1','always ask for confirmation.|do not ask for confirmation.','When closing or reopening a basket,','Choice'),
66
('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'),
66
('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'),
67
('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'),
67
('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'),
68
('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'),
68
('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'),
69
('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'),
69
('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'),
70
('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'),
70
('BorrowerMandatoryField','surname|cardnumber',NULL,'Choose the mandatory fields for a patron\'s account','free'),
71
('BorrowerMandatoryField','surname|cardnumber',NULL,'Choose the mandatory fields for a patron\'s account','free'),
(-)a/installer/data/mysql/updatedatabase.pl (+5 lines)
Lines 8964-8969 if ( CheckVersion($DBversion) ) { Link Here
8964
        ('RisUseItemtypeAsType',  '0', NULL ,  'Use biblio.itemtype for RIS export type if set',  'YesNo')
8964
        ('RisUseItemtypeAsType',  '0', NULL ,  'Use biblio.itemtype for RIS export type if set',  'YesNo')
8965
    });
8965
    });
8966
8966
8967
    $dbh->do(q{
8968
        INSERT INTO systempreferences (variable,value,options,explanation,type)
8969
        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')
8970
    });
8971
8967
    print "Upgrade to $DBversion done (Bug XXX - Add ability to export arbitrary MARC fields for RIS and BibTex)\n";
8972
    print "Upgrade to $DBversion done (Bug XXX - Add ability to export arbitrary MARC fields for RIS and BibTex)\n";
8968
    SetVersion($DBversion);
8973
    SetVersion($DBversion);
8969
}
8974
}
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (-1 / +9 lines)
Lines 201-206 Cataloging: Link Here
201
            - 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.
201
            - 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.
202
    Exporting:
202
    Exporting:
203
        -
203
        -
204
            - Include following fields when exporting BibTeX,
205
            - pref: BibtexExportAdditionalFields
206
              type: textarea
207
            - "Use one line per tag in the format BT_TAG: TAG$SUBFIELD ( e.g. lccn: 010$a )"
208
            - "<br/>"
209
            - "To specificy multiple marc tags/subfields as targets for a repeating BibTex tag, use the following format: BT_TAG: [TAG2$SUBFIELD1, TAG2$SUBFIELD2] ( e.g. notes: [501$a, 505$g] )"
210
            - "<br/>"
211
            - "All values of repeating tags and subfields will be printed with the given BibTeX tag."
212
        -
204
            - Include following fields when exporting RIS,
213
            - Include following fields when exporting RIS,
205
            - pref: RisExportAdditionalFields
214
            - pref: RisExportAdditionalFields
206
              type: textarea
215
              type: textarea
207
- 

Return to bug 12357