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

(-)a/C4/Auth.pm (-1 / +1 lines)
Lines 326-332 sub get_template_and_user { Link Here
326
            XSLTResultsDisplay           => C4::Context->preference("XSLTResultsDisplay"),
326
            XSLTResultsDisplay           => C4::Context->preference("XSLTResultsDisplay"),
327
            using_https                  => $in->{'query'}->https() ? 1 : 0,
327
            using_https                  => $in->{'query'}->https() ? 1 : 0,
328
            noItemTypeImages             => C4::Context->preference("noItemTypeImages"),
328
            noItemTypeImages             => C4::Context->preference("noItemTypeImages"),
329
            marcflavour                  => C4::Context->preference("marcflavour"),
329
            MarcFormat                  => C4::Context->preference("MarcFormat"),
330
            persona                      => C4::Context->preference("persona"),
330
            persona                      => C4::Context->preference("persona"),
331
            UseCourseReserves            => C4::Context->preference("UseCourseReserves"),
331
            UseCourseReserves            => C4::Context->preference("UseCourseReserves"),
332
    );
332
    );
(-)a/C4/AuthoritiesMarc.pm (-14 / +14 lines)
Lines 439-446 sub GuessAuthTypeCode { Link Here
439
        '280'=>{authtypecode=>'GENRE/FORM'},
439
        '280'=>{authtypecode=>'GENRE/FORM'},
440
    }
440
    }
441
};
441
};
442
    foreach my $field (keys %{$heading_fields->{uc(C4::Context->preference('marcflavour'))} }) {
442
    foreach my $field (keys %{$heading_fields->{uc(C4::Context->preference('MarcFormat'))} }) {
443
       return $heading_fields->{uc(C4::Context->preference('marcflavour'))}->{$field}->{'authtypecode'} if (defined $record->field($field));
443
       return $heading_fields->{uc(C4::Context->preference('MarcFormat'))}->{$field}->{'authtypecode'} if (defined $record->field($field));
444
    }
444
    }
445
    return;
445
    return;
446
}
446
}
Lines 577-583 sub AddAuthority { Link Here
577
577
578
# if authid empty => true add, find a new authid number
578
# if authid empty => true add, find a new authid number
579
    my $format;
579
    my $format;
580
    if (uc(C4::Context->preference('marcflavour')) eq 'UNIMARC') {
580
    if (uc(C4::Context->preference('MarcFormat')) eq 'UNIMARC') {
581
        $format= 'UNIMARCAUTH';
581
        $format= 'UNIMARCAUTH';
582
    }
582
    }
583
    else {
583
    else {
Lines 752-758 returns xml form of record $authid Link Here
752
sub GetAuthorityXML {
752
sub GetAuthorityXML {
753
  # Returns MARC::XML of the authority passed in parameter.
753
  # Returns MARC::XML of the authority passed in parameter.
754
  my ( $authid ) = @_;
754
  my ( $authid ) = @_;
755
  if (uc(C4::Context->preference('marcflavour')) eq 'UNIMARC') {
755
  if (uc(C4::Context->preference('MarcFormat')) eq 'UNIMARC') {
756
      my $dbh=C4::Context->dbh;
756
      my $dbh=C4::Context->dbh;
757
      my $sth = $dbh->prepare("select marcxml from auth_header where authid=? "  );
757
      my $sth = $dbh->prepare("select marcxml from auth_header where authid=? "  );
758
      $sth->execute($authid);
758
      $sth->execute($authid);
Lines 914-920 sub BuildSummary { Link Here
914
#         suit the MARC21 version, so for now the "templating"
914
#         suit the MARC21 version, so for now the "templating"
915
#         feature will be enabled only for UNIMARC for backwards
915
#         feature will be enabled only for UNIMARC for backwards
916
#         compatibility.
916
#         compatibility.
917
    if ($summary{summary} and C4::Context->preference('marcflavour') eq 'UNIMARC') {
917
    if ($summary{summary} and C4::Context->preference('MarcFormat') eq 'UNIMARC') {
918
        my @fields = $record->fields();
918
        my @fields = $record->fields();
919
#             $reported_tag = '$9'.$result[$counter];
919
#             $reported_tag = '$9'.$result[$counter];
920
        my @stringssummary;
920
        my @stringssummary;
Lines 949-955 sub BuildSummary { Link Here
949
    my @seefrom;
949
    my @seefrom;
950
    my @seealso;
950
    my @seealso;
951
    my @otherscript;
951
    my @otherscript;
952
    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
952
    if (C4::Context->preference('MarcFormat') eq 'UNIMARC') {
953
# construct UNIMARC summary, that is quite different from MARC21 one
953
# construct UNIMARC summary, that is quite different from MARC21 one
954
# accepted form
954
# accepted form
955
        foreach my $field ($record->field('2..')) {
955
        foreach my $field ($record->field('2..')) {
Lines 1116-1122 sub GetAuthorizedHeading { Link Here
1116
        $record = GetAuthority($args->{authid});
1116
        $record = GetAuthority($args->{authid});
1117
    }
1117
    }
1118
    return unless (ref $record eq 'MARC::Record');
1118
    return unless (ref $record eq 'MARC::Record');
1119
    if (C4::Context->preference('marcflavour') eq 'UNIMARC') {
1119
    if (C4::Context->preference('MarcFormat') eq 'UNIMARC') {
1120
# construct UNIMARC summary, that is quite different from MARC21 one
1120
# construct UNIMARC summary, that is quite different from MARC21 one
1121
# accepted form
1121
# accepted form
1122
        foreach my $field ($record->field('2..')) {
1122
        foreach my $field ($record->field('2..')) {
Lines 1176-1182 Example of text: Link Here
1176
sub BuildAuthHierarchies{
1176
sub BuildAuthHierarchies{
1177
    my $authid = shift @_;
1177
    my $authid = shift @_;
1178
#   warn "authid : $authid";
1178
#   warn "authid : $authid";
1179
    my $force = shift @_ || (C4::Context->preference('marcflavour') eq 'UNIMARC' ? 0 : 1);
1179
    my $force = shift @_ || (C4::Context->preference('MarcFormat') eq 'UNIMARC' ? 0 : 1);
1180
    my @globalresult;
1180
    my @globalresult;
1181
    my $dbh=C4::Context->dbh;
1181
    my $dbh=C4::Context->dbh;
1182
    my $hierarchies;
1182
    my $hierarchies;
Lines 1192-1199 sub BuildAuthHierarchies{ Link Here
1192
        foreach my $field ($record->field('5..')){
1192
        foreach my $field ($record->field('5..')){
1193
            my $broader = 0;
1193
            my $broader = 0;
1194
            $broader = 1 if (
1194
            $broader = 1 if (
1195
                    (C4::Context->preference('marcflavour') eq 'UNIMARC' && $field->subfield('5') && $field->subfield('5') eq 'g') ||
1195
                    (C4::Context->preference('MarcFormat') eq 'UNIMARC' && $field->subfield('5') && $field->subfield('5') eq 'g') ||
1196
                    (C4::Context->preference('marcflavour') ne 'UNIMARC' && $field->subfield('w') && substr($field->subfield('w'), 0, 1) eq 'g'));
1196
                    (C4::Context->preference('MarcFormat') ne 'UNIMARC' && $field->subfield('w') && substr($field->subfield('w'), 0, 1) eq 'g'));
1197
            if ($broader) {
1197
            if ($broader) {
1198
                my $subfauthid=_get_authid_subfield($field) || '';
1198
                my $subfauthid=_get_authid_subfield($field) || '';
1199
                next if ($subfauthid eq $authid);
1199
                next if ($subfauthid eq $authid);
Lines 1247-1254 sub BuildAuthHierarchy{ Link Here
1247
    my %cell;
1247
    my %cell;
1248
    my $parents=""; my $children="";
1248
    my $parents=""; my $children="";
1249
    my (@loopparents,@loopchildren);
1249
    my (@loopparents,@loopchildren);
1250
    my $marcflavour = C4::Context->preference('marcflavour');
1250
    my $MarcFormat = C4::Context->preference('MarcFormat');
1251
    my $relationshipsf = $marcflavour eq 'UNIMARC' ? '5' : 'w';
1251
    my $relationshipsf = $MarcFormat eq 'UNIMARC' ? '5' : 'w';
1252
    foreach my $field ($record->field('5..')){
1252
    foreach my $field ($record->field('5..')){
1253
        my $subfauthid=_get_authid_subfield($field);
1253
        my $subfauthid=_get_authid_subfield($field);
1254
        if ($subfauthid && $field->subfield($relationshipsf) && $field->subfield('a')){
1254
        if ($subfauthid && $field->subfield($relationshipsf) && $field->subfield('a')){
Lines 1267-1273 sub BuildAuthHierarchy{ Link Here
1267
    $cell{"class"}=$class;
1267
    $cell{"class"}=$class;
1268
    $cell{"authid"}=$authid;
1268
    $cell{"authid"}=$authid;
1269
    $cell{"current_value"} =1 if ($authid eq $authid_constructed);
1269
    $cell{"current_value"} =1 if ($authid eq $authid_constructed);
1270
    $cell{"value"}=C4::Context->preference('marcflavour') eq 'UNIMARC' ? $record->subfield('2..',"a") : $record->subfield('1..', 'a');
1270
    $cell{"value"}=C4::Context->preference('MarcFormat') eq 'UNIMARC' ? $record->subfield('2..',"a") : $record->subfield('1..', 'a');
1271
    return \%cell;
1271
    return \%cell;
1272
}
1272
}
1273
1273
Lines 1567-1573 sub get_auth_type_location { Link Here
1567
    if (defined $tag and defined $subfield and $tag != 0 and $subfield ne '' and $subfield ne ' ') {
1567
    if (defined $tag and defined $subfield and $tag != 0 and $subfield ne '' and $subfield ne ' ') {
1568
        return ($tag, $subfield);
1568
        return ($tag, $subfield);
1569
    } else {
1569
    } else {
1570
        if (C4::Context->preference('marcflavour') eq "MARC21")  {
1570
        if (C4::Context->preference('MarcFormat') eq "MARC21")  {
1571
            return C4::AuthoritiesMarc::MARC21::default_auth_type_location();
1571
            return C4::AuthoritiesMarc::MARC21::default_auth_type_location();
1572
        } else {
1572
        } else {
1573
            return C4::AuthoritiesMarc::UNIMARC::default_auth_type_location();
1573
            return C4::AuthoritiesMarc::UNIMARC::default_auth_type_location();
(-)a/C4/AuthoritiesMarc/MARC21.pm (-1 / +1 lines)
Lines 40-46 MARC formats). Link Here
40
Functions from this module generally should not be used
40
Functions from this module generally should not be used
41
directly; instead, use the appropriate function from
41
directly; instead, use the appropriate function from
42
C<C4::Authorities> that will dispatch the appropriate
42
C<C4::Authorities> that will dispatch the appropriate
43
function based on the marcflavour system preference.
43
function based on the MarcFormat system preference.
44
44
45
=head1 FUNCTIONS
45
=head1 FUNCTIONS
46
46
(-)a/C4/AuthoritiesMarc/UNIMARC.pm (-1 / +1 lines)
Lines 39-45 MARC formats). Link Here
39
Functions from this module generally should not be used
39
Functions from this module generally should not be used
40
directly; instead, use the appropriate function from
40
directly; instead, use the appropriate function from
41
C<C4::Authorities> that will dispatch the appropriate
41
C<C4::Authorities> that will dispatch the appropriate
42
function based on the marcflavour system preference.
42
function based on the MarcFormat system preference.
43
43
44
=head1 FUNCTIONS
44
=head1 FUNCTIONS
45
45
(-)a/C4/Biblio.pm (-60 / +60 lines)
Lines 566-572 sub LinkBibHeadingsToAuthorities { Link Here
566
                    my $authtypedata =
566
                    my $authtypedata =
567
                      C4::AuthoritiesMarc::GetAuthType( $heading->auth_type() );
567
                      C4::AuthoritiesMarc::GetAuthType( $heading->auth_type() );
568
                    my $marcrecordauth = MARC::Record->new();
568
                    my $marcrecordauth = MARC::Record->new();
569
                    if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
569
                    if ( C4::Context->preference('MarcFormat') eq 'MARC21' ) {
570
                        $marcrecordauth->leader('     nz  a22     o  4500');
570
                        $marcrecordauth->leader('     nz  a22     o  4500');
571
                        SetMarcUnicodeFlag( $marcrecordauth, 'MARC21' );
571
                        SetMarcUnicodeFlag( $marcrecordauth, 'MARC21' );
572
                    }
572
                    }
Lines 588-594 sub LinkBibHeadingsToAuthorities { Link Here
588
# use UTF-8, but as of 2008-08-05, did not want to introduce that kind
588
# use UTF-8, but as of 2008-08-05, did not want to introduce that kind
589
# of change to a core API just before the 3.0 release.
589
# of change to a core API just before the 3.0 release.
590
590
591
                    if ( C4::Context->preference('marcflavour') eq 'MARC21' ) {
591
                    if ( C4::Context->preference('MarcFormat') eq 'MARC21' ) {
592
                        $marcrecordauth->insert_fields_ordered(
592
                        $marcrecordauth->insert_fields_ordered(
593
                            MARC::Field->new(
593
                            MARC::Field->new(
594
                                '667', '', '',
594
                                '667', '', '',
Lines 1256-1266 sub GetMarcBiblio { Link Here
1256
    $sth->execute($biblionumber);
1256
    $sth->execute($biblionumber);
1257
    my $row     = $sth->fetchrow_hashref;
1257
    my $row     = $sth->fetchrow_hashref;
1258
    my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
1258
    my $marcxml = StripNonXmlChars( $row->{'marcxml'} );
1259
    MARC::File::XML->default_record_format( C4::Context->preference('marcflavour') );
1259
    MARC::File::XML->default_record_format( C4::Context->preference('MarcFormat') );
1260
    my $record = MARC::Record->new();
1260
    my $record = MARC::Record->new();
1261
1261
1262
    if ($marcxml) {
1262
    if ($marcxml) {
1263
        $record = eval { MARC::Record::new_from_xml( $marcxml, "utf8", C4::Context->preference('marcflavour') ) };
1263
        $record = eval { MARC::Record::new_from_xml( $marcxml, "utf8", C4::Context->preference('MarcFormat') ) };
1264
        if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; }
1264
        if ($@) { warn " problem with :$biblionumber : $@ \n$marcxml"; }
1265
        return unless $record;
1265
        return unless $record;
1266
1266
Lines 1368-1374 sub GetCOinSBiblio { Link Here
1368
1368
1369
    $genre = ( $mtx eq 'dc' ) ? "&amp;rft.type=$genre" : "&amp;rft.genre=$genre";
1369
    $genre = ( $mtx eq 'dc' ) ? "&amp;rft.type=$genre" : "&amp;rft.genre=$genre";
1370
1370
1371
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
1371
    if ( C4::Context->preference("MarcFormat") eq "UNIMARC" ) {
1372
1372
1373
        # Setting datas
1373
        # Setting datas
1374
        $aulast  = $record->subfield( '700', 'a' ) || '';
1374
        $aulast  = $record->subfield( '700', 'a' ) || '';
Lines 1448-1461 return the prices in accordance with the Marc format. Link Here
1448
=cut
1448
=cut
1449
1449
1450
sub GetMarcPrice {
1450
sub GetMarcPrice {
1451
    my ( $record, $marcflavour ) = @_;
1451
    my ( $record, $MarcFormat ) = @_;
1452
    my @listtags;
1452
    my @listtags;
1453
    my $subfield;
1453
    my $subfield;
1454
    
1454
    
1455
    if ( $marcflavour eq "MARC21" ) {
1455
    if ( $MarcFormat eq "MARC21" ) {
1456
        @listtags = ('345', '020');
1456
        @listtags = ('345', '020');
1457
        $subfield="c";
1457
        $subfield="c";
1458
    } elsif ( $marcflavour eq "UNIMARC" ) {
1458
    } elsif ( $MarcFormat eq "UNIMARC" ) {
1459
        @listtags = ('345', '010');
1459
        @listtags = ('345', '010');
1460
        $subfield="d";
1460
        $subfield="d";
1461
    } else {
1461
    } else {
Lines 1523-1535 Warning : this is not really in the marc standard. In Unimarc, Electre (the most Link Here
1523
=cut
1523
=cut
1524
1524
1525
sub GetMarcQuantity {
1525
sub GetMarcQuantity {
1526
    my ( $record, $marcflavour ) = @_;
1526
    my ( $record, $MarcFormat ) = @_;
1527
    my @listtags;
1527
    my @listtags;
1528
    my $subfield;
1528
    my $subfield;
1529
    
1529
    
1530
    if ( $marcflavour eq "MARC21" ) {
1530
    if ( $MarcFormat eq "MARC21" ) {
1531
        return 0
1531
        return 0
1532
    } elsif ( $marcflavour eq "UNIMARC" ) {
1532
    } elsif ( $MarcFormat eq "UNIMARC" ) {
1533
        @listtags = ('969');
1533
        @listtags = ('969');
1534
        $subfield="a";
1534
        $subfield="a";
1535
    } else {
1535
    } else {
Lines 1602-1619 sub GetAuthorisedValueDesc { Link Here
1602
1602
1603
=head2 GetMarcControlnumber
1603
=head2 GetMarcControlnumber
1604
1604
1605
  $marccontrolnumber = GetMarcControlnumber($record,$marcflavour);
1605
  $marccontrolnumber = GetMarcControlnumber($record,$MarcFormat);
1606
1606
1607
Get the control number / record Identifier from the MARC record and return it.
1607
Get the control number / record Identifier from the MARC record and return it.
1608
1608
1609
=cut
1609
=cut
1610
1610
1611
sub GetMarcControlnumber {
1611
sub GetMarcControlnumber {
1612
    my ( $record, $marcflavour ) = @_;
1612
    my ( $record, $MarcFormat ) = @_;
1613
    my $controlnumber = "";
1613
    my $controlnumber = "";
1614
    # Control number or Record identifier are the same field in MARC21, UNIMARC and NORMARC
1614
    # Control number or Record identifier are the same field in MARC21, UNIMARC and NORMARC
1615
    # Keep $marcflavour for possible later use
1615
    # Keep $MarcFormat for possible later use
1616
    if ($marcflavour eq "MARC21" || $marcflavour eq "UNIMARC" || $marcflavour eq "NORMARC") {
1616
    if ($MarcFormat eq "MARC21" || $MarcFormat eq "UNIMARC" || $MarcFormat eq "NORMARC") {
1617
        my $controlnumberField = $record->field('001');
1617
        my $controlnumberField = $record->field('001');
1618
        if ($controlnumberField) {
1618
        if ($controlnumberField) {
1619
            $controlnumber = $controlnumberField->data();
1619
            $controlnumber = $controlnumberField->data();
Lines 1624-1630 sub GetMarcControlnumber { Link Here
1624
1624
1625
=head2 GetMarcISBN
1625
=head2 GetMarcISBN
1626
1626
1627
  $marcisbnsarray = GetMarcISBN( $record, $marcflavour );
1627
  $marcisbnsarray = GetMarcISBN( $record, $MarcFormat );
1628
1628
1629
Get all ISBNs from the MARC record and returns them in an array.
1629
Get all ISBNs from the MARC record and returns them in an array.
1630
ISBNs stored in different fields depending on MARC flavour
1630
ISBNs stored in different fields depending on MARC flavour
Lines 1632-1640 ISBNs stored in different fields depending on MARC flavour Link Here
1632
=cut
1632
=cut
1633
1633
1634
sub GetMarcISBN {
1634
sub GetMarcISBN {
1635
    my ( $record, $marcflavour ) = @_;
1635
    my ( $record, $MarcFormat ) = @_;
1636
    my $scope;
1636
    my $scope;
1637
    if ( $marcflavour eq "UNIMARC" ) {
1637
    if ( $MarcFormat eq "UNIMARC" ) {
1638
        $scope = '010';
1638
        $scope = '010';
1639
    } else {    # assume marc21 if not unimarc
1639
    } else {    # assume marc21 if not unimarc
1640
        $scope = '020';
1640
        $scope = '020';
Lines 1665-1671 sub GetMarcISBN { Link Here
1665
1665
1666
=head2 GetMarcISSN
1666
=head2 GetMarcISSN
1667
1667
1668
  $marcissnsarray = GetMarcISSN( $record, $marcflavour );
1668
  $marcissnsarray = GetMarcISSN( $record, $MarcFormat );
1669
1669
1670
Get all valid ISSNs from the MARC record and returns them in an array.
1670
Get all valid ISSNs from the MARC record and returns them in an array.
1671
ISSNs are stored in different fields depending on MARC flavour
1671
ISSNs are stored in different fields depending on MARC flavour
Lines 1673-1681 ISSNs are stored in different fields depending on MARC flavour Link Here
1673
=cut
1673
=cut
1674
1674
1675
sub GetMarcISSN {
1675
sub GetMarcISSN {
1676
    my ( $record, $marcflavour ) = @_;
1676
    my ( $record, $MarcFormat ) = @_;
1677
    my $scope;
1677
    my $scope;
1678
    if ( $marcflavour eq "UNIMARC" ) {
1678
    if ( $MarcFormat eq "UNIMARC" ) {
1679
        $scope = '011';
1679
        $scope = '011';
1680
    }
1680
    }
1681
    else {    # assume MARC21 or NORMARC
1681
    else {    # assume MARC21 or NORMARC
Lines 1690-1696 sub GetMarcISSN { Link Here
1690
1690
1691
=head2 GetMarcNotes
1691
=head2 GetMarcNotes
1692
1692
1693
  $marcnotesarray = GetMarcNotes( $record, $marcflavour );
1693
  $marcnotesarray = GetMarcNotes( $record, $MarcFormat );
1694
1694
1695
Get all notes from the MARC record and returns them in an array.
1695
Get all notes from the MARC record and returns them in an array.
1696
The note are stored in different fields depending on MARC flavour
1696
The note are stored in different fields depending on MARC flavour
Lines 1698-1706 The note are stored in different fields depending on MARC flavour Link Here
1698
=cut
1698
=cut
1699
1699
1700
sub GetMarcNotes {
1700
sub GetMarcNotes {
1701
    my ( $record, $marcflavour ) = @_;
1701
    my ( $record, $MarcFormat ) = @_;
1702
    my $scope;
1702
    my $scope;
1703
    if ( $marcflavour eq "UNIMARC" ) {
1703
    if ( $MarcFormat eq "UNIMARC" ) {
1704
        $scope = '3..';
1704
        $scope = '3..';
1705
    } else {    # assume marc21 if not unimarc
1705
    } else {    # assume marc21 if not unimarc
1706
        $scope = '5..';
1706
        $scope = '5..';
Lines 1734-1740 sub GetMarcNotes { Link Here
1734
1734
1735
=head2 GetMarcSubjects
1735
=head2 GetMarcSubjects
1736
1736
1737
  $marcsubjcts = GetMarcSubjects($record,$marcflavour);
1737
  $marcsubjcts = GetMarcSubjects($record,$MarcFormat);
1738
1738
1739
Get all subjects from the MARC record and returns them in an array.
1739
Get all subjects from the MARC record and returns them in an array.
1740
The subjects are stored in different fields depending on MARC flavour
1740
The subjects are stored in different fields depending on MARC flavour
Lines 1742-1750 The subjects are stored in different fields depending on MARC flavour Link Here
1742
=cut
1742
=cut
1743
1743
1744
sub GetMarcSubjects {
1744
sub GetMarcSubjects {
1745
    my ( $record, $marcflavour ) = @_;
1745
    my ( $record, $MarcFormat ) = @_;
1746
    my ( $mintag, $maxtag, $fields_filter );
1746
    my ( $mintag, $maxtag, $fields_filter );
1747
    if ( $marcflavour eq "UNIMARC" ) {
1747
    if ( $MarcFormat eq "UNIMARC" ) {
1748
        $mintag = "600";
1748
        $mintag = "600";
1749
        $maxtag = "611";
1749
        $maxtag = "611";
1750
        $fields_filter = '6..';
1750
        $fields_filter = '6..';
Lines 1780-1788 sub GetMarcSubjects { Link Here
1780
            next if ( $subject_subfield->[0] eq '9' );
1780
            next if ( $subject_subfield->[0] eq '9' );
1781
1781
1782
            # don't load unimarc subfields 3,4,5
1782
            # don't load unimarc subfields 3,4,5
1783
            next if ( ( $marcflavour eq "UNIMARC" ) and ( $subject_subfield->[0] =~ /2|3|4|5/ ) );
1783
            next if ( ( $MarcFormat eq "UNIMARC" ) and ( $subject_subfield->[0] =~ /2|3|4|5/ ) );
1784
            # don't load MARC21 subfields 2 (FIXME: any more subfields??)
1784
            # don't load MARC21 subfields 2 (FIXME: any more subfields??)
1785
            next if ( ( $marcflavour eq "MARC21" ) and ( $subject_subfield->[0] =~ /2/ ) );
1785
            next if ( ( $MarcFormat eq "MARC21" ) and ( $subject_subfield->[0] =~ /2/ ) );
1786
1786
1787
            my $code      = $subject_subfield->[0];
1787
            my $code      = $subject_subfield->[0];
1788
            my $value     = $subject_subfield->[1];
1788
            my $value     = $subject_subfield->[1];
Lines 1819-1825 sub GetMarcSubjects { Link Here
1819
1819
1820
=head2 GetMarcAuthors
1820
=head2 GetMarcAuthors
1821
1821
1822
  authors = GetMarcAuthors($record,$marcflavour);
1822
  authors = GetMarcAuthors($record,$MarcFormat);
1823
1823
1824
Get all authors from the MARC record and returns them in an array.
1824
Get all authors from the MARC record and returns them in an array.
1825
The authors are stored in different fields depending on MARC flavour
1825
The authors are stored in different fields depending on MARC flavour
Lines 1827-1839 The authors are stored in different fields depending on MARC flavour Link Here
1827
=cut
1827
=cut
1828
1828
1829
sub GetMarcAuthors {
1829
sub GetMarcAuthors {
1830
    my ( $record, $marcflavour ) = @_;
1830
    my ( $record, $MarcFormat ) = @_;
1831
    my ( $mintag, $maxtag, $fields_filter );
1831
    my ( $mintag, $maxtag, $fields_filter );
1832
1832
1833
    # tagslib useful for UNIMARC author reponsabilities
1833
    # tagslib useful for UNIMARC author reponsabilities
1834
    my $tagslib =
1834
    my $tagslib =
1835
      &GetMarcStructure( 1, '' );    # FIXME : we don't have the framework available, we take the default framework. May be buggy on some setups, will be usually correct.
1835
      &GetMarcStructure( 1, '' );    # FIXME : we don't have the framework available, we take the default framework. May be buggy on some setups, will be usually correct.
1836
    if ( $marcflavour eq "UNIMARC" ) {
1836
    if ( $MarcFormat eq "UNIMARC" ) {
1837
        $mintag = "700";
1837
        $mintag = "700";
1838
        $maxtag = "712";
1838
        $maxtag = "712";
1839
        $fields_filter = '7..';
1839
        $fields_filter = '7..';
Lines 1866-1879 sub GetMarcAuthors { Link Here
1866
            next if ( $authors_subfield->[0] eq '9' );
1866
            next if ( $authors_subfield->[0] eq '9' );
1867
1867
1868
            # don't load unimarc subfields 3, 5
1868
            # don't load unimarc subfields 3, 5
1869
            next if ( $marcflavour eq 'UNIMARC' and ( $authors_subfield->[0] =~ /3|5/ ) );
1869
            next if ( $MarcFormat eq 'UNIMARC' and ( $authors_subfield->[0] =~ /3|5/ ) );
1870
1870
1871
            my $code = $authors_subfield->[0];
1871
            my $code = $authors_subfield->[0];
1872
            my $value        = $authors_subfield->[1];
1872
            my $value        = $authors_subfield->[1];
1873
            my $linkvalue    = $value;
1873
            my $linkvalue    = $value;
1874
            $linkvalue =~ s/(\(|\))//g;
1874
            $linkvalue =~ s/(\(|\))//g;
1875
            # UNIMARC author responsibility
1875
            # UNIMARC author responsibility
1876
            if ( $marcflavour eq 'UNIMARC' and $code eq '4' ) {
1876
            if ( $MarcFormat eq 'UNIMARC' and $code eq '4' ) {
1877
                $value = GetAuthorisedValueDesc( $field->tag(), $code, $value, '', $tagslib );
1877
                $value = GetAuthorisedValueDesc( $field->tag(), $code, $value, '', $tagslib );
1878
                $linkvalue = "($value)";
1878
                $linkvalue = "($value)";
1879
            }
1879
            }
Lines 1907-1913 sub GetMarcAuthors { Link Here
1907
1907
1908
=head2 GetMarcUrls
1908
=head2 GetMarcUrls
1909
1909
1910
  $marcurls = GetMarcUrls($record,$marcflavour);
1910
  $marcurls = GetMarcUrls($record,$MarcFormat);
1911
1911
1912
Returns arrayref of URLs from MARC data, suitable to pass to tmpl loop.
1912
Returns arrayref of URLs from MARC data, suitable to pass to tmpl loop.
1913
Assumes web resources (not uncommon in MARC21 to omit resource type ind) 
1913
Assumes web resources (not uncommon in MARC21 to omit resource type ind) 
Lines 1915-1921 Assumes web resources (not uncommon in MARC21 to omit resource type ind) Link Here
1915
=cut
1915
=cut
1916
1916
1917
sub GetMarcUrls {
1917
sub GetMarcUrls {
1918
    my ( $record, $marcflavour ) = @_;
1918
    my ( $record, $MarcFormat ) = @_;
1919
1919
1920
    my @marcurls;
1920
    my @marcurls;
1921
    for my $field ( $record->field('856') ) {
1921
    for my $field ( $record->field('856') ) {
Lines 1926-1932 sub GetMarcUrls { Link Here
1926
        my @urls = $field->subfield('u');
1926
        my @urls = $field->subfield('u');
1927
        foreach my $url (@urls) {
1927
        foreach my $url (@urls) {
1928
            my $marcurl;
1928
            my $marcurl;
1929
            if ( $marcflavour eq 'MARC21' ) {
1929
            if ( $MarcFormat eq 'MARC21' ) {
1930
                my $s3   = $field->subfield('3');
1930
                my $s3   = $field->subfield('3');
1931
                my $link = $field->subfield('y');
1931
                my $link = $field->subfield('y');
1932
                unless ( $url =~ /^\w+:/ ) {
1932
                unless ( $url =~ /^\w+:/ ) {
Lines 1962-1968 sub GetMarcUrls { Link Here
1962
1962
1963
=head2 GetMarcSeries
1963
=head2 GetMarcSeries
1964
1964
1965
  $marcseriesarray = GetMarcSeries($record,$marcflavour);
1965
  $marcseriesarray = GetMarcSeries($record,$MarcFormat);
1966
1966
1967
Get all series from the MARC record and returns them in an array.
1967
Get all series from the MARC record and returns them in an array.
1968
The series are stored in different fields depending on MARC flavour
1968
The series are stored in different fields depending on MARC flavour
Lines 1970-1978 The series are stored in different fields depending on MARC flavour Link Here
1970
=cut
1970
=cut
1971
1971
1972
sub GetMarcSeries {
1972
sub GetMarcSeries {
1973
    my ( $record, $marcflavour ) = @_;
1973
    my ( $record, $MarcFormat ) = @_;
1974
    my ( $mintag, $maxtag, $fields_filter );
1974
    my ( $mintag, $maxtag, $fields_filter );
1975
    if ( $marcflavour eq "UNIMARC" ) {
1975
    if ( $MarcFormat eq "UNIMARC" ) {
1976
        $mintag = "600";
1976
        $mintag = "600";
1977
        $maxtag = "619";
1977
        $maxtag = "619";
1978
        $fields_filter = '6..';
1978
        $fields_filter = '6..';
Lines 2032-2054 sub GetMarcSeries { Link Here
2032
2032
2033
=head2 GetMarcHosts
2033
=head2 GetMarcHosts
2034
2034
2035
  $marchostsarray = GetMarcHosts($record,$marcflavour);
2035
  $marchostsarray = GetMarcHosts($record,$MarcFormat);
2036
2036
2037
Get all host records (773s MARC21, 461 UNIMARC) from the MARC record and returns them in an array.
2037
Get all host records (773s MARC21, 461 UNIMARC) from the MARC record and returns them in an array.
2038
2038
2039
=cut
2039
=cut
2040
2040
2041
sub GetMarcHosts {
2041
sub GetMarcHosts {
2042
    my ( $record, $marcflavour ) = @_;
2042
    my ( $record, $MarcFormat ) = @_;
2043
    my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf);
2043
    my ( $tag,$title_subf,$bibnumber_subf,$itemnumber_subf);
2044
    $marcflavour ||="MARC21";
2044
    $MarcFormat ||="MARC21";
2045
    if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) {
2045
    if ( $MarcFormat eq "MARC21" || $MarcFormat eq "NORMARC" ) {
2046
        $tag = "773";
2046
        $tag = "773";
2047
        $title_subf = "t";
2047
        $title_subf = "t";
2048
        $bibnumber_subf ="0";
2048
        $bibnumber_subf ="0";
2049
        $itemnumber_subf='9';
2049
        $itemnumber_subf='9';
2050
    }
2050
    }
2051
    elsif ($marcflavour eq "UNIMARC") {
2051
    elsif ($MarcFormat eq "UNIMARC") {
2052
        $tag = "461";
2052
        $tag = "461";
2053
        $title_subf = "t";
2053
        $title_subf = "t";
2054
        $bibnumber_subf ="0";
2054
        $bibnumber_subf ="0";
Lines 2103-2109 entry from user entry Link Here
2103
sub TransformKohaToMarc {
2103
sub TransformKohaToMarc {
2104
    my $hash = shift;
2104
    my $hash = shift;
2105
    my $record = MARC::Record->new();
2105
    my $record = MARC::Record->new();
2106
    SetMarcUnicodeFlag( $record, C4::Context->preference("marcflavour") );
2106
    SetMarcUnicodeFlag( $record, C4::Context->preference("MarcFormat") );
2107
    my $db_to_marc = C4::Context->marcfromkohafield;
2107
    my $db_to_marc = C4::Context->marcfromkohafield;
2108
    while ( my ($name, $value) = each %$hash ) {
2108
    while ( my ($name, $value) = each %$hash ) {
2109
        next unless my $dtm = $db_to_marc->{''}->{$name};
2109
        next unless my $dtm = $db_to_marc->{''}->{$name};
Lines 2125-2146 sub TransformKohaToMarc { Link Here
2125
2125
2126
=head2 PrepHostMarcField
2126
=head2 PrepHostMarcField
2127
2127
2128
    $hostfield = PrepHostMarcField ( $hostbiblionumber,$hostitemnumber,$marcflavour )
2128
    $hostfield = PrepHostMarcField ( $hostbiblionumber,$hostitemnumber,$MarcFormat )
2129
2129
2130
This function returns a host field populated with data from the host record, the field can then be added to an analytical record
2130
This function returns a host field populated with data from the host record, the field can then be added to an analytical record
2131
2131
2132
=cut
2132
=cut
2133
2133
2134
sub PrepHostMarcField {
2134
sub PrepHostMarcField {
2135
    my ($hostbiblionumber,$hostitemnumber, $marcflavour) = @_;
2135
    my ($hostbiblionumber,$hostitemnumber, $MarcFormat) = @_;
2136
    $marcflavour ||="MARC21";
2136
    $MarcFormat ||="MARC21";
2137
    
2137
    
2138
    require C4::Items;
2138
    require C4::Items;
2139
    my $hostrecord = GetMarcBiblio($hostbiblionumber);
2139
    my $hostrecord = GetMarcBiblio($hostbiblionumber);
2140
	my $item = C4::Items::GetItem($hostitemnumber);
2140
	my $item = C4::Items::GetItem($hostitemnumber);
2141
	
2141
	
2142
	my $hostmarcfield;
2142
	my $hostmarcfield;
2143
    if ( $marcflavour eq "MARC21" || $marcflavour eq "NORMARC" ) {
2143
    if ( $MarcFormat eq "MARC21" || $MarcFormat eq "NORMARC" ) {
2144
	
2144
	
2145
        #main entry
2145
        #main entry
2146
        my $mainentry;
2146
        my $mainentry;
Lines 2191-2197 sub PrepHostMarcField { Link Here
2191
                'x' => $issn,
2191
                'x' => $issn,
2192
                'z' => $isbn
2192
                'z' => $isbn
2193
                );
2193
                );
2194
    } elsif ($marcflavour eq "UNIMARC") {
2194
    } elsif ($MarcFormat eq "UNIMARC") {
2195
        $hostmarcfield = MARC::Field->new(
2195
        $hostmarcfield = MARC::Field->new(
2196
            461, '', '',
2196
            461, '', '',
2197
            '0' => $hostbiblionumber,
2197
            '0' => $hostbiblionumber,
Lines 2226-2232 sub TransformHtmlToXml { Link Here
2226
    my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_;
2226
    my ( $tags, $subfields, $values, $indicator, $ind_tag, $auth_type ) = @_;
2227
    my $xml = MARC::File::XML::header('UTF-8');
2227
    my $xml = MARC::File::XML::header('UTF-8');
2228
    $xml .= "<record>\n";
2228
    $xml .= "<record>\n";
2229
    $auth_type = C4::Context->preference('marcflavour') unless $auth_type;
2229
    $auth_type = C4::Context->preference('MarcFormat') unless $auth_type;
2230
    MARC::File::XML->default_record_format($auth_type);
2230
    MARC::File::XML->default_record_format($auth_type);
2231
2231
2232
    # in UNIMARC, field 100 contains the encoding
2232
    # in UNIMARC, field 100 contains the encoding
Lines 2240-2246 sub TransformHtmlToXml { Link Here
2240
    my $j       = -1;
2240
    my $j       = -1;
2241
    for ( my $i = 0 ; $i < @$tags ; $i++ ) {
2241
    for ( my $i = 0 ; $i < @$tags ; $i++ ) {
2242
2242
2243
        if ( C4::Context->preference('marcflavour') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a" ) {
2243
        if ( C4::Context->preference('MarcFormat') eq 'UNIMARC' and @$tags[$i] eq "100" and @$subfields[$i] eq "a" ) {
2244
2244
2245
            # if we have a 100 field and it's values are not correct, skip them.
2245
            # if we have a 100 field and it's values are not correct, skip them.
2246
            # if we don't have any valid 100 field, we will create a default one at the end
2246
            # if we don't have any valid 100 field, we will create a default one at the end
Lines 2324-2330 sub TransformHtmlToXml { Link Here
2324
        $prevtag = @$tags[$i];
2324
        $prevtag = @$tags[$i];
2325
    }
2325
    }
2326
    $xml .= "</datafield>\n" if $xml =~ m/<datafield/;
2326
    $xml .= "</datafield>\n" if $xml =~ m/<datafield/;
2327
    if ( C4::Context->preference('marcflavour') eq 'UNIMARC' and !$unimarc_and_100_exist ) {
2327
    if ( C4::Context->preference('MarcFormat') eq 'UNIMARC' and !$unimarc_and_100_exist ) {
2328
2328
2329
        #     warn "SETTING 100 for $auth_type";
2329
        #     warn "SETTING 100 for $auth_type";
2330
        my $string = strftime( "%Y%m%d", localtime(time) );
2330
        my $string = strftime( "%Y%m%d", localtime(time) );
Lines 3275-3281 sub ModBiblioMarc { Link Here
3275
    my $sth = $dbh->prepare("UPDATE biblio SET frameworkcode=? WHERE biblionumber=?");
3275
    my $sth = $dbh->prepare("UPDATE biblio SET frameworkcode=? WHERE biblionumber=?");
3276
    $sth->execute( $frameworkcode, $biblionumber );
3276
    $sth->execute( $frameworkcode, $biblionumber );
3277
    $sth->finish;
3277
    $sth->finish;
3278
    my $encoding = C4::Context->preference("marcflavour");
3278
    my $encoding = C4::Context->preference("MarcFormat");
3279
3279
3280
    # deal with UNIMARC field 100 (encoding) : create it if needed & set encoding to unicode
3280
    # deal with UNIMARC field 100 (encoding) : create it if needed & set encoding to unicode
3281
    if ( $encoding eq "UNIMARC" ) {
3281
    if ( $encoding eq "UNIMARC" ) {
Lines 3445-3465 sub GetHolds { Link Here
3445
3445
3446
=head2 prepare_host_field
3446
=head2 prepare_host_field
3447
3447
3448
$marcfield = prepare_host_field( $hostbiblioitem, $marcflavour );
3448
$marcfield = prepare_host_field( $hostbiblioitem, $MarcFormat );
3449
Generate the host item entry for an analytic child entry
3449
Generate the host item entry for an analytic child entry
3450
3450
3451
=cut
3451
=cut
3452
3452
3453
sub prepare_host_field {
3453
sub prepare_host_field {
3454
    my ( $hostbiblio, $marcflavour ) = @_;
3454
    my ( $hostbiblio, $MarcFormat ) = @_;
3455
    $marcflavour ||= C4::Context->preference('marcflavour');
3455
    $MarcFormat ||= C4::Context->preference('MarcFormat');
3456
    my $host = GetMarcBiblio($hostbiblio);
3456
    my $host = GetMarcBiblio($hostbiblio);
3457
    # unfortunately as_string does not 'do the right thing'
3457
    # unfortunately as_string does not 'do the right thing'
3458
    # if field returns undef
3458
    # if field returns undef
3459
    my %sfd;
3459
    my %sfd;
3460
    my $field;
3460
    my $field;
3461
    my $host_field;
3461
    my $host_field;
3462
    if ( $marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC' ) {
3462
    if ( $MarcFormat eq 'MARC21' || $MarcFormat eq 'NORMARC' ) {
3463
        if ( $field = $host->field('100') || $host->field('110') || $host->field('11') ) {
3463
        if ( $field = $host->field('100') || $host->field('110') || $host->field('11') ) {
3464
            my $s = $field->as_string('ab');
3464
            my $s = $field->as_string('ab');
3465
            if ($s) {
3465
            if ($s) {
Lines 3502-3508 sub prepare_host_field { Link Here
3502
        $host_field = MARC::Field->new( 773, '0', ' ', %sfd );
3502
        $host_field = MARC::Field->new( 773, '0', ' ', %sfd );
3503
        return $host_field;
3503
        return $host_field;
3504
    }
3504
    }
3505
    elsif ( $marcflavour eq 'UNIMARC' ) {
3505
    elsif ( $MarcFormat eq 'UNIMARC' ) {
3506
        #author
3506
        #author
3507
        if ( $field = $host->field('700') || $host->field('710') || $host->field('720') ) {
3507
        if ( $field = $host->field('700') || $host->field('710') || $host->field('720') ) {
3508
            my $s = $field->as_string('ab');
3508
            my $s = $field->as_string('ab');
(-)a/C4/Breeding.pm (-4 / +4 lines)
Lines 53-59 C4::Breeding : module to add biblios to import_records via Link Here
53
                                possible in the breeding
53
                                possible in the breeding
54
    C<$encoding> => USMARC
54
    C<$encoding> => USMARC
55
                        or UNIMARC. used for char_decoding.
55
                        or UNIMARC. used for char_decoding.
56
                        If not present, the parameter marcflavour is used instead
56
                        If not present, the parameter MarcFormat is used instead
57
    C<$z3950random> => the random value created during a z3950 search result.
57
    C<$z3950random> => the random value created during a z3950 search result.
58
58
59
=head1 DESCRIPTION
59
=head1 DESCRIPTION
Lines 82-88 sub ImportBreeding { Link Here
82
    # FIXME -- not sure that this kind of checking is actually needed
82
    # FIXME -- not sure that this kind of checking is actually needed
83
    my $searchbreeding = $dbh->prepare("select import_record_id from import_biblios where isbn=? and title=?");
83
    my $searchbreeding = $dbh->prepare("select import_record_id from import_biblios where isbn=? and title=?");
84
    
84
    
85
#     $encoding = C4::Context->preference("marcflavour") unless $encoding;
85
#     $encoding = C4::Context->preference("MarcFormat") unless $encoding;
86
    # fields used for import results
86
    # fields used for import results
87
    my $imported=0;
87
    my $imported=0;
88
    my $alreadyindb = 0;
88
    my $alreadyindb = 0;
Lines 92-98 sub ImportBreeding { Link Here
92
    for (my $i=0;$i<=$#marcarray;$i++) {
92
    for (my $i=0;$i<=$#marcarray;$i++) {
93
        my ($marcrecord, $charset_result, $charset_errors);
93
        my ($marcrecord, $charset_result, $charset_errors);
94
        ($marcrecord, $charset_result, $charset_errors) = 
94
        ($marcrecord, $charset_result, $charset_errors) = 
95
            MarcToUTF8Record($marcarray[$i]."\x1D", C4::Context->preference("marcflavour"), $encoding);
95
            MarcToUTF8Record($marcarray[$i]."\x1D", C4::Context->preference("MarcFormat"), $encoding);
96
        
96
        
97
        # Normalize the record so it doesn't have separated diacritics
97
        # Normalize the record so it doesn't have separated diacritics
98
        SetUTF8Flag($marcrecord);
98
        SetUTF8Flag($marcrecord);
Lines 377-383 sub Z3950Search { Link Here
377
                            my $marcrecord;
377
                            my $marcrecord;
378
                            $marcdata   = $rec->raw();
378
                            $marcdata   = $rec->raw();
379
                            my ($charset_result, $charset_errors);
379
                            my ($charset_result, $charset_errors);
380
                            ($marcrecord, $charset_result, $charset_errors)= MarcToUTF8Record($marcdata, C4::Context->preference('marcflavour'), $encoding[$k]);
380
                            ($marcrecord, $charset_result, $charset_errors)= MarcToUTF8Record($marcdata, C4::Context->preference('MarcFormat'), $encoding[$k]);
381
                            # Normalize the record so it doesn't have separated diacritics
381
                            # Normalize the record so it doesn't have separated diacritics
382
                            SetUTF8Flag($marcrecord);
382
                            SetUTF8Flag($marcrecord);
383
                            my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, "" );
383
                            my $oldbiblio = TransformMarcToKoha( $dbh, $marcrecord, "" );
(-)a/C4/Charset.pm (-2 / +2 lines)
Lines 316-322 any actual character conversion. Link Here
316
316
317
sub SetMarcUnicodeFlag {
317
sub SetMarcUnicodeFlag {
318
    my $marc_record = shift;
318
    my $marc_record = shift;
319
    my $marc_flavour = shift; # || C4::Context->preference("marcflavour");
319
    my $marc_flavour = shift; # || C4::Context->preference("MarcFormat");
320
320
321
    $marc_record->encoding('UTF-8');
321
    $marc_record->encoding('UTF-8');
322
    if ($marc_flavour eq 'MARC21' || $marc_flavour eq 'NORMARC') {
322
    if ($marc_flavour eq 'MARC21' || $marc_flavour eq 'NORMARC') {
Lines 348-354 sub SetMarcUnicodeFlag { Link Here
348
        }
348
        }
349
		$debug && warn "encodage: ", substr( $marc_record->subfield(100, 'a'), $encodingposition, 3 );
349
		$debug && warn "encodage: ", substr( $marc_record->subfield(100, 'a'), $encodingposition, 3 );
350
    } else {
350
    } else {
351
        warn "Unrecognized marcflavour: $marc_flavour";
351
        warn "Unrecognized MarcFormat: $marc_flavour";
352
    }
352
    }
353
}
353
}
354
354
(-)a/C4/Context.pm (-1 / +1 lines)
Lines 700-706 sub Zconn { Link Here
700
700
701
        $context->{"Zconn"}->{$server} = &_new_Zconn($server,$async,$auth,$piggyback,$syntax);
701
        $context->{"Zconn"}->{$server} = &_new_Zconn($server,$async,$auth,$piggyback,$syntax);
702
        $context->{ Zconn }->{ $server }->option(
702
        $context->{ Zconn }->{ $server }->option(
703
            preferredRecordSyntax => C4::Context->preference("marcflavour") );
703
            preferredRecordSyntax => C4::Context->preference("MarcFormat") );
704
        return $context->{"Zconn"}->{$server};
704
        return $context->{"Zconn"}->{$server};
705
    }
705
    }
706
}
706
}
(-)a/C4/HTML5Media.pm (-3 / +3 lines)
Lines 48-54 sub gethtml5media { Link Here
48
    my $HTML5MediaParent;
48
    my $HTML5MediaParent;
49
    my $HTML5MediaWidth;
49
    my $HTML5MediaWidth;
50
    my @HTML5MediaExtensions = split( /\|/, C4::Context->preference("HTML5MediaExtensions") );
50
    my @HTML5MediaExtensions = split( /\|/, C4::Context->preference("HTML5MediaExtensions") );
51
    my $marcflavour          = C4::Context->preference("marcflavour");
51
    my $MarcFormat          = C4::Context->preference("MarcFormat");
52
    foreach my $HTML5Media_field (@HTML5Media_fields) {
52
    foreach my $HTML5Media_field (@HTML5Media_fields) {
53
        my %HTML5Media;
53
        my %HTML5Media;
54
        # protocol
54
        # protocol
Lines 59-68 sub gethtml5media { Link Here
59
            $HTML5Media{protocol} = 'http';
59
            $HTML5Media{protocol} = 'http';
60
        }
60
        }
61
        elsif ( $HTML5Media_field->indicator(1) eq '7' ) {
61
        elsif ( $HTML5Media_field->indicator(1) eq '7' ) {
62
            if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC') {
62
            if ($MarcFormat eq 'MARC21' || $MarcFormat eq 'NORMARC') {
63
                $HTML5Media{protocol} = $HTML5Media_field->subfield('2');
63
                $HTML5Media{protocol} = $HTML5Media_field->subfield('2');
64
            }
64
            }
65
            elsif ($marcflavour eq 'UNIMARC') {
65
            elsif ($MarcFormat eq 'UNIMARC') {
66
                $HTML5Media{protocol} = $HTML5Media_field->subfield('y');
66
                $HTML5Media{protocol} = $HTML5Media_field->subfield('y');
67
            }
67
            }
68
        }
68
        }
(-)a/C4/Heading.pm (-5 / +5 lines)
Lines 67-75 sub new_from_bib_field { Link Here
67
    my $class         = shift;
67
    my $class         = shift;
68
    my $field         = shift;
68
    my $field         = shift;
69
    my $frameworkcode = shift;
69
    my $frameworkcode = shift;
70
    my $marcflavour   = @_ ? shift : C4::Context->preference('marcflavour');
70
    my $MarcFormat   = @_ ? shift : C4::Context->preference('MarcFormat');
71
71
72
    my $marc_handler = _marc_format_handler($marcflavour);
72
    my $marc_handler = _marc_format_handler($MarcFormat);
73
73
74
    my $tag = $field->tag();
74
    my $tag = $field->tag();
75
    return unless $marc_handler->valid_bib_heading_tag( $tag, $frameworkcode );
75
    return unless $marc_handler->valid_bib_heading_tag( $tag, $frameworkcode );
Lines 219-227 depending on the selected MARC flavour. Link Here
219
=cut
219
=cut
220
220
221
sub _marc_format_handler {
221
sub _marc_format_handler {
222
    my $marcflavour = uc shift;
222
    my $MarcFormat = uc shift;
223
    $marcflavour = 'MARC21' if ( $marcflavour eq 'NORMARC' );
223
    $MarcFormat = 'MARC21' if ( $MarcFormat eq 'NORMARC' );
224
    my $pname = "C4::Heading::$marcflavour";
224
    my $pname = "C4::Heading::$MarcFormat";
225
    load $pname;
225
    load $pname;
226
    return $pname->new();
226
    return $pname->new();
227
}
227
}
(-)a/C4/ImportBatch.pm (-13 / +13 lines)
Lines 255-261 sub AddBiblioToBatch { Link Here
255
    my $z3950random = shift;
255
    my $z3950random = shift;
256
    my $update_counts = @_ ? shift : 1;
256
    my $update_counts = @_ ? shift : 1;
257
257
258
    my $import_record_id = _create_import_record($batch_id, $record_sequence, $marc_record, 'biblio', $encoding, $z3950random, C4::Context->preference('marcflavour'));
258
    my $import_record_id = _create_import_record($batch_id, $record_sequence, $marc_record, 'biblio', $encoding, $z3950random, C4::Context->preference('MarcFormat'));
259
    _add_biblio_fields($import_record_id, $marc_record);
259
    _add_biblio_fields($import_record_id, $marc_record);
260
    _update_batch_record_counts($batch_id) if $update_counts;
260
    _update_batch_record_counts($batch_id) if $update_counts;
261
    return $import_record_id;
261
    return $import_record_id;
Lines 270-276 sub AddBiblioToBatch { Link Here
270
sub ModBiblioInBatch {
270
sub ModBiblioInBatch {
271
    my ($import_record_id, $marc_record) = @_;
271
    my ($import_record_id, $marc_record) = @_;
272
272
273
    _update_import_record_marc($import_record_id, $marc_record, C4::Context->preference('marcflavour'));
273
    _update_import_record_marc($import_record_id, $marc_record, C4::Context->preference('MarcFormat'));
274
    _update_biblio_fields($import_record_id, $marc_record);
274
    _update_biblio_fields($import_record_id, $marc_record);
275
275
276
}
276
}
Lines 289-295 sub AddAuthToBatch { Link Here
289
    my $encoding = shift;
289
    my $encoding = shift;
290
    my $z3950random = shift;
290
    my $z3950random = shift;
291
    my $update_counts = @_ ? shift : 1;
291
    my $update_counts = @_ ? shift : 1;
292
    my $marc_type = shift || C4::Context->preference('marcflavour');
292
    my $marc_type = shift || C4::Context->preference('MarcFormat');
293
293
294
    $marc_type = 'UNIMARCAUTH' if $marc_type eq 'UNIMARC';
294
    $marc_type = 'UNIMARCAUTH' if $marc_type eq 'UNIMARC';
295
295
Lines 308-315 sub AddAuthToBatch { Link Here
308
sub ModAuthInBatch {
308
sub ModAuthInBatch {
309
    my ($import_record_id, $marc_record) = @_;
309
    my ($import_record_id, $marc_record) = @_;
310
310
311
    my $marcflavour = C4::Context->preference('marcflavour');
311
    my $MarcFormat = C4::Context->preference('MarcFormat');
312
    _update_import_record_marc($import_record_id, $marc_record, $marcflavour eq 'UNIMARC' ? 'UNIMARCAUTH' : 'USMARC');
312
    _update_import_record_marc($import_record_id, $marc_record, $MarcFormat eq 'UNIMARC' ? 'UNIMARCAUTH' : 'USMARC');
313
313
314
}
314
}
315
315
Lines 358-364 sub BatchStageMarcRecords { Link Here
358
        SetImportBatchItemAction($batch_id, 'ignore');
358
        SetImportBatchItemAction($batch_id, 'ignore');
359
    }
359
    }
360
360
361
    my $marc_type = C4::Context->preference('marcflavour');
361
    my $marc_type = C4::Context->preference('MarcFormat');
362
    $marc_type .= 'AUTH' if ($marc_type eq 'UNIMARC' && $record_type eq 'auth');
362
    $marc_type .= 'AUTH' if ($marc_type eq 'UNIMARC' && $record_type eq 'auth');
363
    my @invalid_records = ();
363
    my @invalid_records = ();
364
    my $num_valid = 0;
364
    my $num_valid = 0;
Lines 440-446 sub AddItemsToImportBiblio { Link Here
440
440
441
    if ($#import_items_ids > -1) {
441
    if ($#import_items_ids > -1) {
442
        _update_batch_record_counts($batch_id) if $update_counts;
442
        _update_batch_record_counts($batch_id) if $update_counts;
443
        _update_import_record_marc($import_record_id, $marc_record, C4::Context->preference('marcflavour'));
443
        _update_import_record_marc($import_record_id, $marc_record, C4::Context->preference('MarcFormat'));
444
    }
444
    }
445
    return @import_items_ids;
445
    return @import_items_ids;
446
}
446
}
Lines 555-561 sub BatchCommitRecords { Link Here
555
                             LEFT JOIN import_biblios ON (import_records.import_record_id=import_biblios.import_record_id)
555
                             LEFT JOIN import_biblios ON (import_records.import_record_id=import_biblios.import_record_id)
556
                             WHERE import_batch_id = ?");
556
                             WHERE import_batch_id = ?");
557
    $sth->execute($batch_id);
557
    $sth->execute($batch_id);
558
    my $marcflavour = C4::Context->preference('marcflavour');
558
    my $MarcFormat = C4::Context->preference('MarcFormat');
559
    my $rec_num = 0;
559
    my $rec_num = 0;
560
    while (my $rowref = $sth->fetchrow_hashref) {
560
    while (my $rowref = $sth->fetchrow_hashref) {
561
        $record_type = $rowref->{'record_type'};
561
        $record_type = $rowref->{'record_type'};
Lines 569-577 sub BatchCommitRecords { Link Here
569
        }
569
        }
570
570
571
        my $marc_type;
571
        my $marc_type;
572
        if ($marcflavour eq 'UNIMARC' && $record_type eq 'auth') {
572
        if ($MarcFormat eq 'UNIMARC' && $record_type eq 'auth') {
573
            $marc_type = 'UNIMARCAUTH';
573
            $marc_type = 'UNIMARCAUTH';
574
        } elsif ($marcflavour eq 'UNIMARC') {
574
        } elsif ($MarcFormat eq 'UNIMARC') {
575
            $marc_type = 'UNIMARC';
575
            $marc_type = 'UNIMARC';
576
        } else {
576
        } else {
577
            $marc_type = 'USMARC';
577
            $marc_type = 'USMARC';
Lines 747-762 sub BatchRevertRecords { Link Here
747
                             WHERE import_batch_id = ?");
747
                             WHERE import_batch_id = ?");
748
    $sth->execute($batch_id);
748
    $sth->execute($batch_id);
749
    my $marc_type;
749
    my $marc_type;
750
    my $marcflavour = C4::Context->preference('marcflavour');
750
    my $MarcFormat = C4::Context->preference('MarcFormat');
751
    while (my $rowref = $sth->fetchrow_hashref) {
751
    while (my $rowref = $sth->fetchrow_hashref) {
752
        $record_type = $rowref->{'record_type'};
752
        $record_type = $rowref->{'record_type'};
753
        if ($rowref->{'status'} eq 'error' or $rowref->{'status'} eq 'reverted') {
753
        if ($rowref->{'status'} eq 'error' or $rowref->{'status'} eq 'reverted') {
754
            $num_ignored++;
754
            $num_ignored++;
755
            next;
755
            next;
756
        }
756
        }
757
        if ($marcflavour eq 'UNIMARC' && $record_type eq 'auth') {
757
        if ($MarcFormat eq 'UNIMARC' && $record_type eq 'auth') {
758
            $marc_type = 'UNIMARCAUTH';
758
            $marc_type = 'UNIMARCAUTH';
759
        } elsif ($marcflavour eq 'UNIMARC') {
759
        } elsif ($MarcFormat eq 'UNIMARC') {
760
            $marc_type = 'UNIMARC';
760
            $marc_type = 'UNIMARC';
761
        } else {
761
        } else {
762
            $marc_type = 'USMARC';
762
            $marc_type = 'USMARC';
(-)a/C4/Installer.pm (-28 / +28 lines)
Lines 37-43 C4::Installer Link Here
37
 my $list = $installer->sql_file_list('en', 'marc21', { optional => 1, mandatory => 1 });
37
 my $list = $installer->sql_file_list('en', 'marc21', { optional => 1, mandatory => 1 });
38
 my ($fwk_language, $error_list) = $installer->load_sql_in_order($all_languages, @$list);
38
 my ($fwk_language, $error_list) = $installer->load_sql_in_order($all_languages, @$list);
39
 $installer->set_version_syspref();
39
 $installer->set_version_syspref();
40
 $installer->set_marcflavour_syspref('MARC21');
40
 $installer->set_MarcFormat_syspref('MARC21');
41
41
42
=head1 DESCRIPTION
42
=head1 DESCRIPTION
43
43
Lines 69-75 sub new { Link Here
69
                                  ( $self->{port} ? ";port=$self->{port}" : "" ),
69
                                  ( $self->{port} ? ";port=$self->{port}" : "" ),
70
                                  $self->{'user'}, $self->{'password'});
70
                                  $self->{'user'}, $self->{'password'});
71
    $self->{'language'} = undef;
71
    $self->{'language'} = undef;
72
    $self->{'marcflavour'} = undef;
72
    $self->{'MarcFormat'} = undef;
73
	$self->{'dbh'}->do('set NAMES "utf8"');
73
	$self->{'dbh'}->do('set NAMES "utf8"');
74
    $self->{'dbh'}->{'mysql_enable_utf8'}=1;
74
    $self->{'dbh'}->{'mysql_enable_utf8'}=1;
75
75
Lines 77-85 sub new { Link Here
77
    return $self;
77
    return $self;
78
}
78
}
79
79
80
=head2 marcflavour_list
80
=head2 MarcFormat_list
81
81
82
  my ($marcflavours) = $installer->marcflavour_list($lang);
82
  my ($MarcFormats) = $installer->MarcFormat_list($lang);
83
83
84
Return a arrayref of the MARC flavour sets available for the
84
Return a arrayref of the MARC flavour sets available for the
85
specified language C<$lang>.  Returns 'undef' if a directory
85
specified language C<$lang>.  Returns 'undef' if a directory
Lines 87-97 for the language does not exist. Link Here
87
87
88
=cut
88
=cut
89
89
90
sub marcflavour_list {
90
sub MarcFormat_list {
91
    my $self = shift;
91
    my $self = shift;
92
    my $lang = shift;
92
    my $lang = shift;
93
93
94
    my $dir = C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}/$lang/marcflavour";
94
    my $dir = C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}/$lang/MarcFormat";
95
    opendir(MYDIR, $dir) or return;
95
    opendir(MYDIR, $dir) or return;
96
    my @list = grep { !/^\.|CVS/ && -d "$dir/$_" } readdir(MYDIR);
96
    my @list = grep { !/^\.|CVS/ && -d "$dir/$_" } readdir(MYDIR);
97
    closedir MYDIR;
97
    closedir MYDIR;
Lines 101-111 sub marcflavour_list { Link Here
101
=head2 marc_framework_sql_list
101
=head2 marc_framework_sql_list
102
102
103
  my ($defaulted_to_en, $list) = 
103
  my ($defaulted_to_en, $list) = 
104
     $installer->marc_framework_sql_list($lang, $marcflavour);
104
     $installer->marc_framework_sql_list($lang, $MarcFormat);
105
105
106
Returns in C<$list> a structure listing the filename, description, section,
106
Returns in C<$list> a structure listing the filename, description, section,
107
and mandatory/optional status of MARC framework scripts available for C<$lang>
107
and mandatory/optional status of MARC framework scripts available for C<$lang>
108
and C<$marcflavour>.
108
and C<$MarcFormat>.
109
109
110
If the C<$defaulted_to_en> return value is true, no scripts are available
110
If the C<$defaulted_to_en> return value is true, no scripts are available
111
for language C<$lang> and the 'en' ones are returned.
111
for language C<$lang> and the 'en' ones are returned.
Lines 115-138 for language C<$lang> and the 'en' ones are returned. Link Here
115
sub marc_framework_sql_list {
115
sub marc_framework_sql_list {
116
    my $self = shift;
116
    my $self = shift;
117
    my $lang = shift;
117
    my $lang = shift;
118
    my $marcflavour = shift;
118
    my $MarcFormat = shift;
119
119
120
    my $defaulted_to_en = 0;
120
    my $defaulted_to_en = 0;
121
121
122
    undef $/;
122
    undef $/;
123
    my $dir = C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}/$lang/marcflavour/".lc($marcflavour);
123
    my $dir = C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}/$lang/MarcFormat/".lc($MarcFormat);
124
    unless (opendir( MYDIR, $dir )) {
124
    unless (opendir( MYDIR, $dir )) {
125
        if ($lang eq 'en') {
125
        if ($lang eq 'en') {
126
            warn "cannot open MARC frameworks directory $dir";
126
            warn "cannot open MARC frameworks directory $dir";
127
        } else {
127
        } else {
128
            # if no translated MARC framework is available,
128
            # if no translated MARC framework is available,
129
            # default to English
129
            # default to English
130
            $dir = C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}/en/marcflavour/".lc($marcflavour);
130
            $dir = C4::Context->config('intranetdir') . "/installer/data/$self->{dbms}/en/MarcFormat/".lc($MarcFormat);
131
            opendir(MYDIR, $dir) or warn "cannot open English MARC frameworks directory $dir";
131
            opendir(MYDIR, $dir) or warn "cannot open English MARC frameworks directory $dir";
132
            $defaulted_to_en = 1;
132
            $defaulted_to_en = 1;
133
        }
133
        }
134
    }
134
    }
135
    my @listdir = sort grep { !/^\.|marcflavour/ && -d "$dir/$_" } readdir(MYDIR);
135
    my @listdir = sort grep { !/^\.|MarcFormat/ && -d "$dir/$_" } readdir(MYDIR);
136
    closedir MYDIR;
136
    closedir MYDIR;
137
137
138
    my @fwklist;
138
    my @fwklist;
Lines 210-216 sub sample_data_sql_list { Link Here
210
            $defaulted_to_en = 1;
210
            $defaulted_to_en = 1;
211
        }
211
        }
212
    }
212
    }
213
    my @listdir = sort grep { !/^\.|marcflavour/ && -d "$dir/$_" } readdir(MYDIR);
213
    my @listdir = sort grep { !/^\.|MarcFormat/ && -d "$dir/$_" } readdir(MYDIR);
214
    closedir MYDIR;
214
    closedir MYDIR;
215
215
216
    my @levellist;
216
    my @levellist;
Lines 259-268 sub sample_data_sql_list { Link Here
259
259
260
=head2 sql_file_list
260
=head2 sql_file_list
261
261
262
  my $list = $installer->sql_file_list($lang, $marcflavour, $subset_wanted);
262
  my $list = $installer->sql_file_list($lang, $MarcFormat, $subset_wanted);
263
263
264
Returns an arrayref containing the filepaths of installer SQL scripts
264
Returns an arrayref containing the filepaths of installer SQL scripts
265
available for laod.  The C<$lang> and C<$marcflavour> arguments
265
available for laod.  The C<$lang> and C<$MarcFormat> arguments
266
specify the desired language and MARC flavour. while C<$subset_wanted>
266
specify the desired language and MARC flavour. while C<$subset_wanted>
267
is a hashref containing possible named parameters 'mandatory' and 'optional'.
267
is a hashref containing possible named parameters 'mandatory' and 'optional'.
268
268
Lines 271-280 is a hashref containing possible named parameters 'mandatory' and 'optional'. Link Here
271
sub sql_file_list {
271
sub sql_file_list {
272
    my $self = shift;
272
    my $self = shift;
273
    my $lang = shift;
273
    my $lang = shift;
274
    my $marcflavour = shift;
274
    my $MarcFormat = shift;
275
    my $subset_wanted = shift;
275
    my $subset_wanted = shift;
276
276
277
    my ($marc_defaulted_to_en, $marc_sql) = $self->marc_framework_sql_list($lang, $marcflavour);
277
    my ($marc_defaulted_to_en, $marc_sql) = $self->marc_framework_sql_list($lang, $MarcFormat);
278
    my ($sample_defaulted_to_en, $sample_sql) = $self->sample_data_sql_list($lang);
278
    my ($sample_defaulted_to_en, $sample_sql) = $self->sample_data_sql_list($lang);
279
279
280
    my @sql_list = ();
280
    my @sql_list = ();
Lines 400-412 sub load_sql_in_order { Link Here
400
    return ($fwk_language, \@list);
400
    return ($fwk_language, \@list);
401
}
401
}
402
402
403
=head2 set_marcflavour_syspref
403
=head2 set_MarcFormat_syspref
404
404
405
  $installer->set_marcflavour_syspref($marcflavour);
405
  $installer->set_MarcFormat_syspref($MarcFormat);
406
406
407
Set the 'marcflavour' system preference.  The incoming
407
Set the 'MarcFormat' system preference.  The incoming
408
C<$marcflavour> references to a subdirectory of
408
C<$MarcFormat> references to a subdirectory of
409
installer/data/$dbms/$lang/marcflavour, and is
409
installer/data/$dbms/$lang/MarcFormat, and is
410
normalized to MARC21, UNIMARC or NORMARC.
410
normalized to MARC21, UNIMARC or NORMARC.
411
411
412
FIXME: this method assumes that the MARC flavour will be either
412
FIXME: this method assumes that the MARC flavour will be either
Lines 414-431 MARC21, UNIMARC or NORMARC. Link Here
414
414
415
=cut
415
=cut
416
416
417
sub set_marcflavour_syspref {
417
sub set_MarcFormat_syspref {
418
    my $self = shift;
418
    my $self = shift;
419
    my $marcflavour = shift;
419
    my $MarcFormat = shift;
420
420
421
    # we can have some variants of marc flavour, by having different directories, like : unimarc_small and unimarc_full, for small and complete unimarc frameworks.
421
    # we can have some variants of marc flavour, by having different directories, like : unimarc_small and unimarc_full, for small and complete unimarc frameworks.
422
    # marc_cleaned finds the marcflavour, without the variant.
422
    # marc_cleaned finds the MarcFormat, without the variant.
423
    my $marc_cleaned = 'MARC21';
423
    my $marc_cleaned = 'MARC21';
424
    $marc_cleaned = 'UNIMARC' if $marcflavour =~ /unimarc/i;
424
    $marc_cleaned = 'UNIMARC' if $MarcFormat =~ /unimarc/i;
425
    $marc_cleaned = 'NORMARC' if $marcflavour =~ /normarc/i;
425
    $marc_cleaned = 'NORMARC' if $MarcFormat =~ /normarc/i;
426
    my $request =
426
    my $request =
427
        $self->{'dbh'}->prepare(
427
        $self->{'dbh'}->prepare(
428
          "INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('marcflavour','$marc_cleaned','Define global MARC flavor (MARC21, UNIMARC or NORMARC) used for character encoding','MARC21|UNIMARC|NORMARC','Choice');"
428
          "INSERT IGNORE INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MarcFormat','$marc_cleaned','Define global MARC flavor (MARC21, UNIMARC or NORMARC) used for character encoding','MARC21|UNIMARC|NORMARC','Choice');"
429
        );
429
        );
430
    $request->execute;
430
    $request->execute;
431
}
431
}
(-)a/C4/Items.pm (-6 / +6 lines)
Lines 1393-1400 sub GetHostItemsInfo { Link Here
1393
	my ($record) = @_;
1393
	my ($record) = @_;
1394
	my @returnitemsInfo;
1394
	my @returnitemsInfo;
1395
1395
1396
	if (C4::Context->preference('marcflavour') eq 'MARC21' ||
1396
	if (C4::Context->preference('MarcFormat') eq 'MARC21' ||
1397
        C4::Context->preference('marcflavour') eq 'NORMARC'){
1397
        C4::Context->preference('MarcFormat') eq 'NORMARC'){
1398
	    foreach my $hostfield ( $record->field('773') ) {
1398
	    foreach my $hostfield ( $record->field('773') ) {
1399
        	my $hostbiblionumber = $hostfield->subfield("0");
1399
        	my $hostbiblionumber = $hostfield->subfield("0");
1400
	        my $linkeditemnumber = $hostfield->subfield("9");
1400
	        my $linkeditemnumber = $hostfield->subfield("9");
Lines 1406-1412 sub GetHostItemsInfo { Link Here
1406
                	}
1406
                	}
1407
        	}
1407
        	}
1408
	    }
1408
	    }
1409
	} elsif ( C4::Context->preference('marcflavour') eq 'UNIMARC'){
1409
	} elsif ( C4::Context->preference('MarcFormat') eq 'UNIMARC'){
1410
	    foreach my $hostfield ( $record->field('461') ) {
1410
	    foreach my $hostfield ( $record->field('461') ) {
1411
        	my $hostbiblionumber = $hostfield->subfield("0");
1411
        	my $hostbiblionumber = $hostfield->subfield("0");
1412
	        my $linkeditemnumber = $hostfield->subfield("9");
1412
	        my $linkeditemnumber = $hostfield->subfield("9");
Lines 1546-1552 sub get_hostitemnumbers_of { Link Here
1546
	my $marcrecord = GetMarcBiblio($biblionumber);
1546
	my $marcrecord = GetMarcBiblio($biblionumber);
1547
        my (@returnhostitemnumbers,$tag, $biblio_s, $item_s);
1547
        my (@returnhostitemnumbers,$tag, $biblio_s, $item_s);
1548
	
1548
	
1549
	my $marcflavor = C4::Context->preference('marcflavour');
1549
	my $marcflavor = C4::Context->preference('MarcFormat');
1550
	if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') {
1550
	if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') {
1551
        $tag='773';
1551
        $tag='773';
1552
        $biblio_s='0';
1552
        $biblio_s='0';
Lines 2787-2795 sub PrepareItemrecordDisplay { Link Here
2787
                    $subfield_data{marc_value} = qq(<input type="text" tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" value="$defaultvalue" />);
2787
                    $subfield_data{marc_value} = qq(<input type="text" tabindex="1" id="$subfield_data{id}" name="field_value" class="input_marceditor" size="67" maxlength="255" value="$defaultvalue" />);
2788
                }
2788
                }
2789
                elsif ( length($defaultvalue) > 100
2789
                elsif ( length($defaultvalue) > 100
2790
                            or (C4::Context->preference("marcflavour") eq "UNIMARC" and
2790
                            or (C4::Context->preference("MarcFormat") eq "UNIMARC" and
2791
                                  300 <= $tag && $tag < 400 && $subfield eq 'a' )
2791
                                  300 <= $tag && $tag < 400 && $subfield eq 'a' )
2792
                            or (C4::Context->preference("marcflavour") eq "MARC21"  and
2792
                            or (C4::Context->preference("MarcFormat") eq "MARC21"  and
2793
                                  500 <= $tag && $tag < 600                     )
2793
                                  500 <= $tag && $tag < 600                     )
2794
                          ) {
2794
                          ) {
2795
                    # oversize field (textarea)
2795
                    # oversize field (textarea)
(-)a/C4/Koha.pm (-9 / +9 lines)
Lines 698-704 sub getallthemes { Link Here
698
698
699
sub getFacets {
699
sub getFacets {
700
    my $facets;
700
    my $facets;
701
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
701
    if ( C4::Context->preference("MarcFormat") eq "UNIMARC" ) {
702
        $facets = [
702
        $facets = [
703
            {
703
            {
704
                idx   => 'su-to',
704
                idx   => 'su-to',
Lines 1304-1313 sub display_marc_indicators { Link Here
1304
}
1304
}
1305
1305
1306
sub GetNormalizedUPC {
1306
sub GetNormalizedUPC {
1307
 my ($record,$marcflavour) = @_;
1307
 my ($record,$MarcFormat) = @_;
1308
    my (@fields,$upc);
1308
    my (@fields,$upc);
1309
1309
1310
    if ($marcflavour eq 'UNIMARC') {
1310
    if ($MarcFormat eq 'UNIMARC') {
1311
        @fields = $record->field('072');
1311
        @fields = $record->field('072');
1312
        foreach my $field (@fields) {
1312
        foreach my $field (@fields) {
1313
            my $upc = _normalize_match_point($field->subfield('a'));
1313
            my $upc = _normalize_match_point($field->subfield('a'));
Lines 1332-1338 sub GetNormalizedUPC { Link Here
1332
# Normalizes and returns the first valid ISBN found in the record
1332
# Normalizes and returns the first valid ISBN found in the record
1333
# ISBN13 are converted into ISBN10. This is required to get some book cover images.
1333
# ISBN13 are converted into ISBN10. This is required to get some book cover images.
1334
sub GetNormalizedISBN {
1334
sub GetNormalizedISBN {
1335
    my ($isbn,$record,$marcflavour) = @_;
1335
    my ($isbn,$record,$MarcFormat) = @_;
1336
    my @fields;
1336
    my @fields;
1337
    if ($isbn) {
1337
    if ($isbn) {
1338
        # Koha attempts to store multiple ISBNs in biblioitems.isbn, separated by " | "
1338
        # Koha attempts to store multiple ISBNs in biblioitems.isbn, separated by " | "
Lines 1342-1348 sub GetNormalizedISBN { Link Here
1342
    }
1342
    }
1343
    return unless $record;
1343
    return unless $record;
1344
1344
1345
    if ($marcflavour eq 'UNIMARC') {
1345
    if ($MarcFormat eq 'UNIMARC') {
1346
        @fields = $record->field('010');
1346
        @fields = $record->field('010');
1347
        foreach my $field (@fields) {
1347
        foreach my $field (@fields) {
1348
            my $isbn = $field->subfield('a');
1348
            my $isbn = $field->subfield('a');
Lines 1367-1376 sub GetNormalizedISBN { Link Here
1367
}
1367
}
1368
1368
1369
sub GetNormalizedEAN {
1369
sub GetNormalizedEAN {
1370
    my ($record,$marcflavour) = @_;
1370
    my ($record,$MarcFormat) = @_;
1371
    my (@fields,$ean);
1371
    my (@fields,$ean);
1372
1372
1373
    if ($marcflavour eq 'UNIMARC') {
1373
    if ($MarcFormat eq 'UNIMARC') {
1374
        @fields = $record->field('073');
1374
        @fields = $record->field('073');
1375
        foreach my $field (@fields) {
1375
        foreach my $field (@fields) {
1376
            $ean = _normalize_match_point($field->subfield('a'));
1376
            $ean = _normalize_match_point($field->subfield('a'));
Lines 1391-1400 sub GetNormalizedEAN { Link Here
1391
    }
1391
    }
1392
}
1392
}
1393
sub GetNormalizedOCLCNumber {
1393
sub GetNormalizedOCLCNumber {
1394
    my ($record,$marcflavour) = @_;
1394
    my ($record,$MarcFormat) = @_;
1395
    my (@fields,$oclc);
1395
    my (@fields,$oclc);
1396
1396
1397
    if ($marcflavour eq 'UNIMARC') {
1397
    if ($MarcFormat eq 'UNIMARC') {
1398
        # TODO: add UNIMARC fields
1398
        # TODO: add UNIMARC fields
1399
    }
1399
    }
1400
    else { # assume marc21 if not unimarc
1400
    else { # assume marc21 if not unimarc
(-)a/C4/Record.pm (-9 / +9 lines)
Lines 92-98 sub marc2marc { Link Here
92
        unless ($error) {
92
        unless ($error) {
93
            my @privatefields;
93
            my @privatefields;
94
            foreach my $field ($marc_record_obj->fields()) {
94
            foreach my $field ($marc_record_obj->fields()) {
95
                if ($field->tag() =~ m/9/ && ($field->tag() != '490' || C4::Context->preference("marcflavour") eq 'UNIMARC')) {
95
                if ($field->tag() =~ m/9/ && ($field->tag() != '490' || C4::Context->preference("MarcFormat") eq 'UNIMARC')) {
96
                    push @privatefields, $field;
96
                    push @privatefields, $field;
97
                } elsif (! ($field->is_control_field())) {
97
                } elsif (! ($field->is_control_field())) {
98
                    $field->delete_subfield(code => '9') if ($field->subfield('9'));
98
                    $field->delete_subfield(code => '9') if ($field->subfield('9'));
Lines 148-154 sub marc2marcxml { Link Here
148
			foreach my $warn (@warnings) { warn "\t".$warn };
148
			foreach my $warn (@warnings) { warn "\t".$warn };
149
		}
149
		}
150
		unless($encoding) {$encoding = "UTF-8"}; # set default encoding
150
		unless($encoding) {$encoding = "UTF-8"}; # set default encoding
151
		unless($flavour) {$flavour = C4::Context->preference("marcflavour")}; # set default MARC flavour
151
		unless($flavour) {$flavour = C4::Context->preference("MarcFormat")}; # set default MARC flavour
152
152
153
		# attempt to convert the record to MARCXML
153
		# attempt to convert the record to MARCXML
154
		eval { $marcxml = $marc_record_obj->as_xml_record($flavour) }; #handle exceptions
154
		eval { $marcxml = $marc_record_obj->as_xml_record($flavour) }; #handle exceptions
Lines 204-210 sub marcxml2marc { Link Here
204
	my $error; # the error string
204
	my $error; # the error string
205
	my $marc; # the final ISO-2709 scalar
205
	my $marc; # the final ISO-2709 scalar
206
	unless($encoding) {$encoding = "UTF-8"}; # set the default encoding
206
	unless($encoding) {$encoding = "UTF-8"}; # set the default encoding
207
	unless($flavour) {$flavour = C4::Context->preference("marcflavour")}; # set the default MARC flavour
207
	unless($flavour) {$flavour = C4::Context->preference("MarcFormat")}; # set the default MARC flavour
208
208
209
	# attempt to do the conversion
209
	# attempt to do the conversion
210
	eval { $marc = MARC::Record->new_from_xml($marcxml,$encoding,$flavour) }; # handle exceptions
210
	eval { $marc = MARC::Record->new_from_xml($marcxml,$encoding,$flavour) }; # handle exceptions
Lines 604-610 sub changeEncoding { Link Here
604
	my ($record,$format,$flavour,$to_encoding,$from_encoding) = @_;
604
	my ($record,$format,$flavour,$to_encoding,$from_encoding) = @_;
605
	my $newrecord;
605
	my $newrecord;
606
	my $error;
606
	my $error;
607
	unless($flavour) {$flavour = C4::Context->preference("marcflavour")};
607
	unless($flavour) {$flavour = C4::Context->preference("MarcFormat")};
608
	unless($to_encoding) {$to_encoding = "UTF-8"};
608
	unless($to_encoding) {$to_encoding = "UTF-8"};
609
	
609
	
610
	# ISO-2709 Record (MARC21 or UNIMARC)
610
	# ISO-2709 Record (MARC21 or UNIMARC)
Lines 647-659 C<$id> - an id for the BibTex record (might be the biblionumber) Link Here
647
sub marc2bibtex {
647
sub marc2bibtex {
648
    my ($record, $id) = @_;
648
    my ($record, $id) = @_;
649
    my $tex;
649
    my $tex;
650
    my $marcflavour = C4::Context->preference("marcflavour");
650
    my $MarcFormat = C4::Context->preference("MarcFormat");
651
651
652
    # Authors
652
    # Authors
653
    my $author;
653
    my $author;
654
    my @texauthors;
654
    my @texauthors;
655
    my ( $mintag, $maxtag, $fields_filter );
655
    my ( $mintag, $maxtag, $fields_filter );
656
    if ( $marcflavour eq "UNIMARC" ) {
656
    if ( $MarcFormat eq "UNIMARC" ) {
657
        $mintag        = "700";
657
        $mintag        = "700";
658
        $maxtag        = "712";
658
        $maxtag        = "712";
659
        $fields_filter = '7..';
659
        $fields_filter = '7..';
Lines 667-673 sub marc2bibtex { Link Here
667
        next unless $field->tag() >= $mintag && $field->tag() <= $maxtag;
667
        next unless $field->tag() >= $mintag && $field->tag() <= $maxtag;
668
        # author formatted surname, firstname
668
        # author formatted surname, firstname
669
        my $texauthor = '';
669
        my $texauthor = '';
670
        if ( $marcflavour eq "UNIMARC" ) {
670
        if ( $MarcFormat eq "UNIMARC" ) {
671
            $texauthor = join ', ',
671
            $texauthor = join ', ',
672
              ( $field->subfield('a'), $field->subfield('b') );
672
              ( $field->subfield('a'), $field->subfield('b') );
673
        }
673
        }
Lines 678-686 sub marc2bibtex { Link Here
678
    }
678
    }
679
    $author = join ' and ', @texauthors;
679
    $author = join ' and ', @texauthors;
680
680
681
    # Defining the conversion hash according to the marcflavour
681
    # Defining the conversion hash according to the MarcFormat
682
    my %bh;
682
    my %bh;
683
    if ( $marcflavour eq "UNIMARC" ) {
683
    if ( $MarcFormat eq "UNIMARC" ) {
684
	
684
	
685
	# FIXME, TODO : handle repeatable fields
685
	# FIXME, TODO : handle repeatable fields
686
	# TODO : handle more types of documents
686
	# TODO : handle more types of documents
(-)a/C4/Ris.pm (-2 / +2 lines)
Lines 90-97 sub marc2ris { Link Here
90
    my ($record) = @_;
90
    my ($record) = @_;
91
    my $output;
91
    my $output;
92
92
93
    my $marcflavour = C4::Context->preference("marcflavour");
93
    my $MarcFormat = C4::Context->preference("MarcFormat");
94
    my $intype = lc($marcflavour);
94
    my $intype = lc($MarcFormat);
95
    my $marcprint = 0; # Debug flag;
95
    my $marcprint = 0; # Debug flag;
96
96
97
    # Let's redirect stdout
97
    # Let's redirect stdout
(-)a/C4/Search.pm (-9 / +9 lines)
Lines 463-469 sub getRecords { Link Here
463
                        my $tmpauthor;
463
                        my $tmpauthor;
464
464
465
                # the minimal record in author/title (depending on MARC flavour)
465
                # the minimal record in author/title (depending on MARC flavour)
466
                        if ( C4::Context->preference("marcflavour") eq
466
                        if ( C4::Context->preference("MarcFormat") eq
467
                            "UNIMARC" )
467
                            "UNIMARC" )
468
                        {
468
                        {
469
                            $tmptitle = MARC::Field->new(
469
                            $tmptitle = MARC::Field->new(
Lines 1121-1129 sub _handle_exploding_index { Link Here
1121
1121
1122
    return unless ($index =~ m/(su-br|su-na|su-rl)/ && $term);
1122
    return unless ($index =~ m/(su-br|su-na|su-rl)/ && $term);
1123
1123
1124
    my $marcflavour = C4::Context->preference('marcflavour');
1124
    my $MarcFormat = C4::Context->preference('MarcFormat');
1125
1125
1126
    my $codesubfield = $marcflavour eq 'UNIMARC' ? '5' : 'w';
1126
    my $codesubfield = $MarcFormat eq 'UNIMARC' ? '5' : 'w';
1127
    my $wantedcodes = '';
1127
    my $wantedcodes = '';
1128
    my @subqueries = ( "\@attr 1=Subject \@attr 4=1 \"$term\"");
1128
    my @subqueries = ( "\@attr 1=Subject \@attr 4=1 \"$term\"");
1129
    my ($error, $results, $total_hits) = SimpleSearch( "he:$term", undef, undef, [ "authorityserver" ] );
1129
    my ($error, $results, $total_hits) = SimpleSearch( "he:$term", undef, undef, [ "authorityserver" ] );
Lines 1692-1698 sub searchResults { Link Here
1692
        $times = $hits;	 # FIXME: if $hits is undefined, why do we want to equal it?
1692
        $times = $hits;	 # FIXME: if $hits is undefined, why do we want to equal it?
1693
    }
1693
    }
1694
1694
1695
	my $marcflavour = C4::Context->preference("marcflavour");
1695
	my $MarcFormat = C4::Context->preference("MarcFormat");
1696
    # We get the biblionumber position in MARC
1696
    # We get the biblionumber position in MARC
1697
    my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber','');
1697
    my ($bibliotag,$bibliosubf)=GetMarcFromKohaField('biblio.biblionumber','');
1698
1698
Lines 1712-1721 sub searchResults { Link Here
1712
        $oldbiblio->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} );
1712
        $oldbiblio->{imageurl} = getitemtypeimagelocation( $search_context, $itemtypes{ $oldbiblio->{itemtype} }->{imageurl} );
1713
1713
1714
        $oldbiblio->{'authorised_value_images'}  = ($search_context eq 'opac' && C4::Context->preference('AuthorisedValueImages')) || ($search_context eq 'intranet' && C4::Context->preference('StaffAuthorisedValueImages')) ? C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $oldbiblio->{'biblionumber'}, $marcrecord ) ) : [];
1714
        $oldbiblio->{'authorised_value_images'}  = ($search_context eq 'opac' && C4::Context->preference('AuthorisedValueImages')) || ($search_context eq 'intranet' && C4::Context->preference('StaffAuthorisedValueImages')) ? C4::Items::get_authorised_value_images( C4::Biblio::get_biblio_authorised_values( $oldbiblio->{'biblionumber'}, $marcrecord ) ) : [];
1715
		$oldbiblio->{normalized_upc}  = GetNormalizedUPC(       $marcrecord,$marcflavour);
1715
		$oldbiblio->{normalized_upc}  = GetNormalizedUPC(       $marcrecord,$MarcFormat);
1716
		$oldbiblio->{normalized_ean}  = GetNormalizedEAN(       $marcrecord,$marcflavour);
1716
		$oldbiblio->{normalized_ean}  = GetNormalizedEAN(       $marcrecord,$MarcFormat);
1717
		$oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$marcflavour);
1717
		$oldbiblio->{normalized_oclc} = GetNormalizedOCLCNumber($marcrecord,$MarcFormat);
1718
		$oldbiblio->{normalized_isbn} = GetNormalizedISBN(undef,$marcrecord,$marcflavour);
1718
		$oldbiblio->{normalized_isbn} = GetNormalizedISBN(undef,$marcrecord,$MarcFormat);
1719
		$oldbiblio->{content_identifier_exists} = 1 if ($oldbiblio->{normalized_isbn} or $oldbiblio->{normalized_oclc} or $oldbiblio->{normalized_ean} or $oldbiblio->{normalized_upc});
1719
		$oldbiblio->{content_identifier_exists} = 1 if ($oldbiblio->{normalized_isbn} or $oldbiblio->{normalized_oclc} or $oldbiblio->{normalized_ean} or $oldbiblio->{normalized_upc});
1720
1720
1721
		# edition information, if any
1721
		# edition information, if any
Lines 1773-1779 sub searchResults { Link Here
1773
1773
1774
        # Pull out the items fields
1774
        # Pull out the items fields
1775
        my @fields = $marcrecord->field($itemtag);
1775
        my @fields = $marcrecord->field($itemtag);
1776
        my $marcflavor = C4::Context->preference("marcflavour");
1776
        my $marcflavor = C4::Context->preference("MarcFormat");
1777
        # adding linked items that belong to host records
1777
        # adding linked items that belong to host records
1778
        my $analyticsfield = '773';
1778
        my $analyticsfield = '773';
1779
        if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') {
1779
        if ($marcflavor eq 'MARC21' || $marcflavor eq 'NORMARC') {
(-)a/C4/ShelfBrowser.pm (-7 / +7 lines)
Lines 117-123 sub GetNearbyItems { Link Here
117
	$num_each_side ||= 3;
117
	$num_each_side ||= 3;
118
118
119
    my $dbh         = C4::Context->dbh;
119
    my $dbh         = C4::Context->dbh;
120
    my $marcflavour = C4::Context->preference("marcflavour");
120
    my $MarcFormat = C4::Context->preference("MarcFormat");
121
    my $branches = GetBranches();
121
    my $branches = GetBranches();
122
122
123
    my $sth_get_item_details = $dbh->prepare("SELECT cn_sort,homebranch,location,ccode from items where itemnumber=?");
123
    my $sth_get_item_details = $dbh->prepare("SELECT cn_sort,homebranch,location,ccode from items where itemnumber=?");
Lines 177-184 sub GetNearbyItems { Link Here
177
    $sth_next_items->execute(@params);
177
    $sth_next_items->execute(@params);
178
    
178
    
179
    # Now we have the query run, suck out the data like marrow
179
    # Now we have the query run, suck out the data like marrow
180
    my @prev_items = reverse GetShelfInfo($sth_prev_items, $marcflavour);
180
    my @prev_items = reverse GetShelfInfo($sth_prev_items, $MarcFormat);
181
    my @next_items = GetShelfInfo($sth_next_items, $marcflavour);
181
    my @next_items = GetShelfInfo($sth_next_items, $MarcFormat);
182
182
183
    my (
183
    my (
184
        $next_itemnumber, $next_biblionumber,
184
        $next_itemnumber, $next_biblionumber,
Lines 210-216 sub GetNearbyItems { Link Here
210
# them up with additional info that shelves want, and returns those as a list.
210
# them up with additional info that shelves want, and returns those as a list.
211
# Not really intended to be exported.
211
# Not really intended to be exported.
212
sub GetShelfInfo {
212
sub GetShelfInfo {
213
    my ($sth, $marcflavour) = @_;
213
    my ($sth, $MarcFormat) = @_;
214
214
215
    my @items;
215
    my @items;
216
    while (my $this_item = $sth->fetchrow_hashref()) {
216
    while (my $this_item = $sth->fetchrow_hashref()) {
Lines 218-226 sub GetShelfInfo { Link Here
218
        next if (!defined($this_biblio));
218
        next if (!defined($this_biblio));
219
        $this_item->{'title'} = $this_biblio->{'title'};
219
        $this_item->{'title'} = $this_biblio->{'title'};
220
        my $this_record = GetMarcBiblio($this_biblio->{'biblionumber'});
220
        my $this_record = GetMarcBiblio($this_biblio->{'biblionumber'});
221
        $this_item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$marcflavour);
221
        $this_item->{'browser_normalized_upc'} = GetNormalizedUPC($this_record,$MarcFormat);
222
        $this_item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$marcflavour);
222
        $this_item->{'browser_normalized_oclc'} = GetNormalizedOCLCNumber($this_record,$MarcFormat);
223
        $this_item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$marcflavour);
223
        $this_item->{'browser_normalized_isbn'} = GetNormalizedISBN(undef,$this_record,$MarcFormat);
224
        push @items, $this_item;
224
        push @items, $this_item;
225
    }
225
    }
226
    return @items;
226
    return @items;
(-)a/C4/VirtualShelves/Page.pm (-5 / +5 lines)
Lines 73-79 sub shelfpage { Link Here
73
    my $itemoff     = ( $query->param('itemoff')  ? $query->param('itemoff')  : 1 );
73
    my $itemoff     = ( $query->param('itemoff')  ? $query->param('itemoff')  : 1 );
74
    my $displaymode = ( $query->param('display')  ? $query->param('display')  : 'publicshelves' );
74
    my $displaymode = ( $query->param('display')  ? $query->param('display')  : 'publicshelves' );
75
    my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset );
75
    my ( $shelflimit, $shelfoffset, $shelveslimit, $shelvesoffset );
76
    my $marcflavour = C4::Context->preference("marcflavour");
76
    my $MarcFormat = C4::Context->preference("MarcFormat");
77
77
78
    # get biblionumbers stored in the cart
78
    # get biblionumbers stored in the cart
79
    my @cart_list;
79
    my @cart_list;
Lines 271-280 sub shelfpage { Link Here
271
                    $this_item->{'imageurl'}  = getitemtypeinfo( $this_item->{'itemtype'}, $type )->{'imageurl'};
271
                    $this_item->{'imageurl'}  = getitemtypeinfo( $this_item->{'itemtype'}, $type )->{'imageurl'};
272
                    $this_item->{'coins'}     = GetCOinSBiblio( $record );
272
                    $this_item->{'coins'}     = GetCOinSBiblio( $record );
273
                    $this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'}));
273
                    $this_item->{'subtitle'} = GetRecordValue('subtitle', $record, GetFrameworkCode($this_item->{'biblionumber'}));
274
                    $this_item->{'normalized_upc'}  = GetNormalizedUPC(       $record,$marcflavour);
274
                    $this_item->{'normalized_upc'}  = GetNormalizedUPC(       $record,$MarcFormat);
275
                    $this_item->{'normalized_ean'}  = GetNormalizedEAN(       $record,$marcflavour);
275
                    $this_item->{'normalized_ean'}  = GetNormalizedEAN(       $record,$MarcFormat);
276
                    $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber($record,$marcflavour);
276
                    $this_item->{'normalized_oclc'} = GetNormalizedOCLCNumber($record,$MarcFormat);
277
                    $this_item->{'normalized_isbn'} = GetNormalizedISBN(undef,$record,$marcflavour);
277
                    $this_item->{'normalized_isbn'} = GetNormalizedISBN(undef,$record,$MarcFormat);
278
                    # Getting items infos for location display
278
                    # Getting items infos for location display
279
                    my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'});
279
                    my @items_infos = &GetItemsLocationInfo( $this_item->{'biblionumber'});
280
                    $this_item->{'itemsissued'} = CountItemsIssued( $this_item->{'biblionumber'} );
280
                    $this_item->{'itemsissued'} = CountItemsIssued( $this_item->{'biblionumber'} );
(-)a/C4/XSLT.pm (-5 / +5 lines)
Lines 147-168 sub XSLTParse4Display { Link Here
147
        if ($xslsyspref eq "XSLTDetailsDisplay") {
147
        if ($xslsyspref eq "XSLTDetailsDisplay") {
148
            $htdocs  = C4::Context->config('intrahtdocs');
148
            $htdocs  = C4::Context->config('intrahtdocs');
149
            $theme   = C4::Context->preference("template");
149
            $theme   = C4::Context->preference("template");
150
            $xslfile = C4::Context->preference('marcflavour') .
150
            $xslfile = C4::Context->preference('MarcFormat') .
151
                       "slim2intranetDetail.xsl";
151
                       "slim2intranetDetail.xsl";
152
        } elsif ($xslsyspref eq "XSLTResultsDisplay") {
152
        } elsif ($xslsyspref eq "XSLTResultsDisplay") {
153
            $htdocs  = C4::Context->config('intrahtdocs');
153
            $htdocs  = C4::Context->config('intrahtdocs');
154
            $theme   = C4::Context->preference("template");
154
            $theme   = C4::Context->preference("template");
155
            $xslfile = C4::Context->preference('marcflavour') .
155
            $xslfile = C4::Context->preference('MarcFormat') .
156
                        "slim2intranetResults.xsl";
156
                        "slim2intranetResults.xsl";
157
        } elsif ($xslsyspref eq "OPACXSLTDetailsDisplay") {
157
        } elsif ($xslsyspref eq "OPACXSLTDetailsDisplay") {
158
            $htdocs  = C4::Context->config('opachtdocs');
158
            $htdocs  = C4::Context->config('opachtdocs');
159
            $theme   = C4::Context->preference("opacthemes");
159
            $theme   = C4::Context->preference("opacthemes");
160
            $xslfile = C4::Context->preference('marcflavour') .
160
            $xslfile = C4::Context->preference('MarcFormat') .
161
                       "slim2OPACDetail.xsl";
161
                       "slim2OPACDetail.xsl";
162
        } elsif ($xslsyspref eq "OPACXSLTResultsDisplay") {
162
        } elsif ($xslsyspref eq "OPACXSLTResultsDisplay") {
163
            $htdocs  = C4::Context->config('opachtdocs');
163
            $htdocs  = C4::Context->config('opachtdocs');
164
            $theme   = C4::Context->preference("opacthemes");
164
            $theme   = C4::Context->preference("opacthemes");
165
            $xslfile = C4::Context->preference('marcflavour') .
165
            $xslfile = C4::Context->preference('MarcFormat') .
166
                       "slim2OPACResults.xsl";
166
                       "slim2OPACResults.xsl";
167
        }
167
        }
168
        $xslfilename = "$htdocs/$theme/$lang/xslt/$xslfile";
168
        $xslfilename = "$htdocs/$theme/$lang/xslt/$xslfile";
Lines 180-186 sub XSLTParse4Display { Link Here
180
    my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
180
    my $record = transformMARCXML4XSLT($biblionumber, $orig_record);
181
    #return $record->as_formatted();
181
    #return $record->as_formatted();
182
    my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
182
    my $itemsxml  = buildKohaItemsNamespace($biblionumber, $hidden_items);
183
    my $xmlrecord = $record->as_xml(C4::Context->preference('marcflavour'));
183
    my $xmlrecord = $record->as_xml(C4::Context->preference('MarcFormat'));
184
    my $sysxml = "<sysprefs>\n";
184
    my $sysxml = "<sysprefs>\n";
185
    foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
185
    foreach my $syspref ( qw/ hidelostitems OPACURLOpenInNewWindow
186
                              DisplayOPACiconsXSLT URLLinkText viewISBD
186
                              DisplayOPACiconsXSLT URLLinkText viewISBD
(-)a/Koha/Authority.pm (-4 / +4 lines)
Lines 40-46 use C4::Charset; Link Here
40
40
41
use base qw(Class::Accessor);
41
use base qw(Class::Accessor);
42
42
43
__PACKAGE__->mk_accessors(qw( authid authtype record marcflavour ));
43
__PACKAGE__->mk_accessors(qw( authid authtype record MarcFormat ));
44
44
45
=head2 new
45
=head2 new
46
46
Lines 69-87 Create the Koha::Authority object associated with the provided authid. Link Here
69
sub get_from_authid {
69
sub get_from_authid {
70
    my $class = shift;
70
    my $class = shift;
71
    my $authid = shift;
71
    my $authid = shift;
72
    my $marcflavour = C4::Context->preference("marcflavour");
72
    my $MarcFormat = C4::Context->preference("MarcFormat");
73
73
74
    my $dbh=C4::Context->dbh;
74
    my $dbh=C4::Context->dbh;
75
    my $sth=$dbh->prepare("select authtypecode, marcxml from auth_header where authid=?");
75
    my $sth=$dbh->prepare("select authtypecode, marcxml from auth_header where authid=?");
76
    $sth->execute($authid);
76
    $sth->execute($authid);
77
    my ($authtypecode, $marcxml) = $sth->fetchrow;
77
    my ($authtypecode, $marcxml) = $sth->fetchrow;
78
    my $record=eval {MARC::Record->new_from_xml(StripNonXmlChars($marcxml),'UTF-8',
78
    my $record=eval {MARC::Record->new_from_xml(StripNonXmlChars($marcxml),'UTF-8',
79
        (C4::Context->preference("marcflavour") eq "UNIMARC"?"UNIMARCAUTH":C4::Context->preference("marcflavour")))};
79
        (C4::Context->preference("MarcFormat") eq "UNIMARC"?"UNIMARCAUTH":C4::Context->preference("MarcFormat")))};
80
    return if ($@);
80
    return if ($@);
81
    $record->encoding('UTF-8');
81
    $record->encoding('UTF-8');
82
82
83
    my $self = $class->SUPER::new( { authid => $authid,
83
    my $self = $class->SUPER::new( { authid => $authid,
84
                                     marcflavour => $marcflavour,
84
                                     MarcFormat => $MarcFormat,
85
                                     authtype => $authtypecode,
85
                                     authtype => $authtypecode,
86
                                     record => $record });
86
                                     record => $record });
87
87
(-)a/Koha/Indexer/Utils.pm (-4 / +4 lines)
Lines 37-43 of Koha's bibliographic and authority search indexes. Link Here
37
37
38
=head2 zebra_record_abs_to_dom
38
=head2 zebra_record_abs_to_dom
39
39
40
$dom_config = Koha::Indexer::Utils::zebra_record_abs_to_dom($record_abs_config, $marcflavour);
40
$dom_config = Koha::Indexer::Utils::zebra_record_abs_to_dom($record_abs_config, $MarcFormat);
41
41
42
Given a string containing the contents of a records.abs configuration file as
42
Given a string containing the contents of a records.abs configuration file as
43
used by Zebra's GRS-1 filter, emit an equivalent DOM configuration.
43
used by Zebra's GRS-1 filter, emit an equivalent DOM configuration.
Lines 48-54 our $idxNS = 'http://www.koha-community.org/schemas/index-defs'; Link Here
48
48
49
sub zebra_record_abs_to_dom {
49
sub zebra_record_abs_to_dom {
50
    my $grs1_cfg = shift;
50
    my $grs1_cfg = shift;
51
    my $marcflavour = shift;
51
    my $MarcFormat = shift;
52
52
53
    chomp $grs1_cfg;
53
    chomp $grs1_cfg;
54
    my @grs1_cfg_lines = split /\n/, $grs1_cfg, -1;
54
    my @grs1_cfg_lines = split /\n/, $grs1_cfg, -1;
Lines 73-79 sub zebra_record_abs_to_dom { Link Here
73
    my $root = $dom_cfg->createElement('index_defs');
73
    my $root = $dom_cfg->createElement('index_defs');
74
    $root->setNamespace($idxNS, 'kohaidx');
74
    $root->setNamespace($idxNS, 'kohaidx');
75
    foreach my $grs1_def (@$grs1_defs) {
75
    foreach my $grs1_def (@$grs1_defs) {
76
        _append_grs1_def_to_dom_cfg($dom_cfg, $root, $grs1_def, $marcflavour);
76
        _append_grs1_def_to_dom_cfg($dom_cfg, $root, $grs1_def, $MarcFormat);
77
    }
77
    }
78
78
79
    # and emit the result as a string
79
    # and emit the result as a string
Lines 140-146 sub _append_grs1_def_to_dom_cfg { Link Here
140
    my $dom_cfg = shift;
140
    my $dom_cfg = shift;
141
    my $root = shift;
141
    my $root = shift;
142
    my $grs1_def = shift;
142
    my $grs1_def = shift;
143
    my $marcflavour = shift;
143
    my $MarcFormat = shift;
144
144
145
    my $comment = $dom_cfg->createComment('record.abs line ' .
145
    my $comment = $dom_cfg->createComment('record.abs line ' .
146
                                          $grs1_def->{lineno} . ': ' .
146
                                          $grs1_def->{lineno} . ': ' .
(-)a/acqui/addorderiso2709.pl (-2 / +2 lines)
Lines 192-198 if ($op eq ""){ Link Here
192
        my $patron = C4::Members::GetMember( borrowernumber => $loggedinuser );
192
        my $patron = C4::Members::GetMember( borrowernumber => $loggedinuser );
193
        my $branch = C4::Branch->GetBranchDetail( $patron->{branchcode} );
193
        my $branch = C4::Branch->GetBranchDetail( $patron->{branchcode} );
194
        # get quantity in the MARC record (1 if none)
194
        # get quantity in the MARC record (1 if none)
195
        my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('marcflavour')) || 1;
195
        my $quantity = GetMarcQuantity($marcrecord, C4::Context->preference('MarcFormat')) || 1;
196
        my %orderinfo = (
196
        my %orderinfo = (
197
            "biblionumber", $biblionumber, "basketno", $cgiparams->{'basketno'},
197
            "biblionumber", $biblionumber, "basketno", $cgiparams->{'basketno'},
198
            "quantity", $quantity, "branchcode", $branch, 
198
            "quantity", $quantity, "branchcode", $branch, 
Lines 202-208 if ($op eq ""){ Link Here
202
            "currency",$cgiparams->{'currency'},
202
            "currency",$cgiparams->{'currency'},
203
        );
203
        );
204
204
205
        my $price = GetMarcPrice($marcrecord, C4::Context->preference('marcflavour'));
205
        my $price = GetMarcPrice($marcrecord, C4::Context->preference('MarcFormat'));
206
206
207
        if ($price){
207
        if ($price){
208
            eval {
208
            eval {
(-)a/acqui/basketgroup.pl (-2 / +2 lines)
Lines 264-272 sub printbasketgrouppdf{ Link Here
264
            my $en;
264
            my $en;
265
            my $marcrecord=eval{MARC::Record::new_from_xml( $ord->{marcxml},'UTF-8' )};
265
            my $marcrecord=eval{MARC::Record::new_from_xml( $ord->{marcxml},'UTF-8' )};
266
            if ($marcrecord){
266
            if ($marcrecord){
267
                if ( C4::Context->preference("marcflavour") eq 'UNIMARC' ) {
267
                if ( C4::Context->preference("MarcFormat") eq 'UNIMARC' ) {
268
                    $en = $marcrecord->subfield( '345', "b" );
268
                    $en = $marcrecord->subfield( '345', "b" );
269
                } elsif ( C4::Context->preference("marcflavour") eq 'MARC21' ) {
269
                } elsif ( C4::Context->preference("MarcFormat") eq 'MARC21' ) {
270
                    $en = $marcrecord->subfield( '037', "a" );
270
                    $en = $marcrecord->subfield( '037', "a" );
271
                }
271
                }
272
            }
272
            }
(-)a/acqui/histsearch.pl (-1 / +1 lines)
Lines 133-139 $template->param( Link Here
133
    from_placed_on          => $from_date,
133
    from_placed_on          => $from_date,
134
    to_placed_on            => $to_date,
134
    to_placed_on            => $to_date,
135
    debug                   => $debug || $input->param('debug') || 0,
135
    debug                   => $debug || $input->param('debug') || 0,
136
    uc(C4::Context->preference("marcflavour")) => 1
136
    uc(C4::Context->preference("MarcFormat")) => 1
137
);
137
);
138
138
139
output_html_with_http_headers $input, $cookie, $template->output;
139
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/neworderempty.pl (-5 / +5 lines)
Lines 121-127 our ( $template, $loggedinuser, $cookie, $userflags ) = get_template_and_user( Link Here
121
    }
121
    }
122
);
122
);
123
123
124
our $marcflavour = C4::Context->preference('marcflavour');
124
our $MarcFormat = C4::Context->preference('MarcFormat');
125
125
126
if(!$basketno) {
126
if(!$basketno) {
127
    my $order = GetOrder($ordernumber);
127
    my $order = GetOrder($ordernumber);
Lines 164-170 if ( $ordernumber eq '' and defined $params->{'breedingid'}){ Link Here
164
        $params->{'frameworkcode'} or $params->{'frameworkcode'} = "";
164
        $params->{'frameworkcode'} or $params->{'frameworkcode'} = "";
165
        ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $params->{'frameworkcode'} );
165
        ( $biblionumber, $bibitemnum ) = AddBiblio( $marcrecord, $params->{'frameworkcode'} );
166
        # get the price if there is one.
166
        # get the price if there is one.
167
        $listprice = GetMarcPrice($marcrecord, $marcflavour);
167
        $listprice = GetMarcPrice($marcrecord, $MarcFormat);
168
        SetImportRecordStatus($params->{'breedingid'}, 'imported');
168
        SetImportRecordStatus($params->{'breedingid'}, 'imported');
169
}
169
}
170
170
Lines 415-421 $template->param( Link Here
415
    import_batch_id  => $import_batch_id,
415
    import_batch_id  => $import_batch_id,
416
    subscriptionid   => $subscriptionid,
416
    subscriptionid   => $subscriptionid,
417
    acqcreate        => C4::Context->preference("AcqCreateItem") eq "ordering" ? 1 : "",
417
    acqcreate        => C4::Context->preference("AcqCreateItem") eq "ordering" ? 1 : "",
418
    (uc(C4::Context->preference("marcflavour"))) => 1
418
    (uc(C4::Context->preference("MarcFormat"))) => 1
419
);
419
);
420
420
421
$template->param ( notes => $data->{'notes'} ) if ( $ordernumber );
421
$template->param ( notes => $data->{'notes'} ) if ( $ordernumber );
Lines 451-457 sub MARCfindbreeding { Link Here
451
            }
451
            }
452
        }
452
        }
453
        # fix the unimarc 100 coded field (with unicode information)
453
        # fix the unimarc 100 coded field (with unicode information)
454
        if ($marcflavour eq 'UNIMARC' && $record->subfield(100,'a')) {
454
        if ($MarcFormat eq 'UNIMARC' && $record->subfield(100,'a')) {
455
            my $f100a=$record->subfield(100,'a');
455
            my $f100a=$record->subfield(100,'a');
456
            my $f100 = $record->field(100);
456
            my $f100 = $record->field(100);
457
            my $f100temp = $f100->as_string;
457
            my $f100temp = $f100->as_string;
Lines 549-555 sub Load_Duplicate { Link Here
549
    booksellerid        => $basket->{'booksellerid'},
549
    booksellerid        => $basket->{'booksellerid'},
550
    breedingid          => $params->{'breedingid'},
550
    breedingid          => $params->{'breedingid'},
551
    duplicatetitle      => $duplicatetitle,
551
    duplicatetitle      => $duplicatetitle,
552
    (uc(C4::Context->preference("marcflavour"))) => 1
552
    (uc(C4::Context->preference("MarcFormat"))) => 1
553
  );
553
  );
554
554
555
  output_html_with_http_headers $input, $cookie, $template->output;
555
  output_html_with_http_headers $input, $cookie, $template->output;
(-)a/acqui/parcel.pl (-1 / +1 lines)
Lines 300-306 $template->param( Link Here
300
    book_foot_loop        => \@book_foot_loop,
300
    book_foot_loop        => \@book_foot_loop,
301
    totalprice            => sprintf($cfstr, $totalprice),
301
    totalprice            => sprintf($cfstr, $totalprice),
302
    totalquantity         => $totalquantity,
302
    totalquantity         => $totalquantity,
303
    (uc(C4::Context->preference("marcflavour"))) => 1,
303
    (uc(C4::Context->preference("MarcFormat"))) => 1,
304
    total_quantity       => $total_quantity,
304
    total_quantity       => $total_quantity,
305
    total_gste           => sprintf( "%.2f", $total_gste ),
305
    total_gste           => sprintf( "%.2f", $total_gste ),
306
    total_gsti           => sprintf( "%.2f", $total_gsti ),
306
    total_gsti           => sprintf( "%.2f", $total_gsti ),
(-)a/authorities/authorities-home.pl (-1 / +1 lines)
Lines 184-190 $template->param( Link Here
184
    op            => $op,
184
    op            => $op,
185
);
185
);
186
186
187
$template->{VARS}->{marcflavour} = C4::Context->preference("marcflavour");
187
$template->{VARS}->{MarcFormat} = C4::Context->preference("MarcFormat");
188
188
189
# Print the page
189
# Print the page
190
output_html_with_http_headers $query, $cookie, $template->output;
190
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/authorities/authorities.pl (-3 / +3 lines)
Lines 132-138 sub create_input { Link Here
132
    my $max_length = 9999;
132
    my $max_length = 9999;
133
    if ($tag eq '000') {
133
    if ($tag eq '000') {
134
        $max_length = 24;
134
        $max_length = 24;
135
    } elsif ($tag eq '008' and C4::Context->preference('marcflavour') eq 'MARC21')  {
135
    } elsif ($tag eq '008' and C4::Context->preference('MarcFormat') eq 'MARC21')  {
136
        $max_length = 40;
136
        $max_length = 40;
137
    }
137
    }
138
138
Lines 264-274 sub create_input { Link Here
264
        if (
264
        if (
265
            length($value) > 100
265
            length($value) > 100
266
            or
266
            or
267
            ( C4::Context->preference("marcflavour") eq "UNIMARC" && $tag >= 300
267
            ( C4::Context->preference("MarcFormat") eq "UNIMARC" && $tag >= 300
268
                and $tag < 400 && $subfield eq 'a' )
268
                and $tag < 400 && $subfield eq 'a' )
269
            or (    $tag >= 600
269
            or (    $tag >= 600
270
                and $tag < 700
270
                and $tag < 700
271
                && C4::Context->preference("marcflavour") eq "MARC21" )
271
                && C4::Context->preference("MarcFormat") eq "MARC21" )
272
        )
272
        )
273
        {
273
        {
274
            $subfield_data{marc_value} =
274
            $subfield_data{marc_value} =
(-)a/authorities/detail.pl (-1 / +1 lines)
Lines 223-228 $template->param(authid => $authid, Link Here
223
		authtypesloop => \@authtypesloop,
223
		authtypesloop => \@authtypesloop,
224
		);
224
		);
225
225
226
$template->{VARS}->{marcflavour} = C4::Context->preference("marcflavour");
226
$template->{VARS}->{MarcFormat} = C4::Context->preference("MarcFormat");
227
output_html_with_http_headers $query, $cookie, $template->output;
227
output_html_with_http_headers $query, $cookie, $template->output;
228
228
(-)a/authorities/export.pl (-1 / +1 lines)
Lines 30-36 if ( $op eq "export" ) { Link Here
30
        my $marc = GetAuthority($authid);
30
        my $marc = GetAuthority($authid);
31
31
32
        if ( $format =~ /marcxml/ ) {
32
        if ( $format =~ /marcxml/ ) {
33
            $marc = marc2marcxml($marc, 'UTF-8', C4::Context->preference("marcflavour") eq 'UNIMARC' ? 'UNIMARCAUTH' : 'MARC21' );
33
            $marc = marc2marcxml($marc, 'UTF-8', C4::Context->preference("MarcFormat") eq 'UNIMARC' ? 'UNIMARCAUTH' : 'MARC21' );
34
        }
34
        }
35
        elsif ($format=~ /mads/) {
35
        elsif ($format=~ /mads/) {
36
            $marc = marc2madsxml($marc);
36
            $marc = marc2madsxml($marc);
(-)a/basket/basket.pl (-6 / +6 lines)
Lines 48-54 my @bibs = split( /\//, $bib_list ); Link Here
48
my @results;
48
my @results;
49
49
50
my $num = 1;
50
my $num = 1;
51
my $marcflavour = C4::Context->preference('marcflavour');
51
my $MarcFormat = C4::Context->preference('MarcFormat');
52
if (C4::Context->preference('TagsEnabled')) {
52
if (C4::Context->preference('TagsEnabled')) {
53
	$template->param(TagsEnabled => 1);
53
	$template->param(TagsEnabled => 1);
54
	foreach (qw(TagsShowOnList TagsInputOnList)) {
54
	foreach (qw(TagsShowOnList TagsInputOnList)) {
Lines 62-72 foreach my $biblionumber ( @bibs ) { Link Here
62
62
63
    my $dat              = &GetBiblioData($biblionumber);
63
    my $dat              = &GetBiblioData($biblionumber);
64
    my $record           = &GetMarcBiblio($biblionumber);
64
    my $record           = &GetMarcBiblio($biblionumber);
65
    my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
65
    my $marcnotesarray   = GetMarcNotes( $record, $MarcFormat );
66
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
66
    my $marcauthorsarray = GetMarcAuthors( $record, $MarcFormat );
67
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
67
    my $marcsubjctsarray = GetMarcSubjects( $record, $MarcFormat );
68
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
68
    my $marcseriesarray  = GetMarcSeries  ($record,$MarcFormat);
69
    my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
69
    my $marcurlsarray    = GetMarcUrls    ($record,$MarcFormat);
70
    my @items            = GetItemsInfo( $biblionumber );
70
    my @items            = GetItemsInfo( $biblionumber );
71
71
72
    my $hasauthors = 0;
72
    my $hasauthors = 0;
(-)a/basket/downloadcart.pl (-1 / +1 lines)
Lines 52-58 if ($bib_list && $format) { Link Here
52
52
53
    my @bibs = split( /\//, $bib_list );
53
    my @bibs = split( /\//, $bib_list );
54
54
55
    my $marcflavour         = C4::Context->preference('marcflavour');
55
    my $MarcFormat         = C4::Context->preference('MarcFormat');
56
    my $output;
56
    my $output;
57
57
58
    # CSV   
58
    # CSV   
(-)a/basket/sendbasket.pl (-4 / +4 lines)
Lines 70-84 if ( $email_add ) { Link Here
70
    my @bibs = split( /\//, $bib_list );
70
    my @bibs = split( /\//, $bib_list );
71
    my @results;
71
    my @results;
72
    my $iso2709;
72
    my $iso2709;
73
    my $marcflavour = C4::Context->preference('marcflavour');
73
    my $MarcFormat = C4::Context->preference('MarcFormat');
74
    foreach my $biblionumber (@bibs) {
74
    foreach my $biblionumber (@bibs) {
75
        $template2->param( biblionumber => $biblionumber );
75
        $template2->param( biblionumber => $biblionumber );
76
76
77
        my $dat              = GetBiblioData($biblionumber);
77
        my $dat              = GetBiblioData($biblionumber);
78
        my $record           = GetMarcBiblio($biblionumber);
78
        my $record           = GetMarcBiblio($biblionumber);
79
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
79
        my $marcnotesarray   = GetMarcNotes( $record, $MarcFormat );
80
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
80
        my $marcauthorsarray = GetMarcAuthors( $record, $MarcFormat );
81
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
81
        my $marcsubjctsarray = GetMarcSubjects( $record, $MarcFormat );
82
82
83
        my @items = GetItemsInfo( $biblionumber );
83
        my @items = GetItemsInfo( $biblionumber );
84
84
(-)a/catalogue/detail.pl (-12 / +12 lines)
Lines 82-88 if($query->cookie("holdfor")){ Link Here
82
82
83
my $fw           = GetFrameworkCode($biblionumber);
83
my $fw           = GetFrameworkCode($biblionumber);
84
my $showallitems = $query->param('showallitems');
84
my $showallitems = $query->param('showallitems');
85
my $marcflavour  = C4::Context->preference("marcflavour");
85
my $MarcFormat  = C4::Context->preference("MarcFormat");
86
86
87
# XSLT processing of some stuff
87
# XSLT processing of some stuff
88
if (C4::Context->preference("XSLTDetailsDisplay") ) {
88
if (C4::Context->preference("XSLTDetailsDisplay") ) {
Lines 96-105 $template->param( ocoins => GetCOinSBiblio($record) ); Link Here
96
# some useful variables for enhanced content;
96
# some useful variables for enhanced content;
97
# in each case, we're grabbing the first value we find in
97
# in each case, we're grabbing the first value we find in
98
# the record and normalizing it
98
# the record and normalizing it
99
my $upc = GetNormalizedUPC($record,$marcflavour);
99
my $upc = GetNormalizedUPC($record,$MarcFormat);
100
my $ean = GetNormalizedEAN($record,$marcflavour);
100
my $ean = GetNormalizedEAN($record,$MarcFormat);
101
my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
101
my $oclc = GetNormalizedOCLCNumber($record,$MarcFormat);
102
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
102
my $isbn = GetNormalizedISBN(undef,$record,$MarcFormat);
103
103
104
$template->param(
104
$template->param(
105
    normalized_upc => $upc,
105
    normalized_upc => $upc,
Lines 108-120 $template->param( Link Here
108
    normalized_isbn => $isbn,
108
    normalized_isbn => $isbn,
109
);
109
);
110
110
111
my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
111
my $marcnotesarray   = GetMarcNotes( $record, $MarcFormat );
112
my $marcisbnsarray   = GetMarcISBN( $record, $marcflavour );
112
my $marcisbnsarray   = GetMarcISBN( $record, $MarcFormat );
113
my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
113
my $marcauthorsarray = GetMarcAuthors( $record, $MarcFormat );
114
my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
114
my $marcsubjctsarray = GetMarcSubjects( $record, $MarcFormat );
115
my $marcseriesarray  = GetMarcSeries($record,$marcflavour);
115
my $marcseriesarray  = GetMarcSeries($record,$MarcFormat);
116
my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
116
my $marcurlsarray    = GetMarcUrls    ($record,$MarcFormat);
117
my $marchostsarray  = GetMarcHosts($record,$marcflavour);
117
my $marchostsarray  = GetMarcHosts($record,$MarcFormat);
118
my $subtitle         = GetRecordValue('subtitle', $record, $fw);
118
my $subtitle         = GetRecordValue('subtitle', $record, $fw);
119
119
120
# Get Branches, Itemtypes and Locations
120
# Get Branches, Itemtypes and Locations
(-)a/catalogue/export.pl (-1 / +1 lines)
Lines 53-59 if ($op eq "export") { Link Here
53
			}
53
			}
54
            elsif ($format =~ /marcstd/) {
54
            elsif ($format =~ /marcstd/) {
55
                C4::Charset::SetUTF8Flag($marc,1);
55
                C4::Charset::SetUTF8Flag($marc,1);
56
                ($error, $marc) = marc2marc($marc, 'marcstd', C4::Context->preference('marcflavour'));
56
                ($error, $marc) = marc2marc($marc, 'marcstd', C4::Context->preference('MarcFormat'));
57
            }
57
            }
58
			print $query->header(
58
			print $query->header(
59
				-type => 'application/octet-stream',
59
				-type => 'application/octet-stream',
(-)a/catalogue/search.pl (-2 / +2 lines)
Lines 179-185 else { Link Here
179
    flagsrequired   => { catalogue => 1 },
179
    flagsrequired   => { catalogue => 1 },
180
    }
180
    }
181
);
181
);
182
if (C4::Context->preference("marcflavour") eq "UNIMARC" ) {
182
if (C4::Context->preference("MarcFormat") eq "UNIMARC" ) {
183
    $template->param('UNIMARC' => 1);
183
    $template->param('UNIMARC' => 1);
184
}
184
}
185
if (C4::Context->preference("IntranetNumbersPreferPhrase")) {
185
if (C4::Context->preference("IntranetNumbersPreferPhrase")) {
Lines 333-339 if ( $template_type eq 'advsearch' ) { Link Here
333
        }
333
        }
334
334
335
    }
335
    }
336
    $template->param(uc(C4::Context->preference("marcflavour")) => 1,
336
    $template->param(uc(C4::Context->preference("MarcFormat")) => 1,
337
                      search_boxes_loop => \@search_boxes_array);
337
                      search_boxes_loop => \@search_boxes_array);
338
338
339
    # load the language limits (for search)
339
    # load the language limits (for search)
(-)a/cataloguing/addbiblio.pl (-12 / +12 lines)
Lines 41-47 use MARC::File::USMARC; Link Here
41
use MARC::File::XML;
41
use MARC::File::XML;
42
use URI::Escape;
42
use URI::Escape;
43
43
44
if ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
44
if ( C4::Context->preference('MarcFormat') eq 'UNIMARC' ) {
45
    MARC::File::XML->default_record_format('UNIMARC');
45
    MARC::File::XML->default_record_format('UNIMARC');
46
}
46
}
47
47
Lines 77-83 sub MARCfindbreeding { Link Here
77
            }
77
            }
78
        }
78
        }
79
        # fix the unimarc 100 coded field (with unicode information)
79
        # fix the unimarc 100 coded field (with unicode information)
80
        if (C4::Context->preference('marcflavour') eq 'UNIMARC' && $record->subfield(100,'a')) {
80
        if (C4::Context->preference('MarcFormat') eq 'UNIMARC' && $record->subfield(100,'a')) {
81
            my $f100a=$record->subfield(100,'a');
81
            my $f100a=$record->subfield(100,'a');
82
            my $f100 = $record->field(100);
82
            my $f100 = $record->field(100);
83
            my $f100temp = $f100->as_string;
83
            my $f100temp = $f100->as_string;
Lines 97-103 sub MARCfindbreeding { Link Here
97
            # normalize author : UNIMARC specific...
97
            # normalize author : UNIMARC specific...
98
            if (    C4::Context->preference("z3950NormalizeAuthor")
98
            if (    C4::Context->preference("z3950NormalizeAuthor")
99
                and C4::Context->preference("z3950AuthorAuthFields")
99
                and C4::Context->preference("z3950AuthorAuthFields")
100
                and C4::Context->preference("marcflavour") eq 'UNIMARC' )
100
                and C4::Context->preference("MarcFormat") eq 'UNIMARC' )
101
            {
101
            {
102
                my ( $tag, $subfield ) = GetMarcFromKohaField("biblio.author", '');
102
                my ( $tag, $subfield ) = GetMarcFromKohaField("biblio.author", '');
103
103
Lines 456-466 sub create_input { Link Here
456
        if (
456
        if (
457
            length($value) > 100
457
            length($value) > 100
458
            or
458
            or
459
            ( C4::Context->preference("marcflavour") eq "UNIMARC" && $tag >= 300
459
            ( C4::Context->preference("MarcFormat") eq "UNIMARC" && $tag >= 300
460
                and $tag < 400 && $subfield eq 'a' )
460
                and $tag < 400 && $subfield eq 'a' )
461
            or (    $tag >= 500
461
            or (    $tag >= 500
462
                and $tag < 600
462
                and $tag < 600
463
                && C4::Context->preference("marcflavour") eq "MARC21" )
463
                && C4::Context->preference("MarcFormat") eq "MARC21" )
464
          )
464
          )
465
        {
465
        {
466
            $subfield_data{marc_value} =
466
            $subfield_data{marc_value} =
Lines 807-825 if ($breedingid) { Link Here
807
807
808
#populate hostfield if hostbiblionumber is available
808
#populate hostfield if hostbiblionumber is available
809
if ($hostbiblionumber) {
809
if ($hostbiblionumber) {
810
    my $marcflavour = C4::Context->preference("marcflavour");
810
    my $MarcFormat = C4::Context->preference("MarcFormat");
811
    $record = MARC::Record->new();
811
    $record = MARC::Record->new();
812
    $record->leader('');
812
    $record->leader('');
813
    my $field =
813
    my $field =
814
      PrepHostMarcField( $hostbiblionumber, $hostitemnumber, $marcflavour );
814
      PrepHostMarcField( $hostbiblionumber, $hostitemnumber, $MarcFormat );
815
    $record->append_fields($field);
815
    $record->append_fields($field);
816
}
816
}
817
817
818
# This is  a child record
818
# This is  a child record
819
if ($parentbiblio) {
819
if ($parentbiblio) {
820
    my $marcflavour = C4::Context->preference('marcflavour');
820
    my $MarcFormat = C4::Context->preference('MarcFormat');
821
    $record = MARC::Record->new();
821
    $record = MARC::Record->new();
822
    my $hostfield = prepare_host_field($parentbiblio,$marcflavour);
822
    my $hostfield = prepare_host_field($parentbiblio,$MarcFormat);
823
    if ($hostfield) {
823
    if ($hostfield) {
824
        $record->append_fields($hostfield);
824
        $record->append_fields($hostfield);
825
    }
825
    }
Lines 917-924 if ( $op eq "addbiblio" ) { Link Here
917
            done         =>1,
917
            done         =>1,
918
            popup        =>1
918
            popup        =>1
919
          );
919
          );
920
          $template->param( title => $record->subfield('200',"a") ) if ($record ne "-1" && C4::Context->preference('marcflavour') =~/unimarc/i);
920
          $template->param( title => $record->subfield('200',"a") ) if ($record ne "-1" && C4::Context->preference('MarcFormat') =~/unimarc/i);
921
          $template->param( title => $record->title() ) if ($record ne "-1" && C4::Context->preference('marcflavour') eq "usmarc");
921
          $template->param( title => $record->title() ) if ($record ne "-1" && C4::Context->preference('MarcFormat') eq "usmarc");
922
          $template->param(
922
          $template->param(
923
            popup => $mode,
923
            popup => $mode,
924
            itemtype => $frameworkcode,
924
            itemtype => $frameworkcode,
Lines 967-973 elsif ( $op eq "delete" ) { Link Here
967
        eval {
967
        eval {
968
            my $uxml = $record->as_xml;
968
            my $uxml = $record->as_xml;
969
            MARC::Record::default_record_format("UNIMARC")
969
            MARC::Record::default_record_format("UNIMARC")
970
            if ( C4::Context->preference("marcflavour") eq "UNIMARC" );
970
            if ( C4::Context->preference("MarcFormat") eq "UNIMARC" );
971
            my $urecord = MARC::Record::new_from_xml( $uxml, 'UTF-8' );
971
            my $urecord = MARC::Record::new_from_xml( $uxml, 'UTF-8' );
972
            $record = $urecord;
972
            $record = $urecord;
973
        };
973
        };
(-)a/cataloguing/additem.pl (-7 / +7 lines)
Lines 265-273 sub generate_subfield_form { Link Here
265
            $subfield_data{marc_value} = qq(<input type="text" $attributes />);
265
            $subfield_data{marc_value} = qq(<input type="text" $attributes />);
266
        }
266
        }
267
        elsif ( length($value) > 100
267
        elsif ( length($value) > 100
268
                    or (C4::Context->preference("marcflavour") eq "UNIMARC" and
268
                    or (C4::Context->preference("MarcFormat") eq "UNIMARC" and
269
                          300 <= $tag && $tag < 400 && $subfieldtag eq 'a' )
269
                          300 <= $tag && $tag < 400 && $subfieldtag eq 'a' )
270
                    or (C4::Context->preference("marcflavour") eq "MARC21"  and
270
                    or (C4::Context->preference("MarcFormat") eq "MARC21"  and
271
                          500 <= $tag && $tag < 600                     )
271
                          500 <= $tag && $tag < 600                     )
272
                  ) {
272
                  ) {
273
            # oversize field (textarea)
273
            # oversize field (textarea)
Lines 314-320 my $biblionumber = $input->param('biblionumber'); Link Here
314
my $itemnumber   = $input->param('itemnumber');
314
my $itemnumber   = $input->param('itemnumber');
315
my $op           = $input->param('op');
315
my $op           = $input->param('op');
316
my $hostitemnumber = $input->param('hostitemnumber');
316
my $hostitemnumber = $input->param('hostitemnumber');
317
my $marcflavour  = C4::Context->preference("marcflavour");
317
my $MarcFormat  = C4::Context->preference("MarcFormat");
318
# fast cataloguing datas
318
# fast cataloguing datas
319
my $fa_circborrowernumber = $input->param('circborrowernumber');
319
my $fa_circborrowernumber = $input->param('circborrowernumber');
320
my $fa_barcode            = $input->param('barcode');
320
my $fa_barcode            = $input->param('barcode');
Lines 608-616 if ($op eq "additem") { Link Here
608
    $nextop="additem";
608
    $nextop="additem";
609
} elsif ($op eq "delinkitem"){
609
} elsif ($op eq "delinkitem"){
610
    my $analyticfield = '773';
610
    my $analyticfield = '773';
611
	if ($marcflavour  eq 'MARC21' || $marcflavour eq 'NORMARC'){
611
	if ($MarcFormat  eq 'MARC21' || $MarcFormat eq 'NORMARC'){
612
        $analyticfield = '773';
612
        $analyticfield = '773';
613
    } elsif ($marcflavour eq 'UNIMARC') {
613
    } elsif ($MarcFormat eq 'UNIMARC') {
614
        $analyticfield = '461';
614
        $analyticfield = '461';
615
    }
615
    }
616
    foreach my $field ($record->field($analyticfield)){
616
    foreach my $field ($record->field($analyticfield)){
Lines 644-652 my @fields = $temp->fields(); Link Here
644
my @hostitemnumbers;
644
my @hostitemnumbers;
645
if ( C4::Context->preference('EasyAnalyticalRecords') ) {
645
if ( C4::Context->preference('EasyAnalyticalRecords') ) {
646
    my $analyticfield = '773';
646
    my $analyticfield = '773';
647
    if ($marcflavour  eq 'MARC21' || $marcflavour eq 'NORMARC') {
647
    if ($MarcFormat  eq 'MARC21' || $MarcFormat eq 'NORMARC') {
648
        $analyticfield = '773';
648
        $analyticfield = '773';
649
    } elsif ($marcflavour eq 'UNIMARC') {
649
    } elsif ($MarcFormat eq 'UNIMARC') {
650
        $analyticfield = '461';
650
        $analyticfield = '461';
651
    }
651
    }
652
    foreach my $hostfield ($temp->field($analyticfield)){
652
    foreach my $hostfield ($temp->field($analyticfield)){
(-)a/cataloguing/linkitem.pl (-5 / +5 lines)
Lines 45-55 my ($template, $loggedinuser, $cookie) Link Here
45
                 });
45
                 });
46
46
47
my $biblio = GetMarcBiblio($biblionumber);
47
my $biblio = GetMarcBiblio($biblionumber);
48
my $marcflavour = C4::Context->preference("marcflavour");
48
my $MarcFormat = C4::Context->preference("MarcFormat");
49
$marcflavour ||="MARC21";
49
$MarcFormat ||="MARC21";
50
if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC') {
50
if ($MarcFormat eq 'MARC21' || $MarcFormat eq 'NORMARC') {
51
    $template->param(bibliotitle => $biblio->subfield('245','a'));
51
    $template->param(bibliotitle => $biblio->subfield('245','a'));
52
} elsif ($marcflavour eq 'UNIMARC') {
52
} elsif ($MarcFormat eq 'UNIMARC') {
53
    $template->param(bibliotitle => $biblio->subfield('200','a'));
53
    $template->param(bibliotitle => $biblio->subfield('200','a'));
54
}
54
}
55
55
Lines 64-70 if ($barcode && $biblionumber) { Link Here
64
	my $hostbiblionumber = GetBiblionumberFromItemnumber($hostitemnumber);
64
	my $hostbiblionumber = GetBiblionumberFromItemnumber($hostitemnumber);
65
65
66
	if ($hostbiblionumber) {
66
	if ($hostbiblionumber) {
67
	        my $field = PrepHostMarcField($hostbiblionumber, $hostitemnumber,$marcflavour);
67
	        my $field = PrepHostMarcField($hostbiblionumber, $hostitemnumber,$MarcFormat);
68
		$biblio->append_fields($field);
68
		$biblio->append_fields($field);
69
69
70
		my $modresult = ModBiblio($biblio, $biblionumber, ''); 
70
		my $modresult = ModBiblio($biblio, $biblionumber, ''); 
(-)a/installer/data/mysql/ru-RU/mandatory/system_preferences_optimal_values_insert_only.sql (-1 / +1 lines)
Lines 45-51 UPDATE systempreferences SET value='#942|<code><b>|{942j}|</b></code><br/> Link Here
45
45
46
UPDATE systempreferences SET value='942hv' WHERE variable='itemcallnumber';
46
UPDATE systempreferences SET value='942hv' WHERE variable='itemcallnumber';
47
47
48
UPDATE systempreferences SET value='UNIMARC' WHERE variable='marcflavour';
48
UPDATE systempreferences SET value='UNIMARC' WHERE variable='MarcFormat';
49
49
50
-- Circulation - Оборот
50
-- Circulation - Оборот
51
51
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 53-59 INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES Link Here
53
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('LibraryName','','Define the library name as displayed on the OPAC','','');
53
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('LibraryName','','Define the library name as displayed on the OPAC','','');
54
54
55
-- this is selected by the web installer now
55
-- this is selected by the web installer now
56
-- INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('marcflavour','MARC21','Define global MARC flavor (MARC21 or UNIMARC) used for character encoding','MARC21|UNIMARC','Choice');
56
-- INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MarcFormat','MARC21','Define global MARC flavor (MARC21 or UNIMARC) used for character encoding','MARC21|UNIMARC','Choice');
57
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MARCOrgCode','OSt','Define MARC Organization Code - http://www.loc.gov/marc/organizations/orgshome.html','','free');
57
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MARCOrgCode','OSt','Define MARC Organization Code - http://www.loc.gov/marc/organizations/orgshome.html','','free');
58
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MaxFine',NULL,'Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','','Integer');
58
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('MaxFine',NULL,'Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','','Integer');
59
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxoutstanding',5,'maximum amount withstanding to be able make holds','','Integer');
59
INSERT INTO `systempreferences` (variable,value,explanation,options,type) VALUES('maxoutstanding',5,'maximum amount withstanding to be able make holds','','Integer');
(-)a/installer/data/mysql/uk-UA/mandatory/system_preferences_optimal_values_insert_only.sql (-1 / +1 lines)
Lines 45-51 UPDATE systempreferences SET value='#942|<code><b>|{942j}|</b></code><br/> Link Here
45
45
46
UPDATE systempreferences SET value='942hv' WHERE variable='itemcallnumber';
46
UPDATE systempreferences SET value='942hv' WHERE variable='itemcallnumber';
47
47
48
UPDATE systempreferences SET value='UNIMARC' WHERE variable='marcflavour';
48
UPDATE systempreferences SET value='UNIMARC' WHERE variable='MarcFormat';
49
49
50
-- Circulation - Обіг
50
-- Circulation - Обіг
51
51
(-)a/installer/data/mysql/updatedatabase.pl (-17 / +24 lines)
Lines 1057-1063 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
1057
}
1057
}
1058
$DBversion = "3.00.00.056";
1058
$DBversion = "3.00.00.056";
1059
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
1059
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
1060
    if (C4::Context->preference("marcflavour") eq 'UNIMARC') {
1060
    if (C4::Context->preference("MarcFormat") eq 'UNIMARC') {
1061
        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('995', 'v', 'Note sur le N° de périodique','Note sur le N° de périodique', 0, 0, 'items.enumchron', 10, '', '', '', 0, 0, '', '', '', NULL) ");
1061
        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('995', 'v', 'Note sur le N° de périodique','Note sur le N° de périodique', 0, 0, 'items.enumchron', 10, '', '', '', 0, 0, '', '', '', NULL) ");
1062
    } else {
1062
    } else {
1063
        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('952', 'h', 'Serial Enumeration / chronology','Serial Enumeration / chronology', 0, 0, 'items.enumchron', 10, '', '', '', 0, 0, '', '', '', NULL) ");
1063
        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('952', 'h', 'Serial Enumeration / chronology','Serial Enumeration / chronology', 0, 0, 'items.enumchron', 10, '', '', '', 0, 0, '', '', '', NULL) ");
Lines 1577-1583 $DBversion = "3.00.00.084"; Link Here
1577
1577
1578
$DBversion = "3.00.00.085";
1578
$DBversion = "3.00.00.085";
1579
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
1579
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
1580
    if (C4::Context->preference("marcflavour") eq 'MARC21') {
1580
    if (C4::Context->preference("MarcFormat") eq 'MARC21') {
1581
        $dbh->do("UPDATE marc_subfield_structure SET tab = 0 WHERE tab =  9 AND tagfield = '037'");
1581
        $dbh->do("UPDATE marc_subfield_structure SET tab = 0 WHERE tab =  9 AND tagfield = '037'");
1582
        $dbh->do("UPDATE marc_subfield_structure SET tab = 1 WHERE tab =  6 AND tagfield in ('100', '110', '111', '130')");
1582
        $dbh->do("UPDATE marc_subfield_structure SET tab = 1 WHERE tab =  6 AND tagfield in ('100', '110', '111', '130')");
1583
        $dbh->do("UPDATE marc_subfield_structure SET tab = 2 WHERE tab =  6 AND tagfield in ('240', '243')");
1583
        $dbh->do("UPDATE marc_subfield_structure SET tab = 2 WHERE tab =  6 AND tagfield in ('240', '243')");
Lines 1828-1834 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
1828
1828
1829
$DBversion = "3.00.00.095";
1829
$DBversion = "3.00.00.095";
1830
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
1830
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
1831
    if (C4::Context->preference("marcflavour") eq 'MARC21') {
1831
    if (C4::Context->preference("MarcFormat") eq 'MARC21') {
1832
        $dbh->do("UPDATE marc_subfield_structure SET authtypecode = 'MEETI_NAME' WHERE authtypecode = 'Meeting Name'");
1832
        $dbh->do("UPDATE marc_subfield_structure SET authtypecode = 'MEETI_NAME' WHERE authtypecode = 'Meeting Name'");
1833
        $dbh->do("UPDATE marc_subfield_structure SET authtypecode = 'CORPO_NAME' WHERE authtypecode = 'CORP0_NAME'");
1833
        $dbh->do("UPDATE marc_subfield_structure SET authtypecode = 'CORPO_NAME' WHERE authtypecode = 'CORP0_NAME'");
1834
    }
1834
    }
Lines 3259-3265 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3259
	$dbh->do(qq{
3259
	$dbh->do(qq{
3260
	ALTER TABLE deleteditems ADD UNIQUE INDEX deleteditemsstocknumberidx (stocknumber);
3260
	ALTER TABLE deleteditems ADD UNIQUE INDEX deleteditemsstocknumberidx (stocknumber);
3261
	});
3261
	});
3262
	if (C4::Context->preference('marcflavour') eq 'UNIMARC'){
3262
	if (C4::Context->preference('MarcFormat') eq 'UNIMARC'){
3263
		$dbh->do(qq{
3263
		$dbh->do(qq{
3264
	INSERT IGNORE INTO marc_subfield_structure (frameworkcode,tagfield, tagsubfield, tab, repeatable, mandatory,kohafield)
3264
	INSERT IGNORE INTO marc_subfield_structure (frameworkcode,tagfield, tagsubfield, tab, repeatable, mandatory,kohafield)
3265
	SELECT DISTINCT (frameworkcode),995,"j",10,0,0,"items.stocknumber" from biblio_framework ;
3265
	SELECT DISTINCT (frameworkcode),995,"j",10,0,0,"items.stocknumber" from biblio_framework ;
Lines 3976-3982 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
3976
3976
3977
$DBversion = "3.03.00.015";
3977
$DBversion = "3.03.00.015";
3978
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
3978
if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
3979
    if ( C4::Context->preference("marcflavour") eq "MARC21" ) {
3979
    if ( C4::Context->preference("MarcFormat") eq "MARC21" ) {
3980
        my $sth = $dbh->prepare(
3980
        my $sth = $dbh->prepare(
3981
"INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`,
3981
"INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`,
3982
                             `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`)
3982
                             `tab`, `authorised_value`, `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`)
Lines 4492-4504 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4492
4492
4493
$DBversion = '3.05.00.017';
4493
$DBversion = '3.05.00.017';
4494
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4494
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4495
    if (C4::Context->preference("marcflavour") eq 'MARC21' ||
4495
    if (C4::Context->preference("MarcFormat") eq 'MARC21' ||
4496
        C4::Context->preference("marcflavour") eq 'NORMARC'){
4496
        C4::Context->preference("MarcFormat") eq 'NORMARC'){
4497
        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)");
4497
        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '0', 'Host Biblionumber', 'Host Biblionumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)");
4498
        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)");
4498
        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('773', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)");
4499
        print "Upgrade to $DBversion done (Add 773 subfield 9 and 0 to default framework)\n";
4499
        print "Upgrade to $DBversion done (Add 773 subfield 9 and 0 to default framework)\n";
4500
        SetVersion ($DBversion);
4500
        SetVersion ($DBversion);
4501
    } elsif (C4::Context->preference("marcflavour") eq 'UNIMARC'){
4501
    } elsif (C4::Context->preference("MarcFormat") eq 'UNIMARC'){
4502
        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('461', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)");
4502
        $dbh->do("INSERT INTO `marc_subfield_structure` (`tagfield`, `tagsubfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `kohafield`, `tab`, `authorised_value` , `authtypecode`, `value_builder`, `isurl`, `hidden`, `frameworkcode`, `seealso`, `link`, `defaultvalue`) VALUES ('461', '9', 'Host Itemnumber', 'Host Itemnumber', 0, 0, NULL, 7, NULL, NULL, '', NULL, -6, '', '', '', NULL)");
4503
        print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n";
4503
        print "Upgrade to $DBversion done (Add 461 subfield 9 to default framework)\n";
4504
        SetVersion ($DBversion);
4504
        SetVersion ($DBversion);
Lines 4612-4618 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
4612
4612
4613
$DBversion = '3.07.00.008';
4613
$DBversion = '3.07.00.008';
4614
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4614
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
4615
    if (C4::Context->preference("marcflavour") eq 'MARC21') {
4615
    if (C4::Context->preference("MarcFormat") eq 'MARC21') {
4616
        if (C4::Context->preference("opaclanguages") eq "de") {
4616
        if (C4::Context->preference("opaclanguages") eq "de") {
4617
            $dbh->do("INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `authorised_value`, `frameworkcode`) VALUES ('545', 'Fußnote zu biografischen oder historischen Daten', 'Fußnote zu biografischen oder historischen Daten', 1, 0, NULL, '');");
4617
            $dbh->do("INSERT INTO `marc_tag_structure` (`tagfield`, `liblibrarian`, `libopac`, `repeatable`, `mandatory`, `authorised_value`, `frameworkcode`) VALUES ('545', 'Fußnote zu biografischen oder historischen Daten', 'Fußnote zu biografischen oder historischen Daten', 1, 0, NULL, '');");
4618
        } else {
4618
        } else {
Lines 4696-4702 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
4696
    $sth->execute;
4696
    $sth->execute;
4697
    my $already_exists = $sth->fetchrow;
4697
    my $already_exists = $sth->fetchrow;
4698
    if ( not $already_exists ) {
4698
    if ( not $already_exists ) {
4699
        my $field = C4::Context->preference("marcflavour") eq "UNIMARC" ? "205" : "250";
4699
        my $field = C4::Context->preference("MarcFormat") eq "UNIMARC" ? "205" : "250";
4700
        my $subfield = "a";
4700
        my $subfield = "a";
4701
        my $sth = $dbh->prepare( q|
4701
        my $sth = $dbh->prepare( q|
4702
            UPDATE marc_subfield_structure SET kohafield = "biblioitems.editionstatement"
4702
            UPDATE marc_subfield_structure SET kohafield = "biblioitems.editionstatement"
Lines 5049-5061 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5049
       UPDATE `marc_subfield_structure` SET maxlength=24 WHERE tagfield='000';
5049
       UPDATE `marc_subfield_structure` SET maxlength=24 WHERE tagfield='000';
5050
       ");
5050
       ");
5051
       $dbh->do("
5051
       $dbh->do("
5052
       UPDATE marc_subfield_structure SET maxlength = IF ((SELECT value FROM systempreferences WHERE variable = 'marcflavour')='MARC21','40','9999') WHERE tagfield='008';
5052
       UPDATE marc_subfield_structure SET maxlength = IF ((SELECT value FROM systempreferences WHERE variable = 'MarcFormat')='MARC21','40','9999') WHERE tagfield='008';
5053
       ");
5053
       ");
5054
       $dbh->do("
5054
       $dbh->do("
5055
       UPDATE marc_subfield_structure SET maxlength = IF ((SELECT value FROM systempreferences WHERE variable = 'marcflavour')='NORMARC','40','9999') WHERE tagfield='008';
5055
       UPDATE marc_subfield_structure SET maxlength = IF ((SELECT value FROM systempreferences WHERE variable = 'MarcFormat')='NORMARC','40','9999') WHERE tagfield='008';
5056
       ");
5056
       ");
5057
       $dbh->do("
5057
       $dbh->do("
5058
       UPDATE marc_subfield_structure SET maxlength = IF ((SELECT value FROM systempreferences WHERE variable = 'marcflavour')='UNIMARC','36','9999') WHERE tagfield='100';
5058
       UPDATE marc_subfield_structure SET maxlength = IF ((SELECT value FROM systempreferences WHERE variable = 'MarcFormat')='UNIMARC','36','9999') WHERE tagfield='100';
5059
       ");
5059
       ");
5060
    print "Upgrade to $DBversion done (Add new field maxlength to marc_subfield_structure)\n";
5060
    print "Upgrade to $DBversion done (Add new field maxlength to marc_subfield_structure)\n";
5061
    SetVersion($DBversion);
5061
    SetVersion($DBversion);
Lines 5322-5332 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { Link Here
5322
    $dbh->do("ALTER TABLE `biblioitems` ADD `ean` VARCHAR( 13 ) NULL AFTER issn");
5322
    $dbh->do("ALTER TABLE `biblioitems` ADD `ean` VARCHAR( 13 ) NULL AFTER issn");
5323
    $dbh->do("CREATE INDEX `ean` ON biblioitems (`ean`) ");
5323
    $dbh->do("CREATE INDEX `ean` ON biblioitems (`ean`) ");
5324
    $dbh->do("ALTER TABLE `deletedbiblioitems` ADD `ean` VARCHAR( 13 ) NULL AFTER issn");
5324
    $dbh->do("ALTER TABLE `deletedbiblioitems` ADD `ean` VARCHAR( 13 ) NULL AFTER issn");
5325
    if (C4::Context->preference("marcflavour") eq 'UNIMARC') {
5325
    if (C4::Context->preference("MarcFormat") eq 'UNIMARC') {
5326
         $dbh->do("UPDATE marc_subfield_structure SET kohafield='biblioitems.ean' WHERE tagfield='073' and tagsubfield='a'");
5326
         $dbh->do("UPDATE marc_subfield_structure SET kohafield='biblioitems.ean' WHERE tagfield='073' and tagsubfield='a'");
5327
    }
5327
    }
5328
    print "Upgrade to $DBversion done (Adding ean in biblioitems and deletedbiblioitems)\n";
5328
    print "Upgrade to $DBversion done (Adding ean in biblioitems and deletedbiblioitems)\n";
5329
    print "If you have records with ean, please run misc/batchRebuildBiblioTables.pl to populate bibliotems.ean\n" if (C4::Context->preference("marcflavour") eq 'UNIMARC');
5329
    print "If you have records with ean, please run misc/batchRebuildBiblioTables.pl to populate bibliotems.ean\n" if (C4::Context->preference("MarcFormat") eq 'UNIMARC');
5330
    SetVersion($DBversion);
5330
    SetVersion($DBversion);
5331
}
5331
}
5332
5332
Lines 5574-5580 if (C4::Context->preference("Version") < TransformToNum($DBversion)) { Link Here
5574
5574
5575
$DBversion = "3.09.00.028";
5575
$DBversion = "3.09.00.028";
5576
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5576
if (C4::Context->preference("Version") < TransformToNum($DBversion)) {
5577
    unless ( C4::Context->preference('marcflavour') eq 'UNIMARC' ) {
5577
    unless ( C4::Context->preference('MarcFormat') eq 'UNIMARC' ) {
5578
        my %referencetypes = (  '00' => 'PERSO_NAME',
5578
        my %referencetypes = (  '00' => 'PERSO_NAME',
5579
                                '10' => 'CORPO_NAME',
5579
                                '10' => 'CORPO_NAME',
5580
                                '11' => 'MEETI_NAME',
5580
                                '11' => 'MEETI_NAME',
Lines 6565-6571 if ( CheckVersion($DBversion) ) { Link Here
6565
6565
6566
$DBversion = "3.11.00.105";
6566
$DBversion = "3.11.00.105";
6567
if ( CheckVersion($DBversion) ) {
6567
if ( CheckVersion($DBversion) ) {
6568
    if ( C4::Context->preference("marcflavour") eq 'MARC21' ) {
6568
    if ( C4::Context->preference("MarcFormat") eq 'MARC21' ) {
6569
        $sth = $dbh->prepare(
6569
        $sth = $dbh->prepare(
6570
"SELECT frameworkcode FROM marc_tag_structure WHERE tagfield = '029'"
6570
"SELECT frameworkcode FROM marc_tag_structure WHERE tagfield = '029'"
6571
        );
6571
        );
Lines 6971-6976 if(CheckVersion($DBversion)) { Link Here
6971
    SetVersion ($DBversion);
6971
    SetVersion ($DBversion);
6972
}
6972
}
6973
6973
6974
$DBversion = "3.13.00.XXX";
6975
if ( CheckVersion($DBversion) ) {
6976
   $dbh->do("UPDATE systempreferences SET variable = 'MarcFormat' WHERE variable = 'marcflavour'");
6977
   print "Upgrade to $DBversion done (Bug 10329 - Rename system preference marcflavour to MarcFormat)\n";
6978
   SetVersion ($DBversion);
6979
}
6980
6974
=head1 FUNCTIONS
6981
=head1 FUNCTIONS
6975
6982
6976
=head2 TableExists($table)
6983
=head2 TableExists($table)
(-)a/installer/install.pl (-14 / +14 lines)
Lines 229-247 elsif ( $step && $step == 3 ) { Link Here
229
        my $langchoice = $query->param('fwklanguage');
229
        my $langchoice = $query->param('fwklanguage');
230
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
230
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
231
	$langchoice =~ s/[^a-zA-Z_-]*//g;
231
	$langchoice =~ s/[^a-zA-Z_-]*//g;
232
        my $marcflavour = $query->param('marcflavour');
232
        my $MarcFormat = $query->param('MarcFormat');
233
        if ($marcflavour){
233
        if ($MarcFormat){
234
            $installer->set_marcflavour_syspref($marcflavour);
234
            $installer->set_MarcFormat_syspref($MarcFormat);
235
        };
235
        };
236
        $marcflavour = C4::Context->preference('marcflavour') unless ($marcflavour);
236
        $MarcFormat = C4::Context->preference('MarcFormat') unless ($MarcFormat);
237
        #Insert into database the selected marcflavour
237
        #Insert into database the selected MarcFormat
238
        undef $/;
238
        undef $/;
239
        my ($marc_defaulted_to_en, $fwklist) = $installer->marc_framework_sql_list($langchoice, $marcflavour);
239
        my ($marc_defaulted_to_en, $fwklist) = $installer->marc_framework_sql_list($langchoice, $MarcFormat);
240
        $template->param('en_marc_frameworks' => $marc_defaulted_to_en);
240
        $template->param('en_marc_frameworks' => $marc_defaulted_to_en);
241
        $template->param( "frameworksloop" => $fwklist );
241
        $template->param( "frameworksloop" => $fwklist );
242
        $template->param( "marcflavour" => ucfirst($marcflavour));
242
        $template->param( "MarcFormat" => ucfirst($MarcFormat));
243
243
244
        my ($sample_defaulted_to_en, $levellist) = $installer->sample_data_sql_list($langchoice, $marcflavour);
244
        my ($sample_defaulted_to_en, $levellist) = $installer->sample_data_sql_list($langchoice, $MarcFormat);
245
        $template->param( "en_sample_data" => $sample_defaulted_to_en);
245
        $template->param( "en_sample_data" => $sample_defaulted_to_en);
246
        $template->param( "levelloop" => $levellist );
246
        $template->param( "levelloop" => $levellist );
247
        $template->param( "$op"       => 1 );
247
        $template->param( "$op"       => 1 );
Lines 249-260 elsif ( $step && $step == 3 ) { Link Here
249
    elsif ( $op && $op eq 'choosemarc' ) {
249
    elsif ( $op && $op eq 'choosemarc' ) {
250
        #
250
        #
251
        #
251
        #
252
        # 1ST install, 2nd sub-step : show the user the marcflavour available.
252
        # 1ST install, 2nd sub-step : show the user the MarcFormat available.
253
        #
253
        #
254
        #
254
        #
255
255
256
        #Choose Marc Flavour
256
        #Choose Marc Flavour
257
        #sql data are supposed to be located in installer/data/<dbms>/<language>/marcflavour/marcflavourname
257
        #sql data are supposed to be located in installer/data/<dbms>/<language>/MarcFormat/MarcFormatname
258
	# Where <dbms> is database type according to DBD syntax
258
	# Where <dbms> is database type according to DBD syntax
259
        # Where <language> is en|fr or any international abbreviation (provided language hash is updated... This will be a problem with internationlisation.)
259
        # Where <language> is en|fr or any international abbreviation (provided language hash is updated... This will be a problem with internationlisation.)
260
        # Where <level> is a category of requirement : required, recommended optional
260
        # Where <level> is a category of requirement : required, recommended optional
Lines 268-293 elsif ( $step && $step == 3 ) { Link Here
268
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
268
        $langchoice = $query->cookie('KohaOpacLanguage') unless ($langchoice);
269
	$langchoice =~ s/[^a-zA-Z_-]*//g;
269
	$langchoice =~ s/[^a-zA-Z_-]*//g;
270
        my $dir =
270
        my $dir =
271
          C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/$langchoice/marcflavour";
271
          C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/$langchoice/MarcFormat";
272
        unless (opendir( MYDIR, $dir )) {
272
        unless (opendir( MYDIR, $dir )) {
273
            if ($langchoice eq 'en') {
273
            if ($langchoice eq 'en') {
274
                warn "cannot open MARC frameworks directory $dir";
274
                warn "cannot open MARC frameworks directory $dir";
275
            } else {
275
            } else {
276
                # if no translated MARC framework is available,
276
                # if no translated MARC framework is available,
277
                # default to English
277
                # default to English
278
                $dir = C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/en/marcflavour";
278
                $dir = C4::Context->config('intranetdir') . "/installer/data/$info{dbms}/en/MarcFormat";
279
                opendir(MYDIR, $dir) or warn "cannot open English MARC frameworks directory $dir";
279
                opendir(MYDIR, $dir) or warn "cannot open English MARC frameworks directory $dir";
280
            }
280
            }
281
        }
281
        }
282
        my @listdir = grep { !/^\./ && -d "$dir/$_" } readdir(MYDIR);
282
        my @listdir = grep { !/^\./ && -d "$dir/$_" } readdir(MYDIR);
283
        closedir MYDIR;
283
        closedir MYDIR;
284
        my $marcflavour=C4::Context->preference("marcflavour");
284
        my $MarcFormat=C4::Context->preference("MarcFormat");
285
        my @flavourlist;
285
        my @flavourlist;
286
        foreach my $marc (@listdir) {
286
        foreach my $marc (@listdir) {
287
            my %cell=(
287
            my %cell=(
288
            "label"=> ucfirst($marc),
288
            "label"=> ucfirst($marc),
289
            "code"=>uc($marc),
289
            "code"=>uc($marc),
290
            "checked"=> defined($marcflavour) ? uc($marc) eq $marcflavour : 0);
290
            "checked"=> defined($MarcFormat) ? uc($marc) eq $MarcFormat : 0);
291
#             $cell{"description"}= do { local $/ = undef; open INPUT "<$dir/$marc.txt"||"";<INPUT> };
291
#             $cell{"description"}= do { local $/ = undef; open INPUT "<$dir/$marc.txt"||"";<INPUT> };
292
            push @flavourlist, \%cell;
292
            push @flavourlist, \%cell;
293
        }
293
        }
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search-results.inc (-2 / +2 lines)
Lines 1-5 Link Here
1
[% BLOCK showreference %]
1
[% BLOCK showreference %]
2
    [% IF marcflavour == 'UNIMARC' %]
2
    [% IF MarcFormat == 'UNIMARC' %]
3
        [% SWITCH type %]
3
        [% SWITCH type %]
4
        [% CASE 'broader' %]
4
        [% CASE 'broader' %]
5
            <span class="BT">BT: [% heading | html %]</span>
5
            <span class="BT">BT: [% heading | html %]</span>
Lines 36-42 Link Here
36
          <span class="authorizedheading">[% authorize.heading | html %]</span>
36
          <span class="authorizedheading">[% authorize.heading | html %]</span>
37
        [% END %]
37
        [% END %]
38
        </div>
38
        </div>
39
        [% IF ( marcflavour == 'UNIMARC' ) %]
39
        [% IF ( MarcFormat == 'UNIMARC' ) %]
40
          [% IF summary.notes %]
40
          [% IF summary.notes %]
41
           <div class="authres_notes">
41
           <div class="authres_notes">
42
           [% FOREACH note IN summary.notes %]
42
           [% FOREACH note IN summary.notes %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/authorities-search.inc (-3 / +3 lines)
Lines 24-30 Link Here
24
        <input type="hidden" name="op" value="do_search" />
24
        <input type="hidden" name="op" value="do_search" />
25
        <input type="hidden" name="type" value="intranet" />
25
        <input type="hidden" name="type" value="intranet" />
26
        <select name="authtypecode">
26
        <select name="authtypecode">
27
        [% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
27
        [% IF (MarcFormat == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
28
        [% FOREACH authtypesloo IN authtypesloop %]
28
        [% FOREACH authtypesloo IN authtypesloop %]
29
            [% IF ( authtypesloo.selected ) %]
29
            [% IF ( authtypesloo.selected ) %]
30
            <option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
30
            <option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
Lines 80-86 Link Here
80
        <input type="hidden" name="op" value="do_search" />
80
        <input type="hidden" name="op" value="do_search" />
81
        <input type="hidden" name="type" value="intranet" />
81
        <input type="hidden" name="type" value="intranet" />
82
        <select  name="authtypecode">
82
        <select  name="authtypecode">
83
        [% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
83
        [% IF (MarcFormat == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
84
        [% FOREACH authtypesloo IN authtypesloop %]
84
        [% FOREACH authtypesloo IN authtypesloop %]
85
            [% IF ( authtypesloo.selected ) %]
85
            [% IF ( authtypesloo.selected ) %]
86
            <option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
86
            <option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
Lines 134-140 Link Here
134
        <input type="hidden" name="op" value="do_search" />
134
        <input type="hidden" name="op" value="do_search" />
135
        <input type="hidden" name="type" value="intranet" />
135
        <input type="hidden" name="type" value="intranet" />
136
        <select name="authtypecode">
136
        <select name="authtypecode">
137
        [% IF (marcflavour == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
137
        [% IF (MarcFormat == 'UNIMARC' ) %]<option value="">All authority types</option>[% END %]
138
        [% FOREACH authtypesloo IN authtypesloop %]
138
        [% FOREACH authtypesloo IN authtypesloop %]
139
            [% IF ( authtypesloo.selected ) %]
139
            [% IF ( authtypesloo.selected ) %]
140
            <option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
140
            <option value="[% authtypesloo.value %]" selected="selected">[% authtypesloo.authtypetext %]</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/search_indexes.inc (-1 / +1 lines)
Lines 34-40 Link Here
34
    [% END %]
34
    [% END %]
35
    <option value="ln,rtrn">Language</option>
35
    <option value="ln,rtrn">Language</option>
36
    <option value="nt">Notes/Comments</option>
36
    <option value="nt">Notes/Comments</option>
37
    [% IF (marcflavour != 'UNIMARC' ) %]
37
    [% IF (MarcFormat != 'UNIMARC' ) %]
38
        <option value="curriculum">Curriculum</option>
38
        <option value="curriculum">Curriculum</option>
39
    [% END %]
39
    [% END %]
40
    <option value="pb">Publisher</option>
40
    <option value="pb">Publisher</option>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref (-1 / +1 lines)
Lines 45-51 Cataloging: Link Here
45
            - " Empty defaults to eng."
45
            - " Empty defaults to eng."
46
        -
46
        -
47
            - Interpret and store MARC records in the
47
            - Interpret and store MARC records in the
48
            - pref: marcflavour
48
            - pref: MarcFormat
49
              choices:
49
              choices:
50
                  MARC21: MARC21
50
                  MARC21: MARC21
51
                  UNIMARC: UNIMARC
51
                  UNIMARC: UNIMARC
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt (-4 / +4 lines)
Lines 94-102 function PopupZ3950() { Link Here
94
}
94
}
95
95
96
function PopupMARCFieldDoc(field, blocknumber) {
96
function PopupMARCFieldDoc(field, blocknumber) {
97
    [% IF ( marcflavour == 'MARC21' ) %]
97
    [% IF ( MarcFormat == 'MARC21' ) %]
98
        _MARC21FieldDoc(field);
98
        _MARC21FieldDoc(field);
99
    [% ELSIF ( marcflavour == 'UNIMARC' ) %]
99
    [% ELSIF ( MarcFormat == 'UNIMARC' ) %]
100
        _UNIMARCFieldDoc(field, blocknumber);
100
        _UNIMARCFieldDoc(field, blocknumber);
101
    [% END %]
101
    [% END %]
102
}
102
}
Lines 319-325 function Changefwk(FwkList) { Link Here
319
[% END %]
319
[% END %]
320
</h1>
320
</h1>
321
321
322
[% IF marcflavour != 'NORMARC' %]
322
[% IF MarcFormat != 'NORMARC' %]
323
<div><input type="checkbox" name="marcDocsSelect" id="marcDocsSelect" checked="true" /> Show MARC tag documentation links<br/></div>
323
<div><input type="checkbox" name="marcDocsSelect" id="marcDocsSelect" checked="true" /> Show MARC tag documentation links<br/></div>
324
[% END %]
324
[% END %]
325
325
Lines 447-453 function Changefwk(FwkList) { Link Here
447
                <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a>
447
                <a href="#" tabindex="1" class="tagnum" title="[% innerloo.tag_lib %] - Click to Expand this Tag" onclick="ExpandField('tag_[% innerloo.tag %]_[% innerloo.index %][% innerloo.random %]'); return false;">[% innerloo.tag %]</a>
448
            [% ELSE %]
448
            [% ELSE %]
449
                <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]
449
                <span class="tagnum" title="[% innerloo.tag_lib %]">[% innerloo.tag %]
450
                [% IF marcflavour != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]', [% BIG_LOO.number %]); return false;">&nbsp;?</a>[% END %]
450
                [% IF MarcFormat != 'NORMARC' %]<a href="#" class="marcdocs" onclick="PopupMARCFieldDoc('[% innerloo.tag %]', [% BIG_LOO.number %]); return false;">&nbsp;?</a>[% END %]
451
                </span>
451
                </span>
452
            [% END %]
452
            [% END %]
453
                [% IF ( innerloo.fixedfield ) %]
453
                [% IF ( innerloo.fixedfield ) %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/installer/step3.tt (-3 / +3 lines)
Lines 89-97 Link Here
89
    [% FOREACH flavourloo IN flavourloop %]
89
    [% FOREACH flavourloo IN flavourloop %]
90
    <div>
90
    <div>
91
            [% IF ( flavourloo.checked ) %]
91
            [% IF ( flavourloo.checked ) %]
92
                <input type="radio" name="marcflavour" value="[% flavourloo.code %]" checked /> [% flavourloo.label %] <br/>
92
                <input type="radio" name="MarcFormat" value="[% flavourloo.code %]" checked /> [% flavourloo.label %] <br/>
93
            [% ELSE %]
93
            [% ELSE %]
94
                <input type="radio" name="marcflavour" value="[% flavourloo.code %]" /> [% flavourloo.label %] <br/>
94
                <input type="radio" name="MarcFormat" value="[% flavourloo.code %]" /> [% flavourloo.label %] <br/>
95
            [% END %]
95
            [% END %]
96
    </div>
96
    </div>
97
    [% END %]
97
    [% END %]
Lines 107-113 Link Here
107
    <input type="hidden" name="op" value="addframeworks" />
107
    <input type="hidden" name="op" value="addframeworks" />
108
    
108
    
109
    [% IF ( frameworksloop ) %]
109
    [% IF ( frameworksloop ) %]
110
    <h2>MARC frameworks: [% marcflavour %]</h2>
110
    <h2>MARC frameworks: [% MarcFormat %]</h2>
111
    [% IF ( en_marc_frameworks ) %]
111
    [% IF ( en_marc_frameworks ) %]
112
        <h4><span class="error">No MARC frameworks are available for your language.  
112
        <h4><span class="error">No MARC frameworks are available for your language.  
113
                Defaulting to the frameworks supplied for English (en)<span></h4>
113
                Defaulting to the frameworks supplied for English (en)<span></h4>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/serials/serials-search.tt (-2 / +2 lines)
Lines 65-71 Link Here
65
                  <label for="title">Title:</label>
65
                  <label for="title">Title:</label>
66
                  <input type="text" id="title" name="title_filter" value="[% title_filter %]" />
66
                  <input type="text" id="title" name="title_filter" value="[% title_filter %]" />
67
                </li>
67
                </li>
68
                [% IF ( marcflavour == "UNIMARC" ) %]
68
                [% IF ( MarcFormat == "UNIMARC" ) %]
69
                <li>
69
                <li>
70
                  <label for="ean">EAN:</label>
70
                  <label for="ean">EAN:</label>
71
                  <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" />
71
                  <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" />
Lines 285-291 Link Here
285
                  <label for="title">Title:</label>
285
                  <label for="title">Title:</label>
286
                  <input type="text" id="title" name="title_filter" value="[% title_filter %]" />
286
                  <input type="text" id="title" name="title_filter" value="[% title_filter %]" />
287
                </li>
287
                </li>
288
                [% IF ( marcflavour == "UNIMARC" ) %]
288
                [% IF ( MarcFormat == "UNIMARC" ) %]
289
                <li>
289
                <li>
290
                  <label for="ean">EAN:</label>
290
                  <label for="ean">EAN:</label>
291
                  <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" />
291
                  <input type="text" id="ean" name="EAN_filter" value="[% EAN_filter %]" />
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/authorities-search-results.inc (-2 / +2 lines)
Lines 1-5 Link Here
1
[% BLOCK showreference %]
1
[% BLOCK showreference %]
2
    [% IF marcflavour == 'UNIMARC' %]
2
    [% IF MarcFormat == 'UNIMARC' %]
3
        [% SWITCH type %]
3
        [% SWITCH type %]
4
        [% CASE 'broader' %]
4
        [% CASE 'broader' %]
5
            <span class="BT">BT: [% heading | html %]</span>
5
            <span class="BT">BT: [% heading | html %]</span>
Lines 36-42 Link Here
36
            <span class="authorizedheading">[% authorize.heading | html %]</span>
36
            <span class="authorizedheading">[% authorize.heading | html %]</span>
37
          [% END %]
37
          [% END %]
38
        </div>
38
        </div>
39
        [% IF ( marcflavour == 'UNIMARC' ) %]
39
        [% IF ( MarcFormat == 'UNIMARC' ) %]
40
            [% IF summary.notes %]
40
            [% IF summary.notes %]
41
             <div class="authres_notes">
41
             <div class="authres_notes">
42
             [% FOREACH note IN summary.notes %]
42
             [% FOREACH note IN summary.notes %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-advsearch.tt (-1 / +1 lines)
Lines 96-102 Link Here
96
[% END %]
96
[% END %]
97
[% IF ( expanded_options ) %]
97
[% IF ( expanded_options ) %]
98
            <option value="nt">Notes/Comments</option>
98
            <option value="nt">Notes/Comments</option>
99
    [% IF (marcflavour != 'UNIMARC') %]
99
    [% IF (MarcFormat != 'UNIMARC') %]
100
            <option value="curriculum">Curriculum</option>
100
            <option value="curriculum">Curriculum</option>
101
    [% END %]
101
    [% END %]
102
[% END %]
102
[% END %]
(-)a/koha-tmpl/opac-tmpl/prog/en/modules/opac-auth-detail.tt (-1 / +1 lines)
Lines 75-81 $(document).ready(function() { Link Here
75
    [% PROCESS otherscript headings=summary.otherscript wantcategory='seealso' %]
75
    [% PROCESS otherscript headings=summary.otherscript wantcategory='seealso' %]
76
    </div>
76
    </div>
77
[% END %]
77
[% END %]
78
[% IF marcflavour == 'UNIMARC' && summary.otherscript %]
78
[% IF MarcFormat == 'UNIMARC' && summary.otherscript %]
79
  <div class="authstanza">
79
  <div class="authstanza">
80
    <div class="authstanzaheading">Other forms:</div>
80
    <div class="authstanzaheading">Other forms:</div>
81
    <ul>
81
    <ul>
(-)a/misc/cronjobs/MARC21_parse_test.pl (-5 / +5 lines)
Lines 88-95 if ($lint) { Link Here
88
    require MARC::Lint;
88
    require MARC::Lint;
89
    $lint_object = new MARC::Lint;
89
    $lint_object = new MARC::Lint;
90
}
90
}
91
my $marcflavour = C4::Context->preference('marcflavour') or die "No marcflavour (MARC21 or UNIMARC) set in syspref";
91
my $MarcFormat = C4::Context->preference('MarcFormat') or die "No MarcFormat (MARC21 or UNIMARC) set in syspref";
92
(uc($marcflavour) eq 'MARC21') or die "Only marcflavour MARC21, not '$marcflavour'";
92
(uc($MarcFormat) eq 'MARC21') or die "Only MarcFormat MARC21, not '$MarcFormat'";
93
93
94
# my $countq = C4::Context->dbh->prepare("SELECT COUNT(*) FROM biblioitems");    # Too SLOW on large systems
94
# my $countq = C4::Context->dbh->prepare("SELECT COUNT(*) FROM biblioitems");    # Too SLOW on large systems
95
# $countq->execute; $countq->fetchrow();
95
# $countq->execute; $countq->fetchrow();
Lines 104-110 if ($summary) { Link Here
104
    $verbose and print "# Using temp file: $filename\n"
104
    $verbose and print "# Using temp file: $filename\n"
105
}
105
}
106
106
107
MARC::File::XML->default_record_format($marcflavour) or die "FAILED MARC::File::XML->default_record_format($marcflavour)";
107
MARC::File::XML->default_record_format($MarcFormat) or die "FAILED MARC::File::XML->default_record_format($MarcFormat)";
108
108
109
my $query = "SELECT  *  FROM biblioitems ";
109
my $query = "SELECT  *  FROM biblioitems ";
110
my $recs;
110
my $recs;
Lines 164-170 while ( my $row = next_row() ) { Link Here
164
    $verbose and printf "# %4d of %4d: biblionumber %s\n", ++$printline, $limit, $row->{biblionumber};
164
    $verbose and printf "# %4d of %4d: biblionumber %s\n", ++$printline, $limit, $row->{biblionumber};
165
    my $stripped = StripNonXmlChars($xml);
165
    my $stripped = StripNonXmlChars($xml);
166
    ($stripped eq $xml) or printf "$bibnum_prefix: %d NON-XML Characters removed!!\n", (length($xml) - length($stripped));
166
    ($stripped eq $xml) or printf "$bibnum_prefix: %d NON-XML Characters removed!!\n", (length($xml) - length($stripped));
167
    my $record = eval { MARC::Record::new_from_xml( $stripped, 'utf8', $marcflavour ) };
167
    my $record = eval { MARC::Record::new_from_xml( $stripped, 'utf8', $MarcFormat ) };
168
    if (not $record) {
168
    if (not $record) {
169
        $found++;
169
        $found++;
170
    	my $msg = $@ || '';
170
    	my $msg = $@ || '';
Lines 286-292 options can still be used with biblionumbers specified from file. Files will be Link Here
286
=head1 DESCRIPTION
286
=head1 DESCRIPTION
287
287
288
This checks for data corruption or otherwise unparsable data in biblioitems.marcxml.  
288
This checks for data corruption or otherwise unparsable data in biblioitems.marcxml.  
289
As the name suggests, this script is only useful for MARC21 and will die for marcflavour UNIMARC.
289
As the name suggests, this script is only useful for MARC21 and will die for MarcFormat UNIMARC.
290
290
291
Run MARC21_parse_test.pl the first time with no options and type in individual biblionumbers to test.
291
Run MARC21_parse_test.pl the first time with no options and type in individual biblionumbers to test.
292
Or run with B<--All> to go through the entire table.
292
Or run with B<--All> to go through the entire table.
(-)a/misc/maintenance/MARC21_utf8_flag_fix.pl (-7 / +7 lines)
Lines 72-79 if ($debug) { Link Here
72
    $verbose++;
72
    $verbose++;
73
}
73
}
74
74
75
my $marcflavour = C4::Context->preference('marcflavour') or die "No marcflavour (MARC21 or UNIMARC) set in syspref";
75
my $MarcFormat = C4::Context->preference('MarcFormat') or die "No MarcFormat (MARC21 or UNIMARC) set in syspref";
76
($marcflavour eq 'MARC21') or die "marcflavour must be MARC21, not $marcflavour";
76
($MarcFormat eq 'MARC21') or die "MarcFormat must be MARC21, not $MarcFormat";
77
77
78
my $all = C4::Context->dbh->prepare("SELECT COUNT(*) FROM biblioitems");
78
my $all = C4::Context->dbh->prepare("SELECT COUNT(*) FROM biblioitems");
79
$all->execute;
79
$all->execute;
Lines 101-107 $limit or $limit = $bad_recs->rows(); # limit becomes max if unspecified Link Here
101
$limit += $offset if $offset;           # increase limit for offset
101
$limit += $offset if $offset;           # increase limit for offset
102
my $i = 0;
102
my $i = 0;
103
103
104
MARC::File::XML->default_record_format($marcflavour) or die "FAILED MARC::File::XML->default_record_format($marcflavour)";
104
MARC::File::XML->default_record_format($MarcFormat) or die "FAILED MARC::File::XML->default_record_format($MarcFormat)";
105
105
106
while ( my $row = $bad_recs->fetchrow_hashref() ) {
106
while ( my $row = $bad_recs->fetchrow_hashref() ) {
107
    (++$i > $limit) and last;
107
    (++$i > $limit) and last;
Lines 113-125 while ( my $row = $bad_recs->fetchrow_hashref() ) { Link Here
113
    printf "# %4d of %4d: biblionumber %s : %s\n", $i, $badcount, $row->{biblionumber}, $xml;
113
    printf "# %4d of %4d: biblionumber %s : %s\n", $i, $badcount, $row->{biblionumber}, $xml;
114
    my $stripped = StripNonXmlChars($row->{marcxml});
114
    my $stripped = StripNonXmlChars($row->{marcxml});
115
    ($stripped eq $row->{marcxml}) or printf STDERR "%d NON-XML Characters removed!!\n", (length($row->{marcxml}) - length($stripped));
115
    ($stripped eq $row->{marcxml}) or printf STDERR "%d NON-XML Characters removed!!\n", (length($row->{marcxml}) - length($stripped));
116
    my $record = eval { MARC::Record::new_from_xml( $stripped, 'utf8', $marcflavour ) };
116
    my $record = eval { MARC::Record::new_from_xml( $stripped, 'utf8', $MarcFormat ) };
117
    if ($@ or not $record) {
117
    if ($@ or not $record) {
118
        print STDERR "ERROR in MARC::Record::new_from_xml(\$marcxml, 'utf8', $marcflavour): $@\n\tSkipping $row->{biblionumber}\n";
118
        print STDERR "ERROR in MARC::Record::new_from_xml(\$marcxml, 'utf8', $MarcFormat): $@\n\tSkipping $row->{biblionumber}\n";
119
        next;
119
        next;
120
    }
120
    }
121
    if ($fix) {
121
    if ($fix) {
122
        SetMarcUnicodeFlag($record, $marcflavour);
122
        SetMarcUnicodeFlag($record, $MarcFormat);
123
        if (ModBiblioMarc($record, $row->{biblionumber})) {
123
        if (ModBiblioMarc($record, $row->{biblionumber})) {
124
            printf "# %4d of %4d: biblionumber %s : <leader>%s</leader>\n", $i, $badcount, $row->{biblionumber}, $record->leader();
124
            printf "# %4d of %4d: biblionumber %s : <leader>%s</leader>\n", $i, $badcount, $row->{biblionumber}, $record->leader();
125
        } else {
125
        } else {
Lines 187-193 presents a problem when records have been inserted with the leader/09 showing Link Here
187
blank for MARC8 encoding.  This script is used to determine the extent of the 
187
blank for MARC8 encoding.  This script is used to determine the extent of the 
188
problem and to fix the affected leaders.
188
problem and to fix the affected leaders.
189
189
190
As the name suggests, this script is only useful for MARC21 and will die for marcflavour UNIMARC.
190
As the name suggests, this script is only useful for MARC21 and will die for MarcFormat UNIMARC.
191
191
192
Run MARC21_utf8_flag_fix.pl the first time with no options, and assuming you agree that the leaders
192
Run MARC21_utf8_flag_fix.pl the first time with no options, and assuming you agree that the leaders
193
presented need fixing, run it again with B<--fix>.  
193
presented need fixing, run it again with B<--fix>.  
(-)a/misc/maintenance/UNIMARC_fix_collectiontitle.pl (-1 / +1 lines)
Lines 24-30 sub process { Link Here
24
24
25
}
25
}
26
26
27
if (lc(C4::Context->preference('marcflavour')) eq "unimarc"){
27
if (lc(C4::Context->preference('MarcFormat')) eq "unimarc"){
28
print "count subfields changed :".process()." kohafields biblio.seriestitle changed into biblioitems.collectiontitle";
28
print "count subfields changed :".process()." kohafields biblio.seriestitle changed into biblioitems.collectiontitle";
29
} 
29
} 
30
else {
30
else {
(-)a/misc/maintenance/UNIMARC_sync_date_created_with_marc_biblio.pl (-1 / +1 lines)
Lines 200-206 sub process { Link Here
200
    $verbose and print "Number of modified biblios: " . $mod_count . "\n";
200
    $verbose and print "Number of modified biblios: " . $mod_count . "\n";
201
}
201
}
202
202
203
if ( lc( C4::Context->preference('marcflavour') ) eq "unimarc" ) {
203
if ( lc( C4::Context->preference('MarcFormat') ) eq "unimarc" ) {
204
    $verbose
204
    $verbose
205
      and !$run
205
      and !$run
206
      and print "*** Not in run mode, modifications will not be applyed ***\n";
206
      and print "*** Not in run mode, modifications will not be applyed ***\n";
(-)a/misc/migration_tools/22_to_30/export_Authorities.pl (-1 / +1 lines)
Lines 30-36 while (my ($authid,$authtypecode)=$rq->fetchrow){ Link Here
30
	  utf8::decode($record);
30
	  utf8::decode($record);
31
  }
31
  }
32
  
32
  
33
  if (C4::Context->preference('marcflavour') eq "UNIMARC"){
33
  if (C4::Context->preference('MarcFormat') eq "UNIMARC"){
34
	$record->leader('     nac  22     1u 4500');
34
	$record->leader('     nac  22     1u 4500');
35
    my $string=$1 if $time=~m/([0-9\-]+)/;
35
    my $string=$1 if $time=~m/([0-9\-]+)/;
36
    $string=~s/\-//g;
36
    $string=~s/\-//g;
(-)a/misc/migration_tools/22_to_30/export_Authorities_xml.pl (-1 / +1 lines)
Lines 29-35 open my $fileoutput, '>:encoding(UTF-8)', "./$filename/$authid.xml" or die "unab Link Here
29
    utf8::decode($record);
29
    utf8::decode($record);
30
  }
30
  }
31
			
31
			
32
#  if (C4::Context->preference('marcflavour') eq "UNIMARC"){
32
#  if (C4::Context->preference('MarcFormat') eq "UNIMARC"){
33
	$record->leader('     nac  22     1u 4500');
33
	$record->leader('     nac  22     1u 4500');
34
    my $string=$1 if $time=~m/([0-9\-]+)/;
34
    my $string=$1 if $time=~m/([0-9\-]+)/;
35
    $string=~s/\-//g;
35
    $string=~s/\-//g;
(-)a/misc/migration_tools/22_to_30/move_marc_to_biblioitems.pl (-6 / +6 lines)
Lines 38-50 while (my ($bibid,$biblionumber) = $sth->fetchrow) { Link Here
38
    my $record = LocalMARCgetbiblio($dbh,$bibid);
38
    my $record = LocalMARCgetbiblio($dbh,$bibid);
39
    #Force UTF-8 in record leader
39
    #Force UTF-8 in record leader
40
    $record->encoding('UTF-8');
40
    $record->encoding('UTF-8');
41
    my $marcflavour;
41
    my $MarcFormat;
42
    if (C4::Context->preference("marcflavour")=~/unimarc/i){
42
    if (C4::Context->preference("MarcFormat")=~/unimarc/i){
43
      $marcflavour="UNIMARC";
43
      $MarcFormat="UNIMARC";
44
    } else {
44
    } else {
45
     $marcflavour="USMARC";
45
     $MarcFormat="USMARC";
46
    }
46
    }
47
    $sth_update->execute($record->as_usmarc(),$record->as_xml_record($marcflavour),$biblionumber);
47
    $sth_update->execute($record->as_usmarc(),$record->as_xml_record($MarcFormat),$biblionumber);
48
    $totaldone++;
48
    $totaldone++;
49
    print ".";
49
    print ".";
50
    print "\r$totaldone / $totaltodo" unless ($totaldone % 100);
50
    print "\r$totaldone / $totaltodo" unless ($totaldone % 100);
Lines 148-154 sub LocalMARCgetbiblio { Link Here
148
            $record->add_fields($field);
148
            $record->add_fields($field);
149
        }
149
        }
150
    }
150
    }
151
    if (C4::Context->preference('marcflavour')=~/unimarc/i){
151
    if (C4::Context->preference('MarcFormat')=~/unimarc/i){
152
      $record->leader('     nac  22     1u 4500');
152
      $record->leader('     nac  22     1u 4500');
153
      $update=1;
153
      $update=1;
154
      my $string;
154
      my $string;
(-)a/misc/migration_tools/build_oai_sets.pl (-2 / +2 lines)
Lines 115-124 foreach my $res (@$results) { Link Here
115
    # The following lines are copied from GetMarcBiblio
115
    # The following lines are copied from GetMarcBiblio
116
    # We don't call GetMarcBiblio to avoid a sql query to be executed each time
116
    # We don't call GetMarcBiblio to avoid a sql query to be executed each time
117
    $marcxml = StripNonXmlChars($marcxml);
117
    $marcxml = StripNonXmlChars($marcxml);
118
    MARC::File::XML->default_record_format(C4::Context->preference('marcflavour'));
118
    MARC::File::XML->default_record_format(C4::Context->preference('MarcFormat'));
119
    my $record;
119
    my $record;
120
    eval {
120
    eval {
121
        $record = MARC::Record::new_from_xml($marcxml, "utf8", C4::Context->preference('marcflavour'));
121
        $record = MARC::Record::new_from_xml($marcxml, "utf8", C4::Context->preference('MarcFormat'));
122
    };
122
    };
123
    if($@) {
123
    if($@) {
124
        warn "(biblio $biblionumber) Error while creating record from marcxml: $@";
124
        warn "(biblio $biblionumber) Error while creating record from marcxml: $@";
(-)a/misc/migration_tools/bulkmarcimport.pl (-3 / +3 lines)
Lines 129-135 if ($test_parameter) { Link Here
129
    print "TESTING MODE ONLY\n    DOING NOTHING\n===============\n";
129
    print "TESTING MODE ONLY\n    DOING NOTHING\n===============\n";
130
}
130
}
131
131
132
my $marcFlavour = C4::Context->preference('marcflavour') || 'MARC21';
132
my $marcFlavour = C4::Context->preference('MarcFormat') || 'MARC21';
133
133
134
print "Characteristic MARC flavour: $marcFlavour\n" if $verbose;
134
print "Characteristic MARC flavour: $marcFlavour\n" if $verbose;
135
my $starttime = gettimeofday;
135
my $starttime = gettimeofday;
Lines 560-571 sub get_heading_fields{ Link Here
560
    my $headingfields;
560
    my $headingfields;
561
    if ($authtypes){
561
    if ($authtypes){
562
        $headingfields=YAML::LoadFile($authtypes);
562
        $headingfields=YAML::LoadFile($authtypes);
563
        $headingfields={C4::Context->preference('marcflavour')=>$headingfields};
563
        $headingfields={C4::Context->preference('MarcFormat')=>$headingfields};
564
        $debug && warn YAML::Dump($headingfields);
564
        $debug && warn YAML::Dump($headingfields);
565
    }
565
    }
566
    unless ($headingfields){
566
    unless ($headingfields){
567
        $headingfields=$dbh->selectall_hashref("SELECT auth_tag_to_report, authtypecode from auth_types",'auth_tag_to_report',{Slice=>{}});
567
        $headingfields=$dbh->selectall_hashref("SELECT auth_tag_to_report, authtypecode from auth_types",'auth_tag_to_report',{Slice=>{}});
568
        $headingfields={C4::Context->preference('marcflavour')=>$headingfields};
568
        $headingfields={C4::Context->preference('MarcFormat')=>$headingfields};
569
    }
569
    }
570
    return $headingfields;
570
    return $headingfields;
571
}
571
}
(-)a/misc/migration_tools/fix_onloan.pl (-1 / +1 lines)
Lines 15-21 use C4::Biblio; Link Here
15
15
16
my $dbh=C4::Context->dbh;
16
my $dbh=C4::Context->dbh;
17
17
18
# if (C4::Context->preference("marcflavour") ne "UNIMARC") {
18
# if (C4::Context->preference("MarcFormat") ne "UNIMARC") {
19
#     print "this script is for UNIMARC only\n";
19
#     print "this script is for UNIMARC only\n";
20
#     exit;
20
#     exit;
21
# }
21
# }
(-)a/misc/migration_tools/rebuild_zebra.pl (-7 / +7 lines)
Lines 410-416 sub export_marc_records_from_sth { Link Here
410
            eval {
410
            eval {
411
                my $rec;
411
                my $rec;
412
                if ($as_xml) {
412
                if ($as_xml) {
413
                    $rec = $marc->as_xml_record(C4::Context->preference('marcflavour'));
413
                    $rec = $marc->as_xml_record(C4::Context->preference('MarcFormat'));
414
                    eval {
414
                    eval {
415
                        my $doc = $tester->parse_string($rec);
415
                        my $doc = $tester->parse_string($rec);
416
                    };
416
                    };
Lines 459-465 sub export_marc_records_from_list { Link Here
459
            eval {
459
            eval {
460
                my $rec;
460
                my $rec;
461
                if ($as_xml) {
461
                if ($as_xml) {
462
                    $rec = $marc->as_xml_record(C4::Context->preference('marcflavour'));
462
                    $rec = $marc->as_xml_record(C4::Context->preference('MarcFormat'));
463
                    $rec =~ s!<\?xml version="1.0" encoding="UTF-8"\?>\n!!;
463
                    $rec =~ s!<\?xml version="1.0" encoding="UTF-8"\?>\n!!;
464
                } else {
464
                } else {
465
                    $rec = $marc->as_usmarc();
465
                    $rec = $marc->as_usmarc();
Lines 498-510 sub generate_deleted_marc_records { Link Here
498
        } else {
498
        } else {
499
            fix_authority_id($marc, $record_number);
499
            fix_authority_id($marc, $record_number);
500
        }
500
        }
501
        if (C4::Context->preference("marcflavour") eq "UNIMARC") {
501
        if (C4::Context->preference("MarcFormat") eq "UNIMARC") {
502
            fix_unimarc_100($marc);
502
            fix_unimarc_100($marc);
503
        }
503
        }
504
504
505
        my $rec;
505
        my $rec;
506
        if ($as_xml) {
506
        if ($as_xml) {
507
            $rec = $marc->as_xml_record(C4::Context->preference('marcflavour'));
507
            $rec = $marc->as_xml_record(C4::Context->preference('MarcFormat'));
508
            $rec =~ s!<\?xml version="1.0" encoding="UTF-8"\?>\n!!;
508
            $rec =~ s!<\?xml version="1.0" encoding="UTF-8"\?>\n!!;
509
        } else {
509
        } else {
510
            $rec = $marc->as_usmarc();
510
            $rec = $marc->as_usmarc();
Lines 534-540 sub get_corrected_marc_record { Link Here
534
            my $normalizer = Koha::RecordProcessor->new( { filters => 'EmbedSeeFromHeadings' } );
534
            my $normalizer = Koha::RecordProcessor->new( { filters => 'EmbedSeeFromHeadings' } );
535
            $marc = $normalizer->process($marc);
535
            $marc = $normalizer->process($marc);
536
        }
536
        }
537
        if (C4::Context->preference("marcflavour") eq "UNIMARC") {
537
        if (C4::Context->preference("MarcFormat") eq "UNIMARC") {
538
            fix_unimarc_100($marc);
538
            fix_unimarc_100($marc);
539
        }
539
        }
540
    }
540
    }
Lines 886-892 if ($authorities) { Link Here
886
    #
886
    #
887
    # the record model, depending on marc flavour
887
    # the record model, depending on marc flavour
888
    unless (-f "$authorityserverdir/tab/record.abs") {
888
    unless (-f "$authorityserverdir/tab/record.abs") {
889
        if (C4::Context->preference("marcflavour") eq "UNIMARC") {
889
        if (C4::Context->preference("MarcFormat") eq "UNIMARC") {
890
            system("cp -f $kohadir/etc/zebradb/marc_defs/unimarc/authorities/record.abs $authorityserverdir/tab/record.abs");
890
            system("cp -f $kohadir/etc/zebradb/marc_defs/unimarc/authorities/record.abs $authorityserverdir/tab/record.abs");
891
            print "Info: copied record.abs for UNIMARC\n";
891
            print "Info: copied record.abs for UNIMARC\n";
892
        } else {
892
        } else {
Lines 1032-1038 if ($biblios) { Link Here
1032
    #
1032
    #
1033
    # the record model, depending on marc flavour
1033
    # the record model, depending on marc flavour
1034
    unless (-f "$biblioserverdir/tab/record.abs") {
1034
    unless (-f "$biblioserverdir/tab/record.abs") {
1035
        if (C4::Context->preference("marcflavour") eq "UNIMARC") {
1035
        if (C4::Context->preference("MarcFormat") eq "UNIMARC") {
1036
            system("cp -f $kohadir/etc/zebradb/marc_defs/unimarc/biblios/record.abs $biblioserverdir/tab/record.abs");
1036
            system("cp -f $kohadir/etc/zebradb/marc_defs/unimarc/biblios/record.abs $biblioserverdir/tab/record.abs");
1037
            print "Info: copied record.abs for UNIMARC\n";
1037
            print "Info: copied record.abs for UNIMARC\n";
1038
        } else {
1038
        } else {
(-)a/misc/migration_tools/upgradeitems.pl (-1 / +1 lines)
Lines 8-14 use C4::Biblio; Link Here
8
8
9
my $dbh=C4::Context->dbh;
9
my $dbh=C4::Context->dbh;
10
10
11
if (C4::Context->preference("marcflavour") ne "UNIMARC") {
11
if (C4::Context->preference("MarcFormat") ne "UNIMARC") {
12
    print "this script is for UNIMARC only\n";
12
    print "this script is for UNIMARC only\n";
13
    exit;
13
    exit;
14
}
14
}
(-)a/opac/oai.pl (-2 / +2 lines)
Lines 610-616 sub stylesheet { Link Here
610
                       ? $self->{ conf }->{ format }->{ $format }->{ xsl_file }
610
                       ? $self->{ conf }->{ format }->{ $format }->{ xsl_file }
611
                       : ( C4::Context->config('intrahtdocs') .
611
                       : ( C4::Context->config('intrahtdocs') .
612
                         '/prog/en/xslt/' .
612
                         '/prog/en/xslt/' .
613
                         C4::Context->preference('marcflavour') .
613
                         C4::Context->preference('MarcFormat') .
614
                         'slim2OAIDC.xsl' );
614
                         'slim2OAIDC.xsl' );
615
        my $parser = XML::LibXML->new();
615
        my $parser = XML::LibXML->new();
616
        my $xslt = XML::LibXSLT->new();
616
        my $xslt = XML::LibXSLT->new();
Lines 645-651 In simple mode, repository configuration comes entirely from Koha system Link Here
645
preferences (OAI-PMH:archiveID and OAI-PMH:MaxCount) and the server returns
645
preferences (OAI-PMH:archiveID and OAI-PMH:MaxCount) and the server returns
646
records in marcxml or dublin core format. Dublin core records are created from
646
records in marcxml or dublin core format. Dublin core records are created from
647
koha marcxml records tranformed with XSLT. Used XSL file is located in
647
koha marcxml records tranformed with XSLT. Used XSL file is located in
648
koha-tmpl/intranet-tmpl/prog/en/xslt directory and choosed based on marcflavour,
648
koha-tmpl/intranet-tmpl/prog/en/xslt directory and choosed based on MarcFormat,
649
respecively MARC21slim2OAIDC.xsl for MARC21 and  MARC21slim2OAIDC.xsl for
649
respecively MARC21slim2OAIDC.xsl for MARC21 and  MARC21slim2OAIDC.xsl for
650
UNIMARC.
650
UNIMARC.
651
651
(-)a/opac/opac-ISBDdetail.pl (-7 / +7 lines)
Lines 83-89 if($query->cookie("bib_list")){ Link Here
83
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
83
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
84
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
84
$template->param( 'ItemsIssued' => CountItemsIssued( $biblionumber ) );
85
85
86
my $marcflavour      = C4::Context->preference("marcflavour");
86
my $MarcFormat      = C4::Context->preference("MarcFormat");
87
my $record = GetMarcBiblio($biblionumber);
87
my $record = GetMarcBiblio($biblionumber);
88
if ( ! $record ) {
88
if ( ! $record ) {
89
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
89
    print $query->redirect("/cgi-bin/koha/errors/404.pl");
Lines 92-101 if ( ! $record ) { Link Here
92
# some useful variables for enhanced content;
92
# some useful variables for enhanced content;
93
# in each case, we're grabbing the first value we find in
93
# in each case, we're grabbing the first value we find in
94
# the record and normalizing it
94
# the record and normalizing it
95
my $upc = GetNormalizedUPC($record,$marcflavour);
95
my $upc = GetNormalizedUPC($record,$MarcFormat);
96
my $ean = GetNormalizedEAN($record,$marcflavour);
96
my $ean = GetNormalizedEAN($record,$MarcFormat);
97
my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
97
my $oclc = GetNormalizedOCLCNumber($record,$MarcFormat);
98
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
98
my $isbn = GetNormalizedISBN(undef,$record,$MarcFormat);
99
my $content_identifier_exists;
99
my $content_identifier_exists;
100
if ( $isbn or $ean or $oclc or $upc ) {
100
if ( $isbn or $ean or $oclc or $upc ) {
101
    $content_identifier_exists = 1;
101
    $content_identifier_exists = 1;
Lines 176-183 my @export_options = split(/\|/,$OpacExportOptions); Link Here
176
$template->{VARS}->{'export_options'} = \@export_options;
176
$template->{VARS}->{'export_options'} = \@export_options;
177
177
178
#Search for title in links
178
#Search for title in links
179
my $marccontrolnumber   = GetMarcControlnumber ($record, $marcflavour);
179
my $marccontrolnumber   = GetMarcControlnumber ($record, $MarcFormat);
180
my $marcissns = GetMarcISSN ( $record, $marcflavour );
180
my $marcissns = GetMarcISSN ( $record, $MarcFormat );
181
my $issn = $marcissns->[0] || '';
181
my $issn = $marcissns->[0] || '';
182
182
183
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
183
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
(-)a/opac/opac-MARCdetail.pl (-4 / +4 lines)
Lines 288-298 my @export_options = split(/\|/,$OpacExportOptions); Link Here
288
$template->{VARS}->{'export_options'} = \@export_options;
288
$template->{VARS}->{'export_options'} = \@export_options;
289
289
290
#Search for title in links
290
#Search for title in links
291
my $marcflavour  = C4::Context->preference("marcflavour");
291
my $MarcFormat  = C4::Context->preference("MarcFormat");
292
my $dat = TransformMarcToKoha( $dbh, $record );
292
my $dat = TransformMarcToKoha( $dbh, $record );
293
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
293
my $isbn = GetNormalizedISBN(undef,$record,$MarcFormat);
294
my $marccontrolnumber   = GetMarcControlnumber ($record, $marcflavour);
294
my $marccontrolnumber   = GetMarcControlnumber ($record, $MarcFormat);
295
my $marcissns = GetMarcISSN( $record, $marcflavour );
295
my $marcissns = GetMarcISSN( $record, $MarcFormat );
296
my $issn = $marcissns->[0] || '';
296
my $issn = $marcissns->[0] || '';
297
297
298
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
298
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
(-)a/opac/opac-authoritiesdetail.pl (-2 / +2 lines)
Lines 122-128 if ($show_marc) { Link Here
122
        my @subfields_data;
122
        my @subfields_data;
123
123
124
# skip UNIMARC fields <200, they are useless for a patron
124
# skip UNIMARC fields <200, they are useless for a patron
125
        next if C4::Context->preference('marcflavour') eq 'UNIMARC' && $field->tag() <200;
125
        next if C4::Context->preference('MarcFormat') eq 'UNIMARC' && $field->tag() <200;
126
126
127
# if tag <10, there's no subfield, use the "@" trick
127
# if tag <10, there's no subfield, use the "@" trick
128
        if ( $field->tag() < 10 ) {
128
        if ( $field->tag() < 10 ) {
Lines 134-140 if ($show_marc) { Link Here
134
            $subfield_data{marc_tag}      = $field->tag();
134
            $subfield_data{marc_tag}      = $field->tag();
135
            push( @subfields_data, \%subfield_data );
135
            push( @subfields_data, \%subfield_data );
136
        }
136
        }
137
        elsif ( C4::Context->preference('marcflavour') eq 'MARC21' && $field->tag() eq 667 ) {
137
        elsif ( C4::Context->preference('MarcFormat') eq 'MARC21' && $field->tag() eq 667 ) {
138
            # tagfield 667 is a nonpublic general note in MARC21, which shouldn't be shown in the OPAC
138
            # tagfield 667 is a nonpublic general note in MARC21, which shouldn't be shown in the OPAC
139
        }
139
        }
140
        else {
140
        else {
(-)a/opac/opac-basket.pl (-6 / +6 lines)
Lines 50-56 my @bibs = split( /\//, $bib_list ); Link Here
50
my @results;
50
my @results;
51
51
52
my $num = 1;
52
my $num = 1;
53
my $marcflavour = C4::Context->preference('marcflavour');
53
my $MarcFormat = C4::Context->preference('MarcFormat');
54
if (C4::Context->preference('TagsEnabled')) {
54
if (C4::Context->preference('TagsEnabled')) {
55
	$template->param(TagsEnabled => 1);
55
	$template->param(TagsEnabled => 1);
56
	foreach (qw(TagsShowOnList TagsInputOnList)) {
56
	foreach (qw(TagsShowOnList TagsInputOnList)) {
Lines 65-75 foreach my $biblionumber ( @bibs ) { Link Here
65
    my $dat              = &GetBiblioData($biblionumber);
65
    my $dat              = &GetBiblioData($biblionumber);
66
    my $record           = &GetMarcBiblio($biblionumber);
66
    my $record           = &GetMarcBiblio($biblionumber);
67
    next unless $record;
67
    next unless $record;
68
    my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
68
    my $marcnotesarray   = GetMarcNotes( $record, $MarcFormat );
69
    my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
69
    my $marcauthorsarray = GetMarcAuthors( $record, $MarcFormat );
70
    my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
70
    my $marcsubjctsarray = GetMarcSubjects( $record, $MarcFormat );
71
    my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
71
    my $marcseriesarray  = GetMarcSeries  ($record,$MarcFormat);
72
    my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
72
    my $marcurlsarray    = GetMarcUrls    ($record,$MarcFormat);
73
    my @items            = &GetItemsInfo( $biblionumber );
73
    my @items            = &GetItemsInfo( $biblionumber );
74
    my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
74
    my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
75
75
(-)a/opac/opac-detail.pl (-18 / +18 lines)
Lines 93-100 if($query->cookie("bib_list")){ Link Here
93
93
94
94
95
SetUTF8Flag($record);
95
SetUTF8Flag($record);
96
my $marcflavour      = C4::Context->preference("marcflavour");
96
my $MarcFormat      = C4::Context->preference("MarcFormat");
97
my $ean = GetNormalizedEAN( $record, $marcflavour );
97
my $ean = GetNormalizedEAN( $record, $MarcFormat );
98
98
99
# XSLT processing of some stuff
99
# XSLT processing of some stuff
100
if (C4::Context->preference("OPACXSLTDetailsDisplay") ) {
100
if (C4::Context->preference("OPACXSLTDetailsDisplay") ) {
Lines 403-411 my @all_items = GetItemsInfo( $biblionumber ); Link Here
403
# adding items linked via host biblios
403
# adding items linked via host biblios
404
404
405
my $analyticfield = '773';
405
my $analyticfield = '773';
406
if ($marcflavour eq 'MARC21' || $marcflavour eq 'NORMARC'){
406
if ($MarcFormat eq 'MARC21' || $MarcFormat eq 'NORMARC'){
407
    $analyticfield = '773';
407
    $analyticfield = '773';
408
} elsif ($marcflavour eq 'UNIMARC') {
408
} elsif ($MarcFormat eq 'UNIMARC') {
409
    $analyticfield = '461';
409
    $analyticfield = '461';
410
}
410
}
411
foreach my $hostfield ( $record->field($analyticfield)) {
411
foreach my $hostfield ( $record->field($analyticfield)) {
Lines 629-641 if (scalar(@itemloop) >= 50 && !$viewallitems) { Link Here
629
629
630
## get notes and subjects from MARC record
630
## get notes and subjects from MARC record
631
my $dbh              = C4::Context->dbh;
631
my $dbh              = C4::Context->dbh;
632
my $marcnotesarray   = GetMarcNotes   ($record,$marcflavour);
632
my $marcnotesarray   = GetMarcNotes   ($record,$MarcFormat);
633
my $marcisbnsarray   = GetMarcISBN    ($record,$marcflavour);
633
my $marcisbnsarray   = GetMarcISBN    ($record,$MarcFormat);
634
my $marcauthorsarray = GetMarcAuthors ($record,$marcflavour);
634
my $marcauthorsarray = GetMarcAuthors ($record,$MarcFormat);
635
my $marcsubjctsarray = GetMarcSubjects($record,$marcflavour);
635
my $marcsubjctsarray = GetMarcSubjects($record,$MarcFormat);
636
my $marcseriesarray  = GetMarcSeries  ($record,$marcflavour);
636
my $marcseriesarray  = GetMarcSeries  ($record,$MarcFormat);
637
my $marcurlsarray    = GetMarcUrls    ($record,$marcflavour);
637
my $marcurlsarray    = GetMarcUrls    ($record,$MarcFormat);
638
my $marchostsarray  = GetMarcHosts($record,$marcflavour);
638
my $marchostsarray  = GetMarcHosts($record,$MarcFormat);
639
my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
639
my $subtitle         = GetRecordValue('subtitle', $record, GetFrameworkCode($biblionumber));
640
640
641
    $template->param(
641
    $template->param(
Lines 692-700 foreach ( keys %{$dat} ) { Link Here
692
# some useful variables for enhanced content;
692
# some useful variables for enhanced content;
693
# in each case, we're grabbing the first value we find in
693
# in each case, we're grabbing the first value we find in
694
# the record and normalizing it
694
# the record and normalizing it
695
my $upc = GetNormalizedUPC($record,$marcflavour);
695
my $upc = GetNormalizedUPC($record,$MarcFormat);
696
my $oclc = GetNormalizedOCLCNumber($record,$marcflavour);
696
my $oclc = GetNormalizedOCLCNumber($record,$MarcFormat);
697
my $isbn = GetNormalizedISBN(undef,$record,$marcflavour);
697
my $isbn = GetNormalizedISBN(undef,$record,$MarcFormat);
698
my $content_identifier_exists;
698
my $content_identifier_exists;
699
if ( $isbn or $ean or $oclc or $upc ) {
699
if ( $isbn or $ean or $oclc or $upc ) {
700
    $content_identifier_exists = 1;
700
    $content_identifier_exists = 1;
Lines 782-788 if (C4::Context->preference("OPACFRBRizeEditions")==1) { Link Here
782
782
783
# Serial Collection
783
# Serial Collection
784
my @sc_fields = $record->field(955);
784
my @sc_fields = $record->field(955);
785
my @lc_fields = $marcflavour eq 'UNIMARC'
785
my @lc_fields = $MarcFormat eq 'UNIMARC'
786
    ? $record->field(930)
786
    ? $record->field(930)
787
    : $record->field(852);
787
    : $record->field(852);
788
my @serialcollections = ();
788
my @serialcollections = ();
Lines 793-799 foreach my $sc_field (@sc_fields) { Link Here
793
    $row_data{text}    = $sc_field->subfield('r');
793
    $row_data{text}    = $sc_field->subfield('r');
794
    $row_data{branch}  = $sc_field->subfield('9');
794
    $row_data{branch}  = $sc_field->subfield('9');
795
    foreach my $lc_field (@lc_fields) {
795
    foreach my $lc_field (@lc_fields) {
796
        $row_data{itemcallnumber} = $marcflavour eq 'UNIMARC'
796
        $row_data{itemcallnumber} = $MarcFormat eq 'UNIMARC'
797
            ? $lc_field->subfield('a') # 930$a
797
            ? $lc_field->subfield('a') # 930$a
798
            : $lc_field->subfield('h') # 852$h
798
            : $lc_field->subfield('h') # 852$h
799
            if ($sc_field->subfield('5') eq $lc_field->subfield('5'));
799
            if ($sc_field->subfield('5') eq $lc_field->subfield('5'));
Lines 1004-1011 if ( C4::Context->preference('OpacStarRatings') !~ /disable/ ) { Link Here
1004
}
1004
}
1005
1005
1006
#Search for title in links
1006
#Search for title in links
1007
my $marccontrolnumber   = GetMarcControlnumber ($record, $marcflavour);
1007
my $marccontrolnumber   = GetMarcControlnumber ($record, $MarcFormat);
1008
my $marcissns = GetMarcISSN ( $record, $marcflavour );
1008
my $marcissns = GetMarcISSN ( $record, $MarcFormat );
1009
my $issn = $marcissns->[0] || '';
1009
my $issn = $marcissns->[0] || '';
1010
1010
1011
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
1011
if (my $search_for_title = C4::Context->preference('OPACSearchForTitleIn')){
(-)a/opac/opac-downloadcart.pl (-1 / +1 lines)
Lines 52-58 if ($bib_list && $format) { Link Here
52
52
53
    my @bibs = split( /\//, $bib_list );
53
    my @bibs = split( /\//, $bib_list );
54
54
55
    my $marcflavour         = C4::Context->preference('marcflavour');
55
    my $MarcFormat         = C4::Context->preference('MarcFormat');
56
    my $output;
56
    my $output;
57
57
58
    # CSV   
58
    # CSV   
(-)a/opac/opac-downloadshelf.pl (-1 / +1 lines)
Lines 53-59 if ( ShelfPossibleAction( (defined($borrowernumber) ? $borrowernumber : -1), $sh Link Here
53
    if ($shelfid && $format) {
53
    if ($shelfid && $format) {
54
54
55
        my ($items, $totitems)  = GetShelfContents($shelfid);
55
        my ($items, $totitems)  = GetShelfContents($shelfid);
56
        my $marcflavour         = C4::Context->preference('marcflavour');
56
        my $MarcFormat         = C4::Context->preference('MarcFormat');
57
        my $output;
57
        my $output;
58
58
59
       # CSV
59
       # CSV
(-)a/opac/opac-export.pl (-1 / +1 lines)
Lines 76-82 elsif ($format =~ /utf8/) { Link Here
76
}
76
}
77
elsif ($format =~ /marcstd/) {
77
elsif ($format =~ /marcstd/) {
78
    C4::Charset::SetUTF8Flag($marc,1);
78
    C4::Charset::SetUTF8Flag($marc,1);
79
    ($error,$marc) = marc2marc($marc, 'marcstd', C4::Context->preference('marcflavour'));
79
    ($error,$marc) = marc2marc($marc, 'marcstd', C4::Context->preference('MarcFormat'));
80
    $format = 'marcstd';
80
    $format = 'marcstd';
81
}
81
}
82
else {
82
else {
(-)a/opac/opac-readingrecord.pl (-1 / +1 lines)
Lines 87-93 foreach my $issue ( @{$issues} ) { Link Here
87
        my $marcxml = StripNonXmlChars( $issue->{marcxml} );
87
        my $marcxml = StripNonXmlChars( $issue->{marcxml} );
88
        my $marc_rec =
88
        my $marc_rec =
89
          MARC::Record::new_from_xml( $marcxml, 'utf8',
89
          MARC::Record::new_from_xml( $marcxml, 'utf8',
90
            C4::Context->preference('marcflavour') );
90
            C4::Context->preference('MarcFormat') );
91
        $issue->{subtitle} =
91
        $issue->{subtitle} =
92
          GetRecordValue( 'subtitle', $marc_rec, $issue->{frameworkcode} );
92
          GetRecordValue( 'subtitle', $marc_rec, $issue->{frameworkcode} );
93
    }
93
    }
(-)a/opac/opac-search.pl (-3 / +3 lines)
Lines 137-146 if ($format eq 'rss2' or $format eq 'opensearchdescription' or $format eq 'atom' Link Here
137
    # FIXME - the timestamp is a hack - the biblio update timestamp should be used for each
137
    # FIXME - the timestamp is a hack - the biblio update timestamp should be used for each
138
    # entry, but not sure if that's worth an extra database query for each bib
138
    # entry, but not sure if that's worth an extra database query for each bib
139
}
139
}
140
if (C4::Context->preference("marcflavour") eq "UNIMARC" ) {
140
if (C4::Context->preference("MarcFormat") eq "UNIMARC" ) {
141
    $template->param('UNIMARC' => 1);
141
    $template->param('UNIMARC' => 1);
142
}
142
}
143
elsif (C4::Context->preference("marcflavour") eq "MARC21" ) {
143
elsif (C4::Context->preference("MarcFormat") eq "MARC21" ) {
144
    $template->param('usmarc' => 1);
144
    $template->param('usmarc' => 1);
145
}
145
}
146
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
146
$template->param( 'AllowOnShelfHolds' => C4::Context->preference('AllowOnShelfHolds') );
Lines 298-304 if ( $template_type && $template_type eq 'advsearch' ) { Link Here
298
        }
298
        }
299
299
300
    }
300
    }
301
    $template->param(uc(    C4::Context->preference("marcflavour")) => 1,   # we already did this for UNIMARC
301
    $template->param(uc(    C4::Context->preference("MarcFormat")) => 1,   # we already did this for UNIMARC
302
                            advsearch => 1,
302
                            advsearch => 1,
303
                            search_boxes_loop => \@search_boxes_array);
303
                            search_boxes_loop => \@search_boxes_array);
304
304
(-)a/opac/opac-sendbasket.pl (-4 / +4 lines)
Lines 82-96 if ( $email_add ) { Link Here
82
    my @bibs = split( /\//, $bib_list );
82
    my @bibs = split( /\//, $bib_list );
83
    my @results;
83
    my @results;
84
    my $iso2709;
84
    my $iso2709;
85
    my $marcflavour = C4::Context->preference('marcflavour');
85
    my $MarcFormat = C4::Context->preference('MarcFormat');
86
    foreach my $biblionumber (@bibs) {
86
    foreach my $biblionumber (@bibs) {
87
        $template2->param( biblionumber => $biblionumber );
87
        $template2->param( biblionumber => $biblionumber );
88
88
89
        my $dat              = GetBiblioData($biblionumber);
89
        my $dat              = GetBiblioData($biblionumber);
90
        my $record           = GetMarcBiblio($biblionumber);
90
        my $record           = GetMarcBiblio($biblionumber);
91
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
91
        my $marcnotesarray   = GetMarcNotes( $record, $MarcFormat );
92
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
92
        my $marcauthorsarray = GetMarcAuthors( $record, $MarcFormat );
93
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
93
        my $marcsubjctsarray = GetMarcSubjects( $record, $MarcFormat );
94
94
95
        my @items = GetItemsInfo( $biblionumber );
95
        my @items = GetItemsInfo( $biblionumber );
96
96
(-)a/opac/opac-sendshelf.pl (-4 / +4 lines)
Lines 74-80 if ( $email ) { Link Here
74
74
75
    my @shelf               = GetShelf($shelfid);
75
    my @shelf               = GetShelf($shelfid);
76
    my ($items, $totitems)  = GetShelfContents($shelfid);
76
    my ($items, $totitems)  = GetShelfContents($shelfid);
77
    my $marcflavour         = C4::Context->preference('marcflavour');
77
    my $MarcFormat         = C4::Context->preference('MarcFormat');
78
    my $iso2709;
78
    my $iso2709;
79
    my @results;
79
    my @results;
80
80
Lines 84-92 if ( $email ) { Link Here
84
        my $fw               = GetFrameworkCode($biblionumber);
84
        my $fw               = GetFrameworkCode($biblionumber);
85
        my $dat              = GetBiblioData($biblionumber);
85
        my $dat              = GetBiblioData($biblionumber);
86
        my $record           = GetMarcBiblio($biblionumber);
86
        my $record           = GetMarcBiblio($biblionumber);
87
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
87
        my $marcnotesarray   = GetMarcNotes( $record, $MarcFormat );
88
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
88
        my $marcauthorsarray = GetMarcAuthors( $record, $MarcFormat );
89
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
89
        my $marcsubjctsarray = GetMarcSubjects( $record, $MarcFormat );
90
        my $subtitle         = GetRecordValue('subtitle', $record, $fw);
90
        my $subtitle         = GetRecordValue('subtitle', $record, $fw);
91
91
92
        my @items = GetItemsInfo( $biblionumber );
92
        my @items = GetItemsInfo( $biblionumber );
(-)a/opac/opac-showmarc.pl (-1 / +1 lines)
Lines 67-73 if ($view eq 'card' || $view eq 'html') { Link Here
67
        $xslfile = "compact.xsl";
67
        $xslfile = "compact.xsl";
68
    }
68
    }
69
    else { # must be html
69
    else { # must be html
70
        $xslfile = C4::Context->preference('marcflavour') . "slim2OPACMARCdetail.xsl";
70
        $xslfile = C4::Context->preference('MarcFormat') . "slim2OPACMARCdetail.xsl";
71
    }
71
    }
72
    $xslfilename = "$htdocs/$theme/$lang/xslt/$xslfile";
72
    $xslfilename = "$htdocs/$theme/$lang/xslt/$xslfile";
73
    $xslfilename = "$htdocs/$theme/en/xslt/$xslfile" unless ( $lang ne 'en' && -f $xslfilename );
73
    $xslfilename = "$htdocs/$theme/en/xslt/$xslfile" unless ( $lang ne 'en' && -f $xslfilename );
(-)a/opac/opac-showreviews.pl (-5 / +5 lines)
Lines 77-83 if ( C4::Context->preference('ShowReviewer') and C4::Context->preference('ShowRe Link Here
77
}
77
}
78
78
79
my $reviews = getallreviews(1,$offset,$results_per_page);
79
my $reviews = getallreviews(1,$offset,$results_per_page);
80
my $marcflavour      = C4::Context->preference("marcflavour");
80
my $MarcFormat      = C4::Context->preference("MarcFormat");
81
my $hits = numberofreviews(1);
81
my $hits = numberofreviews(1);
82
my $i = 0;
82
my $i = 0;
83
my $latest_comment_date;
83
my $latest_comment_date;
Lines 87-96 for my $result (@$reviews){ Link Here
87
    my $record = GetMarcBiblio($biblionumber);
87
    my $record = GetMarcBiblio($biblionumber);
88
    my $frameworkcode = GetFrameworkCode($biblionumber);
88
    my $frameworkcode = GetFrameworkCode($biblionumber);
89
	my ( $borr ) = GetMemberDetails( $result->{borrowernumber} );
89
	my ( $borr ) = GetMemberDetails( $result->{borrowernumber} );
90
	$result->{normalized_upc} = GetNormalizedUPC($record,$marcflavour);
90
	$result->{normalized_upc} = GetNormalizedUPC($record,$MarcFormat);
91
	$result->{normalized_ean} = GetNormalizedEAN($record,$marcflavour);
91
	$result->{normalized_ean} = GetNormalizedEAN($record,$MarcFormat);
92
	$result->{normalized_oclc} = GetNormalizedOCLCNumber($record,$marcflavour);
92
	$result->{normalized_oclc} = GetNormalizedOCLCNumber($record,$MarcFormat);
93
	$result->{normalized_isbn} = GetNormalizedISBN(undef,$record,$marcflavour);
93
	$result->{normalized_isbn} = GetNormalizedISBN(undef,$record,$MarcFormat);
94
	$result->{title} = $bib->{'title'};
94
	$result->{title} = $bib->{'title'};
95
	$result->{subtitle} = GetRecordValue('subtitle', $record, $frameworkcode);
95
	$result->{subtitle} = GetRecordValue('subtitle', $record, $frameworkcode);
96
	$result->{author} = $bib->{'author'};
96
	$result->{author} = $bib->{'author'};
(-)a/opac/unapi (-5 / +5 lines)
Lines 182-189 sub emit_formats { Link Here
182
        print "<formats>\n";
182
        print "<formats>\n";
183
    }
183
    }
184
184
185
    my $marcflavour = uc(C4::Context->preference('marcflavour'));
185
    my $MarcFormat = uc(C4::Context->preference('MarcFormat'));
186
    foreach my $format (sort keys %{ $format_to_stylesheet_map->{$marcflavour} }) {
186
    foreach my $format (sort keys %{ $format_to_stylesheet_map->{$MarcFormat} }) {
187
        print $format_info->{$format}, "\n";
187
        print $format_info->{$format}, "\n";
188
    }
188
    }
189
    print "</formats>\n";
189
    print "</formats>\n";
Lines 195-206 sub get_transformer { Link Here
195
    my ($format, $format_to_stylesheet_map, $format_info) = @_;
195
    my ($format, $format_to_stylesheet_map, $format_info) = @_;
196
    $format = lc $format;
196
    $format = lc $format;
197
197
198
    my $marcflavour = uc(C4::Context->preference('marcflavour'));
198
    my $MarcFormat = uc(C4::Context->preference('MarcFormat'));
199
    return unless $format_to_stylesheet_map->{$marcflavour}->{$format};
199
    return unless $format_to_stylesheet_map->{$MarcFormat}->{$format};
200
200
201
    my $xslt_file = C4::Context->config('intranetdir') .
201
    my $xslt_file = C4::Context->config('intranetdir') .
202
                    "/koha-tmpl/intranet-tmpl/prog/en/xslt/" .
202
                    "/koha-tmpl/intranet-tmpl/prog/en/xslt/" .
203
                    $format_to_stylesheet_map->{$marcflavour}->{$format};
203
                    $format_to_stylesheet_map->{$MarcFormat}->{$format};
204
204
205
    my $parser = XML::LibXML->new();
205
    my $parser = XML::LibXML->new();
206
    my $xslt = XML::LibXSLT->new();
206
    my $xslt = XML::LibXSLT->new();
(-)a/serials/checkexpiration.pl (-1 / +1 lines)
Lines 97-102 if ($date) { Link Here
97
    );
97
    );
98
}
98
}
99
$template->param (
99
$template->param (
100
    (uc(C4::Context->preference("marcflavour"))) => 1
100
    (uc(C4::Context->preference("MarcFormat"))) => 1
101
);
101
);
102
output_html_with_http_headers $query, $cookie, $template->output;
102
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/claims.pl (-1 / +1 lines)
Lines 98-103 $template->param( Link Here
98
        claimletter => $claimletter,
98
        claimletter => $claimletter,
99
        supplierloop => \@supplierinfo,
99
        supplierloop => \@supplierinfo,
100
        branchloop   => $branchloop,
100
        branchloop   => $branchloop,
101
        (uc(C4::Context->preference("marcflavour"))) => 1
101
        (uc(C4::Context->preference("MarcFormat"))) => 1
102
        );
102
        );
103
output_html_with_http_headers $input, $cookie, $template->output;
103
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/serials/routing-preview.pl (-1 / +1 lines)
Lines 133-139 $template->param( Link Here
133
    routingnotes => $routingnotes,
133
    routingnotes => $routingnotes,
134
    generalroutingnote => C4::Context->preference('RoutingListNote'),
134
    generalroutingnote => C4::Context->preference('RoutingListNote'),
135
    hasRouting => check_routing($subscriptionid),
135
    hasRouting => check_routing($subscriptionid),
136
    (uc(C4::Context->preference("marcflavour"))) => 1
136
    (uc(C4::Context->preference("MarcFormat"))) => 1
137
    );
137
    );
138
138
139
output_html_with_http_headers $query, $cookie, $template->output;
139
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/routing.pl (-1 / +1 lines)
Lines 121-127 $template->param( Link Here
121
    dates => $dates,
121
    dates => $dates,
122
    routingnotes => $serials[0]->{'routingnotes'},
122
    routingnotes => $serials[0]->{'routingnotes'},
123
    hasRouting => check_routing($subscriptionid),
123
    hasRouting => check_routing($subscriptionid),
124
    (uc(C4::Context->preference("marcflavour"))) => 1
124
    (uc(C4::Context->preference("MarcFormat"))) => 1
125
125
126
    );
126
    );
127
127
(-)a/serials/serial-issues.pl (-1 / +1 lines)
Lines 108-112 if ($selectview eq "full"){ Link Here
108
        virtualshelves => "".C4::Context->preference("virtualshelves"),
108
        virtualshelves => "".C4::Context->preference("virtualshelves"),
109
    );
109
    );
110
}
110
}
111
$template->param((uc(C4::Context->preference("marcflavour"))) => 1);
111
$template->param((uc(C4::Context->preference("MarcFormat"))) => 1);
112
output_html_with_http_headers $query, $cookie, $template->output;
112
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/serials-collection.pl (-1 / +1 lines)
Lines 170-176 $template->param( Link Here
170
          subscriptioncount => $subscriptioncount,
170
          subscriptioncount => $subscriptioncount,
171
          location	       => $locationlib,
171
          location	       => $locationlib,
172
          callnumber	       => $callnumber,
172
          callnumber	       => $callnumber,
173
          uc(C4::Context->preference("marcflavour")) => 1,
173
          uc(C4::Context->preference("MarcFormat")) => 1,
174
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
174
          serialsadditems   => $subscriptiondescs->[0]{'serialsadditems'},
175
          );
175
          );
176
176
(-)a/serials/serials-edit.pl (-1 / +1 lines)
Lines 401-407 $template->param( Link Here
401
    serialslist     => \@serialdatalist,
401
    serialslist     => \@serialdatalist,
402
    default_bib_view => $default_bib_view,
402
    default_bib_view => $default_bib_view,
403
    location         => $locationlib,
403
    location         => $locationlib,
404
    (uc(C4::Context->preference("marcflavour"))) => 1
404
    (uc(C4::Context->preference("MarcFormat"))) => 1
405
405
406
);
406
);
407
output_html_with_http_headers $query, $cookie, $template->output;
407
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/serials-home.pl (-1 / +1 lines)
Lines 52-58 my ( $template, $loggedinuser, $cookie ) = get_template_and_user( Link Here
52
52
53
$template->param(
53
$template->param(
54
    routing       => $routing,
54
    routing       => $routing,
55
    (uc(C4::Context->preference("marcflavour"))) => 1
55
    (uc(C4::Context->preference("MarcFormat"))) => 1
56
);
56
);
57
57
58
output_html_with_http_headers $query, $cookie, $template->output;
58
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/serials-recieve.pl (-1 / +1 lines)
Lines 278-283 $template->param( Link Here
278
            frommissing => $manualstatus,
278
            frommissing => $manualstatus,
279
            missingdate => $manualdate,
279
            missingdate => $manualdate,
280
            missingid => $manualid,
280
            missingid => $manualid,
281
            (uc(C4::Context->preference("marcflavour"))) => 1
281
            (uc(C4::Context->preference("MarcFormat"))) => 1
282
        );
282
        );
283
output_html_with_http_headers $query, $cookie, $template->output;
283
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/serials-search.pl (-1 / +1 lines)
Lines 127-133 $template->param( Link Here
127
    branches_loop => \@branches_loop,
127
    branches_loop => \@branches_loop,
128
    done_searched => $searched,
128
    done_searched => $searched,
129
    routing       => $routing,
129
    routing       => $routing,
130
    marcflavour   => (uc(C4::Context->preference("marcflavour")))
130
    MarcFormat   => (uc(C4::Context->preference("MarcFormat")))
131
);
131
);
132
132
133
output_html_with_http_headers $query, $cookie, $template->output;
133
output_html_with_http_headers $query, $cookie, $template->output;
(-)a/serials/subscription-add.pl (-1 / +1 lines)
Lines 173-179 if ($op eq 'addsubscription') { Link Here
173
            $template->param(bibliotitle => $bib->{title});
173
            $template->param(bibliotitle => $bib->{title});
174
        }
174
        }
175
    }
175
    }
176
        $template->param((uc(C4::Context->preference("marcflavour"))) => 1);
176
        $template->param((uc(C4::Context->preference("MarcFormat"))) => 1);
177
	output_html_with_http_headers $query, $cookie, $template->output;
177
	output_html_with_http_headers $query, $cookie, $template->output;
178
}
178
}
179
179
(-)a/serials/subscription-detail.pl (-1 / +1 lines)
Lines 174-180 $template->param( Link Here
174
    intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'),
174
    intranetcolorstylesheet => C4::Context->preference('intranetcolorstylesheet'),
175
    irregular_issues => scalar @irregular_issues,
175
    irregular_issues => scalar @irregular_issues,
176
    default_bib_view => $default_bib_view,
176
    default_bib_view => $default_bib_view,
177
    (uc(C4::Context->preference("marcflavour"))) => 1,
177
    (uc(C4::Context->preference("MarcFormat"))) => 1,
178
    show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
178
    show_acquisition_details => defined $tmpl_infos->{ordered_exists} || defined $tmpl_infos->{spent_exists} ? 1 : 0,
179
    basketno => $order->{basketno},
179
    basketno => $order->{basketno},
180
    %$tmpl_infos,
180
    %$tmpl_infos,
(-)a/serials/viewalerts.pl (-1 / +1 lines)
Lines 53-59 foreach (@$borrowers) { Link Here
53
$template->param(alertloop => $borrowers,
53
$template->param(alertloop => $borrowers,
54
                bibliotitle => $subscription->{bibliotitle},
54
                bibliotitle => $subscription->{bibliotitle},
55
                subscriptionid => $subscriptionid,
55
                subscriptionid => $subscriptionid,
56
                (uc(C4::Context->preference("marcflavour"))) => 1
56
                (uc(C4::Context->preference("MarcFormat"))) => 1
57
                );
57
                );
58
58
59
output_html_with_http_headers $input, $cookie, $template->output;
59
output_html_with_http_headers $input, $cookie, $template->output;
(-)a/svc/bib (-1 / +1 lines)
Lines 82-88 sub update_bib { Link Here
82
    my $inxml = $query->param('POSTDATA');
82
    my $inxml = $query->param('POSTDATA');
83
    print $query->header(-type => 'text/xml');
83
    print $query->header(-type => 'text/xml');
84
84
85
    my $record = eval {MARC::Record::new_from_xml( $inxml, "utf8", C4::Context->preference('marcflavour'))};
85
    my $record = eval {MARC::Record::new_from_xml( $inxml, "utf8", C4::Context->preference('MarcFormat'))};
86
    my $do_not_escape = 0;
86
    my $do_not_escape = 0;
87
    if ($@) {
87
    if ($@) {
88
        $result->{'status'} = "failed";
88
        $result->{'status'} = "failed";
(-)a/svc/import_bib (-2 / +2 lines)
Lines 73-80 sub import_bib { Link Here
73
        return $result;
73
        return $result;
74
    }
74
    }
75
75
76
    my $marcflavour = C4::Context->preference('marcflavour') || 'MARC21';
76
    my $MarcFormat = C4::Context->preference('MarcFormat') || 'MARC21';
77
    my $marc_record = eval {MARC::Record::new_from_xml( $inxml, "utf8", $marcflavour)};
77
    my $marc_record = eval {MARC::Record::new_from_xml( $inxml, "utf8", $MarcFormat)};
78
    if ($@) {
78
    if ($@) {
79
        $result->{'status'} = "failed";
79
        $result->{'status'} = "failed";
80
        $result->{'error'} = $@;
80
        $result->{'error'} = $@;
(-)a/svc/new_bib (-3 / +3 lines)
Lines 53-60 sub add_bib { Link Here
53
    my $inxml = $query->param('POSTDATA');
53
    my $inxml = $query->param('POSTDATA');
54
    print $query->header(-type => 'text/xml');
54
    print $query->header(-type => 'text/xml');
55
55
56
    my $marcflavour = C4::Context->preference('marcflavour') || 'MARC21';
56
    my $MarcFormat = C4::Context->preference('MarcFormat') || 'MARC21';
57
    my $record = eval {MARC::Record::new_from_xml( $inxml, "utf8", $marcflavour)};
57
    my $record = eval {MARC::Record::new_from_xml( $inxml, "utf8", $MarcFormat)};
58
    my $do_not_escape = 0;
58
    my $do_not_escape = 0;
59
    if ($@) {
59
    if ($@) {
60
        $result->{'status'} = "failed";
60
        $result->{'status'} = "failed";
Lines 63-69 sub add_bib { Link Here
63
        # fix character set
63
        # fix character set
64
        if ($record->encoding() eq 'MARC-8') {
64
        if ($record->encoding() eq 'MARC-8') {
65
            my ($guessed_charset, $charset_errors);
65
            my ($guessed_charset, $charset_errors);
66
            ($record, $guessed_charset, $charset_errors) = MarcToUTF8Record($record, $marcflavour);
66
            ($record, $guessed_charset, $charset_errors) = MarcToUTF8Record($record, $MarcFormat);
67
        }
67
        }
68
68
69
        my $fullrecord = $record->clone();
69
        my $fullrecord = $record->clone();
(-)a/t/db_dependent/Heading_MARC21.t (-1 / +1 lines)
Lines 14-20 BEGIN { Link Here
14
}
14
}
15
15
16
SKIP: {
16
SKIP: {
17
    skip "MARC21 heading tests not applicable to UNIMARC", 2 if C4::Context->preference('marcflavour') eq 'UNIMARC';
17
    skip "MARC21 heading tests not applicable to UNIMARC", 2 if C4::Context->preference('MarcFormat') eq 'UNIMARC';
18
    my $field = MARC::Field->new( '650', ' ', '0', a => 'Uncles', x => 'Fiction' );
18
    my $field = MARC::Field->new( '650', ' ', '0', a => 'Uncles', x => 'Fiction' );
19
    my $heading = C4::Heading->new_from_bib_field($field);
19
    my $heading = C4::Heading->new_from_bib_field($field);
20
    is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
20
    is($heading->display_form(), 'Uncles--Fiction', 'Display form generation');
(-)a/t/db_dependent/Search.t (-1 / +1 lines)
Lines 40-46 $contextmodule->mock('_new_dbh', sub { Link Here
40
    return $dbh });
40
    return $dbh });
41
$contextmodule->mock('preference', sub {
41
$contextmodule->mock('preference', sub {
42
    my ($self, $pref) = @_;
42
    my ($self, $pref) = @_;
43
    if ($pref eq 'marcflavour') {
43
    if ($pref eq 'MarcFormat') {
44
        return 'MARC21';
44
        return 'MARC21';
45
    } elsif ($pref eq 'QueryStemming') {
45
    } elsif ($pref eq 'QueryStemming') {
46
        return $QueryStemming;
46
        return $QueryStemming;
(-)a/t/db_dependent/lib/KohaTest.pm (-1 / +1 lines)
Lines 720-726 sub create_test_database { Link Here
720
                                                           mandatory => 1 } );
720
                                                           mandatory => 1 } );
721
    my ($fwk_language, $installed_list) = $installer->load_sql_in_order($all_languages, @$list);
721
    my ($fwk_language, $installed_list) = $installer->load_sql_in_order($all_languages, @$list);
722
    $installer->set_version_syspref();
722
    $installer->set_version_syspref();
723
    $installer->set_marcflavour_syspref('MARC21');
723
    $installer->set_MarcFormat_syspref('MARC21');
724
    diag 'database created.'
724
    diag 'database created.'
725
}
725
}
726
726
(-)a/t/db_dependent/lib/KohaTest/Installer.pm (-2 / +2 lines)
Lines 16-28 sub methods : Test( 1 ) { Link Here
16
    my $self = shift;
16
    my $self = shift;
17
    my @methods = qw(
17
    my @methods = qw(
18
                       new 
18
                       new 
19
                       marcflavour_list 
19
                       MarcFormat_list 
20
                       marc_framework_sql_list 
20
                       marc_framework_sql_list 
21
                       sample_data_sql_list 
21
                       sample_data_sql_list 
22
                       sql_file_list 
22
                       sql_file_list 
23
                       load_db_schema 
23
                       load_db_schema 
24
                       load_sql_in_order 
24
                       load_sql_in_order 
25
                       set_marcflavour_syspref 
25
                       set_MarcFormat_syspref 
26
                       set_version_syspref 
26
                       set_version_syspref 
27
                       load_sql 
27
                       load_sql 
28
    );
28
    );
(-)a/t/db_dependent/lib/KohaTest/Installer/SqlScripts.pm (-1 / +1 lines)
Lines 32-38 sub installer_all_sample_data : Tests { Link Here
32
    
32
    
33
    foreach my $lang_code (@languages) {
33
    foreach my $lang_code (@languages) {
34
        SKIP: {
34
        SKIP: {
35
            my $marc_flavours = $self->{installer}->marcflavour_list($lang_code);
35
            my $marc_flavours = $self->{installer}->MarcFormat_list($lang_code);
36
            ok(defined($marc_flavours), "at least one MARC flavour for $lang_code");
36
            ok(defined($marc_flavours), "at least one MARC flavour for $lang_code");
37
            skip "no MARC flavours for $lang_code" unless defined($marc_flavours);
37
            skip "no MARC flavours for $lang_code" unless defined($marc_flavours);
38
38
(-)a/t/db_dependent/www/batch.t (-3 / +3 lines)
Lines 33-43 my $koha_conf = $ENV{KOHA_CONF}; Link Here
33
my $xml       = XMLin($koha_conf);
33
my $xml       = XMLin($koha_conf);
34
34
35
use C4::Context;
35
use C4::Context;
36
my $marcflavour = C4::Context->preference('marcflavour') || 'MARC21';
36
my $MarcFormat = C4::Context->preference('MarcFormat') || 'MARC21';
37
37
38
# For the purpose of this test, we can reasonably take MARC21 and NORMARC to be the same
38
# For the purpose of this test, we can reasonably take MARC21 and NORMARC to be the same
39
my $file =
39
my $file =
40
  $marcflavour eq 'UNIMARC'
40
  $MarcFormat eq 'UNIMARC'
41
  ? "$testdir/data/unimarcrecord.mrc"
41
  ? "$testdir/data/unimarcrecord.mrc"
42
  : "$testdir/data/marc21record.mrc";
42
  : "$testdir/data/marc21record.mrc";
43
43
Lines 157-163 $agent->submit_form_ok( Link Here
157
157
158
$agent->follow_link_ok( { text => 'Manage staged records' }, 'view batch' );
158
$agent->follow_link_ok( { text => 'Manage staged records' }, 'view batch' );
159
my $bookdescription;
159
my $bookdescription;
160
if ( $marcflavour eq 'UNIMARC' ) {
160
if ( $MarcFormat eq 'UNIMARC' ) {
161
    $bookdescription = 'Jeffrey Esakov et Tom Weiss';
161
    $bookdescription = 'Jeffrey Esakov et Tom Weiss';
162
}
162
}
163
else {
163
else {
(-)a/tags/list.pl (-1 / +1 lines)
Lines 56-62 if ( $op eq "del" ) { Link Here
56
}
56
}
57
else {
57
else {
58
58
59
    my $marcflavour = C4::Context->preference('marcflavour');
59
    my $MarcFormat = C4::Context->preference('MarcFormat');
60
    my @results;
60
    my @results;
61
61
62
    if ($tag) {
62
    if ($tag) {
(-)a/tools/batchMod.pl (-2 / +2 lines)
Lines 418-426 foreach my $tag (sort keys %{$tagslib}) { Link Here
418
        $subfield_data{marc_value} = qq(<input type="text" $attributes />);
418
        $subfield_data{marc_value} = qq(<input type="text" $attributes />);
419
    }
419
    }
420
    elsif ( length($value) > 100
420
    elsif ( length($value) > 100
421
            or (C4::Context->preference("marcflavour") eq "UNIMARC" and
421
            or (C4::Context->preference("MarcFormat") eq "UNIMARC" and
422
                  300 <= $tag && $tag < 400 && $subfield eq 'a' )
422
                  300 <= $tag && $tag < 400 && $subfield eq 'a' )
423
            or (C4::Context->preference("marcflavour") eq "MARC21"  and
423
            or (C4::Context->preference("MarcFormat") eq "MARC21"  and
424
                  500 <= $tag && $tag < 600                     )
424
                  500 <= $tag && $tag < 600                     )
425
          ) {
425
          ) {
426
        # oversize field (textarea)
426
        # oversize field (textarea)
(-)a/tools/export.pl (-3 / +3 lines)
Lines 42-48 my $help; Link Here
42
my $op       = $query->param("op")       || '';
42
my $op       = $query->param("op")       || '';
43
my $filename = $query->param("filename") || 'koha.mrc';
43
my $filename = $query->param("filename") || 'koha.mrc';
44
my $dbh      = C4::Context->dbh;
44
my $dbh      = C4::Context->dbh;
45
my $marcflavour = C4::Context->preference("marcflavour");
45
my $MarcFormat = C4::Context->preference("MarcFormat");
46
my $format = $query->param("format") || 'iso2709';
46
my $format = $query->param("format") || 'iso2709';
47
47
48
# Checks if the script is called from commandline
48
# Checks if the script is called from commandline
Lines 379-387 if ( $op eq "export" ) { Link Here
379
                    unless ($xml_header_written) {
379
                    unless ($xml_header_written) {
380
                        MARC::File::XML->default_record_format(
380
                        MARC::File::XML->default_record_format(
381
                            (
381
                            (
382
                                     $marcflavour eq 'UNIMARC'
382
                                     $MarcFormat eq 'UNIMARC'
383
                                  && $record_type eq 'auths'
383
                                  && $record_type eq 'auths'
384
                            ) ? 'UNIMARCAUTH' : $marcflavour
384
                            ) ? 'UNIMARCAUTH' : $MarcFormat
385
                        );
385
                        );
386
                        print MARC::File::XML::header();
386
                        print MARC::File::XML::header();
387
                        print "\n";
387
                        print "\n";
(-)a/tools/stage-marc-import.pl (-1 / +1 lines)
Lines 184-190 if ($completedJobID) { Link Here
184
184
185
} else {
185
} else {
186
    # initial form
186
    # initial form
187
    if (C4::Context->preference("marcflavour") eq "UNIMARC") {
187
    if (C4::Context->preference("MarcFormat") eq "UNIMARC") {
188
        $template->param("UNIMARC" => 1);
188
        $template->param("UNIMARC" => 1);
189
    }
189
    }
190
    my @matchers = C4::Matcher::GetMatcherList();
190
    my @matchers = C4::Matcher::GetMatcherList();
(-)a/virtualshelves/downloadshelf.pl (-1 / +1 lines)
Lines 51-57 my $dbh = C4::Context->dbh; Link Here
51
if ($shelfid && $format) {
51
if ($shelfid && $format) {
52
52
53
    my ($items, $totitems)  = GetShelfContents($shelfid);
53
    my ($items, $totitems)  = GetShelfContents($shelfid);
54
    my $marcflavour         = C4::Context->preference('marcflavour');
54
    my $MarcFormat         = C4::Context->preference('MarcFormat');
55
    my $output='';
55
    my $output='';
56
56
57
    # CSV 
57
    # CSV 
(-)a/virtualshelves/sendshelf.pl (-4 / +4 lines)
Lines 71-77 if ( $email ) { Link Here
71
71
72
    my @shelf               = GetShelf($shelfid);
72
    my @shelf               = GetShelf($shelfid);
73
    my ($items, $totitems)  = GetShelfContents($shelfid);
73
    my ($items, $totitems)  = GetShelfContents($shelfid);
74
    my $marcflavour         = C4::Context->preference('marcflavour');
74
    my $MarcFormat         = C4::Context->preference('MarcFormat');
75
    my $iso2709;
75
    my $iso2709;
76
    my @results;
76
    my @results;
77
77
Lines 81-89 if ( $email ) { Link Here
81
        my $fw               = GetFrameworkCode($biblionumber);
81
        my $fw               = GetFrameworkCode($biblionumber);
82
        my $dat              = GetBiblioData($biblionumber);
82
        my $dat              = GetBiblioData($biblionumber);
83
        my $record           = GetMarcBiblio($biblionumber);
83
        my $record           = GetMarcBiblio($biblionumber);
84
        my $marcnotesarray   = GetMarcNotes( $record, $marcflavour );
84
        my $marcnotesarray   = GetMarcNotes( $record, $MarcFormat );
85
        my $marcauthorsarray = GetMarcAuthors( $record, $marcflavour );
85
        my $marcauthorsarray = GetMarcAuthors( $record, $MarcFormat );
86
        my $marcsubjctsarray = GetMarcSubjects( $record, $marcflavour );
86
        my $marcsubjctsarray = GetMarcSubjects( $record, $MarcFormat );
87
        my $subtitle         = GetRecordValue('subtitle', $record, $fw);
87
        my $subtitle         = GetRecordValue('subtitle', $record, $fw);
88
88
89
        my @items = GetItemsInfo( $biblionumber );
89
        my @items = GetItemsInfo( $biblionumber );
(-)a/xt/fix-old-fsf-address.exclude (-3 / +2 lines)
Lines 2-7 INSTALL.fedora7 Link Here
2
t/smolder_smoke_signal
2
t/smolder_smoke_signal
3
misc/cronjobs/check-url.pl
3
misc/cronjobs/check-url.pl
4
misc/cronjobs/cloud-kw.pl
4
misc/cronjobs/cloud-kw.pl
5
misc/installer_devel_notes/data/en/marcflavour/marc21/mandatory/marc21_framework_DEFAULT.sql
5
misc/installer_devel_notes/data/en/MarcFormat/marc21/mandatory/marc21_framework_DEFAULT.sql
6
misc/installer_devel_notes/data/en/marcflavour/marc21/optional/marc21_simple_bib_frameworks.sql
6
misc/installer_devel_notes/data/en/MarcFormat/marc21/optional/marc21_simple_bib_frameworks.sql
7
koha-tmpl/
7
koha-tmpl/
8
- 

Return to bug 10329