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

(-)a/C4/Record.pm (-1 / +32 lines)
Lines 709-715 sub marc2bibtex { Link Here
709
709
710
    $tex .= "\@book{";
710
    $tex .= "\@book{";
711
    $tex .= join(",\n", $id, map { $bh{$_} ? qq(\t$_ = {$bh{$_}}) : () } keys %bh);
711
    $tex .= join(",\n", $id, map { $bh{$_} ? qq(\t$_ = {$bh{$_}}) : () } keys %bh);
712
    $tex .= "\n}\n";
712
    $tex .= "\n";
713
714
    my $syspref = C4::Context->preference('BibtexExportAdditionalFields');
715
    if ($syspref) {
716
        $syspref = "$syspref\n\n";
717
        my $yaml = eval { YAML::Load($syspref); };
718
        if ($@) {
719
            warn "Unable to parse BibtexExportAdditionalFields : $@";
720
        }
721
        else {
722
            my $r;
723
            foreach my $bibtex_tag ( keys %$yaml ) {
724
                my @fields =
725
                  ref( $yaml->{$bibtex_tag} ) eq 'ARRAY'
726
                  ? @{ $yaml->{$bibtex_tag} }
727
                  : $yaml->{$bibtex_tag};
728
                for my $tag_subfield (@fields) {
729
                    my ( $f, $sf ) = split /\$/, $tag_subfield;
730
                    if ( $f && $sf ) {
731
                        foreach my $field ( $record->field($f) ) {
732
                            my @values = $field->subfield($sf);
733
                            foreach my $v (@values) {
734
                                $tex .= qq(\t$bibtex_tag = {$v}\n);
735
                            }
736
                        }
737
                    }
738
                }
739
            }
740
        }
741
    }
742
743
    $tex .= "}\n";
713
744
714
    return $tex;
745
    return $tex;
715
}
746
}
(-)a/installer/data/mysql/sysprefs.sql (+1 lines)
Lines 64-69 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
64
('BasketConfirmations','1','always ask for confirmation.|do not ask for confirmation.','When closing or reopening a basket,','Choice'),
64
('BasketConfirmations','1','always ask for confirmation.|do not ask for confirmation.','When closing or reopening a basket,','Choice'),
65
('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'),
65
('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
('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'),
66
('BiblioDefaultView','normal','normal|marc|isbd','Choose the default detail view in the catalog; choose between normal, marc or isbd','Choice'),
67
('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'),
67
('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'),
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'),
68
('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'),
69
('BlockReturnOfWithdrawnItems','1','0','If enabled, items that are marked as withdrawn cannot be returned.','YesNo'),
69
('BorrowerMandatoryField','surname|cardnumber',NULL,'Choose the mandatory fields for a patron\'s account','free'),
70
('BorrowerMandatoryField','surname|cardnumber',NULL,'Choose the mandatory fields for a patron\'s account','free'),
(-)a/installer/data/mysql/updatedatabase.pl (-1 / +6 lines)
Lines 8559-8568 if ( CheckVersion($DBversion) ) { Link Here
8559
    });
8559
    });
8560
8560
8561
    $dbh->do(q{
8561
    $dbh->do(q{
8562
        INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES 
8562
        INSERT INTO systempreferences (variable,value,options,explanation,type) VALUES
8563
        ('RisUseItemtypeAsType',  '0', NULL ,  'Use biblio.itemtype for RIS export type if set',  'YesNo')
8563
        ('RisUseItemtypeAsType',  '0', NULL ,  'Use biblio.itemtype for RIS export type if set',  'YesNo')
8564
    });
8564
    });
8565
8565
8566
    $dbh->do(q{
8567
        INSERT INTO systempreferences (variable,value,options,explanation,type)
8568
        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')
8569
    });
8570
8566
    print "Upgrade to $DBversion done (Bug XXX - Add ability to export arbitrary MARC fields for RIS and BibTex)\n";
8571
    print "Upgrade to $DBversion done (Bug XXX - Add ability to export arbitrary MARC fields for RIS and BibTex)\n";
8567
    SetVersion($DBversion);
8572
    SetVersion($DBversion);
8568
}
8573
}
(-)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