From acaa3178433e4f4350860f29cd2cd2e57d0ca726 Mon Sep 17 00:00:00 2001 From: Bernardo Gonzalez Kriegel Date: Thu, 10 Jan 2013 19:01:07 -0300 Subject: [PATCH] Followup Bug 9353: Missing subfields on MARC21 frameworks This followup changes updatedatabase.pl. Only touch frameworks that have the missing subfields. If both patches are applied, the test plan changes. To test: 1) dev master system with default and example MARC21 frameworks 2) Go to Home > Administration > MARC frameworks 3) Click on 'MARC structure' of any framework 4) Search for tag 029 (or 863/4/5) 5) Click 'Subfields', there are none. 6) Apply both patches 7) run 'perl installer/data/mysql/updatedatabase.pl' 8) Repeat steps 2-4 9) Click 'Subfields', now they are. Signed-off-by: Kyle M Hall Signed-off-by: Katrin Fischer Update works nicely. Checked various frameworks and results were ok. Also new fields are hidden. Signed-off-by: Jared Camins-Esakov (cherry picked from commit da4bc6a6315a7f5aca1bb3105549758b8acd7592) Signed-off-by: Bernardo Gonzalez Kriegel (cherry picked from commit da4bc6a6315a7f5aca1bb3105549758b8acd7592) Solved conflict in updatedatabase.pl This two are necessary for Bug 5858 Signed-off-by: Chris Hall (cherry picked from commit 459422c8bad09a8301cf47a7b39abf15a3b265ff) --- installer/data/mysql/updatedatabase.pl | 67 ++++++++++++++++++++++++++ kohaversion.pl | 2 +- 2 files changed, 68 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 41893bc327..d5acdbeed1 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5399,6 +5399,73 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = "3.08.17.001"; +if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { + if ( C4::Context->preference("marcflavour") eq 'MARC21' ) { + $sth = $dbh->prepare( +"SELECT frameworkcode FROM marc_tag_structure WHERE tagfield = '029'" + ); + $sth->execute; + my $frameworkcodes = $sth->fetchall_hashref('frameworkcode'); + + for my $frameworkcode ( keys %$frameworkcodes ) { + $dbh->do( " + INSERT IGNORE INTO marc_subfield_structure (tagfield, tagsubfield, liblibrarian, + libopac, repeatable, mandatory, kohafield, tab, authorised_value, authtypecode, + value_builder, isurl, hidden, frameworkcode, seealso, link, defaultvalue) VALUES + ('029', 'a', 'OCLC library identifier', 'OCLC library identifier', 0, 0, '', 0, '', '', '', 0, -6, '$frameworkcode', '', '', NULL), + ('029', 'b', 'System control number', 'System control number', 0, 0, '', 0, '', '', '', 0, -6, '$frameworkcode', '', '', NULL), + ('029', 'c', 'OAI set name', 'OAI set name', 0, 0, '', 0, '', '', '', 0, -6, '$frameworkcode', '', '', NULL), + ('029', 't', 'Content type identifier', 'Content type identifier', 0, 0, '', 0, '', '', '', 0, -6, '$frameworkcode', '', '', NULL) + " ); + } + + for my $tag ( '863', '864', '865' ) { + $sth = $dbh->prepare( +"SELECT frameworkcode FROM marc_tag_structure WHERE tagfield = '$tag'" + ); + $sth->execute; + my $frameworkcodes = $sth->fetchall_hashref('frameworkcode'); + + for my $frameworkcode ( keys %$frameworkcodes ) { + $dbh->do( " + INSERT IGNORE INTO marc_subfield_structure (tagfield, tagsubfield, liblibrarian, + libopac, repeatable, mandatory, kohafield, tab, authorised_value, authtypecode, + value_builder, isurl, hidden, frameworkcode, seealso, link, defaultvalue) VALUES + ('$tag', '6', 'Linkage', 'Linkage', 0, 0, '', 8, '', '', '', NULL, 5, '$frameworkcode', '', '', NULL), + ('$tag', '8', 'Field link and sequence number', 'Field link and sequence number', 0, 0, '', 8, '', '', '', NULL, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'a', 'First level of enumeration', 'First level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'b', 'Second level of enumeration', 'Second level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'c', 'Third level of enumeration', 'Third level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'd', 'Fourth level of enumeration', 'Fourth level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'e', 'Fifth level of enumeration', 'Fifth level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'f', 'Sixth level of enumeration', 'Sixth level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'g', 'Alternative numbering scheme, first level of enumeration', 'Alternative numbering scheme, first level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'h', 'Alternative numbering scheme, second level of enumeration', 'Alternative numbering scheme, second level of enumeration', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'i', 'First level of chronology', 'First level of chronology', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'j', 'Second level of chronology', 'Second level of chronology', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'k', 'Third level of chronology', 'Third level of chronology', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'l', 'Fourth level of chronology', 'Fourth level of chronology', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'm', 'Alternative numbering scheme, chronology', 'Alternative numbering scheme, chronology', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'n', 'Converted Gregorian year', 'Converted Gregorian year', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'o', 'Type of unit', 'Type of unit', 1, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'p', 'Piece designation', 'Piece designation', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'q', 'Piece physical condition', 'Piece physical condition', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 's', 'Copyright article-fee code', 'Copyright article-fee code', 1, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 't', 'Copy number', 'Copy number', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'v', 'Issuing date', 'Issuing date', 1, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'w', 'Break indicator', 'Break indicator', 0, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'x', 'Nonpublic note', 'Nonpublic note', 1, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL), + ('$tag', 'z', 'Public note', 'Public note', 1, 0, '', 8, '', '', '', 0, 5, '$frameworkcode', '', '', NULL) + " ); + } + } + } + print "Upgrade to $DBversion done (Bug 9353: Missing subfields on MARC21 frameworks)\n"; + SetVersion($DBversion); +} + + =head1 FUNCTIONS =head2 TableExists($table) diff --git a/kohaversion.pl b/kohaversion.pl index 0ca7f9c30e..afa1ed4826 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -16,7 +16,7 @@ the kohaversion is divided in 4 parts : use strict; sub kohaversion { - our $VERSION = '3.08.17.000'; + our $VERSION = '3.08.17.001'; # version needs to be set this way # so that it can be picked up by Makefile.PL # during install -- 2.39.5