forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request magento#1182 from magento-frontend/PR_08062017
Fixed issues: - MAGETWO-61189: Stored xss using svg images in Favicon - MAGETWO-54702: Failed ClearAllCompareProductsTest test due to Alert window. - MAGETWO-66885: Special Characters like % in widget inside of WYSIWYG gives an error magento#9452 - MAGETWO-59514: Hard coded "tax_region_id" in the \Magento\Tax\Setup\InstallData - MAGETWO-64952: Admin login does not handle autocomplete feature correctly
- Loading branch information
Showing
18 changed files
with
119 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Tax\Setup; | ||
|
||
use Magento\Directory\Model\RegionFactory; | ||
use Magento\Framework\Api\Search\SearchCriteriaFactory; | ||
use Magento\Framework\Setup\InstallDataInterface; | ||
use Magento\Framework\Setup\ModuleContextInterface; | ||
use Magento\Framework\Setup\ModuleDataSetupInterface; | ||
use Magento\Tax\Api\TaxRateRepositoryInterface; | ||
|
||
/** | ||
* Update installed tax region codes | ||
*/ | ||
class RecurringData implements InstallDataInterface | ||
{ | ||
/** | ||
* Tax rate repository | ||
* | ||
* @var TaxRateRepositoryInterface | ||
*/ | ||
private $taxRateRepository; | ||
|
||
/** | ||
* @var SearchCriteriaFactory | ||
*/ | ||
|
||
private $searchCriteriaFactory; | ||
|
||
/** | ||
* @var RegionFactory | ||
*/ | ||
private $directoryRegionFactory; | ||
|
||
/** | ||
* Init | ||
* | ||
* @param TaxRateRepositoryInterface $taxRateRepository | ||
* @param SearchCriteriaFactory $searchCriteriaFactory | ||
* @param RegionFactory $directoryRegionFactory | ||
*/ | ||
public function __construct( | ||
TaxRateRepositoryInterface $taxRateRepository, | ||
SearchCriteriaFactory $searchCriteriaFactory, | ||
RegionFactory $directoryRegionFactory | ||
) { | ||
$this->taxRateRepository = $taxRateRepository; | ||
$this->searchCriteriaFactory = $searchCriteriaFactory; | ||
$this->directoryRegionFactory = $directoryRegionFactory; | ||
} | ||
|
||
/** | ||
* {@inheritdoc} | ||
*/ | ||
public function install(ModuleDataSetupInterface $setup, ModuleContextInterface $context) | ||
{ | ||
$taxRateList = $this->taxRateRepository->getList($this->searchCriteriaFactory->create()); | ||
/** @var \Magento\Tax\Api\Data\TaxRateInterface $taxRateData */ | ||
foreach ($taxRateList->getItems() as $taxRateData) { | ||
$regionCode = $this->parseRegionFromTaxCode($taxRateData->getCode()); | ||
if ($regionCode) { | ||
/** @var \Magento\Directory\Model\Region $region */ | ||
$region = $this->directoryRegionFactory->create(); | ||
$region->loadByCode($regionCode, $taxRateData->getTaxCountryId()); | ||
$taxRateData->setTaxRegionId($region->getRegionId()); | ||
$this->taxRateRepository->save($taxRateData); | ||
} | ||
} | ||
} | ||
|
||
/** | ||
* Parse region code from tax code | ||
* | ||
* @param string $taxCode | ||
* @return string | ||
*/ | ||
private function parseRegionFromTaxCode($taxCode) | ||
{ | ||
$result = ''; | ||
$parts = explode('-', $taxCode, 3); | ||
|
||
if (isset($parts[1])) { | ||
$result = $parts[1]; | ||
} | ||
|
||
return $result; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters