Skip to content

Commit ecf5ef3

Browse files
author
Joan He
committed
Merge remote-tracking branch 'upstream/2.3-develop' into MC-21994
2 parents d58c24e + 6f1c7e3 commit ecf5ef3

File tree

41 files changed

+871
-104
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+871
-104
lines changed

app/code/Magento/Braintree/Model/Ui/ConfigProvider.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,12 @@ public function __construct(
6767
public function getConfig()
6868
{
6969
$storeId = $this->session->getStoreId();
70+
$isActive = $this->config->isActive($storeId);
7071
return [
7172
'payment' => [
7273
self::CODE => [
73-
'isActive' => $this->config->isActive($storeId),
74-
'clientToken' => $this->getClientToken(),
74+
'isActive' => $isActive,
75+
'clientToken' => $isActive ? $this->getClientToken() : null,
7576
'ccTypesMapper' => $this->config->getCcTypesMapper(),
7677
'sdkUrl' => $this->config->getSdkUrl(),
7778
'hostedFieldsSdkUrl' => $this->config->getHostedFieldsSdkUrl(),

app/code/Magento/Braintree/Test/Unit/Model/Ui/ConfigProviderTest.php

Lines changed: 37 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,30 +76,45 @@ protected function setUp()
7676
}
7777

7878
/**
79-
* Run test getConfig method
79+
* Ensure that get config returns correct data if payment is active or not
8080
*
8181
* @param array $config
8282
* @param array $expected
8383
* @dataProvider getConfigDataProvider
8484
*/
8585
public function testGetConfig($config, $expected)
8686
{
87-
$this->braintreeAdapter->expects(static::once())
88-
->method('generate')
89-
->willReturn(self::CLIENT_TOKEN);
87+
if ($config['isActive']) {
88+
$this->braintreeAdapter->expects($this->once())
89+
->method('generate')
90+
->willReturn(self::CLIENT_TOKEN);
91+
} else {
92+
$config = array_replace_recursive(
93+
$this->getConfigDataProvider()[0]['config'],
94+
$config
95+
);
96+
$expected = array_replace_recursive(
97+
$this->getConfigDataProvider()[0]['expected'],
98+
$expected
99+
);
100+
$this->braintreeAdapter->expects($this->never())
101+
->method('generate');
102+
}
90103

91104
foreach ($config as $method => $value) {
92-
$this->config->expects(static::once())
105+
$this->config->expects($this->once())
93106
->method($method)
94107
->willReturn($value);
95108
}
96109

97-
static::assertEquals($expected, $this->configProvider->getConfig());
110+
$this->assertEquals($expected, $this->configProvider->getConfig());
98111
}
99112

100113
/**
101-
* @covers \Magento\Braintree\Model\Ui\ConfigProvider::getClientToken
114+
* @covers \Magento\Braintree\Model\Ui\ConfigProvider::getClientToken
102115
* @dataProvider getClientTokenDataProvider
116+
* @param $merchantAccountId
117+
* @param $params
103118
*/
104119
public function testGetClientToken($merchantAccountId, $params)
105120
{
@@ -124,7 +139,7 @@ public function getConfigDataProvider()
124139
[
125140
'config' => [
126141
'isActive' => true,
127-
'getCcTypesMapper' => ['visa' => 'VI', 'american-express'=> 'AE'],
142+
'getCcTypesMapper' => ['visa' => 'VI', 'american-express' => 'AE'],
128143
'getSdkUrl' => self::SDK_URL,
129144
'getHostedFieldsSdkUrl' => 'https://sdk.com/test.js',
130145
'getCountrySpecificCardTypeConfig' => [
@@ -148,7 +163,7 @@ public function getConfigDataProvider()
148163
'ccTypesMapper' => ['visa' => 'VI', 'american-express' => 'AE'],
149164
'sdkUrl' => self::SDK_URL,
150165
'hostedFieldsSdkUrl' => 'https://sdk.com/test.js',
151-
'countrySpecificCardTypes' =>[
166+
'countrySpecificCardTypes' => [
152167
'GB' => ['VI', 'AE'],
153168
'US' => ['DI', 'JCB']
154169
],
@@ -166,6 +181,19 @@ public function getConfigDataProvider()
166181
]
167182
]
168183
]
184+
],
185+
[
186+
'config' => [
187+
'isActive' => false,
188+
],
189+
'expected' => [
190+
'payment' => [
191+
ConfigProvider::CODE => [
192+
'isActive' => false,
193+
'clientToken' => null,
194+
]
195+
]
196+
]
169197
]
170198
];
171199
}

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/AdvancedPricing.php

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public function modifyMeta(array $meta)
149149

150150
$this->specialPriceDataToInline();
151151
$this->customizeTierPrice();
152+
$this->customizePrice();
152153

153154
if (isset($this->meta['advanced-pricing'])) {
154155
$this->addAdvancedPriceLink();
@@ -197,6 +198,29 @@ protected function preparePriceFields($fieldCode)
197198
return $this;
198199
}
199200

201+
/**
202+
* Customize price field.
203+
*
204+
* @return $this
205+
*/
206+
private function customizePrice(): AdvancedPricing
207+
{
208+
$pathFrom = $this->arrayManager->findPath('price', $this->meta, null, 'children');
209+
210+
if ($pathFrom) {
211+
$this->meta = $this->arrayManager->merge(
212+
$this->arrayManager->slicePath($pathFrom, 0, -2) . '/arguments/data/config',
213+
$this->meta,
214+
[
215+
'label' => false,
216+
'required' => false,
217+
]
218+
);
219+
}
220+
221+
return $this;
222+
}
223+
200224
/**
201225
* Customize tier price field
202226
*
@@ -573,21 +597,21 @@ private function specialPriceDataToInline()
573597
$this->arrayManager->slicePath($pathFrom, 0, -2) . '/arguments/data/config',
574598
$this->meta,
575599
[
576-
'label' => __('Special Price From'),
600+
'label' => false,
601+
'required' => false,
577602
'additionalClasses' => 'admin__control-grouped-date',
578603
'breakLine' => false,
579604
'component' => 'Magento_Ui/js/form/components/group',
580-
'scopeLabel' =>
581-
$this->arrayManager->get($pathFrom . '/arguments/data/config/scopeLabel', $this->meta),
582605
]
583606
);
584607
$this->meta = $this->arrayManager->merge(
585608
$pathFrom . '/arguments/data/config',
586609
$this->meta,
587610
[
588611
'label' => __('Special Price From'),
589-
'scopeLabel' => null,
590-
'additionalClasses' => 'admin__field-date'
612+
'scopeLabel' =>
613+
$this->arrayManager->get($pathFrom . '/arguments/data/config/scopeLabel', $this->meta),
614+
'additionalClasses' => 'admin__field-date',
591615
]
592616
);
593617
$this->meta = $this->arrayManager->merge(

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Categories.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,13 +243,14 @@ protected function customizeCategoriesField(array $meta)
243243
'arguments' => [
244244
'data' => [
245245
'config' => [
246-
'label' => __('Categories'),
246+
'label' => false,
247+
'required' => false,
247248
'dataScope' => '',
248249
'breakLine' => false,
249250
'formElement' => 'container',
250251
'componentType' => 'container',
251252
'component' => 'Magento_Ui/js/form/components/group',
252-
'scopeLabel' => __('[GLOBAL]'),
253+
'disabled' => $this->locator->getProduct()->isLockedAttribute($fieldCode),
253254
],
254255
],
255256
],

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/Eav.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -861,7 +861,9 @@ public function setupAttributeContainerMeta(ProductAttributeInterface $attribute
861861
'arguments/data/config',
862862
$containerMeta,
863863
[
864-
'component' => 'Magento_Ui/js/form/components/group'
864+
'component' => 'Magento_Ui/js/form/components/group',
865+
'label' => false,
866+
'required' => false,
865867
]
866868
);
867869
}

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/General.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,7 @@ protected function customizeWeightField(array $meta)
224224
'validate-zero-or-greater' => true
225225
],
226226
'additionalClasses' => 'admin__field-small',
227+
'sortOrder' => 0,
227228
'addafter' => $this->locator->getStore()->getConfig('general/locale/weight_unit'),
228229
'imports' => $disabled ? [] : [
229230
'disabled' => '!${$.provider}:' . self::DATA_SCOPE_PRODUCT
@@ -242,6 +243,8 @@ protected function customizeWeightField(array $meta)
242243
$containerPath . static::META_CONFIG_PATH,
243244
$meta,
244245
[
246+
'label' => false,
247+
'required' => false,
245248
'component' => 'Magento_Ui/js/form/components/group',
246249
]
247250
);
@@ -269,6 +272,7 @@ protected function customizeWeightField(array $meta)
269272
],
270273
],
271274
'value' => (int)$this->locator->getProduct()->getTypeInstance()->hasWeight(),
275+
'sortOrder' => 10,
272276
'disabled' => $disabled,
273277
]
274278
);
@@ -317,7 +321,8 @@ protected function customizeNewDateRangeField(array $meta)
317321
$fromContainerPath . self::META_CONFIG_PATH,
318322
$meta,
319323
[
320-
'label' => __('Set Product as New From'),
324+
'label' => false,
325+
'required' => false,
321326
'additionalClasses' => 'admin__control-grouped-date',
322327
'breakLine' => false,
323328
'component' => 'Magento_Ui/js/form/components/group',

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/ScheduleDesignUpdate.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ public function __construct(ArrayManager $arrayManager)
3737
}
3838

3939
/**
40-
* {@inheritdoc}
40+
* @inheritdoc
41+
*
4142
* @since 101.0.0
4243
*/
4344
public function modifyMeta(array $meta)
@@ -47,7 +48,8 @@ public function modifyMeta(array $meta)
4748
}
4849

4950
/**
50-
* {@inheritdoc}
51+
* @inheritdoc
52+
*
5153
* @since 101.0.0
5254
*/
5355
public function modifyData(array $data)
@@ -96,7 +98,8 @@ protected function customizeDateRangeField(array $meta)
9698
$fromContainerPath . self::META_CONFIG_PATH,
9799
$meta,
98100
[
99-
'label' => __('Schedule Update From'),
101+
'label' => false,
102+
'required' => false,
100103
'additionalClasses' => 'admin__control-grouped-date',
101104
'breakLine' => false,
102105
'component' => 'Magento_Ui/js/form/components/group',

app/code/Magento/Catalog/Ui/DataProvider/Product/Form/Modifier/TierPrice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ private function getUpdatedTierPriceStructure(array $priceMeta)
115115
'dataType' => Price::NAME,
116116
'component' => 'Magento_Ui/js/form/components/group',
117117
'label' => __('Price'),
118-
'enableLabel' => true,
118+
'showLabel' => false,
119119
'dataScope' => '',
120120
'additionalClasses' => 'control-grouped',
121121
'sortOrder' => isset($priceMeta['arguments']['data']['config']['sortOrder'])

app/code/Magento/Catalog/view/adminhtml/ui_component/category_form.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -528,10 +528,7 @@
528528
<item name="type" xsi:type="string">group</item>
529529
<item name="config" xsi:type="array">
530530
<item name="additionalClasses" xsi:type="string">admin__control-grouped-date</item>
531-
<item name="label" xsi:type="string" translate="true">Schedule Update From</item>
532-
<item name="required" xsi:type="boolean">false</item>
533531
<item name="breakLine" xsi:type="boolean">false</item>
534-
<item name="scopeLabel" xsi:type="string">[STORE VIEW]</item>
535532
</item>
536533
</argument>
537534
<field name="custom_design_from" sortOrder="230" formElement="date">
@@ -541,6 +538,7 @@
541538
</additionalClasses>
542539
<dataType>string</dataType>
543540
<label translate="true">Schedule Update From</label>
541+
<scopeLabel>[STORE VIEW]</scopeLabel>
544542
</settings>
545543
</field>
546544
<field name="custom_design_to" sortOrder="240" formElement="date">

app/code/Magento/CatalogInventory/Ui/DataProvider/Product/Form/Modifier/AdvancedInventory.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function modifyMeta(array $meta)
177177
}
178178

179179
/**
180-
* Prepare Meta
180+
* Modify UI Quantity and Stock status attribute meta.
181181
*
182182
* @return void
183183
*/
@@ -187,10 +187,6 @@ private function prepareMeta()
187187
$pathField = $this->arrayManager->findPath($fieldCode, $this->meta, null, 'children');
188188

189189
if ($pathField) {
190-
$labelField = $this->arrayManager->get(
191-
$this->arrayManager->slicePath($pathField, 0, -2) . '/arguments/data/config/label',
192-
$this->meta
193-
);
194190
$fieldsetPath = $this->arrayManager->slicePath($pathField, 0, -4);
195191

196192
$this->meta = $this->arrayManager->merge(
@@ -218,10 +214,9 @@ private function prepareMeta()
218214
'formElement' => 'container',
219215
'componentType' => 'container',
220216
'component' => "Magento_Ui/js/form/components/group",
221-
'label' => $labelField,
217+
'label' => false,
222218
'breakLine' => false,
223219
'dataScope' => $fieldCode,
224-
'scopeLabel' => '[GLOBAL]',
225220
'source' => 'product_details',
226221
'sortOrder' => (int) $this->arrayManager->get(
227222
$this->arrayManager->slicePath($pathField, 0, -2) . '/arguments/data/config/sortOrder',

0 commit comments

Comments
 (0)