Skip to content

Commit 564030f

Browse files
committed
#11523: Merge branch '2.1-develop' of github.com:magento/magento2 into PR#ReportCustomerReview-2.1
2 parents 04c8e33 + 5b0667c commit 564030f

File tree

52 files changed

+2049
-219
lines changed

Some content is hidden

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

52 files changed

+2049
-219
lines changed

app/code/Magento/Braintree/view/frontend/web/js/view/payment/method-renderer/paypal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ define([
296296
getShippingAddress: function () {
297297
var address = quote.shippingAddress();
298298

299-
if (address.postcode === null) {
299+
if (_.isNull(address.postcode) || _.isUndefined(address.postcode)) {
300300

301301
return {};
302302
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Ui\DataProvider\Product;
7+
8+
/**
9+
* Collection which is used for rendering product list in the backend.
10+
*
11+
* Used for product grid and customizes behavior of the default Product collection for grid needs.
12+
*/
13+
class ProductCollection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
14+
{
15+
/**
16+
* Disables using of price index for grid rendering
17+
*
18+
* Admin area shouldn't use price index and should rely on actual product data instead.
19+
*
20+
* @codeCoverageIgnore
21+
* @return \Magento\Catalog\Model\ResourceModel\Product\Collection
22+
*/
23+
protected function _productLimitationJoinPrice()
24+
{
25+
$this->_productLimitationFilters->setUsePriceIndex(false);
26+
return $this->_productLimitationPrice(true);
27+
}
28+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@
7777
<type name="Magento\Catalog\Model\ResourceModel\Attribute">
7878
<plugin name="invalidate_pagecache_after_attribute_save" type="Magento\Catalog\Plugin\Model\ResourceModel\Attribute\Save" />
7979
</type>
80+
<virtualType name="\Magento\Catalog\Ui\DataProvider\Product\ProductCollectionFactory" type="\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory">
81+
<arguments>
82+
<argument name="instanceName" xsi:type="string">\Magento\Catalog\Ui\DataProvider\Product\ProductCollection</argument>
83+
</arguments>
84+
</virtualType>
8085
<type name="Magento\Catalog\Ui\DataProvider\Product\ProductDataProvider">
8186
<arguments>
8287
<argument name="addFieldStrategies" xsi:type="array">
@@ -85,6 +90,7 @@
8590
<argument name="addFilterStrategies" xsi:type="array">
8691
<item name="store_id" xsi:type="object">Magento\Catalog\Ui\DataProvider\Product\AddStoreFieldToCollection</item>
8792
</argument>
93+
<argument name="collectionFactory" xsi:type="object">\Magento\Catalog\Ui\DataProvider\Product\ProductCollectionFactory</argument>
8894
</arguments>
8995
</type>
9096
<type name="Magento\Catalog\Model\Product\Action">

app/code/Magento/Checkout/view/frontend/web/template/cart/shipping-rates.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@
2424
checked: $parents[1].selectedShippingMethod,
2525
attr: {
2626
value: carrier_code + '_' + method_code,
27-
id: 's_method_' + method_code
27+
id: 's_method_' + carrier_code + '_' + method_code
2828
}
2929
"/>
30-
<label class="label" data-bind="attr: {for: 's_method_' + method_code}">
30+
<label class="label" data-bind="attr: {for: 's_method_' + carrier_code + '_' + method_code}">
3131
<!-- ko text: $data.method_title --><!-- /ko -->
3232
<!-- ko text: $parents[1].getFormattedPrice(amount) --><!-- /ko -->
3333
</label>

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6-
76
namespace Magento\Cron\Console\Command;
87

98
use Symfony\Component\Console\Command\Command;
@@ -94,7 +93,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
9493
}
9594
}
9695
/** @var \Magento\Framework\App\Cron $cronObserver */
97-
$cronObserver = $objectManager->create('Magento\Framework\App\Cron', ['parameters' => $params]);
96+
$cronObserver = $objectManager->create(\Magento\Framework\App\Cron::class, ['parameters' => $params]);
9897
$cronObserver->launch();
9998
$output->writeln('<info>' . 'Ran jobs by schedule.' . '</info>');
10099
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cron\Console\Command;
7+
8+
use Magento\Framework\Crontab\CrontabManagerInterface;
9+
use Magento\Framework\Crontab\TasksProviderInterface;
10+
use Magento\Framework\Exception\LocalizedException;
11+
use Symfony\Component\Console\Command\Command;
12+
use Symfony\Component\Console\Input\InputInterface;
13+
use Symfony\Component\Console\Output\OutputInterface;
14+
use Magento\Framework\Console\Cli;
15+
use Symfony\Component\Console\Input\InputOption;
16+
17+
/**
18+
* CronInstallCommand installs Magento cron tasks
19+
*/
20+
class CronInstallCommand extends Command
21+
{
22+
/**
23+
* @var CrontabManagerInterface
24+
*/
25+
private $crontabManager;
26+
27+
/**
28+
* @var TasksProviderInterface
29+
*/
30+
private $tasksProvider;
31+
32+
/**
33+
* @param CrontabManagerInterface $crontabManager
34+
* @param TasksProviderInterface $tasksProvider
35+
*/
36+
public function __construct(
37+
CrontabManagerInterface $crontabManager,
38+
TasksProviderInterface $tasksProvider
39+
) {
40+
$this->crontabManager = $crontabManager;
41+
$this->tasksProvider = $tasksProvider;
42+
43+
parent::__construct();
44+
}
45+
46+
/**
47+
* {@inheritdoc}
48+
*/
49+
protected function configure()
50+
{
51+
$this->setName('cron:install')
52+
->setDescription('Generates and installs crontab for current user')
53+
->addOption('force', 'f', InputOption::VALUE_NONE, 'Force install tasks');
54+
55+
parent::configure();
56+
}
57+
58+
/**
59+
* {@inheritdoc}
60+
*/
61+
protected function execute(InputInterface $input, OutputInterface $output)
62+
{
63+
if ($this->crontabManager->getTasks() && !$input->getOption('force')) {
64+
$output->writeln('<error>Crontab has already been generated and saved</error>');
65+
return Cli::RETURN_FAILURE;
66+
}
67+
68+
try {
69+
$this->crontabManager->saveTasks($this->tasksProvider->getTasks());
70+
} catch (LocalizedException $e) {
71+
$output->writeln('<error>' . $e->getMessage() . '</error>');
72+
return Cli::RETURN_FAILURE;
73+
}
74+
75+
$output->writeln('<info>Crontab has been generated and saved</info>');
76+
77+
return Cli::RETURN_SUCCESS;
78+
}
79+
}
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
* Copyright © 2013-2017 Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Cron\Console\Command;
7+
8+
use Magento\Framework\Crontab\CrontabManagerInterface;
9+
use Symfony\Component\Console\Command\Command;
10+
use Symfony\Component\Console\Input\InputInterface;
11+
use Symfony\Component\Console\Output\OutputInterface;
12+
use Magento\Framework\Console\Cli;
13+
use Magento\Framework\Exception\LocalizedException;
14+
15+
/**
16+
* CronRemoveCommand removes Magento cron tasks
17+
*/
18+
class CronRemoveCommand extends Command
19+
{
20+
/**
21+
* @var CrontabManagerInterface
22+
*/
23+
private $crontabManager;
24+
25+
/**
26+
* @param CrontabManagerInterface $crontabManager
27+
*/
28+
public function __construct(CrontabManagerInterface $crontabManager)
29+
{
30+
$this->crontabManager = $crontabManager;
31+
32+
parent::__construct();
33+
}
34+
35+
/**
36+
* {@inheritdoc}
37+
*/
38+
protected function configure()
39+
{
40+
$this->setName('cron:remove')
41+
->setDescription('Removes tasks from crontab');
42+
43+
parent::configure();
44+
}
45+
46+
/**
47+
* {@inheritdoc}
48+
*/
49+
protected function execute(InputInterface $input, OutputInterface $output)
50+
{
51+
try {
52+
$this->crontabManager->removeTasks();
53+
} catch (LocalizedException $e) {
54+
$output->writeln('<error>' . $e->getMessage() . '</error>');
55+
return Cli::RETURN_FAILURE;
56+
}
57+
58+
$output->writeln('<info>Magento cron tasks have been removed</info>');
59+
60+
return Cli::RETURN_SUCCESS;
61+
}
62+
}

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
<schedule_ahead_for>20</schedule_ahead_for>
1212
<schedule_lifetime>15</schedule_lifetime>
1313
<history_cleanup_every>10</history_cleanup_every>
14-
<history_success_lifetime>60</history_success_lifetime>
15-
<history_failure_lifetime>600</history_failure_lifetime>
14+
<history_success_lifetime>10080</history_success_lifetime>
15+
<history_failure_lifetime>10080</history_failure_lifetime>
1616
<use_separate_process>0</use_separate_process>
1717
</group>
1818
</config>

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

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
99
<preference for="Magento\Cron\Model\ConfigInterface" type="Magento\Cron\Model\Config" />
1010
<preference for="Magento\Framework\Shell\CommandRendererInterface" type="Magento\Framework\Shell\CommandRenderer" />
11+
<preference for="Magento\Framework\Crontab\CrontabManagerInterface" type="Magento\Framework\Crontab\CrontabManager" />
12+
<preference for="Magento\Framework\Crontab\TasksProviderInterface" type="Magento\Framework\Crontab\TasksProvider" />
1113
<type name="Magento\Cron\Model\Config\Reader\Db">
1214
<arguments>
1315
<argument name="defaultReader" xsi:type="object">DefaultScopeReader</argument>
@@ -33,6 +35,8 @@
3335
<arguments>
3436
<argument name="commands" xsi:type="array">
3537
<item name="cronCommand" xsi:type="object">Magento\Cron\Console\Command\CronCommand</item>
38+
<item name="cronInstall" xsi:type="object">Magento\Cron\Console\Command\CronInstallCommand</item>
39+
<item name="cronRemove" xsi:type="object">Magento\Cron\Console\Command\CronRemoveCommand</item>
3640
</argument>
3741
</arguments>
3842
</type>
@@ -43,4 +47,24 @@
4347
</argument>
4448
</arguments>
4549
</type>
50+
<type name="Magento\Framework\Crontab\CrontabManagerInterface">
51+
<arguments>
52+
<argument name="shell" xsi:type="object">Magento\Framework\App\Shell</argument>
53+
</arguments>
54+
</type>
55+
<type name="Magento\Framework\Crontab\TasksProviderInterface">
56+
<arguments>
57+
<argument name="tasks" xsi:type="array">
58+
<item name="cronMagento" xsi:type="array">
59+
<item name="command" xsi:type="string">{magentoRoot}bin/magento cron:run | grep -v "Ran jobs by schedule" >> {magentoLog}magento.cron.log</item>
60+
</item>
61+
<item name="cronUpdate" xsi:type="array">
62+
<item name="command" xsi:type="string">{magentoRoot}update/cron.php >> {magentoLog}update.cron.log</item>
63+
</item>
64+
<item name="cronSetup" xsi:type="array">
65+
<item name="command" xsi:type="string">{magentoRoot}bin/magento setup:cron:run >> {magentoLog}setup.cron.log</item>
66+
</item>
67+
</argument>
68+
</arguments>
69+
</type>
4670
</config>

app/code/Magento/Eav/Model/ResourceModel/Entity/Attribute/Collection.php

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,19 @@ public function setAttributeSetsFilter(array $setIds)
205205
*/
206206
public function setInAllAttributeSetsFilter(array $setIds)
207207
{
208-
foreach ($setIds as $setId) {
209-
$setId = (int)$setId;
210-
if (!$setId) {
211-
continue;
212-
}
213-
$alias = sprintf('entity_attribute_%d', $setId);
214-
$joinCondition = $this->getConnection()->quoteInto(
215-
"{$alias}.attribute_id = main_table.attribute_id AND {$alias}.attribute_set_id =?",
216-
$setId
217-
);
218-
$this->join([$alias => 'eav_entity_attribute'], $joinCondition, 'attribute_id');
208+
if (!empty($setIds)) {
209+
$this->getSelect()
210+
->join(
211+
['entity_attribute' => $this->getTable('eav_entity_attribute')],
212+
'entity_attribute.attribute_id = main_table.attribute_id',
213+
['count' => new \Zend_Db_Expr('COUNT(*)')]
214+
)
215+
->where(
216+
'entity_attribute.attribute_set_id IN (?)',
217+
$setIds
218+
)
219+
->group('entity_attribute.attribute_id')
220+
->having('count = ' . count($setIds));
219221
}
220222

221223
//$this->getSelect()->distinct(true);

0 commit comments

Comments
 (0)