onBeforeWrite() public method

public onBeforeWrite ( )
 /**
  * adding a sequential order number.
  */
 function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if ($order = $this->Order()) {
         if (!$this->Total) {
             $this->Total = $order->Total();
             $this->SubTotal = $order->SubTotal();
         }
     }
     if (!intval($this->SequentialOrderNumber)) {
         $this->SequentialOrderNumber = 1;
         $min = intval(EcommerceConfig::get("Order", "order_id_start_number")) - 0;
         if (isset($this->ID)) {
             $id = intval($this->ID);
         } else {
             $id = 0;
         }
         $lastOne = OrderStatusLog_Submitted::get()->Exclude(array("ID" => $id))->Sort("SequentialOrderNumber", "DESC")->First();
         if ($lastOne) {
             $this->SequentialOrderNumber = intval($lastOne->SequentialOrderNumber) + 1;
         }
         if (intval($min) && $this->SequentialOrderNumber < $min) {
             $this->SequentialOrderNumber = $min;
         }
     }
 }
 /**
  * Standard SS method
  * Creates the folder and files.
  */
 function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if (!$this->IsExpired()) {
         $this->FolderName = $this->getOrderDownloadFolder(true);
     }
 }
 /**
  * adding a sequential order number.
  */
 function onBeforeWrite()
 {
     parent::onBeforeWrite();
     if ($order = $this->Order()) {
         if (!$this->Total) {
             $this->Total = $order->Total();
             $this->SubTotal = $order->SubTotal();
         }
     }
     if (!intval($this->SequentialOrderNumber)) {
         $min = intval(EcommerceConfig::get("Order", "order_id_start_number"));
         if (isset($this->ID)) {
             $id = intval($this->ID);
         } else {
             $id = 0;
         }
         $lastOneAsDos = DataObject::get("OrderStatusLog_Submitted", "\"OrderStatusLog_Submitted\".\"ID\" <> {$id}", "\"SequentialOrderNumber\" DESC", null, 1);
         if ($lastOneAsDos) {
             foreach ($lastOneAsDos as $lastOne) {
                 $this->SequentialOrderNumber = intval($lastOne->SequentialOrderNumber) + 1;
                 if ($this->SequentialOrderNumber < $min) {
                     $this->SequentialOrderNumber = $min;
                 }
             }
         } else {
             $this->SequentialOrderNumber = $min;
         }
     }
     if (!intval($this->SequentialOrderNumber)) {
         $this->SequentialOrderNumber = 1;
     }
 }
 public function onBeforeWrite()
 {
     if (!$this->Title) {
         $this->Title = $this->Status;
     }
     parent::onBeforeWrite();
     if (!$this->Sent && $this->Send && $this->Order()->exists() && ($email = $this->Email)) {
         $email->send();
         $this->Sent = SS_Datetime::now()->Rfc2822();
         $this->Send_To = $email->To();
         $this->Send_From = $email->From();
         $this->Send_Subject = $email->Subject();
         $this->Send_Body = $email->Body();
     }
 }
 function onBeforeWrite()
 {
     parent::onBeforeWrite();
 }