shoppingflux / shoppingfluxexport

7 stars 7 forks source link

SHOPPING_BACKOFFICE_CALL value should be set after SHOPPING_FLUX_ORDERS condition #345

Closed ghost closed 6 years ago

ghost commented 6 years ago

Expected behaviour

If SHOPPING_FLUX_ORDERS is not enabled (so "Order import" parameter isn't checked), then we should anyway be able to use orders.php at anytime to import orders from cron/manually.

Actual behaviour

orders.php is in fact triggering the good conditions to check orders from the webservice, however SHOPPING_BACKOFFICE_CALL (which roles is to make sure that there is at least 1 minute delay between each API call) is sometimes set by other events that are not even triggering API calls. Therefore, Configuration::updateValue('SHOPPING_BACKOFFICE_CALL', $now); should be set after the condition preceding the API call.

Steps to reproduce the behaviour

Do not check "Order import" in the settings and try calling orders.php multiple time at 1 minute interval. Some of the calls will never be triggered.

ghost commented 6 years ago
            if (($controller == 'adminorders' &&
                $ordersConfig != '' &&
                $curlInstalled) ||
                $no_cron == false ||
                $forcedOrder) {

                Configuration::updateValue('SHOPPING_BACKOFFICE_CALL', $now);