/**
  * Method is called by the controller before the requested action is
  * invoked.
  *
  * This method checks if a valid licence for the package is available,
  * if not the user is redirected to the package detail page to enter
  * a valid serialz.
  *
  * @return Mage_Core_Controller_Front_Action The controller instance
  */
 public function preDispatch()
 {
     try {
         // invoke the parent's preDispatch method
         parent::preDispatch();
         // validate the package information
         Mage::getModel('manager/connector')->validate($packageInformation = $this->_getPackageInformation());
         // return the instance
         return $this;
     } catch (Faett_Manager_Exceptions_InvalidLicenceException $ile) {
         // log the exception
         Mage::logException($ile);
         // add an error to the session
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('piwik')->__('100.error.invalid.serialz', $packageInformation->getIdentifier()));
     } catch (Faett_Manager_Exceptions_ChannelLoginException $cle) {
         // log the exception
         Mage::logException($cle);
         // add an error to the session
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('piwik')->__('100.error.invalid.credentials', $packageInformation->getPackage()->getChannel()->getUrl()));
         // redirect and request user to enter a valid Serialz
         $this->_forward('index', 'adminhtml_channel', 'manager', array('id' => $packageInformation->getPackage()->getId()));
     } catch (Faett_Manager_Exceptions_ChannelNotFoundException $cnfe) {
         // log the exception
         Mage::logException($cnfe);
         // add an error to the session
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('piwik')->__('100.error.invalid.channel', $packageInformation->getPackage()->getChannel()->getUrl()));
         // redirect and request user to register channel first
         $this->_forward('new', 'adminhtml_channel', 'manager');
     }
 }
 /**
  * Method is called by the controller before the requested action is
  * invoked.
  *
  * This method checks if a valid licence for the package is available,
  * if not the user is redirected to the package detail page to enter
  * a valid serialz.
  *
  * @return Mage_Core_Controller_Front_Action The controller instance
  */
 public function preDispatch()
 {
     try {
         // invoke the parent's preDispatch method
         parent::preDispatch();
         // validate the package information
         Mage::getModel('manager/connector')->validate($packageInformation = $this->_getPackageInformation());
         // return the instance
         return $this;
     } catch (Faett_Manager_Exceptions_InvalidLicenceException $ile) {
         // log the exception
         Mage::logException($ile);
         // add an error to the session
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('manager')->__('Please enter a valid serial number'));
     } catch (Faett_Manager_Exceptions_ChannelNotFoundException $cnfe) {
         // log the exception
         Mage::logException($cnfe);
         // add an error to the session
         Mage::getSingleton('adminhtml/session')->addError(Mage::helper('manager')->__($cnfe->getMessage()));
         // redirect and request user to register channel first
         $this->_forward('new', 'adminhtml_channel', 'manager');
     }
 }