diff --git a/application/controllers/bestitamazoncron.php b/application/controllers/bestitamazoncron.php index 7a857cf..44a0d4e 100755 --- a/application/controllers/bestitamazoncron.php +++ b/application/controllers/bestitamazoncron.php @@ -288,49 +288,52 @@ protected function _closeOrders() * @throws Exception * @throws oxSystemComponentException * - * @return void + * @return string */ public function render() { - //Increase execution time for the script to run without timeouts - set_time_limit(3600); - - $this->_oLogger->info('Cronjob started'); - - //If ERP mode is enabled do nothing, if IPN or CRON authorize unauthorized orders - if ((bool)$this->_getContainer()->getConfig()->getConfigParam('blAmazonERP') === true) { - $this->setViewData(array('sError' => 'ERP mode is ON (Module settings)')); - $this->_oLogger->info('ERP mode is ON (Module settings)'); - } elseif ((string)$this->_getContainer()->getConfig()->getConfigParam('sAmazonAuthorize') !== 'CRON') { - $this->setViewData(array('sError' => 'Trigger Authorise via Cronjob mode is turned Off (Module settings)')); - $this->_oLogger->info('Cronjob state: Trigger Authorise via Cronjob mode is turned Off (Module settings)'); - } else { - $this->_oLogger->info('Update authorized orders'); - //Authorize unauthorized or Authorize-Pending orders - $this->_updateAuthorizedOrders(); - - $this->_oLogger->info('Update declined orders'); - //Check for declined orders - $this->_updateDeclinedOrders(); - - $this->_oLogger->info('Update suspended orders'); - //Check for suspended orders - $this->_updateSuspendedOrders(); - - $this->_oLogger->info('Capture orders'); - //Capture handling - $this->_captureOrders(); - - $this->_oLogger->info('Update refund stats'); - //Check refund stats - $this->_updateRefundDetails(); - - $this->_oLogger->info('Close orders'); - //Check for order which can be closed - $this->_closeOrders(); - - $this->_oLogger->info('Cronjob finished'); - $this->_addToMessages('Done'); + // Only execute the complete cronjob if the action is not amazon call + if ($this->_getContainer()->getConfig()->getRequestParameter('fnc') !== 'amazonCall') { + //Increase execution time for the script to run without timeouts + set_time_limit(3600); + + $this->_oLogger->info('Cronjob started'); + + //If ERP mode is enabled do nothing, if IPN or CRON authorize unauthorized orders + if ((bool)$this->_getContainer()->getConfig()->getConfigParam('blAmazonERP') === true) { + $this->setViewData(array('sError' => 'ERP mode is ON (Module settings)')); + $this->_oLogger->info('ERP mode is ON (Module settings)'); + } elseif ((string)$this->_getContainer()->getConfig()->getConfigParam('sAmazonAuthorize') !== 'CRON') { + $this->setViewData(array('sError' => 'Trigger Authorise via Cronjob mode is turned Off (Module settings)')); + $this->_oLogger->info('Cronjob state: Trigger Authorise via Cronjob mode is turned Off (Module settings)'); + } else { + $this->_oLogger->info('Update authorized orders'); + //Authorize unauthorized or Authorize-Pending orders + $this->_updateAuthorizedOrders(); + + $this->_oLogger->info('Update declined orders'); + //Check for declined orders + $this->_updateDeclinedOrders(); + + $this->_oLogger->info('Update suspended orders'); + //Check for suspended orders + $this->_updateSuspendedOrders(); + + $this->_oLogger->info('Capture orders'); + //Capture handling + $this->_captureOrders(); + + $this->_oLogger->info('Update refund stats'); + //Check refund stats + $this->_updateRefundDetails(); + + $this->_oLogger->info('Close orders'); + //Check for order which can be closed + $this->_closeOrders(); + + $this->_oLogger->info('Cronjob finished'); + $this->_addToMessages('Done'); + } } return $this->_sThisTemplate; diff --git a/docker-compose.yml b/docker-compose.yml index f9f9206..88db2b5 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -15,7 +15,7 @@ services: depends_on: - mysql environment: - APP_DIR: /var/www/app + APP_DIR: /var/www/html MODULE_DIR: /var/www/module HTTP_PORT: 8100 HTTPS_PORT: 4444