Skip to content

Commit

Permalink
OXAP-275 added method exception to disable the cronjob on amazon call…
Browse files Browse the repository at this point in the history
… function

- fixed html path for docker
  • Loading branch information
mKnoop committed Nov 12, 2019
1 parent 63597f5 commit 142b3b0
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 41 deletions.
83 changes: 43 additions & 40 deletions application/controllers/bestitamazoncron.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 142b3b0

Please sign in to comment.