Skip to content

Commit 5a558f9

Browse files
authored
Merge pull request #5872 from magento-tsg/2.4.0-develop-pr65
[TSG] Fixes for 2.4 (pr65) (2.4.0-develop)
2 parents 524f164 + c4ca054 commit 5a558f9

File tree

3 files changed

+102
-3
lines changed

3 files changed

+102
-3
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Customer\Setup\Patch\Data;
9+
10+
use Magento\Customer\Model\GroupManagement;
11+
use Magento\Customer\Model\Vat;
12+
use Magento\Framework\Setup\ModuleDataSetupInterface;
13+
use Magento\Framework\Setup\Patch\DataPatchInterface;
14+
15+
/**
16+
* Update default customer group id in customer configuration if it's value is NULL
17+
*/
18+
class UpdateDefaultCustomerGroupInConfig implements DataPatchInterface
19+
{
20+
/**
21+
* @var ModuleDataSetupInterface
22+
*/
23+
private $moduleDataSetup;
24+
25+
/**
26+
* @var GroupManagement
27+
*/
28+
private $groupManagement;
29+
30+
/**
31+
* @param ModuleDataSetupInterface $moduleDataSetup
32+
* @param GroupManagement $groupManagement
33+
*/
34+
public function __construct(
35+
ModuleDataSetupInterface $moduleDataSetup,
36+
GroupManagement $groupManagement
37+
) {
38+
$this->moduleDataSetup = $moduleDataSetup;
39+
$this->groupManagement = $groupManagement;
40+
}
41+
42+
/**
43+
* @inheritDoc
44+
*/
45+
public function apply()
46+
{
47+
$customerGroups = $this->groupManagement->getLoggedInGroups();
48+
$commonGroup = array_shift($customerGroups);
49+
50+
$this->moduleDataSetup->getConnection()->update(
51+
$this->moduleDataSetup->getTable('core_config_data'),
52+
['value' => $commonGroup->getId()],
53+
[
54+
'value is ?' => new \Zend_Db_Expr('NULL'),
55+
'path = ?' => GroupManagement::XML_PATH_DEFAULT_ID,
56+
]
57+
);
58+
59+
return $this;
60+
}
61+
62+
/**
63+
* @inheritDoc
64+
*/
65+
public function getAliases()
66+
{
67+
return [];
68+
}
69+
70+
/**
71+
* @inheritDoc
72+
*/
73+
public static function getDependencies()
74+
{
75+
return [
76+
DefaultCustomerGroupsAndAttributes::class,
77+
];
78+
}
79+
}

app/code/Magento/Customer/etc/adminhtml/system.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
<field id="default_group" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">
4141
<label>Default Group</label>
4242
<source_model>Magento\Customer\Model\Config\Source\Group</source_model>
43+
<validate>required-entry</validate>
4344
</field>
4445
<field id="viv_domestic_group" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
4546
<label>Group for Valid VAT ID - Domestic</label>

lib/internal/Magento/Framework/View/Element/Html/Calendar.php

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,9 +107,7 @@ protected function _toHtml()
107107
]
108108
);
109109

110-
// get "today" and "week" words
111-
$this->assign('today', $this->encoder->encode($localeData['fields']['day']['relative']['0']));
112-
$this->assign('week', $this->encoder->encode($localeData['fields']['week']['dn']));
110+
$this->assignFieldsValues($localeData);
113111

114112
// get "am" & "pm" words
115113
$this->assign('am', $this->encoder->encode($localeData['calendar']['gregorian']['AmPmMarkers']['0']));
@@ -189,4 +187,25 @@ public function getYearRange()
189187
return (new \DateTime())->modify('- 100 years')->format('Y')
190188
. ':' . (new \DateTime())->modify('+ 100 years')->format('Y');
191189
}
190+
191+
/**
192+
* Assign "fields" values from the ICU data
193+
*
194+
* @param \ResourceBundle $localeData
195+
*/
196+
private function assignFieldsValues(\ResourceBundle $localeData): void
197+
{
198+
/**
199+
* Fields value in the current position has been added to ICU Data tables
200+
* starting with ICU library version 51.1.
201+
* Due to fact that we do not use these variables in templates, we do not initialize them for older versions
202+
*
203+
* @see https://github.com/unicode-org/icu/blob/release-50-2/icu4c/source/data/locales/en.txt
204+
* @see https://github.com/unicode-org/icu/blob/release-51-2/icu4c/source/data/locales/en.txt
205+
*/
206+
if ($localeData->get('fields')) {
207+
$this->assign('today', $this->encoder->encode($localeData['fields']['day']['relative']['0']));
208+
$this->assign('week', $this->encoder->encode($localeData['fields']['week']['dn']));
209+
}
210+
}
192211
}

0 commit comments

Comments
 (0)