private function executeUpdateSynch() { $mode = (bool) $this->config->getGroupValue('/amazon/orders/update/', 'mode'); if (!$mode) { return; } $tempSynch = new Ess_M2ePro_Model_Amazon_Synchronization_Tasks_Orders_Update(); $tempSynch->process(); }
private function isLockedAccount($accountId) { /** @var $lockItem Ess_M2ePro_Model_LockItem */ $lockItem = Mage::getModel('M2ePro/LockItem'); $lockItem->setNick(self::LOCK_ITEM_PREFIX . '_' . $accountId); $maxDeactivateTime = (int) $this->config->getGroupValue('/play/orders/receive/', 'max_deactivate_time'); $lockItem->setMaxDeactivateTime($maxDeactivateTime); return $lockItem->isExist(); }
public function process() { // Check tasks config mode //----------------------------- $generalMode = $this->config->getGroupValue('/buy/orders/', 'mode'); $receiveMode = $this->config->getGroupValue('/buy/orders/receive/', 'mode'); $updateMode = $this->config->getGroupValue('/buy/orders/update/', 'mode'); if (!$generalMode || !$receiveMode && !$updateMode) { return; } //----------------------------- // RUN CHILD SYNCH //--------------------------- if ($receiveMode) { $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Orders_Receive(); $tempSynch->process(); } if ($updateMode) { $tempSynch = new Ess_M2ePro_Model_Buy_Synchronization_Tasks_Orders_Update(); $tempSynch->process(); } //--------------------------- }
public function process() { // Check tasks config mode //----------------------------- $generalMode = $this->config->getGroupValue('/ebay/orders/', 'mode'); $receiveMode = $this->config->getGroupValue('/ebay/orders/receive/', 'mode'); $updateMode = $this->config->getGroupValue('/ebay/orders/update/', 'mode'); $cancellationMode = $this->config->getGroupValue('/ebay/orders/cancellation/', 'mode'); $reserveCancellationMode = $this->config->getGroupValue('/ebay/orders/reserve_cancellation/', 'mode'); if (!$generalMode || !$receiveMode && !$cancellationMode && !$reserveCancellationMode) { return false; } //----------------------------- // PREPARE SYNCH //--------------------------- $this->prepareSynch(); //--------------------------- // RUN CANCELLATION SYNCH //--------------------------- $interval = $this->config->getGroupValue('/ebay/orders/cancellation/', 'interval'); $lastAccess = $this->config->getGroupValue('/ebay/orders/cancellation/', 'last_access'); $startDate = $this->config->getGroupValue('/ebay/orders/cancellation/', 'start_date'); $currentTimeStamp = Mage::helper('M2ePro')->getCurrentGmtDate(true); $currentGmtDate = Mage::helper('M2ePro')->getCurrentGmtDate(); $isNowTimeToRun = is_null($lastAccess) || $currentTimeStamp > strtotime($lastAccess) + $interval; $isNowTimeToRun && ($isNowTimeToRun = !is_null($startDate) && $currentTimeStamp > strtotime($startDate)); if ($cancellationMode && $isNowTimeToRun) { $this->config->setGroupValue('/ebay/orders/cancellation/', 'last_access', $currentGmtDate); $tempSynch = new Ess_M2ePro_Model_Ebay_Synchronization_Tasks_Orders_Cancellation(); $tempSynch->process(); } if (is_null($startDate)) { $startDate = new DateTime('now', new DateTimeZone('UTC')); $startDate->modify('+7 days'); $this->config->setGroupValue('/ebay/orders/cancellation/', 'start_date', $startDate->format('Y-m-d H:i:s')); } //--------------------------- // RUN RESERVE CANCELLATION SYNCH //--------------------------- $interval = $this->config->getGroupValue('/ebay/orders/reserve_cancellation/', 'interval'); $lastAccess = $this->config->getGroupValue('/ebay/orders/reserve_cancellation/', 'last_access'); $currentTimeStamp = Mage::helper('M2ePro')->getCurrentGmtDate(true); $currentGmtDate = Mage::helper('M2ePro')->getCurrentGmtDate(); $isNowTimeToRun = is_null($lastAccess) || $currentTimeStamp > strtotime($lastAccess) + $interval; if ($reserveCancellationMode && $isNowTimeToRun) { $this->config->setGroupValue('/ebay/orders/reserve_cancellation/', 'last_access', $currentGmtDate); $tempSynch = new Ess_M2ePro_Model_Ebay_Synchronization_Tasks_Orders_Reserve_Cancellation(); $tempSynch->process(); } //--------------------------- // RUN RECEIVE SYNCH //--------------------------- if ($receiveMode) { $tempSynch = new Ess_M2ePro_Model_Ebay_Synchronization_Tasks_Orders_Receive(); $tempSynch->process(); } //--------------------------- // RUN UPDATE SYNCH //------------------------------ if ($updateMode) { $tempSynch = new Ess_M2ePro_Model_Ebay_Synchronization_Tasks_Orders_Update(); $tempSynch->process(); } //------------------------------ // CANCEL SYNCH //--------------------------- $this->cancelSynch(); //--------------------------- }