From 6a73fe511a88f249d8f82e8e73816bb94a256d17 Mon Sep 17 00:00:00 2001 From: Marcel de Rooy Date: Wed, 6 Apr 2011 11:35:37 +0000 Subject: [PATCH] 5936: Remove some obsolete db columns from aqbooksellers and aqbudgets if needed Removes obsolete columns from aqbooksellers and aqbudgets if needed. aqbooksellers: deliverydays followupdays followupscancel invoicedisc nocalc specialty aqbudgets: budget_description These columns should not exist in a fresh install from kohastructure.sql, but originate from older 3.0 versions. One line in acqui/updatesupplier.pl referring to one of these columns is removed too. This patch therefore does not change functionality, but only keeps your db in shape. Signed-off-by: Julian Maurice Rebased April 6. Signed-off-by: Chris Cormack --- acqui/updatesupplier.pl | 2 +- installer/data/mysql/updatedatabase.pl | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/acqui/updatesupplier.pl b/acqui/updatesupplier.pl index 7c7aa2c87f..6bc978f97e 100755 --- a/acqui/updatesupplier.pl +++ b/acqui/updatesupplier.pl @@ -92,7 +92,7 @@ $data{'contnotes'}=$input->param('contact_notes'); # warn "".$data{'contnotes'}; $data{'notes'}=$input->param('notes'); $data{'active'}=$input->param('status'); -$data{'specialty'}=$input->param('publishers_imprints'); + $data{'listprice'}=$input->param('list_currency'); $data{'invoiceprice'}=$input->param('invoice_currency'); $data{'gstreg'}=$input->param('gst'); diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 793102963e..a4bdb20c66 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -4234,6 +4234,24 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { SetVersion($DBversion); } +$DBversion = '3.03.00.XXX'; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + #Remove obsolete columns from aqbooksellers if needed + my $a = $dbh->selectall_hashref('SHOW columns from aqbooksellers','Field'); + my $sqldrop="ALTER TABLE aqbooksellers DROP COLUMN "; + foreach(qw/deliverydays followupdays followupscancel invoicedisc nocalc specialty/) { + $dbh->do($sqldrop.$_) if exists $a->{$_}; + } + #Remove obsolete column from aqbudgets if needed + #The correct column is budget_notes + $a = $dbh->selectall_hashref('SHOW columns from aqbudgets','Field'); + if(exists $a->{budget_description}) { + $dbh->do("ALTER TABLE aqbudgets DROP COLUMN budget_description"); + } + print "Upgrade to $DBversion done (Remove obsolete columns from aqbooksellers and aqbudgets if needed)\n"; + SetVersion ($DBversion); +} + =head1 FUNCTIONS =head2 DropAllForeignKeys($table) -- 2.39.5