public function save() { if (!$this->ocs_channel_id) { $this->ocs_channel_id = null; } if (!$this->ocs_client_id) { $this->ocs_client_id = null; } $this->price_quote = (double) $this->price_quote; $is_new = !$this->id; if ($is_new) { $initial_status_options = ocsPkgOcsOrderStatusHelperLibrary::getNextStatusOptions($this); if ($initial_status_options) { $initial_status = array_shift(array_keys($initial_status_options)); $this->setStatus($initial_status); } $this->created = date("Y-m-d H:i:s"); } $id = parent::save(); if ($id) { foreach ($this->_flow as $f) { if (!$f->ocs_order_id) { $f->ocs_order_id = $id; } if (!$f->id) { $f->save(); } } } return $id; }
public function save() { $is_new = !$this->id; if ($is_new) { $user_session = Application::getUserSession(); $this->user_id = $user_session->getUserId(); } $id = parent::save(); if ($id) { imagePkgHelperLibrary::commitUploadedFiles(Request::get('image'), $id); } return $id; }
public function save() { if (!$this->parent_id) { $this->parent_id = null; } if (!$this->user_id) { $this->user_id = null; } $is_new = !$this->id; if ($is_new) { $this->created = date('Y-m-d H:i:s'); } if ($this->_parent) { if (!$this->_parent->id) { $this->_parent->save(); } $this->parent_id = $this->_parent->id; } return parent::save(); }