From b62b84778105cce243a067904f6be9bdc1774523 Mon Sep 17 00:00:00 2001 From: M2E Pro Date: Tue, 29 Oct 2024 12:32:58 +0000 Subject: [PATCH] 1.69.0 (FINAL RELEASE) --- .../Ebay/Listing/Create/General/Form.php | 12 +- .../Variation/Manage/Tabs/Settings/Form.php | 5 +- .../Variation/Manage/Tabs/Variations/Grid.php | 3 + .../Manage/SetChildListingProductOptions.php | 7 +- Helper/Module/Support.php | 16 +- Model/Ebay/Account.php | 25 ++ Model/Ebay/Account/Builder.php | 9 +- Model/Ebay/Account/Create.php | 15 +- Model/Ebay/Account/Update.php | 9 +- Model/Ebay/Connector/Protocol.php | 2 +- Model/ResourceModel/Account.php | 1 + Model/ResourceModel/Ebay/Account.php | 30 ++ Model/Setup/Installer.php | 414 +++++++++--------- Model/Setup/Upgrader.php | 1 + Setup/MigrationFromMagento1/Modifier.php | 19 +- .../PreconditionsChecker/AbstractModel.php | 2 + .../PreconditionsChecker/Prepared.php | 3 +- Setup/Update/Config.php | 4 +- .../y24_m10/EbayAccountAddSiteColumn.php | 63 +++ Setup/Upgrade/v1_68_2__v1_69_0/Config.php | 15 + composer.json | 2 +- etc/module.xml | 2 +- 22 files changed, 407 insertions(+), 252 deletions(-) create mode 100644 Setup/Update/y24_m10/EbayAccountAddSiteColumn.php create mode 100644 Setup/Upgrade/v1_68_2__v1_69_0/Config.php diff --git a/Block/Adminhtml/Ebay/Listing/Create/General/Form.php b/Block/Adminhtml/Ebay/Listing/Create/General/Form.php index 2984bd90d..51dc978d4 100644 --- a/Block/Adminhtml/Ebay/Listing/Create/General/Form.php +++ b/Block/Adminhtml/Ebay/Listing/Create/General/Form.php @@ -64,13 +64,19 @@ protected function _prepareForm() $title = $this->ebayFactory->getObject('Listing')->getCollection()->getSize() == 0 ? 'Default' : ''; $accountId = ''; - $account = $this->ebayFactory->getObject('Account')->getCollection()->getLastItem(); + /** @var \Ess\M2ePro\Model\Account $accountModel */ + $accountModel = $this->ebayFactory->getObject('Account'); + /** @var \Ess\M2ePro\Model\Account $account */ + $account = $accountModel->getCollection()->getLastItem(); $marketplaceId = $this->getRequest()->getParam('marketplace_id', ''); $marketplaceSelectionDisabled = true; if (!$marketplaceId && $account->getId()) { $accountId = $account->getId(); - $info = \Ess\M2ePro\Helper\Json::decode($account->getChildObject()->getInfo()); - $marketplaceId = $this->activeRecordFactory->getObject('Marketplace')->getIdByCode($info['Site']); + /** @var \Ess\M2ePro\Model\Ebay\Account $ebayAccount */ + $ebayAccount = $account->getChildObject(); + /** @var \Ess\M2ePro\Model\Marketplace $marketplaceModel */ + $marketplaceModel = $this->activeRecordFactory->getObject('Marketplace'); + $marketplaceId = $marketplaceModel->getIdByCode($ebayAccount->getEbaySite()); $marketplaceSelectionDisabled = false; } diff --git a/Block/Adminhtml/Walmart/Listing/Product/Variation/Manage/Tabs/Settings/Form.php b/Block/Adminhtml/Walmart/Listing/Product/Variation/Manage/Tabs/Settings/Form.php index 1c2654f25..6b57e10aa 100644 --- a/Block/Adminhtml/Walmart/Listing/Product/Variation/Manage/Tabs/Settings/Form.php +++ b/Block/Adminhtml/Walmart/Listing/Product/Variation/Manage/Tabs/Settings/Form.php @@ -123,10 +123,7 @@ protected function _prepareForm() HTML; - if ( - !$this->getListingProductTypeModel()->hasChannelGroupId() && - !$this->getListingProduct()->isSetProcessingLock('child_products_in_action') - ) { + if (!$this->getListingProduct()->isSetProcessingLock('child_products_in_action')) { $button = $this->getLayout()->createBlock(\Ess\M2ePro\Block\Adminhtml\Magento\Button::class)->setData([ 'class' => 'action primary', 'label' => $this->getListingProductTypeModel()->hasChannelAttributes() ? diff --git a/Block/Adminhtml/Walmart/Listing/Product/Variation/Manage/Tabs/Variations/Grid.php b/Block/Adminhtml/Walmart/Listing/Product/Variation/Manage/Tabs/Variations/Grid.php index 4bcd7c978..380858c91 100644 --- a/Block/Adminhtml/Walmart/Listing/Product/Variation/Manage/Tabs/Variations/Grid.php +++ b/Block/Adminhtml/Walmart/Listing/Product/Variation/Manage/Tabs/Variations/Grid.php @@ -446,6 +446,9 @@ public function callbackColumnChannelOptions($additionalData, $row, $column, $is $sortedOptions = []; foreach ($matchedAttributes as $magentoAttr => $walmartAttr) { + if (empty($options[$walmartAttr])) { + continue; + } $sortedOptions[$walmartAttr] = $options[$walmartAttr]; } diff --git a/Controller/Adminhtml/Walmart/Listing/Product/Variation/Manage/SetChildListingProductOptions.php b/Controller/Adminhtml/Walmart/Listing/Product/Variation/Manage/SetChildListingProductOptions.php index b7a4037f0..5d32b5d6b 100644 --- a/Controller/Adminhtml/Walmart/Listing/Product/Variation/Manage/SetChildListingProductOptions.php +++ b/Controller/Adminhtml/Walmart/Listing/Product/Variation/Manage/SetChildListingProductOptions.php @@ -78,9 +78,12 @@ public function execute() foreach ($matchedAttributes as $productAttribute => $channelAttribute) { $productOption = $magentoOptions[$productAttribute]; - $channelOption = $channelOptions[$channelAttribute]; + $channelOption = $channelOptions[$channelAttribute] ?? null; - if ($productOption == $channelOption) { + if ( + $channelOption === null + || $productOption == $channelOption + ) { continue; } diff --git a/Helper/Module/Support.php b/Helper/Module/Support.php index 7d1ae953a..e4faa6aeb 100644 --- a/Helper/Module/Support.php +++ b/Helper/Module/Support.php @@ -1,15 +1,11 @@ getData(\Ess\M2ePro\Model\ResourceModel\Ebay\Account::COLUMN_EBAY_SITE); + if (!empty($site)) { + return $site; + } + + $info = $this->getInfo(); + if (empty($info)) { + return ''; + } + + $infoData = json_decode($info, true); + if (!is_array($infoData) || !isset($infoData['Site'])) { + return ''; + } + + return $infoData['Site']; + } + + public function getInfo() + { + return $this->getData(\Ess\M2ePro\Model\ResourceModel\Ebay\Account::COLUMN_INFO); + } } diff --git a/Model/Ebay/Account/Builder.php b/Model/Ebay/Account/Builder.php index 1210caf54..ee226e1e3 100644 --- a/Model/Ebay/Account/Builder.php +++ b/Model/Ebay/Account/Builder.php @@ -3,6 +3,7 @@ namespace Ess\M2ePro\Model\Ebay\Account; use Ess\M2ePro\Model\Ebay\Account as Account; +use Ess\M2ePro\Model\ResourceModel\Ebay\Account as EbayAccountResource; class Builder extends \Ess\M2ePro\Model\ActiveRecord\AbstractBuilder { @@ -29,7 +30,8 @@ protected function prepareData() 'mode', 'user_id', 'is_token_exist', - 'info', + EbayAccountResource::COLUMN_INFO, + EbayAccountResource::COLUMN_EBAY_SITE, 'server_hash', 'sell_api_token_expired_date', ]; @@ -433,7 +435,7 @@ public function getDefaultData(): array 'other_listings_mapping_settings' => [ 'sku' => [ 'mode' => Account::OTHER_LISTINGS_MAPPING_SKU_MODE_DEFAULT, - 'priority' => 1 + 'priority' => 1, ], ], 'mapping_sku_mode' => Account::OTHER_LISTINGS_MAPPING_SKU_MODE_DEFAULT, @@ -505,11 +507,14 @@ public function getDefaultData(): array 'create_magento_shipment' => 1, 'skip_evtin' => 0, + EbayAccountResource::COLUMN_EBAY_SITE => '', 'ebay_store_title' => '', 'ebay_store_url' => '', 'ebay_store_subscription_level' => '', 'ebay_store_description' => '', + EbayAccountResource::COLUMN_INFO => json_encode([]), + 'feedbacks_receive' => 0, 'feedbacks_auto_response' => Account::FEEDBACKS_AUTO_RESPONSE_NONE, 'feedbacks_auto_response_only_positive' => 0, diff --git a/Model/Ebay/Account/Create.php b/Model/Ebay/Account/Create.php index 369ea7be7..cbc165b06 100644 --- a/Model/Ebay/Account/Create.php +++ b/Model/Ebay/Account/Create.php @@ -5,6 +5,7 @@ namespace Ess\M2ePro\Model\Ebay\Account; use Ess\M2ePro\Model\Ebay\Account as EbayAccount; +use Ess\M2ePro\Model\ResourceModel\Ebay\Account as EbayAccountResource; class Create { @@ -44,13 +45,13 @@ public function create(string $authCode, int $mode): \Ess\M2ePro\Model\Account throw new \Ess\M2ePro\Model\Exception('An account with the same eBay User ID already exists.'); } - $data['mode'] = $mode; - $data['is_token_exist'] = 1; - $data['info'] = \Ess\M2ePro\Helper\Json::encode($responseData['info']); - $data['sell_api_token_expired_date'] = $responseData['token_expired_date']; - $data['server_hash'] = $responseData['hash']; - $data['user_id'] = $responseData['user_id']; - $data['title'] = $responseData['user_id']; + $data[EbayAccountResource::COLUMN_MODE] = $mode; + $data[EbayAccountResource::COLUMN_IS_TOKEN_EXIST] = 1; + $data[EbayAccountResource::COLUMN_EBAY_SITE] = $responseData['site']; + $data[EbayAccountResource::COLUMN_SELL_API_TOKEN_EXPIRED_DATE] = $responseData['token_expired_date']; + $data[EbayAccountResource::COLUMN_SERVER_HASH] = $responseData['hash']; + $data[EbayAccountResource::COLUMN_USER_ID] = $responseData['user_id']; + $data[\Ess\M2ePro\Model\ResourceModel\Account::COLUMN_TITLE] = $responseData['user_id']; $builder->build($account, $data); diff --git a/Model/Ebay/Account/Update.php b/Model/Ebay/Account/Update.php index 890d0c9aa..84944f9be 100644 --- a/Model/Ebay/Account/Update.php +++ b/Model/Ebay/Account/Update.php @@ -6,6 +6,7 @@ use Ess\M2ePro\Model\Ebay\Account as EbayAccount; use Ess\M2ePro\Model\Ebay\Account\Issue\ValidTokens; +use Ess\M2ePro\Model\ResourceModel\Ebay\Account as EbayAccountResource; class Update { @@ -45,10 +46,10 @@ public function updateCredentials( $responseData = $this->updateOnServer($account, $authCode, $mode); $dataForUpdate = [ - 'info' => \Ess\M2ePro\Helper\Json::encode($responseData['info']), - 'sell_api_token_expired_date' => $responseData['token_expired_date'], - 'user_id' => $responseData['user_id'], - 'is_token_exist' => 1 + EbayAccountResource::COLUMN_EBAY_SITE => $responseData['site'], + EbayAccountResource::COLUMN_SELL_API_TOKEN_EXPIRED_DATE => $responseData['token_expired_date'], + EbayAccountResource::COLUMN_USER_ID => $responseData['user_id'], + EbayAccountResource::COLUMN_IS_TOKEN_EXIST => 1 ]; $account->getChildObject()->addData($dataForUpdate); diff --git a/Model/Ebay/Connector/Protocol.php b/Model/Ebay/Connector/Protocol.php index 622c5cb76..28e0f4369 100644 --- a/Model/Ebay/Connector/Protocol.php +++ b/Model/Ebay/Connector/Protocol.php @@ -4,7 +4,7 @@ class Protocol implements \Ess\M2ePro\Model\Connector\ProtocolInterface { - public const COMPONENT_VERSION = 26; + public const COMPONENT_VERSION = 27; public function getComponent(): string { diff --git a/Model/ResourceModel/Account.php b/Model/ResourceModel/Account.php index 4922b1f3a..b3e9c4139 100644 --- a/Model/ResourceModel/Account.php +++ b/Model/ResourceModel/Account.php @@ -7,6 +7,7 @@ class Account extends ActiveRecord\Component\Parent\AbstractModel { public const COLUMN_ID = 'id'; + public const COLUMN_TITLE = 'title'; public const COLUMN_CREATE_DATE = 'create_date'; public function _construct() diff --git a/Model/ResourceModel/Ebay/Account.php b/Model/ResourceModel/Ebay/Account.php index 4f5492340..bd5f0d775 100644 --- a/Model/ResourceModel/Ebay/Account.php +++ b/Model/ResourceModel/Ebay/Account.php @@ -5,7 +5,37 @@ class Account extends \Ess\M2ePro\Model\ResourceModel\ActiveRecord\Component\Child\AbstractModel { public const COLUMN_ACCOUNT_ID = 'account_id'; + public const COLUMN_MODE = 'mode'; + public const COLUMN_SERVER_HASH = 'server_hash'; + public const COLUMN_USER_ID = 'user_id'; + public const COLUMN_IS_TOKEN_EXIST = 'is_token_exist'; + public const COLUMN_SELL_API_TOKEN_EXPIRED_DATE = 'sell_api_token_expired_date'; + public const COLUMN_MARKETPLACES_DATA = 'marketplaces_data'; + public const COLUMN_INVENTORY_LAST_SYNCHRONIZATION = 'inventory_last_synchronization'; + public const COLUMN_OTHER_LISTINGS_SYNCHRONIZATION = 'other_listings_synchronization'; + public const COLUMN_OTHER_LISTINGS_MAPPING_MODE = 'other_listings_mapping_mode'; + public const COLUMN_OTHER_LISTINGS_MAPPING_SETTINGS = 'other_listings_mapping_settings'; + public const COLUMN_OTHER_LISTINGS_LAST_SYNCHRONIZATION = 'other_listings_last_synchronization'; + public const COLUMN_FEEDBACKS_RECEIVE = 'feedbacks_receive'; + public const COLUMN_FEEDBACKS_AUTO_RESPONSE = 'feedbacks_auto_response'; + public const COLUMN_FEEDBACKS_AUTO_RESPONSE_ONLY_POSITIVE = 'feedbacks_auto_response_only_positive'; + public const COLUMN_FEEDBACKS_LAST_USED_ID = 'feedbacks_last_used_id'; + public const COLUMN_EBAY_SITE = 'ebay_site'; + public const COLUMN_EBAY_STORE_TITLE = 'ebay_store_title'; + public const COLUMN_EBAY_STORE_URL = 'ebay_store_url'; + public const COLUMN_EBAY_STORE_SUBSCRIPTION_LEVEL = 'ebay_store_subscription_level'; + public const COLUMN_EBAY_STORE_DESCRIPTION = 'ebay_store_description'; + public const COLUMN_INFO = 'info'; + public const COLUMN_USER_PREFERENCES = 'user_preferences'; + public const COLUMN_RATE_TABLES = 'rate_tables'; + public const COLUMN_EBAY_SHIPPING_DISCOUNT_PROFILES = 'ebay_shipping_discount_profiles'; + public const COLUMN_JOB_TOKEN = 'job_token'; + public const COLUMN_ORDERS_LAST_SYNCHRONIZATION = 'orders_last_synchronization'; + public const COLUMN_MAGENTO_ORDERS_SETTINGS = 'magento_orders_settings'; + public const COLUMN_CREATE_MAGENTO_INVOICE = 'create_magento_invoice'; + public const COLUMN_CREATE_MAGENTO_SHIPMENT = 'create_magento_shipment'; public const COLUMN_SKIP_EVTIN = 'skip_evtin'; + public const COLUMN_MESSAGES_RECEIVE = 'messages_receive'; /** @var bool */ protected $_isPkAutoIncrement = false; diff --git a/Model/Setup/Installer.php b/Model/Setup/Installer.php index 22d66500e..5011741b3 100644 --- a/Model/Setup/Installer.php +++ b/Model/Setup/Installer.php @@ -5,6 +5,7 @@ use Ess\M2ePro\Helper\Module\Database\Tables as TablesHelper; use Ess\M2ePro\Model\ResourceModel\Amazon\Dictionary\Marketplace as AmazonDictionaryMarketplaceResoruce; use Ess\M2ePro\Model\ResourceModel\Amazon\Dictionary\ProductType as AmazonDictionaryProductTypeResource; +use Ess\M2ePro\Model\ResourceModel\Ebay\Account as ebayAccountResource; use Magento\Framework\DB\Adapter\AdapterInterface; use Magento\Framework\DB\Ddl\Table; use Magento\Framework\Config\ConfigOptionsListConstants; @@ -3063,7 +3064,7 @@ private function installGeneralData() $moduleConfig->insert('/health_status/notification/', 'level', 40); $this->getConnection()->insertMultiple( - $this->getFullTableName(\Ess\M2ePro\Helper\Module\Database\Tables::TABLE_WIZARD), + $this->getFullTableName(TablesHelper::TABLE_WIZARD), [ [ 'nick' => 'installationEbay', @@ -3160,197 +3161,210 @@ private function installGeneralData() */ private function installEbaySchema() { - $ebayAccountTable = $this->getConnection()->newTable($this->getFullTableName('ebay_account')) - ->addColumn( - 'account_id', - Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'primary' => true, 'nullable' => false] - ) - ->addColumn( - 'mode', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false] - ) - ->addColumn( - 'server_hash', - Table::TYPE_TEXT, - 255, - ['nullable' => false] - ) - ->addColumn( - 'user_id', - Table::TYPE_TEXT, - 255, - ['nullable' => false] - ) - ->addColumn( - 'is_token_exist', - Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0] - ) - ->addColumn( - 'sell_api_token_expired_date', - Table::TYPE_DATETIME, - null, - ['default' => null] - ) - ->addColumn( - 'marketplaces_data', - Table::TYPE_TEXT, - null, - ['default' => null] - ) - ->addColumn( - 'inventory_last_synchronization', - Table::TYPE_DATETIME, - null, - ['default' => null] - ) - ->addColumn( - 'other_listings_synchronization', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 1] - ) - ->addColumn( - 'other_listings_mapping_mode', - Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0] - ) - ->addColumn( - 'other_listings_mapping_settings', - Table::TYPE_TEXT, - 255, - ['default' => null] - ) - ->addColumn( - 'other_listings_last_synchronization', - Table::TYPE_DATETIME, - null, - ['default' => null] - ) - ->addColumn( - 'feedbacks_receive', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0] - ) - ->addColumn( - 'feedbacks_auto_response', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0] - ) - ->addColumn( - 'feedbacks_auto_response_only_positive', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0] - ) - ->addColumn( - 'feedbacks_last_used_id', - Table::TYPE_INTEGER, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0] - ) - ->addColumn( - 'ebay_store_title', - Table::TYPE_TEXT, - 255, - ['nullable' => false] - ) - ->addColumn( - 'ebay_store_url', - Table::TYPE_TEXT, - null, - ['nullable' => false] - ) - ->addColumn( - 'ebay_store_subscription_level', - Table::TYPE_TEXT, - 255, - ['nullable' => false] - ) - ->addColumn( - 'ebay_store_description', - Table::TYPE_TEXT, - null, - ['nullable' => false] - ) - ->addColumn( - 'info', - Table::TYPE_TEXT, - null, - ['default' => null] - ) - ->addColumn( - 'user_preferences', - Table::TYPE_TEXT, - null, - ['default' => null] - ) - ->addColumn( - 'rate_tables', - Table::TYPE_TEXT, - null, - ['default' => null] - ) - ->addColumn( - 'ebay_shipping_discount_profiles', - Table::TYPE_TEXT, - null, - ['default' => null] - ) - ->addColumn( - 'job_token', - Table::TYPE_TEXT, - 255, - ['default' => null] - ) - ->addColumn( - 'orders_last_synchronization', - Table::TYPE_DATETIME, - null, - ['default' => null] - ) - ->addColumn( - 'magento_orders_settings', - Table::TYPE_TEXT, - null, - ['nullable' => false] - ) - ->addColumn( - 'create_magento_invoice', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 1] - ) - ->addColumn( - 'create_magento_shipment', - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 1] - ) - ->addColumn( - \Ess\M2ePro\Model\ResourceModel\Ebay\Account::COLUMN_SKIP_EVTIN, - Table::TYPE_SMALLINT, - null, - ['unsigned' => true, 'nullable' => false, 'default' => 0] - ) - ->addColumn( - 'messages_receive', - Table::TYPE_SMALLINT, - null, - ['nullable' => false, 'default' => 0] - ) - ->setOption('type', 'INNODB') - ->setOption('charset', 'utf8') - ->setOption('collate', 'utf8_general_ci') - ->setOption('row_format', 'dynamic'); + $tableName = $this->getFullTableName(TablesHelper::TABLE_EBAY_ACCOUNT); + + $ebayAccountTable = $this->getConnection()->newTable($tableName); + + $ebayAccountTable + ->addColumn( + ebayAccountResource::COLUMN_ACCOUNT_ID, + Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'primary' => true, 'nullable' => false] + ) + ->addColumn( + ebayAccountResource::COLUMN_MODE, + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false] + ) + ->addColumn( + ebayAccountResource::COLUMN_SERVER_HASH, + Table::TYPE_TEXT, + 255, + ['nullable' => false] + ) + ->addColumn( + ebayAccountResource::COLUMN_USER_ID, + Table::TYPE_TEXT, + 255, + ['nullable' => false] + ) + ->addColumn( + ebayAccountResource::COLUMN_IS_TOKEN_EXIST, + Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0] + ) + ->addColumn( + ebayAccountResource::COLUMN_SELL_API_TOKEN_EXPIRED_DATE, + Table::TYPE_DATETIME, + null, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_MARKETPLACES_DATA, + Table::TYPE_TEXT, + null, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_INVENTORY_LAST_SYNCHRONIZATION, + Table::TYPE_DATETIME, + null, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_OTHER_LISTINGS_SYNCHRONIZATION, + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 1] + ) + ->addColumn( + ebayAccountResource::COLUMN_OTHER_LISTINGS_MAPPING_MODE, + Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0] + ) + ->addColumn( + ebayAccountResource::COLUMN_OTHER_LISTINGS_MAPPING_SETTINGS, + Table::TYPE_TEXT, + 255, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_OTHER_LISTINGS_LAST_SYNCHRONIZATION, + Table::TYPE_DATETIME, + null, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_FEEDBACKS_RECEIVE, + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0] + ) + ->addColumn( + ebayAccountResource::COLUMN_FEEDBACKS_AUTO_RESPONSE, + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0] + ) + ->addColumn( + ebayAccountResource::COLUMN_FEEDBACKS_AUTO_RESPONSE_ONLY_POSITIVE, + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0] + ) + ->addColumn( + ebayAccountResource::COLUMN_FEEDBACKS_LAST_USED_ID, + Table::TYPE_INTEGER, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0] + ) + ->addColumn( + ebayAccountResource::COLUMN_EBAY_SITE, + Table::TYPE_TEXT, + 20, + ['nullable' => false] + ) + ->addColumn( + ebayAccountResource::COLUMN_EBAY_STORE_TITLE, + Table::TYPE_TEXT, + 255, + ['nullable' => false] + ) + ->addColumn( + ebayAccountResource::COLUMN_EBAY_STORE_URL, + Table::TYPE_TEXT, + null, + ['nullable' => false] + ) + ->addColumn( + ebayAccountResource::COLUMN_EBAY_STORE_SUBSCRIPTION_LEVEL, + Table::TYPE_TEXT, + 255, + ['nullable' => false] + ) + ->addColumn( + ebayAccountResource::COLUMN_EBAY_STORE_DESCRIPTION, + Table::TYPE_TEXT, + null, + ['nullable' => false] + ) + ->addColumn( + ebayAccountResource::COLUMN_INFO, + Table::TYPE_TEXT, + null, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_USER_PREFERENCES, + Table::TYPE_TEXT, + null, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_RATE_TABLES, + Table::TYPE_TEXT, + null, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_EBAY_SHIPPING_DISCOUNT_PROFILES, + Table::TYPE_TEXT, + null, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_JOB_TOKEN, + Table::TYPE_TEXT, + 255, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_ORDERS_LAST_SYNCHRONIZATION, + Table::TYPE_DATETIME, + null, + ['default' => null] + ) + ->addColumn( + ebayAccountResource::COLUMN_MAGENTO_ORDERS_SETTINGS, + Table::TYPE_TEXT, + null, + ['nullable' => false] + ) + ->addColumn( + ebayAccountResource::COLUMN_CREATE_MAGENTO_INVOICE, + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 1] + ) + ->addColumn( + ebayAccountResource::COLUMN_CREATE_MAGENTO_SHIPMENT, + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 1] + ) + ->addColumn( + ebayAccountResource::COLUMN_SKIP_EVTIN, + Table::TYPE_SMALLINT, + null, + ['unsigned' => true, 'nullable' => false, 'default' => 0] + ) + ->addColumn( + ebayAccountResource::COLUMN_MESSAGES_RECEIVE, + Table::TYPE_SMALLINT, + null, + ['nullable' => false, 'default' => 0] + ); + + $ebayAccountTable + ->setOption('type', 'INNODB') + ->setOption('charset', 'utf8') + ->setOption('collate', 'utf8_general_ci') + ->setOption('row_format', 'dynamic'); + $this->getConnection()->createTable($ebayAccountTable); $ebayAccountStoreCategoryTable = $this->getConnection()->newTable( @@ -4825,7 +4839,7 @@ private function installEbaySchema() $this->getConnection()->createTable($ebayListingProductScheduledStopActionTable); $ebayMarketplaceTable = $this->getConnection()->newTable( - $this->getFullTableName(\Ess\M2ePro\Helper\Module\Database\Tables::TABLE_EBAY_MARKETPLACE) + $this->getFullTableName(TablesHelper::TABLE_EBAY_MARKETPLACE) ) ->addColumn( EbayMarketplaceResource::COLUMN_MARKETPLACE_ID, @@ -7724,7 +7738,7 @@ private function installEbayData() ); $this->getConnection()->insertMultiple( - $this->getFullTableName(\Ess\M2ePro\Helper\Module\Database\Tables::TABLE_EBAY_MARKETPLACE), + $this->getFullTableName(TablesHelper::TABLE_EBAY_MARKETPLACE), [ [ 'marketplace_id' => 1, @@ -11675,7 +11689,7 @@ private function installWalmartSchema() #region walmart_dictionary_category $walmartDictionaryCategoryTableName = $this->getFullTableName( - \Ess\M2ePro\Helper\Module\Database\Tables::TABLE_WALMART_DICTIONARY_CATEGORY + TablesHelper::TABLE_WALMART_DICTIONARY_CATEGORY ); $walmartDictionaryCategoryTable = $this->getConnection() ->newTable($walmartDictionaryCategoryTableName); @@ -11762,7 +11776,7 @@ private function installWalmartSchema() #region walmart_dictionary_marketplace $walmartDictionaryMarketplaceTableName = $this->getFullTableName( - \Ess\M2ePro\Helper\Module\Database\Tables::TABLE_WALMART_DICTIONARY_MARKETPLACE + TablesHelper::TABLE_WALMART_DICTIONARY_MARKETPLACE ); $walmartDictionaryMarketplaceTable = $this->getConnection() ->newTable($walmartDictionaryMarketplaceTableName); @@ -11814,7 +11828,7 @@ private function installWalmartSchema() #region walmart_dictionary_product_type $walmartDictionaryProductTypeTableName = $this->getFullTableName( - \Ess\M2ePro\Helper\Module\Database\Tables::TABLE_WALMART_DICTIONARY_PRODUCT_TYPE + TablesHelper::TABLE_WALMART_DICTIONARY_PRODUCT_TYPE ); $walmartDictionaryProductTypeTable = $this->getConnection()->newTable( $walmartDictionaryProductTypeTableName @@ -12013,7 +12027,7 @@ private function installWalmartSchema() #region walmart_listing $walmartListingTableName = $this->getFullTableName( - \Ess\M2ePro\Helper\Module\Database\Tables::TABLE_WALMART_LISTING + TablesHelper::TABLE_WALMART_LISTING ); $walmartListingTable = $this->getConnection()->newTable($walmartListingTableName); $walmartListingTable->addColumn( @@ -12073,7 +12087,7 @@ private function installWalmartSchema() #region walmart_listing_auto_category_group $walmartListingAutoCategoryGroupTableName = $this->getFullTableName( - \Ess\M2ePro\Helper\Module\Database\Tables::TABLE_WALMART_LISTING_AUTO_CATEGORY_GROUP + TablesHelper::TABLE_WALMART_LISTING_AUTO_CATEGORY_GROUP ); $walmartListingAutoCategoryGroupTable = $this->getConnection()->newTable( $walmartListingAutoCategoryGroupTableName @@ -13839,7 +13853,7 @@ private function installWalmartSchema() #region walmart_product_type $walmartProductTypeTableName = $this->getFullTableName( - \Ess\M2ePro\Helper\Module\Database\Tables::TABLE_WALMART_PRODUCT_TYPE + TablesHelper::TABLE_WALMART_PRODUCT_TYPE ); $walmartProductTypeTable = $this->getConnection()->newTable( $this->getFullTableName($walmartProductTypeTableName) diff --git a/Model/Setup/Upgrader.php b/Model/Setup/Upgrader.php index b3597301f..95422bc39 100644 --- a/Model/Setup/Upgrader.php +++ b/Model/Setup/Upgrader.php @@ -214,6 +214,7 @@ class Upgrader '1.67.1' => ['1.68.0'], '1.68.0' => ['1.68.1'], '1.68.1' => ['1.68.2'], + '1.68.2' => ['1.69.0'], ]; //######################################## diff --git a/Setup/MigrationFromMagento1/Modifier.php b/Setup/MigrationFromMagento1/Modifier.php index 22af6f9ad..7960c7ffc 100644 --- a/Setup/MigrationFromMagento1/Modifier.php +++ b/Setup/MigrationFromMagento1/Modifier.php @@ -1,21 +1,14 @@ null, 'type' => 1, 'priority' => 5, + ], + [ + 'nick' => 'walmartMigrationToProductTypes', + 'view' => 'walmart', + 'status' => self::WIZARD_STATUS_SKIPPED, + 'step' => null, + 'type' => 1, + 'priority' => 8, ] ]; diff --git a/Setup/MigrationFromMagento1/PreconditionsChecker/AbstractModel.php b/Setup/MigrationFromMagento1/PreconditionsChecker/AbstractModel.php index 6e58c185a..d22436e59 100644 --- a/Setup/MigrationFromMagento1/PreconditionsChecker/AbstractModel.php +++ b/Setup/MigrationFromMagento1/PreconditionsChecker/AbstractModel.php @@ -76,6 +76,8 @@ abstract class AbstractModel '6.65.*', '6.66.*', '6.67.*', + '6.68.*', + '6.69.*', ]; /** @var \Ess\M2ePro\Model\ActiveRecord\Factory */ diff --git a/Setup/MigrationFromMagento1/PreconditionsChecker/Prepared.php b/Setup/MigrationFromMagento1/PreconditionsChecker/Prepared.php index 36c086a9d..52ea404db 100644 --- a/Setup/MigrationFromMagento1/PreconditionsChecker/Prepared.php +++ b/Setup/MigrationFromMagento1/PreconditionsChecker/Prepared.php @@ -72,12 +72,13 @@ public function checkPreconditions() } if (!$this->compareVersions($sourceParams['/migrationtomagento2/source/m2epro/']['version'])) { + $docUrl = \Ess\M2ePro\Helper\Module\Support::DOCUMENTATION_URL . 'migration-from-m1-to-m2'; throw new \Exception( $this->helperFactory->getObject('Module\Translation')->translate([ 'Your current Module version %v% for Magento v1.x does not support Data Migration. Please read our Migration Guide for more details.', $sourceParams['/migrationtomagento2/source/m2epro/']['version'], - $this->supportHelper->getDocumentationArticleUrl('migration-from-m1-to-m2') + $docUrl ]) ); } diff --git a/Setup/Update/Config.php b/Setup/Update/Config.php index 252749f97..0af36eb51 100644 --- a/Setup/Update/Config.php +++ b/Setup/Update/Config.php @@ -387,6 +387,7 @@ public function getFeaturesList(): array ], 'y24_m10' => [ 'DropTableWalmartDictionarySpecific', + 'EbayAccountAddSiteColumn', ], ]; } @@ -479,9 +480,6 @@ public static function getFeaturesForRepeatAfterMigrationFromMagento1(): array \Ess\M2ePro\Setup\Update\y24_m09\RemoveIsNewAsinAvailableFromAmazonMarketplace::class, \Ess\M2ePro\Setup\Update\y24_m09\RemoveUnusedAmazonTables::class, \Ess\M2ePro\Setup\Update\y24_m07\NewListingWizardTables::class, - \Ess\M2ePro\Setup\Update\y24_m09\AddWalmartProductTypes::class, - - \Ess\M2ePro\Setup\Update\y24_m10\DropTableWalmartDictionarySpecific::class, ]; } diff --git a/Setup/Update/y24_m10/EbayAccountAddSiteColumn.php b/Setup/Update/y24_m10/EbayAccountAddSiteColumn.php new file mode 100644 index 000000000..7690362e4 --- /dev/null +++ b/Setup/Update/y24_m10/EbayAccountAddSiteColumn.php @@ -0,0 +1,63 @@ +addEbaySiteColumn(); + $this->fillEbaySiteColumn(); + } + + private function addEbaySiteColumn(): void + { + $modifier = $this->getTableModifier(Tables::TABLE_EBAY_ACCOUNT); + + $modifier->addColumn( + EbayAccountResource::COLUMN_EBAY_SITE, + 'VARCHAR(20) NOT NULL', + null, + EbayAccountResource::COLUMN_FEEDBACKS_LAST_USED_ID, + false, + false + ); + + $modifier->commit(); + } + + private function fillEbaySiteColumn(): void + { + $tableName = $this->getFullTableName(Tables::TABLE_EBAY_ACCOUNT); + $query = $this->installer + ->getConnection() + ->select() + ->from($tableName) + ->query(); + + while ($row = $query->fetch()) { + $accountId = $row[EbayAccountResource::COLUMN_ACCOUNT_ID]; + + if (!isset($row[EbayAccountResource::COLUMN_INFO])) { + continue; + } + + $infoData = json_decode($row[EbayAccountResource::COLUMN_INFO], true); + + if (!is_array($infoData) || !isset($infoData['Site'])) { + continue; + } + + $this->installer->getConnection()->update( + $tableName, + [EbayAccountResource::COLUMN_EBAY_SITE => $infoData['Site']], + [EbayAccountResource::COLUMN_ACCOUNT_ID => $accountId] + ); + } + } +} diff --git a/Setup/Upgrade/v1_68_2__v1_69_0/Config.php b/Setup/Upgrade/v1_68_2__v1_69_0/Config.php new file mode 100644 index 000000000..b3e3d33f7 --- /dev/null +++ b/Setup/Upgrade/v1_68_2__v1_69_0/Config.php @@ -0,0 +1,15 @@ + - +