/** * Add default records to database. This function is called whenever the * database is built, after the database tables have all been created. * * @uses DataExtension->requireDefaultRecords() */ public function requireDefaultRecords() { /* Inherit Default Record Creation */ parent::requireDefaultRecords(); /* If no records exist, create defaults */ if (!DataObject::get_one(get_class($this))) { $defaults = array(array("Title" => "Pending / Awaiting Payment", "SystemTitle" => "Pending / Awaiting Payment", "Content" => "An order has been received but payment or notification of successful payment is still pending."), array("Title" => "Processing", "SystemTitle" => "Processing", "Content" => "Your payment has been received and your order is being processed."), array("Title" => "Awaiting Stock", "SystemTitle" => "Awaiting Stock", "Content" => "We are currently awaiting stock before we can progress your order."), array("Title" => "Completed", "SystemTitle" => "Completed", "Content" => "Your order is now complete."), array("Title" => "Shipped", "SystemTitle" => "Shipped", "Content" => "Your order has been handed to the courier and is on its way."), array("Title" => "Refunded", "SystemTitle" => "Refunded", "Content" => "Your order has been refunded."), array("Title" => "Part Refunded", "SystemTitle" => "Part Refunded", "Content" => "Your order has been part refunded."), array("Title" => "Cancelled", "SystemTitle" => "Cancelled", "Content" => "Your order has been cancelled.")); foreach ($defaults as $default) { $n = new Order_Statuses(); $n->Title = $default["Title"]; $n->SystemTitle = $default["SystemTitle"]; $n->Content = $default["Content"]; $n->SystemCreated = "1"; $n->write(); unset($n); } DB::alteration_message('Created default order statuses', 'created'); } }