protected function _beforeSave() { if (!$this->getCategory()) { $this->setCategory('general'); } if ($this->isDataEmptyFor(array('extension', 'category', 'subject', 'body'))) { Mage::throwException($this->__('Missing data for item')); } if (Mage::getSingleton('ewcore/module')->exists($this->getExtension()) === false) { Mage::throwException($this->__('Extensions %s does not exist', $this->getExtension())); } $this->setUpdatedAt(now()); if (is_empty_date($this->getCreatedAt())) { $this->setCreatedAt(now()); } return parent::_beforeSave(); }
protected function _beforeSave() { $this->searchReplaceFieldValues(array('url', 'body'), '', null); if ($this->isDataEmptyFor(array('severity', 'category', 'subject', 'reference_id'))) { Mage::throwException($this->__('Missing data for item')); } if (!$this->getStatus()) { $this->setStatus('enabled'); } if (!$this->getState()) { $this->setState('unread'); } if ($this->isDataEmptyFor(array('sent_at'), 'date')) { Mage::throwException($this->__('Missing data for item')); } $this->setUpdatedAt(now()); if (is_empty_date($this->getCreatedAt())) { $this->setCreatedAt(now()); } return parent::_beforeSave(); }