[Koha-patches] [PATCH] Bug 5173 - database changes to save the discount value
Chris Cormack
chrisc at catalyst.net.nz
Tue Aug 31 01:48:19 CEST 2010
From: Robin Sheat <robin at catalyst.net.nz>
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.
Signed-off-by: Chris Cormack <chrisc at catalyst.net.nz>
---
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 9fc1ecb..b7955cb 100755
--- a/acqui/neworderempty.pl
+++ b/acqui/neworderempty.pl
@@ -348,6 +348,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
More information about the Koha-patches
mailing list