|
| 1 | +diff --git a/vendor/magento/module-company-credit/Plugin/Company/Model/DataProvider.php b/vendor/magento/module-company-credit/Plugin/Company/Model/DataProvider.php |
| 2 | +index bbe387b4fb05..4bc91343ef7f 100644 |
| 3 | +--- a/vendor/magento/module-company-credit/Plugin/Company/Model/DataProvider.php |
| 4 | ++++ b/vendor/magento/module-company-credit/Plugin/Company/Model/DataProvider.php |
| 5 | +@@ -9,6 +9,7 @@ |
| 6 | + use Magento\Company\Model\Company\DataProvider as CompanyDataProvider; |
| 7 | + use Magento\CompanyCredit\Api\Data\CreditLimitInterface; |
| 8 | + use Magento\CompanyCredit\Api\CreditDataProviderInterface; |
| 9 | ++use Magento\Framework\Pricing\PriceCurrencyInterface; |
| 10 | + |
| 11 | + /** |
| 12 | + * DataProvider for CompanyCredit form on a company edit page. |
| 13 | +@@ -25,24 +26,16 @@ class DataProvider |
| 14 | + */ |
| 15 | + private $storeManager; |
| 16 | + |
| 17 | +- /** |
| 18 | +- * @var \Magento\Directory\Model\Currency |
| 19 | +- */ |
| 20 | +- private $currencyFormatter; |
| 21 | +- |
| 22 | + /** |
| 23 | + * @param CreditDataProviderInterface $creditDataProvider |
| 24 | + * @param \Magento\Store\Model\StoreManagerInterface $storeManager |
| 25 | +- * @param \Magento\Directory\Model\Currency $currencyFormatter |
| 26 | + */ |
| 27 | + public function __construct( |
| 28 | + CreditDataProviderInterface $creditDataProvider, |
| 29 | +- \Magento\Store\Model\StoreManagerInterface $storeManager, |
| 30 | +- \Magento\Directory\Model\Currency $currencyFormatter |
| 31 | ++ \Magento\Store\Model\StoreManagerInterface $storeManager |
| 32 | + ) { |
| 33 | + $this->creditDataProvider = $creditDataProvider; |
| 34 | + $this->storeManager = $storeManager; |
| 35 | +- $this->currencyFormatter = $currencyFormatter; |
| 36 | + } |
| 37 | + |
| 38 | + /** |
| 39 | +@@ -62,9 +55,11 @@ public function afterGetCompanyResultData(CompanyDataProvider $subject, array $r |
| 40 | + $creditData[CreditLimitInterface::CURRENCY_CODE] = $creditLimit->getCurrencyCode() |
| 41 | + ? $creditLimit->getCurrencyCode() |
| 42 | + : $this->storeManager->getStore()->getBaseCurrency()->getCurrencyCode(); |
| 43 | +- $creditData[CreditLimitInterface::CREDIT_LIMIT] = $this->currencyFormatter->formatTxt( |
| 44 | +- $creditLimit->getCreditLimit(), |
| 45 | +- ['display' => \Magento\Framework\Currency\Data\Currency::NO_SYMBOL] |
| 46 | ++ $creditData[CreditLimitInterface::CREDIT_LIMIT] = number_format( |
| 47 | ++ (float)$creditLimit->getCreditLimit(), |
| 48 | ++ PriceCurrencyInterface::DEFAULT_PRECISION, |
| 49 | ++ '.', |
| 50 | ++ '' |
| 51 | + ); |
| 52 | + } else { |
| 53 | + $creditData[CreditLimitInterface::CURRENCY_CODE] = $this->storeManager->getStore() |
| 54 | +diff --git a/vendor/magento/module-company-credit/Ui/Component/Form/AmountField.php b/vendor/magento/module-company-credit/Ui/Component/Form/AmountField.php |
| 55 | +index 539c10e8f42d..78f1fba6adcd 100644 |
| 56 | +--- a/vendor/magento/module-company-credit/Ui/Component/Form/AmountField.php |
| 57 | ++++ b/vendor/magento/module-company-credit/Ui/Component/Form/AmountField.php |
| 58 | +@@ -32,11 +32,6 @@ class AmountField extends Field |
| 59 | + */ |
| 60 | + private $websiteCurrency; |
| 61 | + |
| 62 | +- /** |
| 63 | +- * @var \Magento\Directory\Model\Currency |
| 64 | +- */ |
| 65 | +- private $currencyFormatter; |
| 66 | +- |
| 67 | + /** |
| 68 | + * @var int |
| 69 | + */ |
| 70 | +@@ -48,7 +43,6 @@ class AmountField extends Field |
| 71 | + * @param PriceCurrencyInterface $priceCurrency |
| 72 | + * @param CreditDataProviderInterface $creditDataProvider |
| 73 | + * @param \Magento\CompanyCredit\Model\WebsiteCurrency $websiteCurrency |
| 74 | +- * @param \Magento\Directory\Model\Currency $currencyFormatter |
| 75 | + * @param UiComponentInterface[] $components |
| 76 | + * @param array $data |
| 77 | + */ |
| 78 | +@@ -58,7 +52,6 @@ public function __construct( |
| 79 | + PriceCurrencyInterface $priceCurrency, |
| 80 | + CreditDataProviderInterface $creditDataProvider, |
| 81 | + \Magento\CompanyCredit\Model\WebsiteCurrency $websiteCurrency, |
| 82 | +- \Magento\Directory\Model\Currency $currencyFormatter, |
| 83 | + array $components = [], |
| 84 | + array $data = [] |
| 85 | + ) { |
| 86 | +@@ -66,7 +59,6 @@ public function __construct( |
| 87 | + $this->creditDataProvider = $creditDataProvider; |
| 88 | + $this->priceCurrency = $priceCurrency; |
| 89 | + $this->websiteCurrency = $websiteCurrency; |
| 90 | +- $this->currencyFormatter = $currencyFormatter; |
| 91 | + } |
| 92 | + |
| 93 | + /** |
| 94 | +@@ -81,9 +73,11 @@ public function prepare() |
| 95 | + $config = $this->getData('config'); |
| 96 | + $currency = $this->getCurrency(); |
| 97 | + $config['addbefore'] = $this->priceCurrency->getCurrencySymbol(null, $currency); |
| 98 | +- $config['value'] = $this->currencyFormatter->formatTxt( |
| 99 | +- $this->defaultFieldValue, |
| 100 | +- ['display' => \Magento\Framework\Currency\Data\Currency::NO_SYMBOL] |
| 101 | ++ $config['value'] = number_format( |
| 102 | ++ (float)$this->defaultFieldValue, |
| 103 | ++ PriceCurrencyInterface::DEFAULT_PRECISION, |
| 104 | ++ '.', |
| 105 | ++ '' |
| 106 | + ); |
| 107 | + |
| 108 | + $this->setData('config', $config); |
| 109 | + |
0 commit comments