From 89a90ad88f1c0876f051e0d4691f90f1f5c7c5d6 Mon Sep 17 00:00:00 2001 From: Dmitriy Belousov Date: Sun, 5 Feb 2017 16:56:51 +0200 Subject: [PATCH] 6.4.8 release --- app/code/community/Ess/M2ePro/CHANGELOG | 20 + .../Controller/Adminhtml/BaseController.php | 67 +- .../Development/CommandController.php | 7 + .../Controller/Adminhtml/MainController.php | 4 +- .../Ess/M2ePro/Helper/Component/Ebay.php | 1 + .../M2ePro/Helper/Component/Ebay/Motors.php | 1 + app/code/community/Ess/M2ePro/Helper/Data.php | 20 +- .../community/Ess/M2ePro/Helper/Module.php | 2 +- .../Amazon/Listing/Product/Repricing.php | 2 +- .../Relation/Parent/Processor/Sub/Options.php | 17 +- .../Listing/Product/Variation/Updater.php | 5 +- .../Repricing/Synchronization/ActualPrice.php | 4 +- .../Repricing/Synchronization/General.php | 48 +- .../UpdateListingsProducts/Responser.php | 13 + .../OtherListings/Update/Responser.php | 10 +- .../Ess/M2ePro/Model/Cron/Runner/Service.php | 2 + .../Synchronization/Orders/Cancellation.php | 6 +- .../community/Ess/M2ePro/Model/Listing.php | 2 +- .../Product/Rule/Condition/Abstract.php | 7 +- .../Model/Mysql4/Amazon/Listing/Other.php | 2 +- .../Amazon/Listing/Product/Repricing.php | 2 +- .../Ess/M2ePro/Model/Order/Reserve.php | 1 + .../Ess/M2ePro/Model/Upgrade/MySqlSetup.php | 183 +- .../Amazon/Listing/RepricingController.php | 16 + .../Adminhtml/Common/LogController.php | 6 +- .../Development/InspectionController.php | 16 + .../Ebay/ConfigurationController.php | 2 +- app/code/community/Ess/M2ePro/etc/config.xml | 2 +- .../sql/M2ePro_setup/mysql4-install-6.4.8.php | 3493 +++++++++++++++++ .../mysql4-upgrade-6.4.7.1-6.4.8.php | 87 + composer.json | 5 +- 31 files changed, 3974 insertions(+), 79 deletions(-) create mode 100644 app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-install-6.4.8.php create mode 100644 app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-upgrade-6.4.7.1-6.4.8.php diff --git a/app/code/community/Ess/M2ePro/CHANGELOG b/app/code/community/Ess/M2ePro/CHANGELOG index 33ed457cd..f830d3e24 100644 --- a/app/code/community/Ess/M2ePro/CHANGELOG +++ b/app/code/community/Ess/M2ePro/CHANGELOG @@ -1,3 +1,23 @@ +* 6.4.8 (r11156) (06/02/2017) + +* Added: [eBay] Ability to use Parts Compatibility Feature for France Marketplace (kTypes) +* Improvement: More stable extension Install / Upgrade process +* Improvement: Prevention of executing synchronization in parallel when Service Cron is working +* Fix: Wrong message "Domain is invalid for this license" in some cases +* Fix: Magento Order was not created due to "Out of Stock" reason if Product Quantity was reserved earlier +* Fix: Unicode string may be cut in a wrong place (on the border of two bytes of one Unicode character) +* Fix: Warning "Compilation failed: regular expression is too large at offset" when you are using Advanced Filter of the Grid +* Fix: "Unknown Product type." exception, during synchronization, if Variation Magento Product was removed directly from database +* Fix: [eBay] Automatic Cancellation did not work for the Orders, which were not paid +* Fix: [eBay] Custom Import from CSV file of Parts Compatibilities (ePIDs/kTypes) did not work in some cases +* Fix: [Amazon] "Disable Repricing" option did not work correctly for Variational Products +* Fix: [Amazon] "Duplicate entry for key 'PRIMARY'" error during Synchronization process +* Fix: [Amazon] If some Products are managed by Repricing Tool, their prices can have wrong values in the grids +* Fix: [Amazon] If some Products are added to the Repricing Tool but they are in the disabled state, their prices can have wrong values in the grids +* Fix: [Amazon] If Magento Product becomes Variational, some associated Listing Products may be broken as a result +* Fix: [Amazon] Incorrect behavior during adding virtual attributes to active variation products +* Fix: [Amazon] Error message "General ID "%id%" is invalid" can be shown during List/Relist/... actions, even if the value is a valid ISBN10 + * 6.4.7.1 (r11020) (05/12/2016) * Fix: [Amazon] Ability to use Repricing Service without the need to contact support of M2E Pro diff --git a/app/code/community/Ess/M2ePro/Controller/Adminhtml/BaseController.php b/app/code/community/Ess/M2ePro/Controller/Adminhtml/BaseController.php index a1754af66..b3dfc78cf 100644 --- a/app/code/community/Ess/M2ePro/Controller/Adminhtml/BaseController.php +++ b/app/code/community/Ess/M2ePro/Controller/Adminhtml/BaseController.php @@ -13,6 +13,8 @@ abstract class Ess_M2ePro_Controller_Adminhtml_BaseController protected $pageHelpLink = NULL; + protected $isUnAuthorized = false; + //######################################## public function indexAction() @@ -43,7 +45,7 @@ protected function getPageHelpLink() //######################################## - public function preDispatch() + final public function preDispatch() { parent::preDispatch(); @@ -57,41 +59,51 @@ public function preDispatch() * The code below is the logical extension of the method \Ess_M2ePro_Controller_Router::addModule. */ // ----------------------------------------------------------------- - if (!$this->getRequest()->isDispatched() && - !Mage::getSingleton('admin/session')->isLoggedIn() && - $this->getRequest()->getActionName() == 'login') { + if (!Mage::getSingleton('admin/session')->isLoggedIn()) { - return $this->_redirect('M2ePro/index/index/'); - } - // ----------------------------------------------------------------- + $this->isUnAuthorized = true; - // client was logged out - if ($this->getRequest()->isXmlHttpRequest() && - !Mage::getSingleton('admin/session')->isLoggedIn()) { + $this->setFlag('', self::FLAG_NO_DISPATCH, true); + $this->setFlag('', self::FLAG_NO_POST_DISPATCH, true); + $this->setFlag('', self::FLAG_NO_PRE_DISPATCH, true); - exit(json_encode(array( - 'ajaxExpired' => 1, - 'ajaxRedirect' => $this->_getRefererUrl() - ))); + if ($this->getRequest()->isXmlHttpRequest()) { + exit(json_encode(array( + 'ajaxExpired' => 1, + 'ajaxRedirect' => Mage::getBaseUrl() + ))); + } + + if (Mage::helper('M2ePro/Module')->isProductionEnvironment()) { + return $this->getResponse()->setRedirect(Mage::getBaseUrl()); + } } + // ----------------------------------------------------------------- + + Mage::helper('M2ePro/Module_Exception')->setFatalErrorHandler(); - // flag controller loaded + // flag that controller is loaded if (is_null(Mage::helper('M2ePro/Data_Global')->getValue('is_base_controller_loaded'))) { Mage::helper('M2ePro/Data_Global')->setValue('is_base_controller_loaded',true); } + $this->__preDispatch(); + return $this; } - public function dispatch($action) + final public function dispatch($action) { try { - Mage::helper('M2ePro/Module_Exception')->setFatalErrorHandler(); parent::dispatch($action); } catch (Exception $exception) { + if ($this->isUnAuthorized) { + throw $exception; + } + if ($this->getRequest()->getControllerName() == Mage::helper('M2ePro/Module_Support')->getPageControllerName()) { exit($exception->getMessage()); @@ -127,6 +139,27 @@ public function dispatch($action) } } + final public function postDispatch() + { + parent::postDispatch(); + + if ($this->isUnAuthorized) { + return; + } + + $this->__postDispatch(); + } + + //######################################## + + protected function __preDispatch() {} + + protected function __postDispatch() + { + // Removes garbage from the response's body + ob_get_clean(); + } + //######################################## public function loadLayout($ids=null, $generateBlocks=true, $generateXml=true) diff --git a/app/code/community/Ess/M2ePro/Controller/Adminhtml/Development/CommandController.php b/app/code/community/Ess/M2ePro/Controller/Adminhtml/Development/CommandController.php index d34eb4ff1..7d073b896 100644 --- a/app/code/community/Ess/M2ePro/Controller/Adminhtml/Development/CommandController.php +++ b/app/code/community/Ess/M2ePro/Controller/Adminhtml/Development/CommandController.php @@ -11,6 +11,13 @@ abstract class Ess_M2ePro_Controller_Adminhtml_Development_CommandController { //######################################## + /** + * Allows fill response by echo(), etc. + */ + protected function __postDispatch() {} + + //######################################## + public function indexAction() { $this->_redirect(Mage::helper('M2ePro/View_Development')->getPageRoute()); diff --git a/app/code/community/Ess/M2ePro/Controller/Adminhtml/MainController.php b/app/code/community/Ess/M2ePro/Controller/Adminhtml/MainController.php index cafcac1f2..cdacd87dc 100644 --- a/app/code/community/Ess/M2ePro/Controller/Adminhtml/MainController.php +++ b/app/code/community/Ess/M2ePro/Controller/Adminhtml/MainController.php @@ -11,9 +11,9 @@ abstract class Ess_M2ePro_Controller_Adminhtml_MainController { //######################################## - public function preDispatch() + protected function __preDispatch() { - parent::preDispatch(); + parent::__preDispatch(); if ($this->getRequest()->isGet() && !$this->getRequest()->isPost() && diff --git a/app/code/community/Ess/M2ePro/Helper/Component/Ebay.php b/app/code/community/Ess/M2ePro/Helper/Component/Ebay.php index f411ed308..087f4b084 100644 --- a/app/code/community/Ess/M2ePro/Helper/Component/Ebay.php +++ b/app/code/community/Ess/M2ePro/Helper/Component/Ebay.php @@ -14,6 +14,7 @@ class Ess_M2ePro_Helper_Component_Ebay extends Mage_Core_Helper_Abstract const MARKETPLACE_MOTORS = 9; const MARKETPLACE_AU = 4; const MARKETPLACE_UK = 3; + const MARKETPLACE_FR = 7; const MARKETPLACE_DE = 8; const MARKETPLACE_IT = 10; diff --git a/app/code/community/Ess/M2ePro/Helper/Component/Ebay/Motors.php b/app/code/community/Ess/M2ePro/Helper/Component/Ebay/Motors.php index d810721de..aa6bfe9f3 100644 --- a/app/code/community/Ess/M2ePro/Helper/Component/Ebay/Motors.php +++ b/app/code/community/Ess/M2ePro/Helper/Component/Ebay/Motors.php @@ -38,6 +38,7 @@ public function getKtypeSupportedMarketplaces() Ess_M2ePro_Helper_Component_Ebay::MARKETPLACE_UK, Ess_M2ePro_Helper_Component_Ebay::MARKETPLACE_DE, Ess_M2ePro_Helper_Component_Ebay::MARKETPLACE_IT, + Ess_M2ePro_Helper_Component_Ebay::MARKETPLACE_FR, ); } diff --git a/app/code/community/Ess/M2ePro/Helper/Data.php b/app/code/community/Ess/M2ePro/Helper/Data.php index 41da05e8b..50b79c63d 100644 --- a/app/code/community/Ess/M2ePro/Helper/Data.php +++ b/app/code/community/Ess/M2ePro/Helper/Data.php @@ -208,14 +208,19 @@ public function escapeHtml($data, $allowedTags = null, $flags = ENT_COMPAT) public function reduceWordsInString($string, $neededLength, $longWord = 6, $minWordLen = 2, $atEndOfWord = '.') { - if (strlen($string) <= $neededLength) { + $oldEncoding = mb_internal_encoding(); + mb_internal_encoding('UTF-8'); + + if (mb_strlen($string) <= $neededLength) { + + mb_internal_encoding($oldEncoding); return $string; } $longWords = array(); foreach (explode(' ', $string) as $word) { - if (strlen($word) >= $longWord && !preg_match('/[0-9]/', $word)) { - $longWords[$word] = strlen($word) - $minWordLen; + if (mb_strlen($word) >= $longWord && !preg_match('/[0-9]/', $word)) { + $longWords[$word] = mb_strlen($word) - $minWordLen; } } @@ -224,9 +229,11 @@ public function reduceWordsInString($string, $neededLength, $longWord = 6, $minW $canBeReduced += $canBeReducedForWord; } - $needToBeReduced = strlen($string) - $neededLength + (count($longWords) * strlen($atEndOfWord)); + $needToBeReduced = mb_strlen($string) - $neededLength + (count($longWords) * mb_strlen($atEndOfWord)); if ($canBeReduced < $needToBeReduced) { + + mb_internal_encoding($oldEncoding); return $string; } @@ -234,7 +241,7 @@ public function reduceWordsInString($string, $neededLength, $longWord = 6, $minW foreach ($longWords as $word => $canBeReducedForWord) { $willReduced = ceil($weightOfOneLetter * $canBeReducedForWord); - $reducedWord = substr($word, 0, strlen($word) - $willReduced) . $atEndOfWord; + $reducedWord = mb_substr($word, 0, mb_strlen($word) - $willReduced) . $atEndOfWord; $string = str_replace($word, $reducedWord, $string); @@ -243,6 +250,7 @@ public function reduceWordsInString($string, $neededLength, $longWord = 6, $minW } } + mb_internal_encoding($oldEncoding); return $string; } @@ -495,6 +503,8 @@ public function isISBN10($string) } $a = 0; + $string = (string)$string; + for ($i = 0; $i < 10; $i++) { if ($string[$i] == "X" || $string[$i] == "x") { $a += 10 * intval(10 - $i); diff --git a/app/code/community/Ess/M2ePro/Helper/Module.php b/app/code/community/Ess/M2ePro/Helper/Module.php index 3691be136..28edc9c1e 100644 --- a/app/code/community/Ess/M2ePro/Helper/Module.php +++ b/app/code/community/Ess/M2ePro/Helper/Module.php @@ -72,7 +72,7 @@ public function getVersion() public function getRevision() { - $revision = '11020'; + $revision = '11156'; if ($revision == str_replace('|','#','|REVISION|')) { $revision = (int)exec('svnversion'); diff --git a/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Repricing.php b/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Repricing.php index ce3f01fa3..2086a94d1 100644 --- a/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Repricing.php +++ b/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Repricing.php @@ -283,7 +283,7 @@ public function isDisabled() return $isDisabled; } - if ($this->getMagentoProduct()->isSimpleType() || $this->getMagentoProduct()->isGroupedType()) { + if ($this->getMagentoProduct()->isSimpleType() || $this->getMagentoProduct()->isBundleType()) { return $isDisabled; } diff --git a/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Variation/Manager/Type/Relation/Parent/Processor/Sub/Options.php b/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Variation/Manager/Type/Relation/Parent/Processor/Sub/Options.php index 6979e20c5..940ec5893 100644 --- a/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Variation/Manager/Type/Relation/Parent/Processor/Sub/Options.php +++ b/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Variation/Manager/Type/Relation/Parent/Processor/Sub/Options.php @@ -38,14 +38,16 @@ protected function check() return; } + $channelVariations = $this->getProcessor()->getTypeModel()->getChannelVariations(); + foreach ($this->getProcessor()->getTypeModel()->getChildListingsProducts() as $listingProduct) { /** @var Ess_M2ePro_Model_Listing_Product $listingProduct */ - /** @var Ess_M2ePro_Model_Amazon_Listing_Product_Variation_Manager $variationManager */ - $variationManager = $listingProduct->getChildObject()->getVariationManager(); + /** @var Ess_M2ePro_Model_Amazon_Listing_Product $amazonListingProduct */ + $amazonListingProduct = $listingProduct->getChildObject(); /** @var Ess_M2ePro_Model_Amazon_Listing_Product_Variation_Manager_Type_Relation_Child $typeModel */ - $typeModel = $variationManager->getTypeModel(); + $typeModel = $amazonListingProduct->getVariationManager()->getTypeModel(); if (!$typeModel->isActualProductAttributes() || !$typeModel->isActualMatchedAttributes() || @@ -55,6 +57,15 @@ protected function check() $typeModel->resetProductVariation(); } + if ($typeModel->isVariationChannelMatched()) { + $currentChannelOptions = $channelVariations[$amazonListingProduct->getGeneralId()]; + $childChannelOptions = $typeModel->getChannelOptions(); + + if ($currentChannelOptions != $childChannelOptions) { + $typeModel->setChannelVariation($currentChannelOptions); + } + } + if (!$typeModel->isVariationProductMatched() && !$typeModel->isVariationChannelMatched()) { $this->getProcessor()->tryToRemoveChildListingProduct($listingProduct); continue; diff --git a/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Variation/Updater.php b/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Variation/Updater.php index a3e351750..d0c20c970 100644 --- a/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Variation/Updater.php +++ b/app/code/community/Ess/M2ePro/Model/Amazon/Listing/Product/Variation/Updater.php @@ -62,9 +62,8 @@ private function checkChangeAsVariationProduct(Ess_M2ePro_Model_Listing_Product } $listingProduct->setData('is_variation_product', 1); - $variationManager->setRelationParentType(); - $variationManager->getTypeModel()->resetProductAttributes(false); - $variationManager->getTypeModel()->getProcessor()->process(); + $variationManager->setIndividualType(); + $variationManager->getTypeModel()->resetProductVariation(); return true; } diff --git a/app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/ActualPrice.php b/app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/ActualPrice.php index 794f85631..1c1dbe74f 100644 --- a/app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/ActualPrice.php +++ b/app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/ActualPrice.php @@ -14,8 +14,8 @@ class Ess_M2ePro_Model_Amazon_Repricing_Synchronization_ActualPrice public function run($skus = NULL) { $existedSkus = array_unique(array_merge( - Mage::getResourceModel('M2ePro/Amazon_Listing_Product_Repricing')->getAllSkus($this->getAccount()), - Mage::getResourceModel('M2ePro/Amazon_Listing_Other')->getAllRepricingSkus($this->getAccount()) + Mage::getResourceModel('M2ePro/Amazon_Listing_Product_Repricing')->getAllSkus($this->getAccount(), true), + Mage::getResourceModel('M2ePro/Amazon_Listing_Other')->getAllRepricingSkus($this->getAccount(), true) )); if (is_null($skus)) { diff --git a/app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/General.php b/app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/General.php index 525473bd1..d26ce4017 100644 --- a/app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/General.php +++ b/app/code/community/Ess/M2ePro/Model/Amazon/Repricing/Synchronization/General.php @@ -20,6 +20,7 @@ public function run($skus = NULL) $filters = array( 'skus_list' => $skus, ); + $skus = array_map('strtolower', $skus); } $response = $this->sendRequest($filters); @@ -41,16 +42,19 @@ public function run($skus = NULL) Mage::getResourceModel('M2ePro/Amazon_Listing_Product_Repricing')->getAllSkus($this->getAccount()), Mage::getResourceModel('M2ePro/Amazon_Listing_Other')->getAllRepricingSkus($this->getAccount()) )); + $existedSkus = array_map('strtolower', $existedSkus); if (!is_null($skus)) { $existedSkus = array_intersect($skus, $existedSkus); } - $existedSkus = array_map('strtolower', $existedSkus); - $skuIndexedResultOffersData = array(); foreach ($response['offers'] as $offerData) { - $skuIndexedResultOffersData[strtolower($offerData['sku'])] = $offerData; + $offerSku = strtolower($offerData['sku']); + if (!is_null($skus) && !in_array($offerSku, $skus, true)) { + continue; + } + $skuIndexedResultOffersData[$offerSku] = $offerData; } $this->processNewOffers($skuIndexedResultOffersData, $existedSkus); @@ -79,14 +83,15 @@ protected function getMode() private function processNewOffers(array $resultOffersData, array $existedSkus) { - $newOffersSkus = array_diff(array_keys($resultOffersData), $existedSkus); - if (empty($newOffersSkus)) { - return; + $newOffersData = array(); + foreach ($resultOffersData as $offerSku => $offerData) { + if (!in_array((string)$offerSku, $existedSkus, true)) { + $newOffersData[(string)$offerSku] = $offerData; + } } - $newOffersData = array(); - foreach ($newOffersSkus as $newOfferSku) { - $newOffersData[$newOfferSku] = $resultOffersData[$newOfferSku]; + if (empty($newOffersData)) { + return; } $this->addListingsProductsRepricing($newOffersData); @@ -95,7 +100,13 @@ private function processNewOffers(array $resultOffersData, array $existedSkus) private function processRemovedOffers(array $resultOffersData, array $existedSkus) { - $removedOffersSkus = array_diff($existedSkus, array_keys($resultOffersData)); + $removedOffersSkus = array(); + foreach ($existedSkus as $existedSku) { + if (!array_key_exists((string)$existedSku, $resultOffersData)) { + $removedOffersSkus[] = (string)$existedSku; + } + } + if (empty($removedOffersSkus)) { return; } @@ -106,14 +117,15 @@ private function processRemovedOffers(array $resultOffersData, array $existedSku private function processUpdatedOffers(array $resultOffersData, array $existedSkus) { - $updatedOffersSkus = array_intersect($existedSkus, array_keys($resultOffersData)); - if (empty($updatedOffersSkus)) { - return; + $updatedOffersData = array(); + foreach ($resultOffersData as $offerSku => $offerData) { + if (in_array((string)$offerSku, $existedSkus, true)) { + $updatedOffersData[(string)$offerSku] = $offerData; + } } - $updatedOffersData = array(); - foreach ($updatedOffersSkus as $updatedOfferSku) { - $updatedOffersData[$updatedOfferSku] = $resultOffersData[$updatedOfferSku]; + if (empty($updatedOffersData)) { + return; } $this->updateListingsProductsRepricing($updatedOffersData); @@ -338,7 +350,7 @@ private function updateListingsProductsRepricing(array $updatedOffersData) $offerData = $updatedOffersData[strtolower($listingProductData['sku'])]; - if (!is_null($offerData['product_price']) && + if (!is_null($offerData['product_price']) && !$offerData['is_calculation_disabled'] && $listingProductData['online_price'] != $offerData['product_price'] ) { $connWrite->update( @@ -456,7 +468,7 @@ private function updateListingsOthersRepricing(array $updatedOffersData) $offerData = $updatedOffersData[strtolower($listingOtherData['sku'])]; - if (!is_null($offerData['product_price']) && + if (!is_null($offerData['product_price']) && !$offerData['is_calculation_disabled'] && $offerData['product_price'] != $listingOtherData['online_price'] ) { $connWrite->update( diff --git a/app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/Defaults/UpdateListingsProducts/Responser.php b/app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/Defaults/UpdateListingsProducts/Responser.php index 68506ea92..9f72b69eb 100644 --- a/app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/Defaults/UpdateListingsProducts/Responser.php +++ b/app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/Defaults/UpdateListingsProducts/Responser.php @@ -204,6 +204,10 @@ protected function updateReceivedListingsProducts($receivedItems) } } + if ($existingItem['is_repricing'] && !$existingItem['is_online_disabled']) { + unset($newData['online_price'], $existingData['online_price']); + } + if ($newData == $existingData) { continue; } @@ -430,6 +434,14 @@ protected function getPdoStatementExistingListings($withData = false) $tempColumns = array('second_table.sku'); if ($withData) { + $collection->getSelect()->joinLeft( + array( + 'repricing' => Mage::getResourceModel('M2ePro/Amazon_Listing_Product_Repricing')->getMainTable() + ), + 'second_table.listing_product_id = repricing.listing_product_id', + array('is_online_disabled') + ); + $tempColumns = array( 'main_table.listing_id', 'main_table.product_id','main_table.status', @@ -439,6 +451,7 @@ protected function getPdoStatementExistingListings($withData = false) 'second_table.is_afn_channel', 'second_table.is_isbn_general_id', 'second_table.listing_product_id', 'second_table.is_variation_product', 'second_table.variation_parent_id', + 'second_table.is_repricing', 'repricing.is_online_disabled', ); } diff --git a/app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/OtherListings/Update/Responser.php b/app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/OtherListings/Update/Responser.php index 8453b7f78..48c06af06 100644 --- a/app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/OtherListings/Update/Responser.php +++ b/app/code/community/Ess/M2ePro/Model/Amazon/Synchronization/OtherListings/Update/Responser.php @@ -178,13 +178,18 @@ protected function updateReceivedOtherListings($receivedItems) unset($newData['title'], $existingData['title']); } + if ($existingItem['is_repricing'] && !$existingItem['is_repricing_disabled']) { + unset($newData['online_price'], $existingData['online_price']); + } + if ($newData == $existingData) { continue; } $tempLogMessages = array(); - if ($newData['online_price'] != $existingData['online_price']) { + if (isset($newData['online_price'], $existingData['online_price']) && + $newData['online_price'] != $existingData['online_price']) { // M2ePro_TRANSLATIONS // Item Price was successfully changed from %from% to %to%. $tempLogMessages[] = Mage::helper('M2ePro')->__( @@ -513,7 +518,8 @@ protected function getPdoStatementExistingListings($withData = false) 'second_table.sku','second_table.general_id','second_table.title', 'second_table.online_price','second_table.online_qty', 'second_table.is_afn_channel', 'second_table.is_isbn_general_id', - 'second_table.listing_other_id'); + 'second_table.listing_other_id', + 'second_table.is_repricing', 'second_table.is_repricing_disabled'); } $collection->getSelect()->reset(Zend_Db_Select::COLUMNS)->columns($tempColumns); diff --git a/app/code/community/Ess/M2ePro/Model/Cron/Runner/Service.php b/app/code/community/Ess/M2ePro/Model/Cron/Runner/Service.php index 58965898a..454bcc1fa 100644 --- a/app/code/community/Ess/M2ePro/Model/Cron/Runner/Service.php +++ b/app/code/community/Ess/M2ePro/Model/Cron/Runner/Service.php @@ -66,6 +66,8 @@ public function resetTasksStartFrom() protected function initialize() { + usleep(rand(0,2000000)); + parent::initialize(); $helper = Mage::helper('M2ePro/Module_Cron'); diff --git a/app/code/community/Ess/M2ePro/Model/Ebay/Synchronization/Orders/Cancellation.php b/app/code/community/Ess/M2ePro/Model/Ebay/Synchronization/Orders/Cancellation.php index 7699ceeab..3edc975fe 100644 --- a/app/code/community/Ess/M2ePro/Model/Ebay/Synchronization/Orders/Cancellation.php +++ b/app/code/community/Ess/M2ePro/Model/Ebay/Synchronization/Orders/Cancellation.php @@ -211,7 +211,7 @@ private function associateAndUpdateOrder(Ess_M2ePro_Model_Account $account, arra /** @var $order Ess_M2ePro_Model_Order */ $order = Mage::helper('M2ePro/Component_Ebay')->getCollection('Order') ->addFieldToFilter('account_id', $account->getId()) - ->addFieldToFilter('ebay_order_id', $orderData['ebay_order_id']) + ->addFieldToFilter('ebay_order_id', $orderData['identifiers']['ebay_order_id']) ->getFirstItem(); if (!$order->getId()) { @@ -251,7 +251,7 @@ private function associateAndUpdateOrder(Ess_M2ePro_Model_Account $account, arra $order->setData('shipping_details', json_encode($shippingDetails)); $order->setData('shipping_status', $shippingStatus); - $order->setData('tax_details', json_encode($orderData['tax_details'])); + $order->setData('tax_details', json_encode($orderData['selling']['tax_details'])); } $order->save(); @@ -373,7 +373,7 @@ private function getOrderItemsForUnpaidItemProcess(Ess_M2ePro_Model_Order $order private function getCheckoutStatus($orderData) { - return Mage::getSingleton('M2ePro/Ebay_Order_Helper')->getCheckoutStatus($orderData['checkout_status']); + return Mage::getSingleton('M2ePro/Ebay_Order_Helper')->getCheckoutStatus($orderData['statuses']['checkout']); } private function getPaymentStatus($orderData) diff --git a/app/code/community/Ess/M2ePro/Model/Listing.php b/app/code/community/Ess/M2ePro/Model/Listing.php index 0b241df80..a6fcd2007 100644 --- a/app/code/community/Ess/M2ePro/Model/Listing.php +++ b/app/code/community/Ess/M2ePro/Model/Listing.php @@ -595,7 +595,7 @@ public function removeDeletedProduct($product) $variationsThatCanNotBeDeleted[] = array( 'qty' => 0, - 'price' => $ebayVariation->getPrice(), + 'price' => $ebayVariation->getOnlinePrice(), 'sku' => $ebayVariation->getOnlineSku(), 'add' => 0, 'delete' => 1, diff --git a/app/code/community/Ess/M2ePro/Model/Magento/Product/Rule/Condition/Abstract.php b/app/code/community/Ess/M2ePro/Model/Magento/Product/Rule/Condition/Abstract.php index 3dbf41bc9..92e0df88f 100644 --- a/app/code/community/Ess/M2ePro/Model/Magento/Product/Rule/Condition/Abstract.php +++ b/app/code/community/Ess/M2ePro/Model/Magento/Product/Rule/Condition/Abstract.php @@ -644,7 +644,12 @@ protected function _compareValues($validatedValue, $value, $strict = true) if ($strict) { $validatePattern = '^' . $validatePattern . '$'; } - return (bool)preg_match('~' . $validatePattern . '~iu', $value); + try { + $result = (bool)preg_match('~' . $validatePattern . '~iu', $value); + } catch (Exception $e) { + return false; + } + return $result; } } diff --git a/app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Other.php b/app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Other.php index 43f285212..1b139241c 100644 --- a/app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Other.php +++ b/app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Other.php @@ -29,7 +29,7 @@ public function getAllRepricingSkus(Ess_M2ePro_Model_Account $account, $repricin $listingOtherCollection->addFieldToFilter('account_id', $account->getId()); if (!is_null($repricingDisabled)) { - $listingOtherCollection->addFieldToFilter('is_repricing_disabled', $repricingDisabled); + $listingOtherCollection->addFieldToFilter('is_repricing_disabled', (int)$repricingDisabled); } $listingOtherCollection->getSelect()->reset(Zend_Db_Select::COLUMNS); diff --git a/app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Product/Repricing.php b/app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Product/Repricing.php index d30b64f02..5018768e9 100644 --- a/app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Product/Repricing.php +++ b/app/code/community/Ess/M2ePro/Model/Mysql4/Amazon/Listing/Product/Repricing.php @@ -40,7 +40,7 @@ public function getAllSkus(Ess_M2ePro_Model_Account $account, $repricingDisabled 'alpr.listing_product_id = main_table.id' ); - $listingProductCollection->addFieldToFilter('alpr.is_online_disabled', $repricingDisabled); + $listingProductCollection->addFieldToFilter('alpr.is_online_disabled', (int)$repricingDisabled); } $listingProductCollection->getSelect()->reset(Zend_Db_Select::COLUMNS); diff --git a/app/code/community/Ess/M2ePro/Model/Order/Reserve.php b/app/code/community/Ess/M2ePro/Model/Order/Reserve.php index 941f9ef1c..f3804b0cf 100644 --- a/app/code/community/Ess/M2ePro/Model/Order/Reserve.php +++ b/app/code/community/Ess/M2ePro/Model/Order/Reserve.php @@ -212,6 +212,7 @@ private function performAction($action, $newState) $productsAffectedCount++; $transaction->addObject($magentoStockItem->getStockItem()); + $item->getProduct()->setStockItem($magentoStockItem->getStockItem()); } $item->setReservedProducts($products); diff --git a/app/code/community/Ess/M2ePro/Model/Upgrade/MySqlSetup.php b/app/code/community/Ess/M2ePro/Model/Upgrade/MySqlSetup.php index c9753a512..480559d67 100644 --- a/app/code/community/Ess/M2ePro/Model/Upgrade/MySqlSetup.php +++ b/app/code/community/Ess/M2ePro/Model/Upgrade/MySqlSetup.php @@ -9,6 +9,7 @@ class Ess_M2ePro_Model_Upgrade_MySqlSetup extends Mage_Core_Model_Resource_Setup { const LOCK_FILE_LIFETIME = 300; + const ERRORS_LOGFILE_NAME = 'm2epro_upgrade_errors.log'; private $lockId; private $cache = array(); @@ -111,6 +112,77 @@ private function getModifier($tableName, $modelName) //######################################## + /** + * Fix for invalid sort upgrade files that contains 4 digits in version (e.g. 6.3.9.1) bug + * + * @param string $actionType + * @param string $fromVersion + * @param string $toVersion + * @param array $arrFiles + * @return array + */ + protected function _getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles) + { + if ($actionType != self::TYPE_DB_UPGRADE) { + return parent::_getModifySqlFiles($actionType, $fromVersion, $toVersion, $arrFiles); + } + + $upgradeFiles = array(); + + foreach ($arrFiles as $versionInfo => $file) { + $versionsInterval = explode('-', $versionInfo); + if (count($versionsInterval) != 2) { + continue; + } + + $fileVersionFrom = $versionsInterval[0]; + $fileVersionTo = $versionsInterval[1]; + + if (version_compare($fileVersionFrom, $fromVersion, '<') || + version_compare($fileVersionTo, $toVersion, '>') + ) { + continue; + } + + if (!isset($upgradeFiles[$fileVersionFrom])) { + $upgradeFiles[$fileVersionFrom] = array(); + } + + $upgradeFiles[$fileVersionFrom][$fileVersionTo] = $file; + } + + uksort($upgradeFiles, function($first, $second) { + return version_compare($first, $second); + }); + + $maxToVersion = null; + $filesData = array(); + + foreach ($upgradeFiles as $fileVersionFrom => $fileData) { + uksort($fileData, function($first, $second) { + return version_compare($first, $second); + }); + + end($fileData); + $finalToVersion = key($fileData); + + if (!is_null($maxToVersion) && version_compare($finalToVersion, $maxToVersion, '<=')) { + continue; + } + + $maxToVersion = $finalToVersion; + + $filesData[] = array( + 'toVersion' => $finalToVersion, + 'fileName' => $fileData[$finalToVersion], + ); + } + + return $filesData; + } + + //######################################## + public function run($sql) { if (trim($sql) == '') { @@ -182,15 +254,19 @@ protected function afterFileExecution() {} protected function _installResourceDb($newVersion) { - // double running protection - usleep(1000000); // 1 sec - if ($this->isLocked()) { return; } $this->lock(); + // double running protection + usleep(1000000); // 1 sec + + if ($this->isLocked() && !$this->isLockOwner()) { + return; + } + try { $this->beforeModuleDbModification(); @@ -204,6 +280,8 @@ protected function _installResourceDb($newVersion) } catch (Exception $e) { $this->unlock(); + Mage::log($e->__toString(), null, self::ERRORS_LOGFILE_NAME, true); + throw $e; } @@ -212,15 +290,19 @@ protected function _installResourceDb($newVersion) protected function _upgradeResourceDb($oldVersion, $newVersion) { - // double running protection - usleep(1000000); // 1 sec - if ($this->isLocked()) { return; } $this->lock(); + // double running protection + usleep(1000000); // 1 sec + + if ($this->isLocked() && !$this->isLockOwner()) { + return; + } + try { $this->beforeModuleDbModification(); @@ -234,6 +316,70 @@ protected function _upgradeResourceDb($oldVersion, $newVersion) } catch (Exception $e) { $this->unlock(); + Mage::log($e->__toString(), null, self::ERRORS_LOGFILE_NAME, true); + + throw $e; + } + + $this->unlock(); + } + + // --------------------------------------- + + protected function _installData($newVersion) + { + if ($this->isLocked()) { + return; + } + + $this->lock(); + + // double running protection + usleep(1000000); // 1 sec + + if ($this->isLocked() && !$this->isLockOwner()) { + return; + } + + try { + + parent::_installData($newVersion); + + } catch (Exception $e) { + + $this->unlock(); + Mage::log($e->__toString(), null, self::ERRORS_LOGFILE_NAME, true); + + throw $e; + } + + $this->unlock(); + } + + protected function _upgradeData($oldVersion, $newVersion) + { + if ($this->isLocked()) { + return; + } + + $this->lock(); + + // double running protection + usleep(1000000); // 1 sec + + if ($this->isLocked() && !$this->isLockOwner()) { + return; + } + + try { + + parent::_upgradeData($oldVersion, $newVersion); + + } catch (Exception $e) { + + $this->unlock(); + Mage::log($e->__toString(), null, self::ERRORS_LOGFILE_NAME, true); + throw $e; } @@ -255,8 +401,7 @@ public function endSetup() parent::endSetup(); $this->afterFileExecution(); - if ($this->isLockFileExists() && - @file_get_contents($this->getLockFilePath()) != $this->lockId) { + if ($this->isLockFileExists() && !$this->isLockOwner()) { exit(); } @@ -380,13 +525,11 @@ private function isLocked() private function lock() { - $this->lockId = $this->generateRandomHash(); - if (!@is_dir($this->getLocksDirPath())) { @mkdir($this->getLocksDirPath(), 0777, true); } - @file_put_contents($this->getLockFilePath(), $this->lockId); + @file_put_contents($this->getLockFilePath(), $this->getLockId()); register_shutdown_function(function () { @unlink(Mage::getBaseDir('var').DS.'locks'.DS.'m2epro_setup.lock'); @@ -398,5 +541,23 @@ private function unlock() $this->isLockFileExists() && @unlink($this->getLockFilePath()); } + private function getLockId() + { + if (is_null($this->lockId)) { + $this->lockId = $this->generateRandomHash(); + } + + return $this->lockId; + } + + private function isLockOwner() + { + if (!$this->isLockFileExists()) { + return false; + } + + return $this->getLockId() == @file_get_contents($this->getLockFilePath()); + } + //######################################## } \ No newline at end of file diff --git a/app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Listing/RepricingController.php b/app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Listing/RepricingController.php index 578871dda..d9ca76e37 100644 --- a/app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Listing/RepricingController.php +++ b/app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/Amazon/Listing/RepricingController.php @@ -73,6 +73,10 @@ public function addProductsAction() $accountId = $this->getRequest()->getParam('account_id'); $responseToken = $this->getRequest()->getParam('response_token'); + if (empty($responseToken)) { + return $this->indexAction(); + } + /** @var Ess_M2ePro_Model_Account $account */ $account = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId); @@ -166,6 +170,10 @@ public function showDetailsAction() $accountId = $this->getRequest()->getParam('account_id'); $responseToken = $this->getRequest()->getParam('response_token'); + if (empty($responseToken)) { + return $this->indexAction(); + } + /** @var Ess_M2ePro_Model_Account $account */ $account = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId); @@ -238,6 +246,10 @@ public function editProductsAction() $accountId = $this->getRequest()->getParam('account_id'); $responseToken = $this->getRequest()->getParam('response_token'); + if (empty($responseToken)) { + return $this->indexAction(); + } + $account = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId); if (!$account->getId()) { @@ -326,6 +338,10 @@ public function removeProductsAction() $accountId = $this->getRequest()->getParam('account_id'); $responseToken = $this->getRequest()->getParam('response_token'); + if (empty($responseToken)) { + return $this->indexAction(); + } + $account = Mage::helper('M2ePro/Component_Amazon')->getModel('Account')->load($accountId); if (!$account->getId()) { diff --git a/app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/LogController.php b/app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/LogController.php index 0685c211b..77a114379 100644 --- a/app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/LogController.php +++ b/app/code/community/Ess/M2ePro/controllers/Adminhtml/Common/LogController.php @@ -32,8 +32,10 @@ protected function _isAllowed() return Mage::getSingleton('admin/session')->isAllowed('m2epro_common/logs'); } - public function preDispatch() + protected function __preDispatch() { + parent::__preDispatch(); + $channel = $this->getRequest()->getParam('channel', false); if (!$channel) { @@ -42,8 +44,6 @@ public function preDispatch() Mage::helper('M2ePro/View_Common_Component')->isBuyDefault() && $this->getRequest()->setParam('channel', Ess_M2ePro_Block_Adminhtml_Common_Log_Tabs::CHANNEL_ID_BUY); } - - return parent::preDispatch(); } //######################################## diff --git a/app/code/community/Ess/M2ePro/controllers/Adminhtml/Development/InspectionController.php b/app/code/community/Ess/M2ePro/controllers/Adminhtml/Development/InspectionController.php index f795a1906..217ee3992 100644 --- a/app/code/community/Ess/M2ePro/controllers/Adminhtml/Development/InspectionController.php +++ b/app/code/community/Ess/M2ePro/controllers/Adminhtml/Development/InspectionController.php @@ -25,6 +25,22 @@ public function resourcesSettingsAction() { $resourcesConfig = Mage::getConfig()->getNode('global/resources'); $resourcesConfig = json_decode(json_encode((array)$resourcesConfig), true); + + $secureKeys = array('host', 'username', 'password'); + foreach ($resourcesConfig as &$configItem) { + if (!isset($configItem['connection']) || !is_array($configItem['connection'])) { + continue; + } + + foreach ($secureKeys as $key) { + if (!isset($configItem['connection'][$key])) { + continue; + } + + $configItem['connection'][$key] = str_repeat('*', strlen($configItem['connection'][$key])); + } + } + echo '
'.print_r($resourcesConfig, true).'
'; } diff --git a/app/code/community/Ess/M2ePro/controllers/Adminhtml/Ebay/ConfigurationController.php b/app/code/community/Ess/M2ePro/controllers/Adminhtml/Ebay/ConfigurationController.php index a5ea231bc..8e314a019 100644 --- a/app/code/community/Ess/M2ePro/controllers/Adminhtml/Ebay/ConfigurationController.php +++ b/app/code/community/Ess/M2ePro/controllers/Adminhtml/Ebay/ConfigurationController.php @@ -225,7 +225,7 @@ private function getPreparedInsertData($csvRow, $existedItems) $requiredColumns = array('epid','product_type','make','model','year'); foreach ($requiredColumns as $columnName) { - if (empty($csvRow[$columnName])) { + if (!isset($csvRow[$columnName])) { return false; } } diff --git a/app/code/community/Ess/M2ePro/etc/config.xml b/app/code/community/Ess/M2ePro/etc/config.xml index 44b04706f..8995173dd 100644 --- a/app/code/community/Ess/M2ePro/etc/config.xml +++ b/app/code/community/Ess/M2ePro/etc/config.xml @@ -2,7 +2,7 @@ - 6.4.7.1 + 6.4.8 diff --git a/app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-install-6.4.8.php b/app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-install-6.4.8.php new file mode 100644 index 000000000..7ab1fcdde --- /dev/null +++ b/app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-install-6.4.8.php @@ -0,0 +1,3493 @@ +startSetup(); + +//######################################## + +// GENERAL SCRIPT + +$tempMagentoConnectUrl = 'https://www.magentocommerce.com/magento-connect/'; +$tempMagentoConnectUrl .= 'ebay-amazon-rakuten-magento-integration-order-import-and-stock-level-synchronization.html'; + +$servicingInterval = rand(43200, 86400); + +$installer->run(<<run(<<generateRandomHash()}', 'Unique identifier of M2E instance', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/modules/', 'M2ePro', '0.0.0.r0', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/server/', 'baseurl_1', 'https://s1.m2epro.com/', 'Support server base url', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'); + +INSERT INTO `m2epro_config` (`group`,`key`,`value`,`notice`,`update_date`,`create_date`) VALUES + ('/cron/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/', 'runner', 'magento', NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/', 'last_access', NULL, 'Time of last cron synchronization', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/', 'last_runner_change', NULL, 'Time of last change cron runner', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/cron/', 'last_executed_slow_task', NULL, '', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/service/', 'auth_key', NULL, NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/service/', 'disabled', '0', NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/magento/', 'disabled', '0', NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/service/', 'hostname', 'cron.m2epro.com', NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/task/logs_clearing/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/cron/task/logs_clearing/', 'interval', '86400', 'in seconds', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/logs_clearing/', 'last_access', NULL, 'date of last access', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/cron/task/logs_clearing/', 'last_run', NULL, 'date of last run', '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/task/repricing_update_settings/', 'mode', '1', '0 - disable, \r\n1 - enable', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/repricing_update_settings/', 'interval', '3600', 'in seconds', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/repricing_update_settings/', 'last_access', NULL, 'date of last access', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/cron/task/repricing_update_settings/', 'last_run', NULL, 'date of last run', + '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/task/repricing_synchronization_actual_price/', 'mode', '1', '0 - disable, \r\n1 - enable', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/repricing_synchronization_actual_price/', 'interval', '3600', 'in seconds', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/repricing_synchronization_actual_price/', 'last_access', NULL, 'date of last access', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/repricing_synchronization_actual_price/', 'last_run', NULL, 'date of last run', + '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/task/repricing_synchronization_general/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/cron/task/repricing_synchronization_general/', 'interval', '86400', 'in seconds', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/repricing_synchronization_general/', 'last_access', NULL, 'date of last access', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/cron/task/repricing_synchronization_general/', 'last_run', NULL, 'date of last run', + '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/task/repricing_inspect_products/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/cron/task/repricing_inspect_products/', 'interval', '3600', 'in seconds', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/repricing_inspect_products/', 'last_access', NULL, 'date of last access', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/cron/task/repricing_inspect_products/', 'last_run', NULL, 'date of last run', + '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/task/synchronization/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/cron/task/synchronization/', 'interval', '300', 'in seconds', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/synchronization/', 'last_access', NULL, 'date of last access', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/cron/task/synchronization/', 'last_run', NULL, 'date of last run', '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/cron/task/servicing/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/servicing/', 'interval', '{$servicingInterval}', 'in seconds', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/servicing/', 'last_access', NULL, 'date of last access', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/cron/task/servicing/', 'last_run', NULL, 'date of last run', '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/logs/clearing/listings/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/logs/clearing/listings/', 'days', '30', 'in days', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/logs/clearing/other_listings/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/logs/clearing/other_listings/', 'days', '30', 'in days', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/logs/clearing/synchronizations/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/logs/clearing/synchronizations/', 'days', '30', 'in days', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/logs/clearing/orders/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/logs/clearing/orders/', 'days', '90', 'in days', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/logs/listings/', 'last_action_id', '0', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/logs/other_listings/', 'last_action_id', '0', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/support/', 'knowledge_base_url', 'http://support.m2epro.com/knowledgebase', NULL, '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/support/', 'documentation_url', 'http://docs.m2epro.com', NULL, '2015-07-03 00:00:00', + '2015-07-03 00:00:00'), + ('/support/', 'clients_portal_url', 'https://clients.m2epro.com/', NULL, '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/support/', 'main_website_url', 'http://m2epro.com/', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/support/', 'main_support_url', 'http://support.m2epro.com/', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/support/', 'magento_connect_url', '{$tempMagentoConnectUrl}', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/support/', 'contact_email', 'support@m2epro.com', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/support/uservoice/', 'api_url', 'http://magento2ebay.uservoice.com/api/v1/', NULL, '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/support/uservoice/', 'api_client_key', 'WEsfO8nFh3FXffUU1Oa7A', NULL, '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/view/', 'show_block_notices', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/', 'show_products_thumbnails', '1', 'Visibility thumbnails into grid', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/view/requirements/popup/', 'closed', '0', '0 - false, - true', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/synchronization/revise_total/', 'show', '0', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/view/common/component/', 'default', 'amazon', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/common/autocomplete/', 'max_records_quantity', '100', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/ebay/', 'mode', 'simple', 'simple, advanced', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/ebay/notice/', 'disable_collapse', '0', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/view/ebay/template/selling_format/', 'show_tax_category', '0', '0 - disable, \r\n1 - enable', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/ebay/feedbacks/notification/', 'mode', '0', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/view/ebay/feedbacks/notification/', 'last_check', NULL, 'Date last check new buyers feedbacks', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/ebay/advanced/autoaction_popup/', 'shown', '0', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/ebay/motors_epids_attribute/', 'listing_notification_shown', '0', NULL, + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/ebay/multi_currency_marketplace_2/', 'notification_shown', '0', NULL, + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/ebay/multi_currency_marketplace_19/', 'notification_shown', '0', NULL, + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/view/ebay/terapeak/', 'mode', '1', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/debug/exceptions/', 'send_to_server', '1', '0 - disable,\r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/debug/exceptions/', 'filters_mode', '0', '0 - disable,\r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/debug/fatal_error/', 'send_to_server', '1', '0 - disable,\r\n1 - enable', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/debug/logging/', 'send_to_server', 1, '0 - disable,\r\n1 - enable', '2015-08-12 00:00:00', '2015-08-12 00:00:00'), + ('/debug/maintenance/', 'mode', '0', '0 - disable,\r\n1 - enable', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/debug/maintenance/', 'restore_date', NULL, NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/renderer/description/', 'convert_linebreaks', '1', '0 - No\r\n1 - Yes', '2013-05-08 00:00:00', + '2013-05-08 00:00:00'), + ('/other/paypal/', 'url', 'paypal.com/cgi-bin/webscr/', 'PayPal url', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/product/index/', 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/product/force_qty/', 'mode', '0', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/product/force_qty/', 'value', '10', 'min qty value', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/qty/percentage/', 'rounding_greater', '0', NULL, '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/order/magento/settings/', 'create_with_first_product_options_when_variation_unavailable', '1', + '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', '2013-05-08 00:00:00'); + +INSERT INTO `m2epro_synchronization_config` (`group`,`key`,`value`,`notice`,`update_date`,`create_date`) VALUES + (NULL, 'mode', '1', '0 - disable, \r\n1 - enable', '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + (NULL, 'last_access', NULL, NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + (NULL, 'last_run', NULL, NULL, '2014-01-01 00:00:00', '2014-01-01 00:00:00'), + ('/settings/product_change/', 'max_count_per_one_time', '500', NULL, + '2012-05-21 10:47:49', '2012-05-21 10:47:49'), + ('/settings/product_change/', 'max_lifetime', '86400', 'in seconds', + '2012-05-21 10:47:49', '2012-05-21 10:47:49'), + ('/settings/product_change/', 'max_count', '10000', NULL, + '2012-05-21 10:47:49', '2012-05-21 10:47:49'), + ('/defaults/', 'mode', '1', '0 - disable, \r\n1 - enable', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/processing/', 'mode', '1', '0 - disable, \r\n1 - enable', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/deleted_products/', 'mode', '1', '0 - disable, \r\n1 - enable', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/deleted_products/', 'interval', '3600', 'in seconds', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/deleted_products/', 'last_time', NULL, 'Last check time', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/added_products/', 'last_magento_product_id', NULL, NULL, + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/stop_queue/', 'mode', '1', '0 - disable, \r\n1 - enable', + '2012-05-21 10:47:49', '2012-05-21 10:47:49'), + ('/defaults/stop_queue/', 'interval', '3600', 'in seconds', + '2012-05-21 10:47:49', '2012-05-21 10:47:49'), + ('/defaults/stop_queue/', 'last_time', NULL, 'Last check time', + '2012-05-21 10:47:49', '2012-05-21 10:47:49'), + ('/defaults/inspector/', 'mode', '0', '0 - disable, \r\n1 - enable', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/inspector/product_changes/', 'type', 'circle', 'circle', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/inspector/product_changes/circle/', 'last_listing_product_id', NULL, NULL, + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/inspector/product_changes/circle/', 'min_interval_between_circles', '3600', 'in seconds', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/inspector/product_changes/circle/', 'max_count_times_for_full_circle', '50', NULL, + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/inspector/product_changes/circle/', 'min_count_items_per_one_time', '100', NULL, + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/inspector/product_changes/circle/', 'max_count_items_per_one_time', '500', NULL, + '2013-05-08 00:00:00', '2013-05-08 00:00:00'), + ('/defaults/inspector/product_changes/circle/', 'last_time_start_circle', NULL, NULL, + '2013-05-08 00:00:00', '2013-05-08 00:00:00'); + +INSERT INTO `m2epro_wizard` VALUES + (1, 'migrationToV6', '*', 3, NULL, 1, 1), + (2, 'installationEbay', 'ebay', 0, NULL, 1, 2), + (3, 'installationCommon', 'common', 0, NULL, 1, 2), + (4, 'amazon', 'common', 0, NULL, 0, 3), + (5, 'buy', 'common', 0, NULL, 0, 4), + (6, 'migrationNewAmazon', 'common', 3, NULL, 1, 5), + (7, 'removedPlay', 'common', 3, NULL, 0, 6), + (8, 'ebayProductDetails', 'ebay', 3, NULL, 1, 7), + (9, 'fullAmazonCategories', 'common', 3, NULL, 1, 8), + (10, 'amazonShippingOverridePolicy', 'common', 3, NULL, 1, 9); + +SQL +); + +//######################################## + +// EBAY SCRIPT +$installer->run(<<run(<<run(<<run(<<run(<<run(<<endSetup(); + +//######################################## \ No newline at end of file diff --git a/app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-upgrade-6.4.7.1-6.4.8.php b/app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-upgrade-6.4.7.1-6.4.8.php new file mode 100644 index 000000000..6d09465df --- /dev/null +++ b/app/code/community/Ess/M2ePro/sql/M2ePro_setup/mysql4-upgrade-6.4.7.1-6.4.8.php @@ -0,0 +1,87 @@ +startSetup(); + +$connection = $installer->getConnection(); + +//######################################## + +// IncreaseCapacityOfSystemLogMessage +//---------------------------------------- + +/* + ALTER TABLE `m2epro_system_log` + CHANGE COLUMN `description` `description` LONGTEXT DEFAULT NULL; +*/ + +$installer->getTableModifier('system_log') + ->changeColumn('description', 'LONGTEXT', 'NULL'); + +// fix for is_repricing default value +// --------------------------------------- + +/* + ALTER TABLE `m2epro_amazon_listing_product` + CHANGE COLUMN `is_repricing` `is_repricing` TINYINT(2) UNSIGNED NOT NULL DEFAULT 0; +*/ + +$installer->getTableModifier('amazon_listing_product') + ->changeColumn('is_repricing', 'TINYINT(2) UNSIGNED NOT NULL', 0); + +$installer->run(<<getMainConfigModifier() + ->getEntity('/cron/task/repricing_synchronization_general/', 'last_run') + ->updateValue(NULL); + +// ebay orders job_token default null fix +// --------------------------------------- + +/* + ALTER TABLE `m2epro_ebay_account` + CHANGE COLUMN `job_token` `job_token` VARCHAR(255) DEFAULT NULL; +*/ + +$installer->getTableModifier('ebay_account') + ->changeColumn('job_token', 'VARCHAR(255)', 'NULL'); + +// repricing_update_settings cron task config fix +// --------------------------------------- + +/* + INSERT INTO `m2epro_config` (`group`,`key`,`value`,`notice`,`update_date`,`create_date`) VALUES + ('/cron/task/repricing_update_settings/', 'mode', '1', '0 - disable, \r\n1 - enable', + '2013-05-08 00:00:00', '2013-05-08 00:00:00'); + */ +$installer->getMainConfigModifier() + ->insert('/cron/task/repricing_update_settings/', 'mode', '1'); + +//######################################## + +$installer->endSetup(); + +//######################################## \ No newline at end of file diff --git a/composer.json b/composer.json index 14029c66d..ec4c8ea75 100644 --- a/composer.json +++ b/composer.json @@ -2,10 +2,11 @@ "name": "m2epro/magento1-extension", "description": "M2E Pro is a Magento trusted (TM), award-winning extension, which allows merchants of all sizes to fully integrate Magento based system(s) into eBay/Amazon/Rakuten.com platforms.", "type": "magento-module", - "version": "6.4.7.1", + "version": "6.4.8", + "license": "Refer to Terms and Conditions on m2epro.com", "keywords": ["ebay", "amazon", "rakuten", "magento"], "homepage": "http://www.m2epro.com/", "require": { - "php": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~7.0.0" + "php": "~5.3.0|~5.4.0|~5.5.0|~5.6.0|~7.0.0|~7.1.0" } } \ No newline at end of file