create audit date for tickets from old system
authorKonrad Rosenbaum <konrad@silmor.de>
Sun, 1 Jan 2012 18:04:48 +0000 (19:04 +0100)
committerKonrad Rosenbaum <konrad@silmor.de>
Sun, 1 Jan 2012 18:04:48 +0000 (19:04 +0100)
www/inc/db/dbupgrade.php

index 1747628..7944f77 100644 (file)
@@ -285,6 +285,8 @@ class DBUpgrade
                //orders
                self::fprint("<br>Converting Order data...\n");
                $orders=$olddb->select("order","*");
+               $ordertime=array();
+               $orderuser=array();
                foreach($orders as $ord){
                        //process invoiceaddr
                        $res=$db->select("address","addressid","customerid=".$ord["customerid"]);
@@ -300,6 +302,9 @@ class DBUpgrade
                                unset($ord["deliveryaddress"]);
                        //create
                        self::insert("order",$ord);
+                       //remember
+                       $ordertime[$ord["orderid"]]=$ord["ordertime"];
+                       $orderuser[$ord["orderid"]]=$ord["soldby"];
                }
                
                //tickets
@@ -316,6 +321,11 @@ class DBUpgrade
                        unset($tick["reservetimeout"]);
                        //finally insert
                        self::insert("ticket",$tick);
+                       //create audit data
+                       $tick["audittime"]=$ordertime[$tick["orderid"]];
+                       $tick["audituname"]=$orderuser[$tick["orderid"]];
+                       $tick["audittransaction"]="1:create order";
+                       $db->insert("ticket_audit",$tick);
                }
                
                //vouchers