Bug 11529: (QA follow-up) Copy existing subtitle mappings and warn others
authorNick Clemens <nick@bywatersolutions.com>
Fri, 26 Jul 2019 15:45:51 +0000 (15:45 +0000)
committerMartin Renvoize <martin.renvoize@ptfs-europe.com>
Mon, 5 Aug 2019 14:03:20 +0000 (15:03 +0100)
Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
installer/data/mysql/atomicupdate/bug_11529.perl

index 17800bf..034821d 100644 (file)
@@ -52,7 +52,18 @@ if( CheckVersion( $DBversion ) ) {
         });
     }
 
-    $dbh->do( "DROP TABLE IF EXISTS fieldmapping" );
+    $dbh->do("UPDATE marc_subfield_structure JOIN fieldmapping ON tagfield = fieldcode AND subfieldcode=tagsubfield SET kohafield='biblio.subtitle' WHERE fieldmapping.frameworkcode=''");
+    $sth = $dbh->prepare("SELECT * FROM fieldmapping WHERE frameworkcode != '' OR field != 'subtitle'");
+    $sth->execute;
+    print "Keyword to MARC mappings below cannot be preserved: \n" if $sth->rows;
+    while ( my $value = $sth->fetchrow_hashref() ){
+        my $framework = $value->{frameworkcode} eq "" ? "Default" : $value->{frameworkcode};
+        print "    keyword: " . $value->{'field'} . " to field: " . $value->{fieldcode} . "\$" . $value->{subfieldcode} . " for $framework framework\n";
+    }
+    print "You will need to remap using Koha to MARC mappings in administration\n" if $sth->rows;
+
+
+#    $dbh->do( "DROP TABLE IF EXISTS fieldmapping" );
 
     $dbh->do( "DELETE FROM user_permissions WHERE code='manage_keywords2koha_mappings'" );