File tree Expand file tree Collapse file tree 3 files changed +63
-2
lines changed
Backend/Block/Dashboard/Orders
Plugin/Model/Config/Backend Expand file tree Collapse file tree 3 files changed +63
-2
lines changed Original file line number Diff line number Diff line change 14
14
* Adminhtml dashboard recent orders grid
15
15
*
16
16
* @api
17
- * @author Magento Core Team <core@magentocommerce.com>
18
17
* @SuppressWarnings(PHPMD.DepthOfInheritance)
19
18
* @since 100.0.2
20
19
*/
@@ -152,7 +151,7 @@ protected function _prepareColumns()
152
151
'header ' => __ ('Total ' ),
153
152
'sortable ' => false ,
154
153
'type ' => 'currency ' ,
155
- 'currency_code ' => $ baseCurrencyCode ,
154
+ 'currency_code ' => $ this -> escapeHtml ( $ baseCurrencyCode) ,
156
155
'index ' => 'revenue '
157
156
]
158
157
);
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+
7
+ declare (strict_types=1 );
8
+
9
+ namespace Magento \Config \Plugin \Model \Config \Backend ;
10
+
11
+ use Magento \Config \Model \Config \Backend \Locale ;
12
+ use Magento \Config \Model \Config \Source \Locale \Currency \All ;
13
+ use Magento \Framework \Exception \LocalizedException ;
14
+
15
+ class LocalePlugin
16
+ {
17
+ /**
18
+ * @var All
19
+ */
20
+ private $ currencyList ;
21
+
22
+ /**
23
+ * @param All $currencyList
24
+ */
25
+ public function __construct (
26
+ All $ currencyList
27
+ ) {
28
+ $ this ->currencyList = $ currencyList ;
29
+ }
30
+
31
+ /**
32
+ * Check whether currency code value is acceptable or not
33
+ *
34
+ * @param Locale $subject
35
+ * @return void
36
+ */
37
+ public function beforeSave (Locale $ subject ): void
38
+ {
39
+ if ($ subject ->isValueChanged ()) {
40
+ $ values = $ subject ->getValue ();
41
+ if (count (array_diff ($ values , $ this ->getOptions ()))) {
42
+ throw new LocalizedException (__ ('There was an error save new configuration value. ' ));
43
+ }
44
+ }
45
+ }
46
+
47
+ /**
48
+ * Get available options for weight unit
49
+ *
50
+ * @return array
51
+ */
52
+ private function getOptions ()
53
+ {
54
+ $ options = $ this ->currencyList ->toOptionArray ();
55
+
56
+ return array_column ($ options , 'value ' );
57
+ }
58
+ }
Original file line number Diff line number Diff line change 9
9
<preference for =" Magento\Config\Model\Config\Backend\File\RequestData\RequestDataInterface" type =" Magento\Config\Model\Config\Backend\File\RequestData" />
10
10
<type name =" Magento\Config\Model\Config\Structure\Element\Iterator\Tab" shared =" false" />
11
11
<type name =" Magento\Config\Model\Config\Structure\Element\Iterator\Section" shared =" false" />
12
+ <type name =" Magento\Config\Model\Config\Backend\Locale" >
13
+ <plugin name =" installed_currency_configuration_validation"
14
+ type =" Magento\Config\Plugin\Model\Config\Backend\LocalePlugin" sortOrder =" 10" />
15
+ </type >
12
16
</config >
You can’t perform that action at this time.
0 commit comments