* @copyright 2020 DIGITAL RETAIL TECHNOLOGIES SL * @license https://opensource.org/licenses/MIT The MIT License * * Don't forget to prefix your containers with your own identifier * to avoid any conflicts with others containers. */ require_once(dirname(__FILE__) . '/../RetailcrmPrestashopLoader.php'); class RetailcrmInventoriesEvent implements RetailcrmEventInterface { /** * @inheritDoc */ public function execute() { $apiUrl = Configuration::get(RetailCRM::API_URL); $apiKey = Configuration::get(RetailCRM::API_KEY); if (!empty($apiUrl) && !empty($apiKey)) { RetailcrmInventories::$api = new RetailcrmProxy($apiUrl, $apiKey, _PS_ROOT_DIR_ . '/retailcrm.log'); } else { RetailcrmLogger::writeCaller('inventories', 'set api key & url first'); exit(); } RetailcrmInventories::loadStocks(); } } if (Configuration::get(RetailCRM::ENABLE_BALANCES_RECEIVING)) { $event = new RetailcrmInventoriesEvent(); $event->execute(); } else { RetailcrmLogger::writeDebug( 'RetailcrmInventoriesEvent', 'Balances receiving is not enabled, skipping...' ); }