getValue() == AW_Helpdesk3_Model_Source_Yesno::YES_VALUE && $this->_isCanEnabled()) { return parent::_beforeSave(); } $this->setValue(AW_Helpdesk3_Model_Source_Yesno::NO_VALUE); return $this; } protected function _isCanEnabled() { $data = Mage::app()->getRequest()->getParam('groups', array()); $supervisorEmails = $data['ticket_escalation']['fields']['supervisor_emails']['value']; if (trim($supervisorEmails) == '' || !$this->_isValidEmail($supervisorEmails)) { Mage::getSingleton('adminhtml/session')->addNotice( Mage::helper('aw_hdu3')->__('Ticket Escalation can\'t be enabled if "Supervisor email(s)" is empty.' .' Please specify ticket escalation email recipient(s).' ) ); return false; } return true; } protected function _isValidEmail($supervisorEmails) { $emails = explode(',', $supervisorEmails); $emailValidator = new Zend_Validate_EmailAddress; foreach ($emails as $email) { if (!$emailValidator->isValid($email)) { return false; } } return true; } }