protected function _beforeSave() { if (is_array($this->getData('scope'))) { $this->setData('scope', @implode(',', $this->getData('scope'))); } return parent::_beforeSave(); }
protected function _beforeSave() { if (is_array($this->getData('attachments'))) { $this->setData('attachments', @serialize($this->getData('attachments'))); } return parent::_beforeSave(); }
/** * Prepares for save * @return */ protected function _beforeSave() { if (!$this->getId()) { $this->getQuote()->setUpdatedAt(now())->save(); $this->setIsNew(true); } if (is_null($this->getStoreId())) { $storeId = Mage::getSingleton('adminhtml/session_quote')->getStoreId() ? Mage::getSingleton('adminhtml/session_quote')->getStoreId() : Mage::app()->getStore()->getId(); $this->setStoreId($storeId); } if ($this->getIsCancelling() && !$this->getIsNew()) { Mage::dispatchEvent('sarp_subscription_cancel_before', array('subscription' => $this)); // Delete payment sequence Mage::getResourceModel('sarp/sequence')->deleteBySubscriptionId($this->getId()); // Delete alert events Mage::getResourceModel('sarp/alert_event')->deleteBySubscriptionId($this->getId()); // Throw payment onCancel $this->_getMethodInstance()->onSubscriptionCancel($this); } if ($this->getIsSuspending() && !$this->getIsNew()) { Mage::dispatchEvent('sarp_subscription_suspend_before', array('subscription' => $this)); $this->_getMethodInstance()->onSubscriptionSuspend($this); } if ($this->getIsReactivated() && !$this->getIsNew()) { Mage::dispatchEvent('sarp_subscription_reactivate_before', array('subscription' => $this)); $this->_getMethodInstance()->onSubscriptionReactivate($this); } if ($this->getIsExpiring() && !$this->getIsNew()) { Mage::dispatchEvent('sarp_subscription_expire_before', array('subscription' => $this)); $this->_getMethodInstance()->onSubscriptionSuspend($this); } return parent::_beforeSave(); }
/** * Run before id * @return */ public function _beforeSave() { if ($this->isReadOnly()) { Mage::throwException('Ticket is locked by another customer'); } if (!$this->getUid()) { $this->setUid($this->generateUid()); } $this->setIsVirtual(intval(!$this->getCustomerId())); if (!$this->getCreatedTime()) { $this->setCreatedTime(now()); } if (!$this->getCreatedBy()) { $this->setCreatedBy('customer'); } if (!$this->getContentType()) { $this->setContentType(AW_Helpdeskultimate_Helper_Config::DEFAULT_MIME_TYPE); } return parent::_beforeSave(); }
/** * Creates hash if no hash * @return */ public function _beforeSave() { if (!$this->getHash()) { // Generate UID if no specified $this->setHash($this->_createHash()); } return parent::_beforeSave(); }
/** * Run before save * @return */ public function _beforeSave() { if (!$this->getCreatedTime()) { $this->setCreatedTime(now()); } return parent::_beforeSave(); }