Skip to content

Commit 0eada38

Browse files
committed
Merge remote-tracking branch 'origin/2.2-develop' into 2.2-develop-pr37
2 parents df8a8dd + 915dfef commit 0eada38

File tree

62 files changed

+194
-158
lines changed

Some content is hidden

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

62 files changed

+194
-158
lines changed

app/code/Magento/Catalog/Model/Product/Type/AbstractType.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -291,13 +291,7 @@ public function attributesCompare($attributeOne, $attributeTwo)
291291
$sortOne = $attributeOne->getGroupSortPath() * 1000 + $attributeOne->getSortPath() * 0.0001;
292292
$sortTwo = $attributeTwo->getGroupSortPath() * 1000 + $attributeTwo->getSortPath() * 0.0001;
293293

294-
if ($sortOne > $sortTwo) {
295-
return 1;
296-
} elseif ($sortOne < $sortTwo) {
297-
return -1;
298-
}
299-
300-
return 0;
294+
return $sortOne <=> $sortTwo;
301295
}
302296

303297
/**

app/code/Magento/Checkout/Test/Mftf/Section/CheckoutPaymentSection.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<element name="isPaymentSection" type="text" selector="//*[@class='opc-progress-bar']/li[contains(@class, '_active') and span[contains(.,'Review &amp; Payments')]]"/>
1313
<element name="availablePaymentSolutions" type="text" selector="#checkout-payment-method-load>div>div>div:nth-child(2)>div.payment-method-title.field.choice"/>
1414
<element name="notAvailablePaymentSolutions" type="text" selector="#checkout-payment-method-load>div>div>div.payment-method._active>div.payment-method-title.field.choice"/>
15-
<element name="billingNewAddressForm" type="text" selector=".billing-new-address-form"/>
15+
<element name="billingNewAddressForm" type="text" selector="[data-form='billing-new-address']"/>
1616
<element name="placeOrderDisabled" type="button" selector="#checkout-payment-method-load button.disabled"/>
1717
<element name="update" type="button" selector=".payment-method-billing-address .action.action-update"/>
1818
<element name="guestFirstName" type="input" selector=".billing-address-form input[name*='firstname']"/>

app/code/Magento/Checkout/view/frontend/web/template/billing-address/form.html

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99
<!-- ko template: getTemplate() --><!-- /ko -->
1010
<!--/ko-->
1111
<form data-bind="attr: {'data-hasrequired': $t('* Required Fields')}">
12-
<fieldset
13-
data-bind="attr: { id:'billing-new-address-form-'+index, value:index}"
14-
class="billing-new-address-form fieldset address">
12+
<fieldset class="fieldset address" data-form="billing-new-address">
1513
<!-- ko foreach: getRegion('additional-fieldsets') -->
1614
<!-- ko template: getTemplate() --><!-- /ko -->
1715
<!--/ko-->

app/code/Magento/Eav/Model/Entity/AbstractEntity.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -602,13 +602,7 @@ public function attributesCompare($firstAttribute, $secondAttribute)
602602
$firstSort = $firstAttribute->getSortWeight((int) $this->_sortingSetId);
603603
$secondSort = $secondAttribute->getSortWeight((int) $this->_sortingSetId);
604604

605-
if ($firstSort > $secondSort) {
606-
return 1;
607-
} elseif ($firstSort < $secondSort) {
608-
return -1;
609-
}
610-
611-
return 0;
605+
return $firstSort <=> $secondSort;
612606
}
613607

614608
/**

app/code/Magento/Quote/Model/Quote/Address.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -872,13 +872,7 @@ public function getGroupedAllShippingRates()
872872
*/
873873
protected function _sortRates($firstItem, $secondItem)
874874
{
875-
if ((int)$firstItem[0]->carrier_sort_order < (int)$secondItem[0]->carrier_sort_order) {
876-
return -1;
877-
} elseif ((int)$firstItem[0]->carrier_sort_order > (int)$secondItem[0]->carrier_sort_order) {
878-
return 1;
879-
} else {
880-
return 0;
881-
}
875+
return (int) $firstItem[0]->carrier_sort_order <=> (int) $secondItem[0]->carrier_sort_order;
882876
}
883877

884878
/**

app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
67
namespace Magento\Reports\Block\Adminhtml\Grid;
78

89
class AbstractGrid extends \Magento\Backend\Block\Widget\Grid\Extended
@@ -170,12 +171,7 @@ public function addColumn($columnId, $column)
170171
*/
171172
protected function _getStoreIds()
172173
{
173-
$filterData = $this->getFilterData();
174-
if ($filterData) {
175-
$storeIds = explode(',', $filterData->getData('store_ids'));
176-
} else {
177-
$storeIds = [];
178-
}
174+
$storeIds = $this->getFilteredStores();
179175
// By default storeIds array contains only allowed stores
180176
$allowedStoreIds = array_keys($this->_storeManager->getStores());
181177
// And then array_intersect with post data for prevent unauthorized stores reports
@@ -409,4 +405,34 @@ protected function _addCustomFilter($collection, $filterData)
409405
{
410406
return $this;
411407
}
408+
409+
/**
410+
*
411+
* @return array
412+
* @throws \Magento\Framework\Exception\LocalizedException
413+
*/
414+
private function getFilteredStores(): array
415+
{
416+
$storeIds = [];
417+
418+
$filterData = $this->getFilterData();
419+
if ($filterData) {
420+
if ($filterData->getWebsite()) {
421+
$storeIds = array_keys(
422+
$this->_storeManager->getWebsite($filterData->getWebsite())->getStores()
423+
);
424+
}
425+
426+
if ($filterData->getGroup()) {
427+
$storeIds = array_keys(
428+
$this->_storeManager->getGroup($filterData->getGroup())->getStores()
429+
);
430+
}
431+
432+
if ($filterData->getData('store_ids')) {
433+
$storeIds = explode(',', $filterData->getData('store_ids'));
434+
}
435+
}
436+
return is_array($storeIds) ? $storeIds : [];
437+
}
412438
}

app/code/Magento/Reports/Block/Adminhtml/Sales/Sales/Grid.php

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
namespace Magento\Reports\Block\Adminhtml\Sales\Sales;
88

9+
use Magento\Reports\Block\Adminhtml\Grid\Column\Renderer\Currency;
10+
911
/**
1012
* Adminhtml sales report grid block
1113
*
@@ -36,7 +38,7 @@ protected function _construct()
3638
*/
3739
public function getResourceCollectionName()
3840
{
39-
return $this->getFilterData()->getData('report_type') == 'updated_at_order'
41+
return $this->getFilterData()->getData('report_type') === 'updated_at_order'
4042
? \Magento\Sales\Model\ResourceModel\Report\Order\Updatedat\Collection::class
4143
: \Magento\Sales\Model\ResourceModel\Report\Order\Collection::class;
4244
}
@@ -103,9 +105,7 @@ protected function _prepareColumns()
103105
]
104106
);
105107

106-
if ($this->getFilterData()->getStoreIds()) {
107-
$this->setStoreIds(explode(',', $this->getFilterData()->getStoreIds()));
108-
}
108+
$this->setStoreIds($this->_getStoreIds());
109109
$currencyCode = $this->getCurrentCurrencyCode();
110110
$rate = $this->getRate($currencyCode);
111111

@@ -118,6 +118,7 @@ protected function _prepareColumns()
118118
'index' => 'total_income_amount',
119119
'total' => 'sum',
120120
'sortable' => false,
121+
'renderer' => Currency::class,
121122
'rate' => $rate,
122123
'header_css_class' => 'col-sales-total',
123124
'column_css_class' => 'col-sales-total'
@@ -133,6 +134,7 @@ protected function _prepareColumns()
133134
'index' => 'total_revenue_amount',
134135
'total' => 'sum',
135136
'sortable' => false,
137+
'renderer' => Currency::class,
136138
'visibility_filter' => ['show_actual_columns'],
137139
'rate' => $rate,
138140
'header_css_class' => 'col-revenue',
@@ -149,6 +151,7 @@ protected function _prepareColumns()
149151
'index' => 'total_profit_amount',
150152
'total' => 'sum',
151153
'sortable' => false,
154+
'renderer' => Currency::class,
152155
'visibility_filter' => ['show_actual_columns'],
153156
'rate' => $rate,
154157
'header_css_class' => 'col-profit',
@@ -165,6 +168,7 @@ protected function _prepareColumns()
165168
'index' => 'total_invoiced_amount',
166169
'total' => 'sum',
167170
'sortable' => false,
171+
'renderer' => Currency::class,
168172
'rate' => $rate,
169173
'header_css_class' => 'col-invoiced',
170174
'column_css_class' => 'col-invoiced'
@@ -180,6 +184,7 @@ protected function _prepareColumns()
180184
'index' => 'total_paid_amount',
181185
'total' => 'sum',
182186
'sortable' => false,
187+
'renderer' => Currency::class,
183188
'visibility_filter' => ['show_actual_columns'],
184189
'rate' => $rate,
185190
'header_css_class' => 'col-paid',
@@ -196,6 +201,7 @@ protected function _prepareColumns()
196201
'index' => 'total_refunded_amount',
197202
'total' => 'sum',
198203
'sortable' => false,
204+
'renderer' => Currency::class,
199205
'rate' => $rate,
200206
'header_css_class' => 'col-refunded',
201207
'column_css_class' => 'col-refunded'
@@ -211,6 +217,7 @@ protected function _prepareColumns()
211217
'index' => 'total_tax_amount',
212218
'total' => 'sum',
213219
'sortable' => false,
220+
'renderer' => Currency::class,
214221
'rate' => $rate,
215222
'header_css_class' => 'col-sales-tax',
216223
'column_css_class' => 'col-sales-tax'
@@ -226,6 +233,7 @@ protected function _prepareColumns()
226233
'index' => 'total_tax_amount_actual',
227234
'total' => 'sum',
228235
'sortable' => false,
236+
'renderer' => Currency::class,
229237
'visibility_filter' => ['show_actual_columns'],
230238
'rate' => $rate,
231239
'header_css_class' => 'col-tax',
@@ -242,6 +250,7 @@ protected function _prepareColumns()
242250
'index' => 'total_shipping_amount',
243251
'total' => 'sum',
244252
'sortable' => false,
253+
'renderer' => Currency::class,
245254
'rate' => $rate,
246255
'header_css_class' => 'col-sales-shipping',
247256
'column_css_class' => 'col-sales-shipping'
@@ -257,6 +266,7 @@ protected function _prepareColumns()
257266
'index' => 'total_shipping_amount_actual',
258267
'total' => 'sum',
259268
'sortable' => false,
269+
'renderer' => Currency::class,
260270
'visibility_filter' => ['show_actual_columns'],
261271
'rate' => $rate,
262272
'header_css_class' => 'col-shipping',
@@ -273,6 +283,7 @@ protected function _prepareColumns()
273283
'index' => 'total_discount_amount',
274284
'total' => 'sum',
275285
'sortable' => false,
286+
'renderer' => Currency::class,
276287
'rate' => $rate,
277288
'header_css_class' => 'col-sales-discount',
278289
'column_css_class' => 'col-sales-discount'
@@ -288,6 +299,7 @@ protected function _prepareColumns()
288299
'index' => 'total_discount_amount_actual',
289300
'total' => 'sum',
290301
'sortable' => false,
302+
'renderer' => Currency::class,
291303
'visibility_filter' => ['show_actual_columns'],
292304
'rate' => $rate,
293305
'header_css_class' => 'col-discount',
@@ -304,6 +316,7 @@ protected function _prepareColumns()
304316
'index' => 'total_canceled_amount',
305317
'total' => 'sum',
306318
'sortable' => false,
319+
'renderer' => Currency::class,
307320
'rate' => $rate,
308321
'header_css_class' => 'col-canceled',
309322
'column_css_class' => 'col-canceled'

app/code/Magento/Reports/Block/Adminhtml/Shopcart/Abandoned/Grid.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ protected function _prepareCollection()
6767

6868
$this->setCollection($collection);
6969
parent::_prepareCollection();
70+
if ($this->_isExport) {
71+
$collection->setPageSize(null);
72+
}
7073
$this->getCollection()->resolveCustomerNames();
7174
return $this;
7275
}

app/code/Magento/Reports/Controller/Adminhtml/Report/AbstractReport.php

Lines changed: 43 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@
99
*
1010
* @author Magento Core Team <core@magentocommerce.com>
1111
*/
12+
1213
namespace Magento\Reports\Controller\Adminhtml\Report;
1314

15+
use Magento\Backend\Helper\Data as BackendHelper;
1416
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
1517

1618
/**
@@ -41,22 +43,30 @@ abstract class AbstractReport extends \Magento\Backend\App\Action
4143
*/
4244
protected $timezone;
4345

46+
/**
47+
* @var BackendHelper
48+
*/
49+
private $backendHelper;
50+
4451
/**
4552
* @param \Magento\Backend\App\Action\Context $context
4653
* @param \Magento\Framework\App\Response\Http\FileFactory $fileFactory
4754
* @param \Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter
4855
* @param TimezoneInterface $timezone
56+
* @param BackendHelper|null $backendHelperData
4957
*/
5058
public function __construct(
5159
\Magento\Backend\App\Action\Context $context,
5260
\Magento\Framework\App\Response\Http\FileFactory $fileFactory,
5361
\Magento\Framework\Stdlib\DateTime\Filter\Date $dateFilter,
54-
TimezoneInterface $timezone
62+
TimezoneInterface $timezone,
63+
BackendHelper $backendHelperData = null
5564
) {
5665
parent::__construct($context);
5766
$this->_fileFactory = $fileFactory;
5867
$this->_dateFilter = $dateFilter;
5968
$this->timezone = $timezone;
69+
$this->backendHelper = $backendHelperData ?: $this->_objectManager->get(BackendHelper::class);
6070
}
6171

6272
/**
@@ -103,25 +113,7 @@ public function _initReportAction($blocks)
103113
$blocks = [$blocks];
104114
}
105115

106-
$requestData = $this->_objectManager->get(
107-
\Magento\Backend\Helper\Data::class
108-
)->prepareFilterString(
109-
$this->getRequest()->getParam('filter')
110-
);
111-
$inputFilter = new \Zend_Filter_Input(
112-
['from' => $this->_dateFilter, 'to' => $this->_dateFilter],
113-
[],
114-
$requestData
115-
);
116-
$requestData = $inputFilter->getUnescaped();
117-
$requestData['store_ids'] = $this->getRequest()->getParam('store_ids');
118-
$params = new \Magento\Framework\DataObject();
119-
120-
foreach ($requestData as $key => $value) {
121-
if (!empty($value)) {
122-
$params->setData($key, $value);
123-
}
124-
}
116+
$params = $this->initFilterData();
125117

126118
foreach ($blocks as $block) {
127119
if ($block) {
@@ -147,7 +139,7 @@ protected function _showLastExecutionTime($flagCode, $refreshCode)
147139
->loadSelf();
148140
$updatedAt = 'undefined';
149141
if ($flag->hasData()) {
150-
$updatedAt = $this->timezone->formatDate(
142+
$updatedAt = $this->timezone->formatDate(
151143
$flag->getLastUpdate(),
152144
\IntlDateFormatter::MEDIUM,
153145
true
@@ -168,4 +160,34 @@ protected function _showLastExecutionTime($flagCode, $refreshCode)
168160
);
169161
return $this;
170162
}
163+
164+
/**
165+
* Init filter data
166+
*
167+
* @return \Magento\Framework\DataObject
168+
*/
169+
private function initFilterData(): \Magento\Framework\DataObject
170+
{
171+
$requestData = $this->backendHelper
172+
->prepareFilterString(
173+
$this->getRequest()->getParam('filter')
174+
);
175+
176+
$filterRules = ['from' => $this->_dateFilter, 'to' => $this->_dateFilter];
177+
$inputFilter = new \Zend_Filter_Input($filterRules, [], $requestData);
178+
179+
$requestData = $inputFilter->getUnescaped();
180+
$requestData['store_ids'] = $this->getRequest()->getParam('store_ids');
181+
$requestData['group'] = $this->getRequest()->getParam('group');
182+
$requestData['website'] = $this->getRequest()->getParam('website');
183+
184+
$params = new \Magento\Framework\DataObject();
185+
186+
foreach ($requestData as $key => $value) {
187+
if (!empty($value)) {
188+
$params->setData($key, $value);
189+
}
190+
}
191+
return $params;
192+
}
171193
}

app/code/Magento/Sales/Model/Config/Ordered.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -167,13 +167,8 @@ function ($a, $b) {
167167
if (!isset($a['sort_order']) || !isset($b['sort_order'])) {
168168
return 0;
169169
}
170-
if ($a['sort_order'] > $b['sort_order']) {
171-
return 1;
172-
} elseif ($a['sort_order'] < $b['sort_order']) {
173-
return -1;
174-
} else {
175-
return 0;
176-
}
170+
171+
return $a['sort_order'] <=> $b['sort_order'];
177172
}
178173
);
179174
}

0 commit comments

Comments
 (0)