From a5e3a6f11e095745e83edf787948f29903d10e63 Mon Sep 17 00:00:00 2001 From: Robin Sheat Date: Thu, 26 Aug 2010 17:31:29 +1200 Subject: [PATCH 2/2] Bug 5173 - database changes to save the discount value This will save the discount value specified for an order so that it doesn't come up as '0.00%' when you view an order again. --- acqui/neworderempty.pl | 1 + installer/data/mysql/kohastructure.sql | 1 + installer/data/mysql/updatedatabase.pl | 8 ++++++++ kohaversion.pl | 2 +- 4 files changed, 11 insertions(+), 1 deletions(-) diff --git a/acqui/neworderempty.pl b/acqui/neworderempty.pl index a580ae7..6dd4848 100755 --- a/acqui/neworderempty.pl +++ b/acqui/neworderempty.pl @@ -347,6 +347,7 @@ $template->param( quantity => $data->{'quantity'}, quantityrec => $data->{'quantity'}, rrp => $data->{'rrp'}, + discount => $data->{'discount'}, listprice => sprintf("%.2f", $data->{'listprice'}||$listprice), total => sprintf("%.2f", ($data->{'ecost'}||0)*($data->{'quantity'}||0) ), ecost => $data->{'ecost'}, diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index e42652c..592bcb4 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2522,6 +2522,7 @@ CREATE TABLE `aqorders` ( `currency` varchar(3) default NULL, `listprice` decimal(28,6) default NULL, `totalamount` decimal(28,6) default NULL, + `discount` float(6,4) default 0, `datereceived` date default NULL, `booksellerinvoicenumber` mediumtext, `freight` decimal(28,6) default NULL, diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index a0b5c4a..e289a21 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -3701,6 +3701,14 @@ if (C4::Context->preference("Version") < TransformToNum($DBversion)) { SetVersion ($DBversion); } +$DBversion = "3.01.00.146"; +if (C4::Context->preference("Version") < TransformToNum($DBversion)) { + $dbh->do('ALTER TABLE aqorders ADD COLUMN discount FLOAT(6,4) DEFAULT NULL;'); + print "Upgrade to $DBversion done (Add 'discount' column on aqorders)\n"; + SetVersion ($DBversion); +} + + =item DropAllForeignKeys($table) Drop all foreign keys of the table $table diff --git a/kohaversion.pl b/kohaversion.pl index 63b6d31..ffd2e69 100644 --- a/kohaversion.pl +++ b/kohaversion.pl @@ -11,7 +11,7 @@ use strict; sub kohaversion { - our $VERSION = '3.01.00.145'; + our $VERSION = '3.01.00.146'; # version needs to be set this way # so that it can be picked up by Makefile.PL -- 1.7.0.4