Skip to content

Commit 03b7994

Browse files
committed
Merge remote-tracking branch 'mainline/develop' into MAGETWO-59818
2 parents e0c032c + 5950439 commit 03b7994

File tree

138 files changed

+3473
-846
lines changed

Some content is hidden

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

138 files changed

+3473
-846
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@ Debug,Debug
6464
"Minimum Order Total","Minimum Order Total"
6565
"Maximum Order Total","Maximum Order Total"
6666
"Sort Order","Sort Order"
67+
"Sorry, but something went wrong. Please contact the seller.","Sorry, but something went wrong. Please contact the seller."

app/code/Magento/Authorizenet/view/frontend/web/js/view/payment/method-renderer/authorizenet-directpost.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,16 @@
55
define(
66
[
77
'jquery',
8-
'Magento_Payment/js/view/payment/iframe'
8+
'Magento_Payment/js/view/payment/iframe',
9+
'mage/translate'
910
],
10-
function ($, Component) {
11+
function ($, Component, $t) {
1112
'use strict';
1213

1314
return Component.extend({
1415
defaults: {
1516
template: 'Magento_Authorizenet/payment/authorizenet-directpost',
16-
timeoutMessage: 'Sorry, but something went wrong. Please contact the seller.'
17+
timeoutMessage: $t('Sorry, but something went wrong. Please contact the seller.')
1718
},
1819
placeOrderHandler: null,
1920
validateHandler: null,

app/code/Magento/Bundle/Setup/InstallSchema.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
2424
$installer = $setup;
2525

2626
$installer->startSetup();
27-
27+
$customerGroupTable = $setup->getConnection()->describeTable($setup->getTable('customer_group'));
28+
$customerGroupIdType = $customerGroupTable['customer_group_id']['DATA_TYPE'] == 'int'
29+
? \Magento\Framework\DB\Ddl\Table::TYPE_INTEGER : $customerGroupTable['customer_group_id']['DATA_TYPE'];
2830
/**
2931
* Create table 'catalog_product_bundle_option'
3032
*/
@@ -340,7 +342,7 @@ public function install(SchemaSetupInterface $setup, ModuleContextInterface $con
340342
)
341343
->addColumn(
342344
'customer_group_id',
343-
\Magento\Framework\DB\Ddl\Table::TYPE_SMALLINT,
345+
$customerGroupIdType,
344346
null,
345347
['unsigned' => true, 'nullable' => false, 'primary' => true],
346348
'Customer Group Id'

app/code/Magento/Bundle/Setup/UpgradeSchema.php

100644100755
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,24 @@ public function upgrade(SchemaSetupInterface $setup, ModuleContextInterface $con
4444
}
4545
}
4646

47+
if (version_compare($context->getVersion(), '2.0.3', '<')) {
48+
$tables = [
49+
'catalog_product_index_price_bundle_idx',
50+
'catalog_product_index_price_bundle_opt_idx',
51+
'catalog_product_index_price_bundle_opt_tmp',
52+
'catalog_product_index_price_bundle_sel_idx',
53+
'catalog_product_index_price_bundle_sel_tmp',
54+
'catalog_product_index_price_bundle_tmp',
55+
];
56+
foreach ($tables as $table) {
57+
$setup->getConnection()->modifyColumn(
58+
$setup->getTable($table),
59+
'customer_group_id',
60+
['type' => 'integer', 'nullable' => false]
61+
);
62+
}
63+
}
64+
4765
$setup->endSetup();
4866
}
4967
}

app/code/Magento/Bundle/etc/module.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9-
<module name="Magento_Bundle" setup_version="2.0.2">
9+
<module name="Magento_Bundle" setup_version="2.0.3">
1010
<sequence>
1111
<module name="Magento_Catalog"/>
1212
</sequence>

app/code/Magento/Catalog/Controller/Adminhtml/Product/AddAttributeToTemplate.php

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
use Magento\Eav\Api\Data\AttributeInterface;
1717
use Magento\Eav\Api\Data\AttributeSetInterface;
1818
use Magento\Framework\Api\SearchCriteriaBuilder;
19-
use Magento\Framework\Api\SortOrderBuilder;
2019
use Magento\Framework\Exception\LocalizedException;
2120
use Psr\Log\LoggerInterface;
2221
use Magento\Framework\Api\ExtensionAttributesFactory;
@@ -53,11 +52,6 @@ class AddAttributeToTemplate extends \Magento\Catalog\Controller\Adminhtml\Produ
5352
*/
5453
protected $searchCriteriaBuilder;
5554

56-
/**
57-
* @var SortOrderBuilder
58-
*/
59-
protected $sortOrderBuilder;
60-
6155
/**
6256
* @var AttributeGroupInterfaceFactory
6357
*/
@@ -115,7 +109,6 @@ public function execute()
115109
$attributeGroupSearchCriteria = $this->getSearchCriteriaBuilder()
116110
->addFilter('attribute_set_id', $attributeSet->getAttributeSetId())
117111
->addFilter('attribute_group_code', $groupCode)
118-
->addSortOrder($this->getSortOrderBuilder()->setAscendingDirection()->create())
119112
->setPageSize(1)
120113
->create();
121114

@@ -252,18 +245,6 @@ private function getSearchCriteriaBuilder()
252245
return $this->searchCriteriaBuilder;
253246
}
254247

255-
/**
256-
* @return SortOrderBuilder
257-
*/
258-
private function getSortOrderBuilder()
259-
{
260-
if (null === $this->sortOrderBuilder) {
261-
$this->sortOrderBuilder = \Magento\Framework\App\ObjectManager::getInstance()
262-
->get(\Magento\Framework\Api\SortOrderBuilder::class);
263-
}
264-
return $this->sortOrderBuilder;
265-
}
266-
267248
/**
268249
* @return AttributeManagementInterface
269250
*/

app/code/Magento/Catalog/Model/Product/Attribute/Backend/Stock.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function beforeSave($object)
5959
if (isset($stockData['qty']) && $stockData['qty'] === '') {
6060
$stockData['qty'] = null;
6161
}
62-
if ($object->getStockData() !== null || $stockData !== null) {
62+
if ($object->getStockData() !== null && $stockData !== null) {
6363
$object->setStockData(array_replace((array)$object->getStockData(), (array)$stockData));
6464
}
6565
$object->unsetData($this->getAttribute()->getAttributeCode());
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Model\ResourceModel\Product;
7+
8+
use Magento\Framework\DB\Select;
9+
10+
/**
11+
* Interface BaseSelectProcessorInterface
12+
* @api
13+
*/
14+
interface BaseSelectProcessorInterface
15+
{
16+
/**
17+
* Product table alias
18+
*/
19+
const PRODUCT_TABLE_ALIAS = 'child';
20+
21+
/**
22+
* @param Select $select
23+
* @return Select
24+
*/
25+
public function process(Select $select);
26+
}
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
<?php
2+
/**
3+
* Copyright © 2016 Magento. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Catalog\Model\ResourceModel\Product;
7+
8+
use Magento\Framework\DB\Select;
9+
use Magento\Framework\Exception\InputException;
10+
11+
/**
12+
* Class CompositeBaseSelectProcessor
13+
*/
14+
class CompositeBaseSelectProcessor implements BaseSelectProcessorInterface
15+
{
16+
/**
17+
* @var BaseSelectProcessorInterface[]
18+
*/
19+
private $baseSelectProcessors;
20+
21+
/**
22+
* @param BaseSelectProcessorInterface[] $baseSelectProcessors
23+
* @throws InputException
24+
*/
25+
public function __construct(
26+
array $baseSelectProcessors
27+
) {
28+
foreach ($baseSelectProcessors as $baseSelectProcessor) {
29+
if (!$baseSelectProcessor instanceof BaseSelectProcessorInterface) {
30+
throw new InputException(
31+
__('Processor %1 doesn\'t implement BaseSelectProcessorInterface', get_class($baseSelectProcessor))
32+
);
33+
}
34+
}
35+
$this->baseSelectProcessors = $baseSelectProcessors;
36+
}
37+
38+
/**
39+
* @param Select $select
40+
* @return Select
41+
*/
42+
public function process(Select $select)
43+
{
44+
foreach ($this->baseSelectProcessors as $baseSelectProcessor) {
45+
$select = $baseSelectProcessor->process($select);
46+
}
47+
return $select;
48+
}
49+
}

app/code/Magento/Catalog/Model/ResourceModel/Product/Indexer/LinkedProductSelectBuilderByIndexPrice.php

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
namespace Magento\Catalog\Model\ResourceModel\Product\Indexer;
77

88
use Magento\Catalog\Api\Data\ProductInterface;
9-
use Magento\Catalog\Model\Product;
9+
use Magento\Catalog\Model\ResourceModel\Product\BaseSelectProcessorInterface;
10+
use Magento\Framework\App\ObjectManager;
1011
use Magento\Framework\DB\Select;
1112
use Magento\Catalog\Model\ResourceModel\Product\LinkedProductSelectBuilderInterface;
1213

@@ -32,22 +33,31 @@ class LinkedProductSelectBuilderByIndexPrice implements LinkedProductSelectBuild
3233
*/
3334
private $metadataPool;
3435

36+
/**
37+
* @var BaseSelectProcessorInterface
38+
*/
39+
private $baseSelectProcessor;
40+
3541
/**
3642
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
3743
* @param \Magento\Framework\App\ResourceConnection $resourceConnection
3844
* @param \Magento\Customer\Model\Session $customerSession
3945
* @param \Magento\Framework\EntityManager\MetadataPool $metadataPool
46+
* @param BaseSelectProcessorInterface $baseSelectProcessor
4047
*/
4148
public function __construct(
4249
\Magento\Store\Model\StoreManagerInterface $storeManager,
4350
\Magento\Framework\App\ResourceConnection $resourceConnection,
4451
\Magento\Customer\Model\Session $customerSession,
45-
\Magento\Framework\EntityManager\MetadataPool $metadataPool
52+
\Magento\Framework\EntityManager\MetadataPool $metadataPool,
53+
BaseSelectProcessorInterface $baseSelectProcessor = null
4654
) {
4755
$this->storeManager = $storeManager;
4856
$this->resource = $resourceConnection;
4957
$this->customerSession = $customerSession;
5058
$this->metadataPool = $metadataPool;
59+
$this->baseSelectProcessor = (null !== $baseSelectProcessor)
60+
? $baseSelectProcessor : ObjectManager::getInstance()->get(BaseSelectProcessorInterface::class);
5161
}
5262

5363
/**
@@ -58,24 +68,27 @@ public function build($productId)
5868
$linkField = $this->metadataPool->getMetadata(ProductInterface::class)->getLinkField();
5969
$productTable = $this->resource->getTableName('catalog_product_entity');
6070

61-
return [$this->resource->getConnection()->select()
71+
$priceSelect = $this->resource->getConnection()->select()
6272
->from(['parent' => $productTable], '')
6373
->joinInner(
6474
['link' => $this->resource->getTableName('catalog_product_relation')],
6575
"link.parent_id = parent.$linkField",
6676
[]
6777
)->joinInner(
68-
['child' => $productTable],
69-
"child.entity_id = link.child_id",
78+
[BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS => $productTable],
79+
sprintf('%s.entity_id = link.child_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
7080
['entity_id']
7181
)->joinInner(
7282
['t' => $this->resource->getTableName('catalog_product_index_price')],
73-
't.entity_id = child.entity_id',
83+
sprintf('t.entity_id = %s.entity_id', BaseSelectProcessorInterface::PRODUCT_TABLE_ALIAS),
7484
[]
75-
)->where('parent.entity_id = ? ', $productId)
85+
)->where('parent.entity_id = ?', $productId)
7686
->where('t.website_id = ?', $this->storeManager->getStore()->getWebsiteId())
7787
->where('t.customer_group_id = ?', $this->customerSession->getCustomerGroupId())
7888
->order('t.min_price ' . Select::SQL_ASC)
79-
->limit(1)];
89+
->limit(1);
90+
$priceSelect = $this->baseSelectProcessor->process($priceSelect);
91+
92+
return [$priceSelect];
8093
}
8194
}

0 commit comments

Comments
 (0)