Skip to content

Commit 6045019

Browse files
[Magento Community Engineering] Community Contributions - 2.3-develop
- merged latest code from mainline branch
2 parents f7cc331 + b0e9433 commit 6045019

File tree

32 files changed

+820
-326
lines changed

32 files changed

+820
-326
lines changed

app/code/Magento/Backend/Block/System/Store/Edit/Form/Store.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Backend\Block\System\Store\Edit\Form;
710

811
/**
@@ -129,6 +132,7 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
129132
'label' => __('Sort Order'),
130133
'value' => $storeModel->getSortOrder(),
131134
'required' => false,
135+
'class' => 'validate-number validate-zero-or-greater',
132136
'disabled' => $storeModel->isReadOnly()
133137
]
134138
);

app/code/Magento/Backend/Block/System/Store/Edit/Form/Website.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
7+
declare(strict_types=1);
8+
69
namespace Magento\Backend\Block\System\Store\Edit\Form;
710

811
/**
@@ -85,6 +88,7 @@ protected function _prepareStoreFieldset(\Magento\Framework\Data\Form $form)
8588
'label' => __('Sort Order'),
8689
'value' => $websiteModel->getSortOrder(),
8790
'required' => false,
91+
'class' => 'validate-number validate-zero-or-greater',
8892
'disabled' => $websiteModel->isReadOnly()
8993
]
9094
);

app/code/Magento/Backend/i18n/en_US.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Minute,Minute
258258
"To use this website you must first enable JavaScript in your browser.","To use this website you must first enable JavaScript in your browser."
259259
"This is only a demo store. You can browse and place orders, but nothing will be processed.","This is only a demo store. You can browse and place orders, but nothing will be processed."
260260
"Report an Issue","Report an Issue"
261-
"Store View:","Store View:"
261+
"Scope:","Scope:"
262262
"Stores Configuration","Stores Configuration"
263263
"Please confirm scope switching. All data that hasn't been saved will be lost.","Please confirm scope switching. All data that hasn't been saved will be lost."
264264
"Additional Cache Management","Additional Cache Management"

app/code/Magento/Backend/view/adminhtml/templates/store/switcher.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
<?php if ($websites = $block->getWebsites()) : ?>
1010

1111
<div class="store-switcher store-view">
12-
<span class="store-switcher-label"><?= $block->escapeHtml(__('Store View:')) ?></span>
12+
<span class="store-switcher-label"><?= $block->escapeHtml(__('Scope:')) ?></span>
1313
<div class="actions dropdown closable">
1414
<input type="hidden" name="store_switcher" id="store_switcher"
1515
data-role="store-view-id" data-param="<?= $block->escapeHtmlAttr($block->getStoreVarName()) ?>"

app/code/Magento/Checkout/view/frontend/web/template/minicart/item/default.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,10 @@
4444
<!-- ko if: Array.isArray(option.value) -->
4545
<span data-bind="html: option.value.join('<br>')"></span>
4646
<!-- /ko -->
47-
<!-- ko ifnot: Array.isArray(option.value) -->
47+
<!-- ko if: (!Array.isArray(option.value) && option.option_type == 'file') -->
48+
<span data-bind="html: option.value"></span>
49+
<!-- /ko -->
50+
<!-- ko if: (!Array.isArray(option.value) && option.option_type != 'file') -->
4851
<span data-bind="text: option.value"></span>
4952
<!-- /ko -->
5053
</dd>

app/code/Magento/Cron/Console/Command/CronInstallCommand.php

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

810
use Magento\Framework\Crontab\CrontabManagerInterface;
@@ -19,6 +21,9 @@
1921
*/
2022
class CronInstallCommand extends Command
2123
{
24+
private const COMMAND_OPTION_FORCE = 'force';
25+
private const COMMAND_OPTION_NON_OPTIONAL = 'non-optional';
26+
2227
/**
2328
* @var CrontabManagerInterface
2429
*/
@@ -44,19 +49,27 @@ public function __construct(
4449
}
4550

4651
/**
47-
* {@inheritdoc}
52+
* @inheritdoc
4853
*/
4954
protected function configure()
5055
{
5156
$this->setName('cron:install')
5257
->setDescription('Generates and installs crontab for current user')
53-
->addOption('force', 'f', InputOption::VALUE_NONE, 'Force install tasks');
58+
->addOption(self::COMMAND_OPTION_FORCE, 'f', InputOption::VALUE_NONE, 'Force install tasks')
59+
// @codingStandardsIgnoreStart
60+
->addOption(self::COMMAND_OPTION_NON_OPTIONAL, 'd', InputOption::VALUE_NONE, 'Install only the non-optional (default) tasks');
61+
// @codingStandardsIgnoreEnd
5462

5563
parent::configure();
5664
}
5765

5866
/**
59-
* {@inheritdoc}
67+
* Executes "cron:install" command.
68+
*
69+
* @param InputInterface $input
70+
* @param OutputInterface $output
71+
* @return int|null
72+
* @throws LocalizedException
6073
*/
6174
protected function execute(InputInterface $input, OutputInterface $output)
6275
{
@@ -65,8 +78,13 @@ protected function execute(InputInterface $input, OutputInterface $output)
6578
return Cli::RETURN_FAILURE;
6679
}
6780

81+
$tasks = $this->tasksProvider->getTasks();
82+
if ($input->getOption(self::COMMAND_OPTION_NON_OPTIONAL)) {
83+
$tasks = $this->extractNonOptionalTasks($tasks);
84+
}
85+
6886
try {
69-
$this->crontabManager->saveTasks($this->tasksProvider->getTasks());
87+
$this->crontabManager->saveTasks($tasks);
7088
} catch (LocalizedException $e) {
7189
$output->writeln('<error>' . $e->getMessage() . '</error>');
7290
return Cli::RETURN_FAILURE;
@@ -76,4 +94,23 @@ protected function execute(InputInterface $input, OutputInterface $output)
7694

7795
return Cli::RETURN_SUCCESS;
7896
}
97+
98+
/**
99+
* Returns an array of non-optional tasks
100+
*
101+
* @param array $tasks
102+
* @return array
103+
*/
104+
private function extractNonOptionalTasks(array $tasks = []): array
105+
{
106+
$defaultTasks = [];
107+
108+
foreach ($tasks as $taskCode => $taskParams) {
109+
if (!$taskParams['optional']) {
110+
$defaultTasks[$taskCode] = $taskParams;
111+
}
112+
}
113+
114+
return $defaultTasks;
115+
}
79116
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,15 @@
6666
<argument name="tasks" xsi:type="array">
6767
<item name="cronMagento" xsi:type="array">
6868
<item name="command" xsi:type="string">{magentoRoot}bin/magento cron:run | grep -v "Ran jobs by schedule" >> {magentoLog}magento.cron.log</item>
69+
<item name="optional" xsi:type="boolean">false</item>
6970
</item>
7071
<item name="cronUpdate" xsi:type="array">
7172
<item name="command" xsi:type="string">{magentoRoot}update/cron.php >> {magentoLog}update.cron.log</item>
73+
<item name="optional" xsi:type="boolean">true</item>
7274
</item>
7375
<item name="cronSetup" xsi:type="array">
7476
<item name="command" xsi:type="string">{magentoRoot}bin/magento setup:cron:run >> {magentoLog}setup.cron.log</item>
77+
<item name="optional" xsi:type="boolean">true</item>
7578
</item>
7679
</argument>
7780
</arguments>

app/code/Magento/Customer/Block/Widget/Dob.php

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,34 @@ public function isRequired()
9999
*/
100100
public function setDate($date)
101101
{
102-
$this->setTime($date ? strtotime($date) : false);
102+
$this->setTime($this->filterTime($date));
103103
$this->setValue($this->applyOutputFilter($date));
104104
return $this;
105105
}
106106

107+
/**
108+
* Sanitizes time
109+
*
110+
* @param mixed $value
111+
* @return bool|int
112+
*/
113+
private function filterTime($value)
114+
{
115+
$time = false;
116+
if ($value) {
117+
if ($value instanceof \DateTimeInterface) {
118+
$time = $value->getTimestamp();
119+
} elseif (is_numeric($value)) {
120+
$time = $value;
121+
} elseif (is_string($value)) {
122+
$time = strtotime($value);
123+
$time = $time === false ? $this->_localeDate->date($value, null, false, false)->getTimestamp() : $time;
124+
}
125+
}
126+
127+
return $time;
128+
}
129+
107130
/**
108131
* Return Data Form Filter or false
109132
*
@@ -200,21 +223,23 @@ public function getStoreLabel($attributeCode)
200223
*/
201224
public function getFieldHtml()
202225
{
203-
$this->dateElement->setData([
204-
'extra_params' => $this->getHtmlExtraParams(),
205-
'name' => $this->getHtmlId(),
206-
'id' => $this->getHtmlId(),
207-
'class' => $this->getHtmlClass(),
208-
'value' => $this->getValue(),
209-
'date_format' => $this->getDateFormat(),
210-
'image' => $this->getViewFileUrl('Magento_Theme::calendar.png'),
211-
'years_range' => '-120y:c+nn',
212-
'max_date' => '-1d',
213-
'change_month' => 'true',
214-
'change_year' => 'true',
215-
'show_on' => 'both',
216-
'first_day' => $this->getFirstDay()
217-
]);
226+
$this->dateElement->setData(
227+
[
228+
'extra_params' => $this->getHtmlExtraParams(),
229+
'name' => $this->getHtmlId(),
230+
'id' => $this->getHtmlId(),
231+
'class' => $this->getHtmlClass(),
232+
'value' => $this->getValue(),
233+
'date_format' => $this->getDateFormat(),
234+
'image' => $this->getViewFileUrl('Magento_Theme::calendar.png'),
235+
'years_range' => '-120y:c+nn',
236+
'max_date' => '-1d',
237+
'change_month' => 'true',
238+
'change_year' => 'true',
239+
'show_on' => 'both',
240+
'first_day' => $this->getFirstDay()
241+
]
242+
);
218243
return $this->dateElement->getHtml();
219244
}
220245

0 commit comments

Comments
 (0)