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

(-)a/installer/data/mysql/updatedatabase.pl (-1 / +63 lines)
Lines 6557-6562 if ( CheckVersion($DBversion) ) { Link Here
6557
    SetVersion($DBversion);
6557
    SetVersion($DBversion);
6558
}
6558
}
6559
6559
6560
$DBversion = "3.11.00.XXX";
6561
if ( CheckVersion($DBversion) ) {
6562
 if (C4::Context->preference("marcflavour") eq 'MARC21') {
6563
  $sth = $dbh->prepare("SELECT frameworkcode FROM marc_tag_structure WHERE tagfield = '029'");
6564
  $sth->execute;
6565
  my $frameworkcodes = $sth->fetchall_hashref('frameworkcode');
6566
6567
  for my $frameworkcode (keys %$frameworkcodes) {
6568
   $dbh->do("
6569
    INSERT IGNORE INTO marc_subfield_structure (tagfield, tagsubfield, liblibrarian,
6570
    libopac, repeatable, mandatory, kohafield, tab, authorised_value, authtypecode,
6571
    value_builder, isurl, hidden, frameworkcode, seealso, link, defaultvalue) VALUES
6572
    ('029', 'a', 'OCLC library identifier', 'OCLC library identifier', 0, 0, '', 0, '', '', '', 0, -6, '$frameworkcode', '', '', NULL),
6573
    ('029', 'b', 'System control number', 'System control number', 0, 0, '', 0, '', '', '', 0, -6, '$frameworkcode', '', '', NULL),
6574
    ('029', 'c', 'OAI set name', 'OAI set name', 0, 0, '', 0, '', '', '', 0, -6, '$frameworkcode', '', '', NULL),
6575
    ('029', 't', 'Content type identifier', 'Content type identifier', 0, 0, '', 0, '', '', '', 0, -6, '$frameworkcode', '', '', NULL)
6576
   ");
6577
  }
6578
6579
  for my $tag ( '863', '864', '865' ) {
6580
   $sth = $dbh->prepare("SELECT frameworkcode FROM marc_tag_structure WHERE tagfield = '$tag'");
6581
   $sth->execute;
6582
   my $frameworkcodes = $sth->fetchall_hashref('frameworkcode');
6583
6584
   for my $frameworkcode (keys %$frameworkcodes) {
6585
    $dbh->do("
6586
     INSERT IGNORE INTO marc_subfield_structure (tagfield, tagsubfield, liblibrarian,
6587
     libopac, repeatable, mandatory, kohafield, tab, authorised_value, authtypecode,
6588
     value_builder, isurl, hidden, frameworkcode, seealso, link, defaultvalue) VALUES
6589
     ('$tag', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 5, '$frameworkcode', '', '', NULL),
6590
     ('$tag', '8', 'Field link and sequence number', 'Field link and sequence number', 0, 0, '', 8, '', '', '', NULL, 5, '$frameworkcode', '', '', NULL),
6591
     ('$tag', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6592
     ('$tag', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6593
     ('$tag', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6594
     ('$tag', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6595
     ('$tag', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6596
     ('$tag', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6597
     ('$tag', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6598
     ('$tag', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6599
     ('$tag', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6600
     ('$tag', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6601
     ('$tag', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6602
     ('$tag', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6603
     ('$tag', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6604
     ('$tag', 'n', 'Converted Gregorian year', 'Converted Gregorian year', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6605
     ('$tag', 'o', 'Type of unit', 'Type of unit', 1, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6606
     ('$tag', 'p', 'Piece designation', 'Piece designation', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6607
     ('$tag', 'q', 'Piece physical condition', 'Piece physical condition', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6608
     ('$tag', 's', 'Copyright article-fee code', 'Copyright article-fee code', 1, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6609
     ('$tag', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6610
     ('$tag', 'v', 'Issuing date', 'Issuing date', 1, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6611
     ('$tag', 'w', 'Break indicator', 'Break indicator', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6612
     ('$tag', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL),
6613
     ('$tag', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL)
6614
    ");
6615
   }
6616
  }
6617
  print "Upgrade to $DBversion done (Bug 9353: Missing subfields on MARC21 frameworks)\n";
6618
  SetVersion ($DBversion);
6619
 }
6620
}
6621
6622
6560
=head1 FUNCTIONS
6623
=head1 FUNCTIONS
6561
6624
6562
=head2 TableExists($table)
6625
=head2 TableExists($table)
6563
- 

Return to bug 9353