/** * Send a message to the client containing the latest * note of {@link OrderStatusLog} and the current status. * * Used in {@link OrderReport}. * * @param string $note Optional note-content (instead of using the OrderStatusLog) */ public function sendStatusChange($title, $note = null) { if (!$note) { $latestLog = OrderStatusLog::get()->filter("OrderID", $this->order->ID)->filter("SentToCustomer", 1)->first(); if ($latestLog) { $note = $latestLog->Note; $title = $latestLog->Title; } } $member = $this->order->Member(); if (Config::inst()->get('OrderProcessor', 'receipt_email')) { $adminEmail = Config::inst()->get('OrderProcessor', 'receipt_email'); } else { $adminEmail = Email::config()->admin_email; } $e = Order_statusEmail::create(); $e->populateTemplate(array("Order" => $this->order, "Member" => $member, "Note" => $note)); $e->setFrom($adminEmail); $e->setSubject($title); $e->setTo($member->Email); $e->send(); }