getEvent()->getObject(); $agent = Mage::getModel('aw_hdu3/department_agent')->loadAgentByUserId($user->getId()); $agent ->setUserId($user->getId()) ->setName($user->getFirstname() . ' ' . $user->getLastname()) ->setEmail($user->getEmail()) ->setStatus( Mage::helper('aw_hdu3/ticket')->isUserPrimaryAgent($user->getId()) ? AW_Helpdesk3_Model_Source_Status::ENABLED_VALUE : ($user->getIsActive() ? AW_Helpdesk3_Model_Source_Status::ENABLED_VALUE : AW_Helpdesk3_Model_Source_Status::DISABLED_VALUE ) ) ->save() ; return $this; } /** * @param Varien_Event_Observer $observer * * @return $this */ public function adminUserDeleteAfter(Varien_Event_Observer $observer) { $user = $observer->getEvent()->getObject(); /** * @var $agent AW_Helpdesk3_Model_Department_Agent */ $agent = Mage::getModel('aw_hdu3/department_agent')->loadAgentByUserId($user->getUserId()); $agent ->setStatus(AW_Helpdesk3_Model_Source_Status::DELETED_VALUE) ->save() ; return $this; } }