conn = $db->getConnection(); $this->db = $db; $this->setShop($shop); $settings = $db->getSettings($this->shop); $settingsFactory = new \Core\App\Factory\SettingsFactory(); $this->settings = $settingsFactory->createSettings( isset($settings['fsync_auth_apikey']) ? $settings['fsync_auth_apikey'] : '', isset($settings['fsync_auth_username']) ? $settings['fsync_auth_username'] : '', isset($settings['fsync_auth_password']) ? $settings['fsync_auth_password'] : '', isset($settings['fsync_auth_fiscalcode']) ? $settings['fsync_auth_fiscalcode'] : '', isset($settings['fsync_option_autosyncstock']) ? $settings['fsync_option_autosyncstock'] : '', isset($settings['fsync_option_autosyncorder']) ? $settings['fsync_option_autosyncorder'] : '', isset($settings['fsync_option_filterstock']) ? $settings['fsync_option_filterstock'] : '', isset($settings['fsync_option_syncordersas']) ? $settings['fsync_option_syncordersas'] : '', isset($settings['fsync_option_proformaserie']) ? $settings['fsync_option_proformaserie'] : '', isset($settings['fsync_option_daysago']) ? $settings['fsync_option_daysago'] : '', isset($settings['fsync_option_locations']) ? $settings['fsync_option_locations'] : null, isset($settings['fsync_option_withdiscount']) ? $settings['fsync_option_withdiscount'] : '' ); } public function getAuthApiKey() { return $this->settings->getAuthApiKey(); } public function getAuthUsername() { return $this->settings->getAuthUsername(); } public function getAuthPassword() { return $this->settings->getAuthPassword(); } public function getAuthFiscalCode() { return $this->settings->getAuthFiscalCode(); } public function getOptionAutoStockSync() { return $this->settings->getOptionAutoStockSync(); } public function getOptionAutoOrderSync() { return $this->settings->getOptionAutoOrderSync(); } public function getOptionStockFilter() { return $this->settings->getOptionStockFilter(); } public function getOptionOrderOrProforma() { return $this->settings->getOptionOrderOrProforma(); } public function getOptionProformaSerie() { return $this->settings->getOptionProformaSerie(); } public function getOptionOrderedDaysAgo() { return $this->settings->getOptionOrderedDaysAgo(); } public function getOptionLocations() { return $this->settings->getOptionLocations(); } public function getCustomFieldBank() { return $this->settings->getCustomFieldBank(); } public function getCustomFieldAccount() { return $this->settings->getCustomFieldAccount(); } public function getCustomFieldCompany() { return $this->settings->getCustomFieldCompany(); } public function getCustomFieldFiscalCode() { return $this->settings->getCustomFieldFiscalCode(); } public function getCustomFieldRegNumber() { return $this->settings->getCustomFieldRegNumber(); } public function getSyncDataTypes() { return $this->settings->getSyncDataTypes(); } public function getSyncOptions() { return array( 'fsync_option_autosyncstock' => $this->settings->getOptionAutoStockSync(), 'fsync_option_autosyncorder' => $this->settings->getOptionAutoOrderSync(), 'fsync_option_filterstock' => $this->settings->getOptionStockFilter(), 'fsync_option_syncordersas' => $this->settings->getOptionOrderOrProforma(), 'fsync_option_proformaserie' => $this->settings->getOptionProformaSerie(), 'fsync_option_daysago' => $this->settings->getOptionOrderedDaysAgo(), 'fsync_option_locations' => $this->settings->getOptionLocations(), 'fsync_option_withdiscount' => $this->settings->getOptionWithDiscount() ); } public function getSyncAuth() { return array( 'fsync_auth_apikey' => $this->settings->getAuthApiKey(), 'fsync_auth_username' => $this->settings->getAuthUsername(), 'fsync_auth_password' => $this->settings->getAuthPassword(), 'fsync_auth_fiscalcode' => $this->settings->getAuthFiscalCode() ); } public function getToken() { return $this->db->getToken($this->shop); } public function getShop() { if(!empty($this->shop)) { return str_replace(SHOPIFY_DOMAIN, '', $this->shop); } else { throw new \Exception('A shop name is required for the script to run'); } } public function getVersionLink() { return VERSION_LINK; } public function getVersion() { return VERSION; } public function setShop($shop = '') { $this->shop = ''; if(!empty($shop)) { $this->shop = $shop; } else { if(isset($_GET['shop'])) { $this->shop = $_GET['shop']; } } } public function getSyncOrdersAs() { return array( \Core\App\Factory\SettingsFactory::SELECT_ORDER, \Core\App\Factory\SettingsFactory::SELECT_PROFORMA ); } public function getAutoSyncOptions() { return array( \Core\App\Factory\SettingsFactory::AUTO_SYNC_ENABLED, \Core\App\Factory\SettingsFactory::AUTO_SYNC_DISABLED ); } public function getOptionWithDiscount() { return $this->settings->getOptionWithDiscount(); } public function getEnabledDisabledOptions() { return array( \Core\App\Factory\SettingsFactory::SYNC_ENABLED, \Core\App\Factory\SettingsFactory::SYNC_DISABLED ); } public function checkLatestVersion($language) { $errorMessage = '