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)");
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='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";
$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";