Esempio n. 1
0
 /**
  * Run cron jobs
  * @return
  */
 public function process()
 {
     if (!self::$isRun) {
         self::$isCronSession = 1;
         if (!self::cleanState()) {
             self::processTodaySubscriptions();
         }
         self::processAlerts();
         self::markExpiredSubscriptions();
         self::$isRun = 1;
         self::$isCronSession = 0;
     }
 }
 public function payAction()
 {
     $subscriptionId = $this->getRequest()->getParam('id');
     $sequenceId = $this->getRequest()->getParam('seq');
     $subscription = Mage::getModel('sarp/subscription')->load($subscriptionId);
     $sequence = Mage::getModel('sarp/sequence')->load($sequenceId);
     AW_Sarp_Model_Cron::$isCronSession = 1;
     try {
         $subscription->payBySequence($sequence);
     } catch (Exception $e) {
         Mage::getSingleton('adminhtml/session')->addError($this->__('Sequence can not be paid: %s', $e->getMessage()));
     }
     AW_Sarp_Model_Cron::$isCronSession = 0;
     $this->_redirectReferer();
 }
 public function payAction()
 {
     $subscriptionId = $this->getRequest()->getParam('id');
     $sequenceId = $this->getRequest()->getParam('seq');
     $subscription = Mage::getModel('sarp/subscription')->load($subscriptionId);
     $sequence = Mage::getModel('sarp/sequence')->load($sequenceId);
     $dateForPay = new Zend_Date($sequence->getDate(), AW_Sarp_Model_Subscription::DB_DATE_FORMAT);
     $dateForPayLoc = Mage::app()->getLocale()->date($dateForPay);
     $diff = (int) $dateForPayLoc->toString('X');
     $dateForPay->subSecond($diff);
     AW_Sarp_Model_Cron::$isCronSession = 1;
     $subscription->payForDate($dateForPay);
     AW_Sarp_Model_Cron::$isCronSession = 0;
     $this->_redirectReferer();
 }