Bug 5336: (follow-up) use understandable codes rather than magic numbers for orderstatus
[koha.git] / installer / data / mysql / updatedatabase.pl
index aa2e411..7d8832e 100755 (executable)
@@ -7309,11 +7309,11 @@ if ( CheckVersion($DBversion) ) {
 $DBversion = "3.13.00.XXX";
 if ( C4::Context->preference("Version") < TransformToNum($DBversion) ) {
     my $return_count;
-    $dbh->do("ALTER TABLE aqorders ADD COLUMN orderstatus tinyint(2) DEFAULT 0 AFTER parent_ordernumber");
-    $dbh->do("UPDATE aqorders SET orderstatus=1 WHERE basketno IN (SELECT basketno FROM aqbasket WHERE closedate IS NOT NULL)");
-    $dbh->do("UPDATE aqorders SET orderstatus=2 WHERE quantity > quantityreceived AND quantityreceived > 0");
-    $dbh->do("UPDATE aqorders SET orderstatus=3 WHERE quantity=quantityreceived");
-    $dbh->do("UPDATE aqorders SET orderstatus=4 WHERE datecancellationprinted IS NOT NULL");
+    $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='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";
     SetVersion($DBversion);
 }