Skip to content

Commit 07a66a2

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into PRS
2 parents b8afac6 + ec23f60 commit 07a66a2

File tree

22 files changed

+817
-132
lines changed

22 files changed

+817
-132
lines changed

app/code/Magento/Catalog/Model/Category/DataProvider.php

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ public function getMeta()
190190

191191
if ($category) {
192192
$meta = $this->addUseDefaultValueCheckbox($category, $meta);
193-
$meta = $this->resolveParentInheritance($category, $meta);
194193
}
195194

196195
return $meta;
@@ -238,28 +237,6 @@ private function addUseDefaultValueCheckbox(Category $category, array $meta)
238237
return $meta;
239238
}
240239

241-
/**
242-
* Removes not necessary inheritance fields
243-
*
244-
* @param Category $category
245-
* @param array $meta
246-
* @return array
247-
*/
248-
private function resolveParentInheritance(Category $category, array $meta)
249-
{
250-
if (!$category->getParentId() || !$this->getArrayManager()->findPath('custom_use_parent_settings', $meta)) {
251-
return $meta;
252-
}
253-
254-
$meta = $this->getArrayManager()->merge(
255-
[$this->getArrayManager()->findPath('custom_use_parent_settings', $meta), 'arguments/data/config'],
256-
$meta,
257-
['visible' => false]
258-
);
259-
260-
return $meta;
261-
}
262-
263240
/**
264241
* Prepare meta data
265242
*

app/code/Magento/Catalog/Test/Unit/Model/Category/DataProviderTest.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,25 @@ public function testGetData()
317317

318318
$this->assertEquals($expects, $result[$categoryId]['image']);
319319
}
320+
321+
public function testGetMetaWithoutParentInheritanceResolving()
322+
{
323+
$categoryMock = $this->getMockBuilder(\Magento\Catalog\Model\Category::class)
324+
->disableOriginalConstructor()
325+
->getMock();
326+
$this->registry->expects($this->once())
327+
->method('registry')
328+
->with('category')
329+
->willReturn($categoryMock);
330+
$attributeMock = $this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Eav\Attribute::class)
331+
->disableOriginalConstructor()
332+
->getMock();
333+
$categoryMock->expects($this->once())
334+
->method('getAttributes')
335+
->willReturn(['image' => $attributeMock]);
336+
$categoryMock->expects($this->never())
337+
->method('getParentId');
338+
339+
$this->getModel()->getMeta();
340+
}
320341
}

app/code/Magento/Config/etc/di.xml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
<argument name="source" xsi:type="object">systemConfigSourceAggregatedProxy</argument>
8383
<argument name="postProcessor" xsi:type="object">systemConfigPostProcessorCompositeProxy</argument>
8484
<argument name="cache" xsi:type="object">Magento\Framework\App\Cache\Type\Config</argument>
85-
<argument name="preProcessor" xsi:type="object">systemConfigPreProcessorComposite</argument>
85+
<argument name="preProcessor" xsi:type="object">Magento\Framework\App\Config\PreProcessorComposite</argument>
8686
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\Serialize</argument>
8787
<argument name="reader" xsi:type="object">Magento\Config\App\Config\Type\System\Reader\Proxy</argument>
8888
</arguments>
@@ -91,7 +91,7 @@
9191
<arguments>
9292
<argument name="source" xsi:type="object">systemConfigSourceAggregated</argument>
9393
<argument name="postProcessor" xsi:type="object">systemConfigPostProcessorComposite</argument>
94-
<argument name="preProcessor" xsi:type="object">systemConfigPreProcessorComposite</argument>
94+
<argument name="preProcessor" xsi:type="object">Magento\Framework\App\Config\PreProcessorComposite</argument>
9595
</arguments>
9696
</type>
9797
<virtualType name="systemSnapshot" type="Magento\Config\App\Config\Type\System">
@@ -148,14 +148,13 @@
148148
</argument>
149149
</arguments>
150150
</virtualType>
151-
<!-- @api -->
152-
<virtualType name="systemConfigPreProcessorComposite" type="Magento\Framework\App\Config\PreProcessorComposite">
151+
<type name="Magento\Framework\App\Config\PreProcessorComposite">
153152
<arguments>
154153
<argument name="processors" xsi:type="array">
155154
<item name="environmentPlaceholder" xsi:type="object">Magento\Config\Model\Config\Processor\EnvironmentPlaceholder</item>
156155
</argument>
157156
</arguments>
158-
</virtualType>
157+
</type>
159158
<!-- @api -->
160159
<virtualType name="systemConfigSourceAggregated" type="Magento\Framework\App\Config\ConfigSourceAggregated">
161160
<arguments>

app/code/Magento/Sales/view/adminhtml/templates/order/create/totals/tax.phtml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ $taxAmount = $block->getTotal()->getValue();
1010
?>
1111
<?php if (($taxAmount == 0 && $this->helper('Magento\Tax\Helper\Data')->displayZeroTax()) || ($taxAmount > 0)): ?>
1212
<?php global $taxIter; $taxIter++; ?>
13+
<?php $class = "{$block->getTotal()->getCode()} " . ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary() ? 'summary-total' : ''); ?>
14+
<tr<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?>
15+
onclick="expandDetails(this, '.summary-details-<?= /* @escapeNotVerified */ $taxIter ?>')"
16+
<?php endif; ?>
17+
class="<?= /* @escapeNotVerified */ $class ?> row-totals">
18+
<td style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="admin__total-mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>">
19+
<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?>
20+
<div class="summary-collapse"><?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?></div>
21+
<?php else: ?>
22+
<?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?>
23+
<?php endif;?>
24+
</td>
25+
<td style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="admin__total-amount"><?= /* @escapeNotVerified */ $block->formatPrice($block->getTotal()->getValue()) ?></td>
26+
</tr>
1327
<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?>
1428
<?php $isTop = 1; ?>
1529
<?php foreach ($block->getTotal()->getFullInfo() as $info): ?>
@@ -41,16 +55,5 @@ $taxAmount = $block->getTotal()->getValue();
4155
<?php endforeach; ?>
4256
<?php endforeach; ?>
4357
<?php endif;?>
44-
<?php $class = "{$block->getTotal()->getCode()} " . ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary() ? 'summary-total' : ''); ?>
45-
<tr<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?> onclick="expandDetails(this, '.summary-details-<?= /* @escapeNotVerified */ $taxIter ?>')"<?php endif; ?> class="<?= /* @escapeNotVerified */ $class ?> row-totals">
46-
<td style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="admin__total-mark" colspan="<?= /* @escapeNotVerified */ $block->getColspan() ?>">
47-
<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?>
48-
<div class="summary-collapse"><?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?></div>
49-
<?php else: ?>
50-
<?= /* @escapeNotVerified */ $block->getTotal()->getTitle() ?>
51-
<?php endif;?>
52-
</td>
53-
<td style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="admin__total-amount"><?= /* @escapeNotVerified */ $block->formatPrice($block->getTotal()->getValue()) ?></td>
54-
</tr>
5558
<?php endif;?>
5659

app/code/Magento/Sales/view/adminhtml/templates/order/totals/tax.phtml

Lines changed: 37 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,45 @@ $_order = $block->getOrder();
1515
$_fullInfo = $block->getFullTaxInfo();
1616
?>
1717

18+
<?php if ($block->displayFullSummary() && $_fullInfo): ?>
19+
<tr class="summary-total" onclick="expandDetails(this, '.summary-details')">
20+
<?php else: ?>
21+
<tr>
22+
<?php endif; ?>
23+
<td class="label">
24+
<div class="summary-collapse" tabindex="0">
25+
<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?>
26+
<?= /* @escapeNotVerified */ __('Total Tax') ?>
27+
<?php else: ?>
28+
<?= /* @escapeNotVerified */ __('Tax') ?>
29+
<?php endif;?>
30+
</div>
31+
</td>
32+
<td>
33+
<?= /* @escapeNotVerified */ $block->displayAmount($_source->getTaxAmount(), $_source->getBaseTaxAmount()) ?>
34+
</td>
35+
</tr>
1836
<?php if ($block->displayFullSummary()): ?>
1937
<?php $isTop = 1; ?>
2038
<?php if (isset($_fullInfo[0]['rates'])): ?>
2139
<?php foreach ($_fullInfo as $info): ?>
2240
<?php if (isset($info['hidden']) && $info['hidden']) {
23-
continue;
24-
} ?>
41+
continue;
42+
} ?>
2543
<?php
26-
$percent = $info['percent'];
27-
$amount = $info['amount'];
28-
$baseAmount = $info['base_amount'];
29-
$rates = $info['rates'];
30-
$isFirst = 1;
44+
$percent = $info['percent'];
45+
$amount = $info['amount'];
46+
$baseAmount = $info['base_amount'];
47+
$rates = $info['rates'];
48+
$isFirst = 1;
3149
?>
3250

3351
<?php foreach ($rates as $rate): ?>
3452
<tr class="summary-details<?php if ($isTop): echo ' summary-details-first'; endif; ?>" style="display:none;">
3553
<?php if (!is_null($rate['percent'])): ?>
36-
<td class="label"><?= /* @escapeNotVerified */ $rate['title'] ?> (<?= (float)$rate['percent'] ?>%)<br /></td>
54+
<td class="admin__total-mark"><?= /* @escapeNotVerified */ $rate['title'] ?> (<?= (float)$rate['percent'] ?>%)<br /></td>
3755
<?php else: ?>
38-
<td class="label"><?= /* @escapeNotVerified */ $rate['title'] ?><br /></td>
56+
<td class="admin__total-mark"><?= /* @escapeNotVerified */ $rate['title'] ?><br /></td>
3957
<?php endif; ?>
4058
<?php if ($isFirst): ?>
4159
<td rowspan="<?= count($rates) ?>"><?= /* @escapeNotVerified */ $block->displayAmount($amount, $baseAmount) ?></td>
@@ -44,48 +62,31 @@ $_fullInfo = $block->getFullTaxInfo();
4462
<?php
4563
$isFirst = 0;
4664
$isTop = 0;
47-
?>
65+
?>
4866
<?php endforeach; ?>
4967
<?php endforeach; ?>
5068
<?php else: ?>
5169
<?php foreach ($_fullInfo as $info): ?>
5270
<?php
53-
$percent = $info['percent'];
54-
$amount = $info['tax_amount'];
55-
$baseAmount = $info['base_tax_amount'];
56-
$isFirst = 1;
71+
$percent = $info['percent'];
72+
$amount = $info['tax_amount'];
73+
$baseAmount = $info['base_tax_amount'];
74+
$isFirst = 1;
5775
?>
5876

5977
<tr class="summary-details<?php if ($isTop): echo ' summary-details-first'; endif; ?>" style="display:none;">
6078
<?php if (!is_null($info['percent'])): ?>
61-
<td class="label"><?= $block->escapeHtml($info['title']) ?> (<?= (float)$info['percent'] ?>%)<br /></td>
79+
<td class="admin__total-mark"><?= $block->escapeHtml($info['title']) ?> (<?= (float)$info['percent'] ?>%)<br /></td>
6280
<?php else: ?>
63-
<td class="label"><?= $block->escapeHtml($info['title']) ?><br /></td>
81+
<td class="admin__total-mark"><?= $block->escapeHtml($info['title']) ?><br /></td>
6482
<?php endif; ?>
6583
<td><?= /* @escapeNotVerified */ $block->displayAmount($amount, $baseAmount) ?></td>
6684
</tr>
6785
<?php
68-
$isFirst = 0;
69-
$isTop = 0;
86+
$isFirst = 0;
87+
$isTop = 0;
7088
?>
7189
<?php endforeach; ?>
7290
<?php endif; ?>
7391
<?php endif;?>
74-
<?php if ($block->displayFullSummary() && $_fullInfo): ?>
75-
<tr class="summary-total" onclick="expandDetails(this, '.summary-details')">
76-
<?php else: ?>
77-
<tr>
78-
<?php endif; ?>
79-
<td class="label">
80-
<div class="summary-collapse">
81-
<?php if ($this->helper('Magento\Tax\Helper\Data')->displayFullSummary()): ?>
82-
<?= /* @escapeNotVerified */ __('Total Tax') ?>
83-
<?php else: ?>
84-
<?= /* @escapeNotVerified */ __('Tax') ?>
85-
<?php endif;?>
86-
</div>
87-
</td>
88-
<td>
89-
<?= /* @escapeNotVerified */ $block->displayAmount($_source->getTaxAmount(), $_source->getBaseTaxAmount()) ?>
90-
</td>
91-
</tr>
92+
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Theme\Model\Config\Processor;
7+
8+
use Magento\Framework\App\Config\Spi\PreProcessorInterface;
9+
use Magento\Framework\Stdlib\ArrayManager;
10+
use Magento\Framework\View\Design\Theme\ListInterface;
11+
use Magento\Framework\View\DesignInterface;
12+
13+
/**
14+
* Allows to convert configurations from \Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID variables.
15+
*
16+
* Detects the design theme configuration data (path \Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID)
17+
* and convert theme identifier from theme_full_path (Ex. "frontend/Magento/blank") to theme_id.
18+
*/
19+
class DesignTheme implements PreProcessorInterface
20+
{
21+
/**
22+
* @var ArrayManager
23+
*/
24+
private $arrayManager;
25+
26+
/**
27+
* @var ListInterface
28+
*/
29+
private $themeList;
30+
31+
/**
32+
* @param ArrayManager $arrayManager
33+
* @param ListInterface $themeList
34+
*/
35+
public function __construct(
36+
ArrayManager $arrayManager,
37+
ListInterface $themeList
38+
) {
39+
$this->arrayManager = $arrayManager;
40+
$this->themeList = $themeList;
41+
}
42+
43+
/**
44+
* Change value from theme_full_path (Ex. "frontend/Magento/blank") to theme_id field for every existed scope.
45+
* All other values leave without changes.
46+
*
47+
* @param array $config
48+
* @return array
49+
*/
50+
public function process(array $config)
51+
{
52+
foreach ($config as $scope => &$item) {
53+
if ($scope === \Magento\Framework\App\Config\ScopeConfigInterface::SCOPE_TYPE_DEFAULT) {
54+
$item = $this->changeThemeFullPathToIdentifier($item);
55+
} else {
56+
foreach ($item as &$scopeItems) {
57+
$scopeItems = $this->changeThemeFullPathToIdentifier($scopeItems);
58+
}
59+
}
60+
}
61+
62+
return $config;
63+
}
64+
65+
/**
66+
* Check \Magento\Framework\View\DesignInterface::XML_PATH_THEME_ID config path
67+
* and convert theme_full_path (Ex. "frontend/Magento/blank") to theme_id
68+
*
69+
* @param array $configItems
70+
* @return array
71+
*/
72+
private function changeThemeFullPathToIdentifier($configItems)
73+
{
74+
$theme = null;
75+
if ($this->arrayManager->exists(DesignInterface::XML_PATH_THEME_ID, $configItems)) {
76+
$themeIdentifier = $this->arrayManager->get(DesignInterface::XML_PATH_THEME_ID, $configItems);
77+
if (!is_numeric($themeIdentifier)) {
78+
$theme = $this->themeList->getThemeByFullPath($themeIdentifier);
79+
}
80+
81+
if ($theme && $theme->getId()) {
82+
return $this->arrayManager->set(DesignInterface::XML_PATH_THEME_ID, $configItems, $theme->getId());
83+
}
84+
}
85+
86+
return $configItems;
87+
}
88+
}

0 commit comments

Comments
 (0)