From a25c8c629ea9f783bc150728671aed18592bca24 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 18 Feb 2015 15:55:16 +0100 Subject: [PATCH] Bug 11062: Update DB entry 3 new DB field: aqbooksellers.invoiceincgst aqbooksellers.shipping_tax_rate aqinvoices.shipping_tax_rate 1 DB field renamed aqinvoices.shipmentcost => aqinvoices.shipping --- installer/data/mysql/kohastructure.sql | 5 ++++- installer/data/mysql/updatedatabase.pl | 21 +++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 4719ee3..1dfd762 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2905,6 +2905,8 @@ CREATE TABLE `aqbooksellers` ( -- information about the vendors listed in acquis `listincgst` tinyint(4) default NULL, -- is tax included in list prices (1 for yes, 0 for no) `invoiceincgst` tinyint(4) default NULL, -- is tax included in invoice prices (1 for yes, 0 for no) `tax_rate` decimal(6,4) default NULL, -- the tax rate the library is charged + `shipping_tax_rate decimal(6,4) default null, -- the tax rate for shipping + `shippingincgst` int(1) default 1, -- is tax included in shipping (1 for yes, 0 for no) `discount` float(6,4) default NULL, -- discount offered on all items ordered from this vendor `fax` varchar(50) default NULL, -- vendor fax number deliverytime int(11) default NULL, -- vendor delivery time @@ -3140,7 +3142,8 @@ CREATE TABLE aqinvoices ( shipmentdate date default NULL, -- date of shipment billingdate date default NULL, -- date of billing closedate date default NULL, -- invoice close date, NULL means the invoice is open - shipmentcost decimal(28,6) default NULL, -- shipment cost + shipping decimal(28,6) default NULL, -- shipment cost + shipping_tax_rate decimal(6,4) default NULL, -- shipment tax rate shipmentcost_budgetid int(11) default NULL, -- foreign key to aqbudgets, link the shipment cost to a budget PRIMARY KEY (invoiceid), CONSTRAINT aqinvoices_fk_aqbooksellerid FOREIGN KEY (booksellerid) REFERENCES aqbooksellers (id) ON DELETE CASCADE ON UPDATE CASCADE, diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index d433eca..93fdfa6 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -9766,6 +9766,27 @@ if ( CheckVersion($DBversion) ) { SetVersion($DBversion); } +$DBversion = '3.19.00.XXX'; +if ( CheckVersion($DBversion) ) { + + ## Add the new columns + $dbh->do(q| + ALTER TABLE aqbooksellers + ADD COLUMN shipping_tax_rate decimal(6,4) default NULL AFTER tax_rate, + ADD COLUMN shippingincgst int(1) default 1 AFTER shipping_tax_rate + + |); + + $dbh->do(q| + ALTER TABLE aqinvoices + CHANGE COLUMN shipmentcost shipping decimal(28,6) DEFAULT NULL, + ADD COLUMN shipping_tax_rate decimal(6,4) default NULL AFTER shipping, + |); + + print "Upgrade to $DBversion done (Bug 11062 - Add columns aqbooksellers.shipping_tax_rate and aqinvoices.shipping*)\n"; + SetVersion($DBversion); +} + =head1 FUNCTIONS =head2 TableExists($table) -- 2.1.0