-
Notifications
You must be signed in to change notification settings - Fork 33
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 #52 from magento-commerce/develop
MCLOUD-8486: Release Cloud Tools
- Loading branch information
Showing
53 changed files
with
318 additions
and
81 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
{ | ||
"templateVersion": "0.1", | ||
"product": { | ||
"name": "Magento Cloud Patches", | ||
"description": "The Magento Cloud Patches package is a set of patches, previously used within the ece-tools package to improve the integration of all Magento versions with Cloud environments and to deliver critical fixes quickly" | ||
}, | ||
"contacts": { | ||
"team": { | ||
"name": "Magic Mountain", | ||
"DL": "Grp-magento-cloud-all", | ||
"slackChannel": "magic_mountain" | ||
} | ||
}, | ||
"ticketTracker": { | ||
"functionalJiraQueue": { | ||
"projectKey": "MCLOUD" | ||
}, | ||
"securityJiraQueue": { | ||
"projectKey": "MAGREQ", | ||
"component": "Magento Cloud Engineering" | ||
} | ||
}, | ||
"staticScan": { | ||
"enable": false | ||
} | ||
} |
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
143 changes: 143 additions & 0 deletions
143
patches/MCLOUD-8279__Fixed_currency_displaying_on_product_page__2.4.3.patch
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,143 @@ | ||
diff -Nuar a/vendor/magento/module-directory/Model/Currency.php b/vendor/magento/module-directory/Model/Currency.php | ||
index 65b47d7535c..e1815b25619 100644 | ||
--- a/vendor/magento/module-directory/Model/Currency.php | ||
+++ b/vendor/magento/module-directory/Model/Currency.php | ||
@@ -13,6 +13,7 @@ use Magento\Framework\Locale\Currency as LocaleCurrency; | ||
use Magento\Framework\Locale\ResolverInterface as LocalResolverInterface; | ||
use Magento\Framework\NumberFormatterFactory; | ||
use Magento\Framework\Serialize\Serializer\Json; | ||
+use Magento\Framework\Exception\LocalizedException; | ||
|
||
/** | ||
* Currency model | ||
@@ -39,8 +40,6 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
protected $_filter; | ||
|
||
/** | ||
- * Currency Rates | ||
- * | ||
* @var array | ||
*/ | ||
protected $_rates; | ||
@@ -147,11 +146,14 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
$this->_localeCurrency = $localeCurrency; | ||
$this->currencyConfig = $currencyConfig ?: ObjectManager::getInstance()->get(CurrencyConfig::class); | ||
$this->localeResolver = $localeResolver ?: ObjectManager::getInstance()->get(LocalResolverInterface::class); | ||
- $this->numberFormatterFactory = $numberFormatterFactory ?: ObjectManager::getInstance()->get(NumberFormatterFactory::class); | ||
+ $this->numberFormatterFactory = $numberFormatterFactory ?: | ||
+ ObjectManager::getInstance()->get(NumberFormatterFactory::class); | ||
$this->serializer = $serializer ?: ObjectManager::getInstance()->get(Json::class); | ||
} | ||
|
||
/** | ||
+ * Initializing Currency Resource model | ||
+ * | ||
* @return void | ||
*/ | ||
protected function _construct() | ||
@@ -253,10 +255,10 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
/** | ||
* Convert price to currency format | ||
* | ||
- * @param float $price | ||
- * @param mixed $toCurrency | ||
- * @return float | ||
- * @throws \Exception | ||
+ * @param float $price | ||
+ * @param mixed $toCurrency | ||
+ * @return float | ||
+ * @throws LocalizedException | ||
*/ | ||
public function convert($price, $toCurrency = null) | ||
{ | ||
@@ -266,7 +268,7 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
return (float)$price * (float)$rate; | ||
} | ||
|
||
- throw new \Exception(__( | ||
+ throw new LocalizedException(__( | ||
'Undefined rate from "%1-%2".', | ||
$this->getCode(), | ||
$this->getCurrencyCodeFromToCurrency($toCurrency) | ||
@@ -274,7 +276,10 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
} | ||
|
||
/** | ||
+ * Return the currency code | ||
+ * | ||
* @param mixed $toCurrency | ||
+ * | ||
* @return string | ||
* @throws \Magento\Framework\Exception\InputException | ||
*/ | ||
@@ -348,8 +353,11 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
} | ||
|
||
/** | ||
+ * Return formatted currency | ||
+ * | ||
* @param float $price | ||
* @param array $options | ||
+ * | ||
* @return string | ||
*/ | ||
public function formatTxt($price, $options = []) | ||
@@ -420,7 +428,8 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
$this->numberFormatter = $this->getNumberFormatter($options); | ||
|
||
$formattedCurrency = $this->numberFormatter->formatCurrency( | ||
- $price, $this->getCode() ?? $this->numberFormatter->getTextAttribute(\NumberFormatter::CURRENCY_CODE) | ||
+ $price, | ||
+ $this->getCode() ?? $this->numberFormatter->getTextAttribute(\NumberFormatter::CURRENCY_CODE) | ||
); | ||
|
||
if (array_key_exists(LocaleCurrency::CURRENCY_OPTION_SYMBOL, $options)) { | ||
@@ -430,7 +439,7 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
|
||
if ((array_key_exists(LocaleCurrency::CURRENCY_OPTION_DISPLAY, $options) | ||
&& $options[LocaleCurrency::CURRENCY_OPTION_DISPLAY] === \Magento\Framework\Currency::NO_SYMBOL)) { | ||
- $formattedCurrency = str_replace(' ', '', $formattedCurrency); | ||
+ $formattedCurrency = preg_replace(['/[^0-9.,۰٫]+/', '/ /'], '', $formattedCurrency); | ||
} | ||
|
||
return preg_replace('/^\s+|\s+$/u', '', $formattedCurrency); | ||
@@ -444,7 +453,10 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
*/ | ||
private function getNumberFormatter(array $options): \Magento\Framework\NumberFormatter | ||
{ | ||
- $key = 'currency_' . md5($this->localeResolver->getLocale() . $this->serializer->serialize($options)); | ||
+ $key = 'currency_' . hash( | ||
+ 'sha256', | ||
+ ($this->localeResolver->getLocale() . $this->serializer->serialize($options)) | ||
+ ); | ||
if (!isset($this->numberFormatterCache[$key])) { | ||
$this->numberFormatter = $this->numberFormatterFactory->create( | ||
['locale' => $this->localeResolver->getLocale(), 'style' => \NumberFormatter::CURRENCY] | ||
@@ -467,7 +479,8 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
{ | ||
if (array_key_exists(LocaleCurrency::CURRENCY_OPTION_SYMBOL, $options)) { | ||
$this->numberFormatter->setSymbol( | ||
- \NumberFormatter::CURRENCY_SYMBOL, $options[LocaleCurrency::CURRENCY_OPTION_SYMBOL] | ||
+ \NumberFormatter::CURRENCY_SYMBOL, | ||
+ $options[LocaleCurrency::CURRENCY_OPTION_SYMBOL] | ||
); | ||
} | ||
if (array_key_exists(LocaleCurrency::CURRENCY_OPTION_DISPLAY, $options) | ||
@@ -490,6 +503,8 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
} | ||
|
||
/** | ||
+ * Return the price format to be displayed to user | ||
+ * | ||
* @return string | ||
*/ | ||
public function getOutputFormat() | ||
@@ -532,6 +547,8 @@ class Currency extends \Magento\Framework\Model\AbstractModel | ||
} | ||
|
||
/** | ||
+ * Retrieve base config currency data by config path. | ||
+ * | ||
* @return array | ||
*/ | ||
public function getConfigBaseCurrencies() |
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,38 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CloudPatches\Test\Functional\Acceptance; | ||
|
||
/** | ||
* @group php74ce | ||
*/ | ||
class Acceptance74CeCest extends Acceptance74Cest | ||
{ | ||
/** | ||
* @var string | ||
*/ | ||
protected $edition = 'CE'; | ||
|
||
/** | ||
* @return array | ||
*/ | ||
protected function patchesDataProvider(): array | ||
{ | ||
return [ | ||
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0'], | ||
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0-p1'], | ||
['templateVersion' => '2.4.1', 'magentoVersion' => '2.4.1'], | ||
['templateVersion' => '2.4.1', 'magentoVersion' => '2.4.1-p1'], | ||
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2'], | ||
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2-p1'], | ||
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2-p2'], | ||
// Magento 2.4.3 CE does not work on the cloud | ||
// ['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3'], | ||
// ['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3-p1'], | ||
]; | ||
} | ||
} |
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,32 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CloudPatches\Test\Functional\Acceptance; | ||
|
||
/** | ||
* @group php74 | ||
*/ | ||
class Acceptance74Cest extends AcceptanceCest | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
protected function patchesDataProvider(): array | ||
{ | ||
return [ | ||
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0'], | ||
['templateVersion' => '2.4.0', 'magentoVersion' => '2.4.0-p1'], | ||
['templateVersion' => '2.4.1', 'magentoVersion' => '2.4.1'], | ||
['templateVersion' => '2.4.1', 'magentoVersion' => '2.4.1-p1'], | ||
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2'], | ||
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2-p1'], | ||
['templateVersion' => '2.4.2', 'magentoVersion' => '2.4.2-p2'], | ||
['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3'], | ||
['templateVersion' => '2.4.3', 'magentoVersion' => '2.4.3-p1'], | ||
]; | ||
} | ||
} |
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
Oops, something went wrong.