From 6a91a0142a5bbcb6d539577eb6e7cf49e74a9234 Mon Sep 17 00:00:00 2001 From: Jared Camins-Esakov Date: Sat, 9 Jun 2012 21:59:03 -0400 Subject: [PATCH] Bug 4222 followup: Do not update mappings unless we ought Content-Type: text/plain; charset="UTF-8" This follow-up modifies the database update for 4222 to only modify mappings if the installation is not UNIMARC, and nothing else has been mapped to the items.nonpublicnotes column (which did not exist before the patch for bug 4222). --- installer/data/mysql/updatedatabase.pl | 9 ++++++++- 1 files changed, 8 insertions(+), 1 deletions(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 0124e28..ab53a0b 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -5340,7 +5340,14 @@ $DBversion = '3.09.00.XXX'; if (C4::Context->preference("Version") < TransformToNum($DBversion)) { $dbh->do("ALTER TABLE items ADD COLUMN nonpublicnote MEDIUMTEXT AFTER itemnotes"); $dbh->do("ALTER TABLE deleteditems ADD COLUMN nonpublicnote MEDIUMTEXT AFTER itemnotes"); - $dbh->do("UPDATE marc_subfield_structure SET kohafield='items.nonpublicnote' WHERE (kohafield IS NULL OR kohafield = '') AND tagfield='952' AND tagsubfield='x'"); + unless ( C4::Context->preference("marcflavour") eq 'UNIMARC' ) { + $sth = $dbh->prepare("SELECT COUNT(*) FROM marc_subfield_structure WHERE kohafield='items.nonpublicnote'"); + $sth->execute; + my ($count) = $sth->fetchrow; + unless ( $count ) { + $dbh->do("UPDATE marc_subfield_structure SET kohafield='items.nonpublicnote' WHERE (kohafield IS NULL OR kohafield = '') AND tagfield='952' AND tagsubfield='x'"); + } + } print "Upgrade to $DBversion done (Make nonpublicnote easier to use. If you have mapped your items to a MARC field other than 952 (system default), please check your Koha to MARC mapping for items.nonpublicnote)\n"; } -- 1.7.2.5