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 <julian.maurice@biblibre.com>

Rebased April 6.
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
This commit is contained in:
Marcel de Rooy 2011-04-06 11:35:37 +00:00 committed by Chris Cormack
parent 9dc9f73bfe
commit 6a73fe511a
2 changed files with 19 additions and 1 deletions

View file

@ -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');

View file

@ -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)