Skip to content

Commit a4dd876

Browse files
author
Akimov, Alexander(aakimov)
committed
Merge pull request #554 from magento-south/BUGS
[SOUTH] Bugfixes
2 parents 1c55514 + 7009584 commit a4dd876

File tree

30 files changed

+377
-49
lines changed

30 files changed

+377
-49
lines changed

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
<button attr="{disabled: disabled}"
1616
class="action-secondary"
1717
type="button"
18-
click="addChild.bind($data, false, false)">
18+
click="processingAddChild.bind($data, false, false, false)">
1919
<span text="addButtonLabel"/>
2020
</button>
2121
</div>
@@ -59,7 +59,7 @@
5959
</tr>
6060
</thead>
6161

62-
<tbody data-bind="foreach: elems">
62+
<tbody>
6363
<tr repeat="foreach: elems, item: '$record'"
6464
class="data-row"
6565
css="'_odd-row': $index % 2">

app/code/Magento/Catalog/etc/config.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,5 +57,12 @@
5757
</allowed_resources>
5858
</media_storage_configuration>
5959
</system>
60+
<design>
61+
<watermark>
62+
<image_position>stretch</image_position>
63+
<small_image_position>stretch</small_image_position>
64+
<thumbnail_position>stretch</thumbnail_position>
65+
</watermark>
66+
</design>
6067
</default>
6168
</config>

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -630,7 +630,7 @@
630630
<item name="watermark_image_position" xsi:type="array">
631631
<item name="path" xsi:type="string">design/watermark/image_position</item>
632632
<item name="fieldset" xsi:type="string">other_settings/watermark/image</item>
633-
<item name="default" xsi:type="string">stretch</item>
633+
634634
</item>
635635
<item name="watermark_small_image_size" xsi:type="array">
636636
<item name="path" xsi:type="string">design/watermark/small_image_size</item>
@@ -658,7 +658,6 @@
658658
<item name="watermark_small_image_position" xsi:type="array">
659659
<item name="path" xsi:type="string">design/watermark/small_image_position</item>
660660
<item name="fieldset" xsi:type="string">other_settings/watermark/small_image</item>
661-
<item name="default" xsi:type="string">stretch</item>
662661
</item>
663662
<item name="watermark_thumbnail_size" xsi:type="array">
664663
<item name="path" xsi:type="string">design/watermark/thumbnail_size</item>
@@ -686,7 +685,6 @@
686685
<item name="watermark_thumbnail_position" xsi:type="array">
687686
<item name="path" xsi:type="string">design/watermark/thumbnail_position</item>
688687
<item name="fieldset" xsi:type="string">other_settings/watermark/thumbnail</item>
689-
<item name="default" xsi:type="string">stretch</item>
690688
</item>
691689
</argument>
692690
</arguments>

app/code/Magento/Checkout/etc/frontend/sections.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
<action name="rest/*/V1/carts/*/payment-information">
4343
<section name="cart"/>
4444
<section name="checkout-data"/>
45+
<section name="last-ordered-items"/>
4546
</action>
4647
<action name="rest/*/V1/guest-carts/*/payment-information">
4748
<section name="cart"/>

app/code/Magento/Cms/view/adminhtml/layout/cms_block_edit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
-->
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
99
<update handle="styles"/>
10+
<update handle="editor"/>
1011
<body>
1112
<referenceContainer name="content">
1213
<uiComponent name="cms_block_form"/>

app/code/Magento/Cms/view/adminhtml/layout/cms_page_edit.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77
-->
88
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="admin-1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
9+
<update handle="editor"/>
910
<body>
1011
<referenceContainer name="content">
1112
<uiComponent name="cms_page_form"/>
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Customer\Model\ResourceModel\Db\VersionControl;
7+
8+
use Magento\Framework\DataObject;
9+
use Magento\Framework\Model\ResourceModel\Db\VersionControl\Snapshot;
10+
11+
class AddressSnapshot extends Snapshot
12+
{
13+
/**
14+
* {@inheritdoc}
15+
*/
16+
public function isModified(DataObject $entity)
17+
{
18+
$result = parent::isModified($entity);
19+
20+
if (!$result
21+
&& !$entity->getIsCustomerSaveTransaction()
22+
&& $this->isAddressDefault($entity)
23+
) {
24+
return true;
25+
}
26+
27+
return $result;
28+
}
29+
30+
/**
31+
* Checks if address has chosen as default and has had an id
32+
*
33+
* @param DataObject $entity
34+
* @return bool
35+
*/
36+
private function isAddressDefault(DataObject $entity)
37+
{
38+
return $entity->getId() && ($entity->getIsDefaultBilling() || $entity->getIsDefaultShipping());
39+
}
40+
}

app/code/Magento/Customer/Observer/AfterAddressSaveObserver.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Magento\Customer\Api\GroupManagementInterface;
1010
use Magento\Customer\Helper\Address as HelperAddress;
1111
use Magento\Customer\Model\Address\AbstractAddress;
12+
use Magento\Customer\Model\Session as CustomerSession;
1213
use Magento\Framework\App\Area;
1314
use Magento\Framework\App\Config\ScopeConfigInterface;
1415
use Magento\Framework\App\State as AppState;
@@ -72,6 +73,11 @@ class AfterAddressSaveObserver implements ObserverInterface
7273
*/
7374
protected $escaper;
7475

76+
/**
77+
* @var CustomerSession
78+
*/
79+
private $customerSession;
80+
7581
/**
7682
* @param Vat $customerVat
7783
* @param HelperAddress $customerAddress
@@ -81,6 +87,7 @@ class AfterAddressSaveObserver implements ObserverInterface
8187
* @param ManagerInterface $messageManager
8288
* @param Escaper $escaper
8389
* @param AppState $appState
90+
* @param CustomerSession $customerSession
8491
*/
8592
public function __construct(
8693
Vat $customerVat,
@@ -90,7 +97,8 @@ public function __construct(
9097
ScopeConfigInterface $scopeConfig,
9198
ManagerInterface $messageManager,
9299
Escaper $escaper,
93-
AppState $appState
100+
AppState $appState,
101+
CustomerSession $customerSession
94102
) {
95103
$this->_customerVat = $customerVat;
96104
$this->_customerAddress = $customerAddress;
@@ -100,6 +108,7 @@ public function __construct(
100108
$this->messageManager = $messageManager;
101109
$this->escaper = $escaper;
102110
$this->appState = $appState;
111+
$this->customerSession = $customerSession;
103112
}
104113

105114
/**
@@ -132,6 +141,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
132141
if (!$customer->getDisableAutoGroupChange() && $customer->getGroupId() != $defaultGroupId) {
133142
$customer->setGroupId($defaultGroupId);
134143
$customer->save();
144+
$this->customerSession->setCustomerGroupId($defaultGroupId);
135145
}
136146
} else {
137147
$result = $this->_customerVat->checkVatNumber(
@@ -148,6 +158,7 @@ public function execute(\Magento\Framework\Event\Observer $observer)
148158
if (!$customer->getDisableAutoGroupChange() && $customer->getGroupId() != $newGroupId) {
149159
$customer->setGroupId($newGroupId);
150160
$customer->save();
161+
$this->customerSession->setCustomerGroupId($newGroupId);
151162
}
152163

153164
$customerAddress->setVatValidationResult($result);
Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Customer\Test\Unit\Model\ResourceModel\Db\VersionControl;
7+
8+
use Magento\Customer\Model\ResourceModel\Db\VersionControl\AddressSnapshot;
9+
10+
class AddressSnapshotTest extends \PHPUnit_Framework_TestCase
11+
{
12+
/**
13+
* @var AddressSnapshot
14+
*/
15+
private $model;
16+
17+
/**
18+
* @var \Magento\Framework\Model\ResourceModel\Db\VersionControl\Metadata|\PHPUnit_Framework_MockObject_MockObject
19+
*/
20+
private $metadataMock;
21+
22+
protected function setUp()
23+
{
24+
$this->metadataMock = $this->getMockBuilder('Magento\Framework\Model\ResourceModel\Db\VersionControl\Metadata')
25+
->disableOriginalConstructor()
26+
->getMock();
27+
28+
$this->model = new AddressSnapshot(
29+
$this->metadataMock
30+
);
31+
}
32+
33+
/**
34+
* @param bool $isCustomerSaveTransaction
35+
* @param int $isDefaultBilling
36+
* @param int $isDefaultShipping
37+
* @param bool $expected
38+
* @dataProvider dataProviderIsModified
39+
*/
40+
public function testIsModified(
41+
$isCustomerSaveTransaction,
42+
$isDefaultBilling,
43+
$isDefaultShipping,
44+
$expected
45+
) {
46+
$entityId = 1;
47+
48+
$dataObjectMock = $this->getMockBuilder('Magento\Framework\DataObject')
49+
->disableOriginalConstructor()
50+
->setMethods([
51+
'getId',
52+
'getData',
53+
'getDataByKey',
54+
'getIsDefaultBilling',
55+
'getIsDefaultShipping',
56+
'getIsCustomerSaveTransaction',
57+
])
58+
->getMock();
59+
60+
$dataObjectMock->expects($this->any())
61+
->method('getId')
62+
->willReturn($entityId);
63+
$dataObjectMock->expects($this->once())
64+
->method('getData')
65+
->willReturn(['is_billing_address' => 1]);
66+
$dataObjectMock->expects($this->once())
67+
->method('getDataByKey')
68+
->with('is_billing_address')
69+
->willReturn(1);
70+
$dataObjectMock->expects($this->once())
71+
->method('getIsCustomerSaveTransaction')
72+
->willReturn($isCustomerSaveTransaction);
73+
$dataObjectMock->expects($this->any())
74+
->method('getIsDefaultBilling')
75+
->willReturn($isDefaultBilling);
76+
$dataObjectMock->expects($this->any())
77+
->method('getIsDefaultShipping')
78+
->willReturn($isDefaultShipping);
79+
80+
$this->metadataMock->expects($this->once())
81+
->method('getFields')
82+
->with($dataObjectMock)
83+
->willReturn(['is_billing_address' => null]);
84+
85+
$this->model->registerSnapshot($dataObjectMock);
86+
87+
$this->assertEquals($expected, $this->model->isModified($dataObjectMock));
88+
}
89+
90+
/**
91+
* @return array
92+
*/
93+
public function dataProviderIsModified()
94+
{
95+
return [
96+
[false, 1, 1, true],
97+
[true, 0, 0, false],
98+
[false, 1, 0, true],
99+
[false, 0, 1, true],
100+
];
101+
}
102+
103+
public function testIsModifiedBypass()
104+
{
105+
$dataObjectMock = $this->getMockBuilder('Magento\Framework\DataObject')
106+
->disableOriginalConstructor()
107+
->setMethods([
108+
'getId',
109+
'getData',
110+
])
111+
->getMock();
112+
113+
$dataObjectMock->expects($this->any())
114+
->method('getId')
115+
->willReturn(null);
116+
$dataObjectMock->expects($this->once())
117+
->method('getData')
118+
->willReturn(['is_billing_address' => 1]);
119+
120+
$this->metadataMock->expects($this->once())
121+
->method('getFields')
122+
->with($dataObjectMock)
123+
->willReturn(['is_billing_address' => null]);
124+
125+
$this->model->registerSnapshot($dataObjectMock);
126+
127+
$this->assertEquals(true, $this->model->isModified($dataObjectMock));
128+
}
129+
}

app/code/Magento/Customer/Test/Unit/Observer/AfterAddressSaveObserverTest.php

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ class AfterAddressSaveObserverTest extends \PHPUnit_Framework_TestCase
7474
*/
7575
protected $customerMock;
7676

77+
/**
78+
* @var \Magento\Customer\Model\Session|\PHPUnit_Framework_MockObject_MockObject
79+
*/
80+
protected $customerSessionMock;
81+
7782
protected function setUp()
7883
{
7984
$this->vat = $this->getMockBuilder('Magento\Customer\Model\Vat')
@@ -105,6 +110,9 @@ protected function setUp()
105110
->disableOriginalConstructor()
106111
->getMock();
107112

113+
$this->customerSessionMock = $this->getMockBuilder('Magento\Customer\Model\Session')
114+
->disableOriginalConstructor()
115+
->getMock();
108116

109117
$this->model = new AfterAddressSaveObserver(
110118
$this->vat,
@@ -114,7 +122,8 @@ protected function setUp()
114122
$this->scopeConfig,
115123
$this->messageManager,
116124
$this->escaper,
117-
$this->appState
125+
$this->appState,
126+
$this->customerSessionMock
118127
);
119128
}
120129

@@ -462,6 +471,11 @@ public function testAfterAddressSaveNewGroup(
462471
->method('save')
463472
->willReturnSelf();
464473

474+
$this->customerSessionMock->expects($this->once())
475+
->method('setCustomerGroupId')
476+
->with($newGroupId)
477+
->willReturnSelf();
478+
465479
$address = $this->getMockBuilder('Magento\Customer\Model\Address')
466480
->disableOriginalConstructor()
467481
->setMethods([

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@
8787
<type name="Magento\Customer\Model\ResourceModel\Address">
8888
<arguments>
8989
<argument name="customerRepository" xsi:type="object">Magento\Customer\Api\CustomerRepositoryInterface\Proxy</argument>
90-
<argument name="entitySnapshot" xsi:type="object">EavVersionControlSnapshot</argument>
90+
<argument name="entitySnapshot" xsi:type="object">CustomerAddressSnapshot</argument>
9191
<argument name="entityRelationComposite" xsi:type="object">CustomerAddressRelationsComposite</argument>
9292
</arguments>
9393
</type>
@@ -152,6 +152,11 @@
152152
<argument name="metadata" xsi:type="object">Magento\Eav\Model\Entity\VersionControl\Metadata</argument>
153153
</arguments>
154154
</virtualType>
155+
<virtualType name="CustomerAddressSnapshot" type="Magento\Customer\Model\ResourceModel\Db\VersionControl\AddressSnapshot">
156+
<arguments>
157+
<argument name="metadata" xsi:type="object">Magento\Eav\Model\Entity\VersionControl\Metadata</argument>
158+
</arguments>
159+
</virtualType>
155160
<virtualType name="CustomerRelationsComposite" type="Magento\Framework\Model\ResourceModel\Db\VersionControl\RelationComposite">
156161
<arguments>
157162
<argument name="relationProcessors" xsi:type="array">

app/code/Magento/Customer/etc/indexer.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
99
xsi:noNamespaceSchemaLocation="urn:magento:framework:Indexer/etc/indexer.xsd">
10-
<indexer id="customer_grid" view_id="dummy" class="Magento\Framework\Indexer\Action\Entity" primary="customer">
10+
<indexer id="customer_grid" view_id="customer_dummy" class="Magento\Framework\Indexer\Action\Entity" primary="customer">
1111
<title translate="true">Customer Grid</title>
1212
<description translate="true">Rebuild Customer grid index</description>
1313

app/code/Magento/Customer/etc/mview.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Mview/etc/mview.xsd">
9-
<view id="dummy" class="Magento\Customer\Model\Indexer\Mview\Dummy" group="indexer"/>
9+
<view id="customer_dummy" class="Magento\Customer\Model\Indexer\Mview\Dummy" group="indexer"/>
1010
</config>

0 commit comments

Comments
 (0)