Ejemplo n.º 1
0
 /**
  * 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)
  */
 function sendStatusChange($title, $note = null)
 {
     if (!$note) {
         $logs = DataObject::get('OrderStatusLog', "\"OrderID\" = {$this->ID} AND \"SentToCustomer\" = 1", "\"Created\" DESC", null, 1);
         if ($logs) {
             $latestLog = $logs->First();
             $note = $latestLog->Note;
             $title = $latestLog->Title;
         }
     }
     $member = $this->Member();
     if (self::$receipt_email) {
         $adminEmail = self::$receipt_email;
     } else {
         $adminEmail = Email::getAdminEmail();
     }
     $e = new Order_statusEmail();
     $e->populateTemplate($this);
     $e->populateTemplate(array("Order" => $this, "Member" => $member, "Note" => $note));
     $e->setFrom($adminEmail);
     $e->setSubject($title);
     $e->setTo($member->Email);
     $e->send();
 }
 /**
  * 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 = new Order_statusEmail();
     $e->populateTemplate(array("Order" => $this->order, "Member" => $member, "Note" => $note));
     $e->setFrom($adminEmail);
     $e->setSubject($title);
     $e->setTo($member->Email);
     $e->send();
 }
Ejemplo n.º 3
0
 /**
  * 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)
  */
 function sendStatusChange($note = null)
 {
     if (!$note) {
         $logs = DataObject::get('OrderStatusLog', "OrderID = {$this->ID}", "Created DESC", null, 1);
         $latestLog = $logs->First();
         $note = $latestLog->Note;
     }
     $member = $this->Member();
     if (self::$receipt_email) {
         $adminEmail = self::$receipt_email;
     } else {
         $adminEmail = Email::getAdminEmail();
     }
     $e = new Order_statusEmail();
     $e->populateTemplate($this);
     $e->populateTemplate(array("Order" => $this, "Member" => $member, "Note" => $note));
     $e->setFrom($adminEmail);
     $e->setSubject('Your order status');
     $e->setTo($member->Email);
     $e->send();
 }