From 19dae97e195d3669df60046b04f41c38ab400a08 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 1 Oct 2013 14:06:11 +0200 Subject: [PATCH] Bug 5336: FIX: partial status was not correctly set An order (o1) is considered as partially received if (at least) another order (o2) has the o1.ordernumber == o2.parent_ordernumber and the quantity received is < to the quantity (to receive). --- installer/data/mysql/updatedatabase.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl index 6812c8c..2f1e8db 100755 --- a/installer/data/mysql/updatedatabase.pl +++ b/installer/data/mysql/updatedatabase.pl @@ -7019,7 +7019,7 @@ if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) { my $return_count; $dbh->do("ALTER TABLE aqorders ADD COLUMN orderstatus varchar(16) DEFAULT 'new' AFTER parent_ordernumber"); $dbh->do("UPDATE aqorders SET orderstatus='ordered' WHERE basketno IN (SELECT basketno FROM aqbasket WHERE closedate IS NOT NULL)"); - $dbh->do("UPDATE aqorders SET orderstatus='partial' WHERE quantity > quantityreceived AND quantityreceived > 0"); + $dbh->do("UPDATE aqorders SET orderstatus='partial' WHERE quantity > quantityreceived AND ordernumber IN ( SELECT parent_ordernumber FROM ( SELECT DISTINCT(parent_ordernumber) FROM aqorders ) AS aq )"); $dbh->do("UPDATE aqorders SET orderstatus='complete' WHERE quantity=quantityreceived"); $dbh->do("UPDATE aqorders SET orderstatus='cancelled' WHERE datecancellationprinted IS NOT NULL"); print "Upgrade to $DBversion done (Bug 5336: Add the new column aqorders.orderstatus)\n"; -- 1.7.10.4