Skip to content

Commit 81c6a29

Browse files
committed
Merge remote-tracking branch 'origin/2.3-develop' into 2.3-develop-pr10
2 parents 8b7b9d1 + 651a556 commit 81c6a29

File tree

30 files changed

+423
-296
lines changed

30 files changed

+423
-296
lines changed

app/code/Magento/Catalog/view/frontend/web/js/product/storage/data-storage.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ define([
228228
this.updateRequestConfig.data = queryBuilder.buildQuery(prepareAjaxParams);
229229
this.updateRequestConfig.data['store_id'] = store;
230230
this.updateRequestConfig.data['currency_code'] = currency;
231-
$.ajax(this.updateRequestConfig).success(function (data) {
231+
$.ajax(this.updateRequestConfig).done(function (data) {
232232
this.request = {};
233233
this.providerHandler(getParsedDataFromServer(data));
234234
}.bind(this));

app/code/Magento/Config/view/adminhtml/templates/system/config/form/field/array.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $_colspan = $block->isAddAfter() ? 2 : 1;
2121
<?php foreach ($block->getColumns() as $columnName => $column): ?>
2222
<th><?= /* @escapeNotVerified */ $column['label'] ?></th>
2323
<?php endforeach;?>
24-
<th class="col-actions" colspan="<?= /* @escapeNotVerified */ $_colspan ?>">Action</th>
24+
<th class="col-actions" colspan="<?= /* @escapeNotVerified */ $_colspan ?>"><?= /* @escapeNotVerified */ __('Action') ?></th>
2525
</tr>
2626
</thead>
2727
<tfoot>

app/code/Magento/ConfigurableProduct/view/adminhtml/templates/product/configurable/affected-attribute-set-selector/js.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@
8989
showLoader: true,
9090
context: $form
9191
})
92-
.success(function (data) {
92+
.done(function (data) {
9393
if (!data.error) {
9494
setAttributeSetId(data.id);
9595
closeDialogAndProcessForm($form);

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/product-grid.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ define([
9595
type: 'GET',
9696
url: this._buildGridUrl(filterData),
9797
context: $('body')
98-
}).success(function (data) {
98+
}).done(function (data) {
9999
bootstrap(JSON.parse(data));
100100
});
101101
},

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/variations/variations.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ define([
492492
dataType: 'json',
493493
showLoader: true,
494494
context: this
495-
}).success(function (data) {
495+
}).done(function (data) {
496496
if (!data.error) {
497497
this.set(
498498
'skeletonAttributeSet',
@@ -507,7 +507,7 @@ define([
507507
}
508508

509509
return false;
510-
}).error(function (xhr) {
510+
}).fail(function (xhr) {
511511
if (xhr.statusText === 'abort') {
512512
return;
513513
}

app/code/Magento/Customer/Controller/Section/Load.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,8 @@ public function execute()
6464
{
6565
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
6666
$resultJson = $this->resultJsonFactory->create();
67-
$resultJson->setHeader('Cache-Control', 'max-age=0, must-revalidate, no-cache, no-store');
68-
$resultJson->setHeader('Pragma', 'no-cache');
67+
$resultJson->setHeader('Cache-Control', 'max-age=0, must-revalidate, no-cache, no-store', true);
68+
$resultJson->setHeader('Pragma', 'no-cache', true);
6969
try {
7070
$sectionNames = $this->getRequest()->getParam('sections');
7171
$sectionNames = $sectionNames ? array_unique(\explode(',', $sectionNames)) : null;

app/code/Magento/Eav/Model/Entity/Collection/AbstractCollection.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1498,6 +1498,10 @@ protected function _getAttributeConditionSql($attribute, $condition, $joinType =
14981498
$condition
14991499
);
15001500
} else {
1501+
if (isset($condition['null'])) {
1502+
$joinType = 'left';
1503+
}
1504+
15011505
$this->_addAttributeJoin($attribute, $joinType);
15021506
if (isset($this->_joinAttributes[$attribute]['condition_alias'])) {
15031507
$field = $this->_joinAttributes[$attribute]['condition_alias'];

app/code/Magento/Sales/Controller/Adminhtml/Order/MassCancel.php

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,23 +9,37 @@
99
use Magento\Backend\App\Action\Context;
1010
use Magento\Ui\Component\MassAction\Filter;
1111
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory;
12+
use Magento\Sales\Api\OrderManagementInterface;
1213

1314
class MassCancel extends \Magento\Sales\Controller\Adminhtml\Order\AbstractMassAction
1415
{
1516
/**
1617
* Authorization level of a basic admin session
1718
*/
1819
const ADMIN_RESOURCE = 'Magento_Sales::cancel';
20+
21+
/**
22+
* @var OrderManagementInterface
23+
*/
24+
private $orderManagement;
1925

2026
/**
2127
* @param Context $context
2228
* @param Filter $filter
2329
* @param CollectionFactory $collectionFactory
30+
* @param OrderManagementInterface|null $orderManagement
2431
*/
25-
public function __construct(Context $context, Filter $filter, CollectionFactory $collectionFactory)
26-
{
32+
public function __construct(
33+
Context $context,
34+
Filter $filter,
35+
CollectionFactory $collectionFactory,
36+
OrderManagementInterface $orderManagement = null
37+
) {
2738
parent::__construct($context, $filter);
2839
$this->collectionFactory = $collectionFactory;
40+
$this->orderManagement = $orderManagement ?: \Magento\Framework\App\ObjectManager::getInstance()->get(
41+
\Magento\Sales\Api\OrderManagementInterface::class
42+
);
2943
}
3044

3145
/**
@@ -38,11 +52,10 @@ protected function massAction(AbstractCollection $collection)
3852
{
3953
$countCancelOrder = 0;
4054
foreach ($collection->getItems() as $order) {
41-
if (!$order->canCancel()) {
55+
$isCanceled = $this->orderManagement->cancel($order->getEntityId());
56+
if ($isCanceled === false) {
4257
continue;
4358
}
44-
$order->cancel();
45-
$order->save();
4659
$countCancelOrder++;
4760
}
4861
$countNonCancelOrder = $collection->count() - $countCancelOrder;

app/code/Magento/Sales/Model/Order/ShipmentFactory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
*/
66
namespace Magento\Sales\Model\Order;
77

8-
use Magento\Framework\App\ObjectManager;
98
use Magento\Framework\Exception\LocalizedException;
10-
use Magento\Sales\Model\Order\Shipment\ShipmentValidatorInterface;
119
use Magento\Framework\Serialize\Serializer\Json;
1210

1311
/**
1412
* Factory class for @see \Magento\Sales\Api\Data\ShipmentInterface
13+
*
14+
* @api
1515
*/
1616
class ShipmentFactory
1717
{

app/code/Magento/Sales/Test/Unit/Controller/Adminhtml/Order/MassCancelTest.php

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,11 @@ class MassCancelTest extends \PHPUnit\Framework\TestCase
8585
*/
8686
protected $filterMock;
8787

88+
/**
89+
* @var \PHPUnit_Framework_MockObject_MockObject
90+
*/
91+
private $orderManagementMock;
92+
8893
protected function setUp()
8994
{
9095
$objectManagerHelper = new ObjectManagerHelper($this);
@@ -145,12 +150,15 @@ protected function setUp()
145150
$this->orderCollectionFactoryMock->expects($this->once())
146151
->method('create')
147152
->willReturn($this->orderCollectionMock);
153+
$this->orderManagementMock = $this->createMock(\Magento\Sales\Api\OrderManagementInterface::class);
154+
148155
$this->massAction = $objectManagerHelper->getObject(
149156
\Magento\Sales\Controller\Adminhtml\Order\MassCancel::class,
150157
[
151158
'context' => $this->contextMock,
152159
'filter' => $this->filterMock,
153-
'collectionFactory' => $this->orderCollectionFactoryMock
160+
'collectionFactory' => $this->orderCollectionFactoryMock,
161+
'orderManagement' => $this->orderManagementMock
154162
]
155163
);
156164
}
@@ -161,6 +169,9 @@ protected function setUp()
161169
*/
162170
public function testExecuteCanCancelOneOrder()
163171
{
172+
$order1id = 100;
173+
$order2id = 200;
174+
164175
$order1 = $this->getMockBuilder(\Magento\Sales\Model\Order::class)
165176
->disableOriginalConstructor()
166177
->getMock();
@@ -175,20 +186,19 @@ public function testExecuteCanCancelOneOrder()
175186
->willReturn($orders);
176187

177188
$order1->expects($this->once())
178-
->method('canCancel')
179-
->willReturn(true);
180-
$order1->expects($this->once())
181-
->method('cancel');
182-
$order1->expects($this->once())
183-
->method('save');
189+
->method('getEntityId')
190+
->willReturn($order1id);
191+
192+
$order2->expects($this->once())
193+
->method('getEntityId')
194+
->willReturn($order2id);
184195

185196
$this->orderCollectionMock->expects($this->once())
186197
->method('count')
187198
->willReturn($countOrders);
188199

189-
$order2->expects($this->once())
190-
->method('canCancel')
191-
->willReturn(false);
200+
$this->orderManagementMock->expects($this->at(0))->method('cancel')->with($order1id)->willReturn(true);
201+
$this->orderManagementMock->expects($this->at(1))->method('cancel')->with($order2id)->willReturn(false);
192202

193203
$this->messageManagerMock->expects($this->once())
194204
->method('addError')
@@ -222,21 +232,23 @@ public function testExcludedCannotCancelOrders()
222232
$orders = [$order1, $order2];
223233
$countOrders = count($orders);
224234

235+
$order1->expects($this->once())
236+
->method('getEntityId')
237+
->willReturn(100);
238+
239+
$order2->expects($this->once())
240+
->method('getEntityId')
241+
->willReturn(200);
242+
225243
$this->orderCollectionMock->expects($this->any())
226244
->method('getItems')
227245
->willReturn([$order1, $order2]);
228246

229-
$order1->expects($this->once())
230-
->method('canCancel')
231-
->willReturn(false);
232-
233247
$this->orderCollectionMock->expects($this->once())
234248
->method('count')
235249
->willReturn($countOrders);
236250

237-
$order2->expects($this->once())
238-
->method('canCancel')
239-
->willReturn(false);
251+
$this->orderManagementMock->expects($this->atLeastOnce())->method('cancel')->willReturn(false);
240252

241253
$this->messageManagerMock->expects($this->once())
242254
->method('addError')
@@ -265,11 +277,10 @@ public function testException()
265277
->willReturn([$order1]);
266278

267279
$order1->expects($this->once())
268-
->method('canCancel')
269-
->willReturn(true);
270-
$order1->expects($this->once())
271-
->method('cancel')
272-
->willThrowException($exception);
280+
->method('getEntityId')
281+
->willReturn(100);
282+
283+
$this->orderManagementMock->expects($this->atLeastOnce())->method('cancel')->willThrowException($exception);
273284

274285
$this->messageManagerMock->expects($this->once())
275286
->method('addError')

0 commit comments

Comments
 (0)