Skip to content

Commit df4bd0c

Browse files
committed
Merge branch '2.2-develop' of github.com:magento/magento2ce into MC-16926
2 parents 77b04c6 + 2c80d2a commit df4bd0c

File tree

13 files changed

+128
-124
lines changed

13 files changed

+128
-124
lines changed

app/code/Magento/Catalog/Observer/SetSpecialPriceStartDate.php

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,31 +3,33 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Catalog\Observer;
79

810
use Magento\Framework\Event\ObserverInterface;
11+
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
912

1013
/**
1114
* Set value for Special Price start date
1215
*/
1316
class SetSpecialPriceStartDate implements ObserverInterface
1417
{
1518
/**
16-
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
19+
* @var TimezoneInterface
1720
*/
1821
private $localeDate;
1922

2023
/**
21-
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
22-
* @codeCoverageIgnore
24+
* @param TimezoneInterface $localeDate
2325
*/
24-
public function __construct(\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate)
26+
public function __construct(TimezoneInterface $localeDate)
2527
{
2628
$this->localeDate = $localeDate;
2729
}
2830

2931
/**
30-
* Set the current date to Special Price From attribute if it empty
32+
* Set the current date to Special Price From attribute if it's empty.
3133
*
3234
* @param \Magento\Framework\Event\Observer $observer
3335
* @return $this
@@ -36,8 +38,8 @@ public function execute(\Magento\Framework\Event\Observer $observer)
3638
{
3739
/** @var $product \Magento\Catalog\Model\Product */
3840
$product = $observer->getEvent()->getProduct();
39-
if ($product->getSpecialPrice() && !$product->getSpecialFromDate()) {
40-
$product->setData('special_from_date', $this->localeDate->date());
41+
if ($product->getSpecialPrice() && ! $product->getSpecialFromDate()) {
42+
$product->setData('special_from_date', $this->localeDate->date()->setTime(0, 0));
4143
}
4244

4345
return $this;

app/code/Magento/Cms/Model/Block.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
/**
1313
* CMS block model
1414
*
15-
* @method Block setStoreId(array $storeId)
16-
* @method array getStoreId()
15+
* @method Block setStoreId(int $storeId)
16+
* @method int getStoreId()
1717
*/
1818
class Block extends AbstractModel implements BlockInterface, IdentityInterface
1919
{
@@ -41,6 +41,8 @@ class Block extends AbstractModel implements BlockInterface, IdentityInterface
4141
protected $_eventPrefix = 'cms_block';
4242

4343
/**
44+
* Construct.
45+
*
4446
* @return void
4547
*/
4648
protected function _construct()

app/code/Magento/Cms/Model/Page.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@
1616
* Cms Page Model
1717
*
1818
* @api
19-
* @method Page setStoreId(array $storeId)
20-
* @method array getStoreId()
19+
* @method Page setStoreId(int $storeId)
20+
* @method int getStoreId()
2121
* @SuppressWarnings(PHPMD.ExcessivePublicCount)
2222
* @since 100.0.2
2323
*/
@@ -103,8 +103,7 @@ public function getStores()
103103
}
104104

105105
/**
106-
* Check if page identifier exist for specific store
107-
* return page id if page exists
106+
* Check if page identifier exist for specific store return page id if page exists
108107
*
109108
* @param string $identifier
110109
* @param int $storeId
@@ -116,8 +115,7 @@ public function checkIdentifier($identifier, $storeId)
116115
}
117116

118117
/**
119-
* Prepare page's statuses.
120-
* Available event cms_page_get_available_statuses to customize statuses.
118+
* Prepare page's statuses, available event cms_page_get_available_statuses to customize statuses.
121119
*
122120
* @return array
123121
*/
@@ -538,7 +536,7 @@ public function setIsActive($isActive)
538536
}
539537

540538
/**
541-
* {@inheritdoc}
539+
* @inheritdoc
542540
* @since 101.0.0
543541
*/
544542
public function beforeSave()
@@ -571,6 +569,8 @@ public function beforeSave()
571569
}
572570

573571
/**
572+
* Returns scope config.
573+
*
574574
* @return ScopeConfigInterface
575575
*/
576576
private function getScopeConfig()

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

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ define([
99

1010
return Sizes.extend({
1111
defaults: {
12-
excludedOptions: ['100', '200']
13-
},
14-
15-
/**
16-
* @override
17-
*/
18-
initialize: function () {
19-
this._super();
20-
21-
this.excludedOptions.forEach(function (excludedOption) {
22-
delete this.options[excludedOption];
23-
}, this);
24-
this.updateArray();
25-
26-
return this;
12+
options: {
13+
'20': {
14+
value: 20,
15+
label: 20
16+
},
17+
'30': {
18+
value: 30,
19+
label: 30
20+
},
21+
'50': {
22+
value: 50,
23+
label: 50
24+
}
25+
},
26+
value: 20
2727
}
2828
});
2929
});

app/code/Magento/Sales/view/adminhtml/templates/order/create/coupons/form.phtml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
<div class="admin__field field-apply-coupon-code">
1111
<label class="admin__field-label"><span><?= $block->escapeHtml(__('Apply Coupon Code')) ?></span></label>
1212
<div class="admin__field-control">
13+
<?php if (!$block->getCouponCode()) : ?>
1314
<input type="text" class="admin__control-text" id="coupons:code" value="" name="coupon_code" />
1415
<?= $block->getButtonHtml(__('Apply'), 'order.applyCoupon($F(\'coupons:code\'))') ?>
16+
<?php endif; ?>
1517
<?php if ($block->getCouponCode()) : ?>
1618
<p class="added-coupon-code">
1719
<span><?= $block->escapeHtml($block->getCouponCode()) ?></span>

app/code/Magento/Search/view/frontend/templates/form.mini.phtml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ $helper = $this->helper(\Magento\Search\Helper\Data::class);
3535
role="combobox"
3636
aria-haspopup="false"
3737
aria-autocomplete="both"
38-
autocomplete="off"/>
38+
autocomplete="off"
39+
aria-expanded="false"/>
3940
<div id="search_autocomplete" class="search-autocomplete"></div>
4041
<?= $block->getChildHtml() ?>
4142
</div>

app/code/Magento/Search/view/frontend/web/js/form-mini.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,7 @@ define([
7171
this.isExpandable = true;
7272
}.bind(this),
7373
exit: function () {
74-
this.isExpandable = false;
75-
this.element.removeAttr('aria-expanded');
74+
this.isExpandable = true;
7675
}.bind(this)
7776
});
7877

@@ -129,11 +128,16 @@ define([
129128
* @param {Boolean} isActive
130129
*/
131130
setActiveState: function (isActive) {
131+
var searchValue;
132+
132133
this.searchForm.toggleClass('active', isActive);
133134
this.searchLabel.toggleClass('active', isActive);
134135

135136
if (this.isExpandable) {
136137
this.element.attr('aria-expanded', isActive);
138+
searchValue = this.element.val();
139+
this.element.val('');
140+
this.element.val(searchValue);
137141
}
138142
},
139143

app/code/Magento/Ui/Component/Paging.php

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

89
/**
10+
* Class Paging
11+
*
912
* @api
1013
* @since 100.0.2
1114
*/
1215
class Paging extends AbstractComponent
1316
{
1417
const NAME = 'paging';
1518

19+
/**
20+
* Default paging options
21+
*
22+
* @var array
23+
*/
24+
private $defaultOptions = [
25+
'20' => [
26+
'value' => 20,
27+
'label' => 20
28+
],
29+
'30' => [
30+
'value' => 30,
31+
'label' => 30
32+
],
33+
'50' => [
34+
'value' => 50,
35+
'label' => 50
36+
],
37+
'100' => [
38+
'value' => 100,
39+
'label' => 100
40+
],
41+
'200' => [
42+
'value' => 200,
43+
'label' => 200
44+
],
45+
];
46+
47+
/**
48+
* Default page size
49+
*
50+
* @var int
51+
*/
52+
private $defaultPageSize = 20;
53+
1654
/**
1755
* Default component data
1856
*
1957
* @var array
2058
*/
2159
protected $_data = [
2260
'config' => [
23-
'options' => [
24-
'20' => [
25-
'value' => 20,
26-
'label' => 20
27-
],
28-
'30' => [
29-
'value' => 30,
30-
'label' => 30
31-
],
32-
'50' => [
33-
'value' => 50,
34-
'label' => 50
35-
],
36-
'100' => [
37-
'value' => 100,
38-
'label' => 100
39-
],
40-
'200' => [
41-
'value' => 200,
42-
'label' => 200
43-
],
44-
],
45-
'pageSize' => 20,
4661
'current' => 1
4762
]
4863
];
@@ -65,13 +80,13 @@ public function getComponentName()
6580
public function prepare()
6681
{
6782
$this->prepareOptions();
83+
$this->preparePageSize();
6884
$paging = $this->getContext()->getRequestParam('paging');
6985
if (!isset($paging['notLimits'])) {
7086
$this->getContext()
7187
->getDataProvider()
7288
->setLimit($this->getOffset($paging), $this->getSize($paging));
7389
}
74-
7590
parent::prepare();
7691
}
7792

@@ -83,12 +98,26 @@ public function prepare()
8398
protected function prepareOptions()
8499
{
85100
$config = $this->getData('config');
86-
if (isset($config['options'])) {
87-
$config['options'] = array_values($config['options']);
88-
foreach ($config['options'] as &$item) {
89-
$item['value'] = (int) $item['value'];
90-
}
91-
unset($item);
101+
if (!isset($config['options'])) {
102+
$config['options'] = $this->defaultOptions;
103+
}
104+
foreach ($config['options'] as &$item) {
105+
$item['value'] = (int)$item['value'];
106+
}
107+
unset($item);
108+
$this->setData('config', $config);
109+
}
110+
111+
/**
112+
* Prepare page size
113+
*
114+
* @return void
115+
*/
116+
private function preparePageSize()
117+
{
118+
$config = $this->getData('config');
119+
if (!isset($config['pageSize'])) {
120+
$config['pageSize'] = $this->defaultPageSize;
92121
$this->setData('config', $config);
93122
}
94123
}
@@ -102,7 +131,7 @@ protected function prepareOptions()
102131
protected function getOffset($paging)
103132
{
104133
$defaultPage = $this->getData('config/current') ?: 1;
105-
return (int) (isset($paging['current']) ? $paging['current'] : $defaultPage);
134+
return (int)(isset($paging['current']) ? $paging['current'] : $defaultPage);
106135
}
107136

108137
/**
@@ -113,7 +142,6 @@ protected function getOffset($paging)
113142
*/
114143
protected function getSize($paging)
115144
{
116-
$defaultLimit = $this->getData('config/pageSize') ?: 20;
117-
return (int) (isset($paging['pageSize']) ? $paging['pageSize'] : $defaultLimit);
145+
return (int)(isset($paging['pageSize']) ? $paging['pageSize'] : $this->getData('config/pageSize'));
118146
}
119147
}

app/code/Magento/Ui/Test/Unit/Component/PagingTest.php

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -81,31 +81,11 @@ public function testPrepare()
8181
],
8282
'config' => [
8383
'options' => [
84-
[
85-
'value' => 20,
86-
'label' => 20
87-
],
88-
[
89-
'value' => 30,
90-
'label' => 30
91-
],
92-
[
93-
'value' => 50,
94-
'label' => 50
95-
],
96-
[
97-
'value' => 100,
98-
'label' => 100
99-
],
100-
[
101-
'value' => 200,
102-
'label' => 200
103-
],
104-
[
84+
'options1' => [
10585
'value' => 20,
10686
'label' => 'options1'
10787
],
108-
[
88+
'options2' => [
10989
'value' => 40,
11090
'label' => 'options2'
11191
],

0 commit comments

Comments
 (0)