Skip to content

Commit 296e700

Browse files
committed
Merge branch '2.2-develop' of github.com:magento/magento2ce into MAGETWO-92887
2 parents b266b52 + ffa3df1 commit 296e700

File tree

70 files changed

+1475
-685
lines changed

Some content is hidden

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

70 files changed

+1475
-685
lines changed

app/code/Magento/Backend/etc/adminhtml/system.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@
416416
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
417417
<backend_model>Magento\Config\Model\Config\Backend\Store</backend_model>
418418
<comment>
419-
<![CDATA[<strong style="color:red">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).]]>
419+
<![CDATA[<strong style="color:red">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).]]>
420420
</comment>
421421
</field>
422422
<field id="redirect_to_base" translate="label" type="select" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1" canRestore="1">

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<module name="Magento_Backend" setup_version="2.0.0">
1010
<sequence>
1111
<module name="Magento_Directory"/>
12+
<module name="Magento_Theme"/>
1213
</sequence>
1314
</module>
1415
</config>

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -405,9 +405,9 @@ Web,Web
405405
"Url Options","Url Options"
406406
"Add Store Code to Urls","Add Store Code to Urls"
407407
"
408-
<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).
408+
<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).
409409
","
410-
<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third party services (e.g. PayPal etc.).
410+
<strong style=""color:red"">Warning!</strong> When using Store Code in URLs, in some cases system may not work properly if URLs without Store Codes are specified in the third-party services (e.g. PayPal etc.).
411411
"
412412
"Auto-redirect to Base URL","Auto-redirect to Base URL"
413413
"Search Engine Optimization","Search Engine Optimization"
@@ -447,7 +447,7 @@ Tags,Tags
447447
"<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>","<h1 class=""page-heading"">404 Error</h1><p>Page not found.</p>"
448448
"Community Edition","Community Edition"
449449
"Default Theme","Default Theme"
450-
"If no value is specified, the system default is used. The system default may be modified by third party extensions.","If no value is specified, the system default is used. The system default may be modified by third party extensions."
450+
"If no value is specified, the system default is used. The system default may be modified by third-party extensions.","If no value is specified, the system default is used. The system default may be modified by third-party extensions."
451451
"Applied Theme","Applied Theme"
452452
"Design Rule","Design Rule"
453453
"User Agent Rules","User Agent Rules"

app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
</settings>
1313
<field name="theme_theme_id" sortOrder="10" formElement="select">
1414
<settings>
15-
<notice translate="true">If no value is specified, the system default is used. The system default may be modified by third party extensions.</notice>
15+
<notice translate="true">If no value is specified, the system default is used. The system default may be modified by third-party extensions.</notice>
1616
<dataType>text</dataType>
1717
<label translate="true">Applied Theme</label>
1818
<dataScope>theme_theme_id</dataScope>

app/code/Magento/Braintree/etc/adminhtml/system.xml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
<comment>http://docs.magento.com/m2/ce/user_guide/payment/braintree.html</comment>
4545
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint</frontend_model>
4646
</group>
47-
<group id="braintree_required" translate="label" showInDefault="1" showInWebsite="1" sortOrder="5">
47+
<group id="braintree_required" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="5">
4848
<label>Basic Braintree Settings</label>
4949
<attribute type="expanded">1</attribute>
5050
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
@@ -77,7 +77,7 @@
7777
<backend_model>Magento\Config\Model\Config\Backend\Encrypted</backend_model>
7878
</field>
7979
</group>
80-
<group id="braintree_advanced" translate="label" showInDefault="1" showInWebsite="1" sortOrder="20">
80+
<group id="braintree_advanced" translate="label" showInDefault="1" showInWebsite="1" showInStore="0" sortOrder="20">
8181
<label>Advanced Braintree Settings</label>
8282
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
8383
<field id="braintree_cc_vault_title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="0">
@@ -125,7 +125,7 @@
125125
<config_path>payment/braintree/sort_order</config_path>
126126
</field>
127127
</group>
128-
<group id="braintree_country_specific" translate="label" showInDefault="1" showInWebsite="1" sortOrder="30">
128+
<group id="braintree_country_specific" translate="label" showInDefault="1" showInWebsite="1" showInStore="0" sortOrder="30">
129129
<label>Country Specific Settings</label>
130130
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
131131
<field id="allowspecific" translate="label" type="allowspecific" sortOrder="200" showInDefault="1" showInWebsite="1" showInStore="0">
@@ -146,7 +146,7 @@
146146
<config_path>payment/braintree/countrycreditcard</config_path>
147147
</field>
148148
</group>
149-
<group id="braintree_paypal" translate="label" showInDefault="1" showInWebsite="1" sortOrder="40">
149+
<group id="braintree_paypal" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="40">
150150
<label>PayPal through Braintree</label>
151151
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
152152
<field id="title" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
@@ -215,7 +215,7 @@
215215
<config_path>payment/braintree_paypal/skip_order_review</config_path>
216216
</field>
217217
</group>
218-
<group id="braintree_3dsecure" translate="label" showInDefault="1" showInWebsite="1" sortOrder="41">
218+
<group id="braintree_3dsecure" translate="label" showInDefault="1" showInWebsite="1" showInStore="0" sortOrder="41">
219219
<label>3D Secure Verification Settings</label>
220220
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>
221221
<field id="verify_3dsecure" translate="label" type="select" sortOrder="150" showInDefault="1" showInWebsite="1" showInStore="0">
@@ -239,7 +239,7 @@
239239
<config_path>payment/braintree/verify_specific_countries</config_path>
240240
</field>
241241
</group>
242-
<group id="braintree_dynamic_descriptor" translate="label" showInDefault="1" showInWebsite="1" sortOrder="50">
242+
<group id="braintree_dynamic_descriptor" translate="label" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="50">
243243
<label>Dynamic Descriptors</label>
244244
<comment><![CDATA[Dynamic descriptors are sent on a per-transaction basis and define what will appear on your customers credit card statements for a specific purchase.
245245
The clearer the description of your product, the less likely customers will issue chargebacks due to confusion or non-recognition.

app/code/Magento/Bundle/Model/ResourceModel/Selection/Collection.php

Lines changed: 110 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,8 @@
55
*/
66
namespace Magento\Bundle\Model\ResourceModel\Selection;
77

8-
use Magento\Customer\Api\GroupManagementInterface;
98
use Magento\Framework\DataObject;
109
use Magento\Framework\DB\Select;
11-
use Magento\Framework\EntityManager\MetadataPool;
1210
use Magento\Catalog\Model\ResourceModel\Product\Collection\ProductLimitationFactory;
1311
use Magento\Framework\App\ObjectManager;
1412

@@ -45,6 +43,95 @@ class Collection extends \Magento\Catalog\Model\ResourceModel\Product\Collection
4543
*/
4644
private $websiteScopePriceJoined = false;
4745

46+
/**
47+
* @var \Magento\CatalogInventory\Model\ResourceModel\Stock\Item
48+
*/
49+
private $stockItem;
50+
51+
/**
52+
* Collection constructor.
53+
* @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
54+
* @param \Psr\Log\LoggerInterface $logger
55+
* @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
56+
* @param \Magento\Framework\Event\ManagerInterface $eventManager
57+
* @param \Magento\Eav\Model\Config $eavConfig
58+
* @param \Magento\Framework\App\ResourceConnection $resource
59+
* @param \Magento\Eav\Model\EntityFactory $eavEntityFactory
60+
* @param \Magento\Catalog\Model\ResourceModel\Helper $resourceHelper
61+
* @param \Magento\Framework\Validator\UniversalFactory $universalFactory
62+
* @param \Magento\Store\Model\StoreManagerInterface $storeManager
63+
* @param \Magento\Framework\Module\Manager $moduleManager
64+
* @param \Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState
65+
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
66+
* @param \Magento\Catalog\Model\Product\OptionFactory $productOptionFactory
67+
* @param \Magento\Catalog\Model\ResourceModel\Url $catalogUrl
68+
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
69+
* @param \Magento\Customer\Model\Session $customerSession
70+
* @param \Magento\Framework\Stdlib\DateTime $dateTime
71+
* @param \Magento\Customer\Api\GroupManagementInterface $groupManagement
72+
* @param \Magento\Framework\DB\Adapter\AdapterInterface|null $connection
73+
* @param ProductLimitationFactory|null $productLimitationFactory
74+
* @param \Magento\Framework\EntityManager\MetadataPool|null $metadataPool
75+
* @param \Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer|null $tableMaintainer
76+
* @param \Magento\CatalogInventory\Model\ResourceModel\Stock\Item|null $stockItem
77+
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
78+
*/
79+
public function __construct(
80+
\Magento\Framework\Data\Collection\EntityFactory $entityFactory,
81+
\Psr\Log\LoggerInterface $logger,
82+
\Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
83+
\Magento\Framework\Event\ManagerInterface $eventManager,
84+
\Magento\Eav\Model\Config $eavConfig,
85+
\Magento\Framework\App\ResourceConnection $resource,
86+
\Magento\Eav\Model\EntityFactory $eavEntityFactory,
87+
\Magento\Catalog\Model\ResourceModel\Helper $resourceHelper,
88+
\Magento\Framework\Validator\UniversalFactory $universalFactory,
89+
\Magento\Store\Model\StoreManagerInterface $storeManager,
90+
\Magento\Framework\Module\Manager $moduleManager,
91+
\Magento\Catalog\Model\Indexer\Product\Flat\State $catalogProductFlatState,
92+
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
93+
\Magento\Catalog\Model\Product\OptionFactory $productOptionFactory,
94+
\Magento\Catalog\Model\ResourceModel\Url $catalogUrl,
95+
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
96+
\Magento\Customer\Model\Session $customerSession,
97+
\Magento\Framework\Stdlib\DateTime $dateTime,
98+
\Magento\Customer\Api\GroupManagementInterface $groupManagement,
99+
\Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
100+
ProductLimitationFactory $productLimitationFactory = null,
101+
\Magento\Framework\EntityManager\MetadataPool $metadataPool = null,
102+
\Magento\Catalog\Model\Indexer\Category\Product\TableMaintainer $tableMaintainer = null,
103+
\Magento\CatalogInventory\Model\ResourceModel\Stock\Item $stockItem = null
104+
) {
105+
parent::__construct(
106+
$entityFactory,
107+
$logger,
108+
$fetchStrategy,
109+
$eventManager,
110+
$eavConfig,
111+
$resource,
112+
$eavEntityFactory,
113+
$resourceHelper,
114+
$universalFactory,
115+
$storeManager,
116+
$moduleManager,
117+
$catalogProductFlatState,
118+
$scopeConfig,
119+
$productOptionFactory,
120+
$catalogUrl,
121+
$localeDate,
122+
$customerSession,
123+
$dateTime,
124+
$groupManagement,
125+
$connection,
126+
$productLimitationFactory,
127+
$metadataPool,
128+
$tableMaintainer
129+
);
130+
131+
$this->stockItem = $stockItem
132+
?? ObjectManager::getInstance()->get(\Magento\CatalogInventory\Model\ResourceModel\Stock\Item::class);
133+
}
134+
48135
/**
49136
* Initialize collection
50137
*
@@ -170,27 +257,31 @@ public function setPositionOrder()
170257
*/
171258
public function addQuantityFilter()
172259
{
173-
$stockItemTable = $this->getTable('cataloginventory_stock_item');
174-
$stockStatusTable = $this->getTable('cataloginventory_stock_status');
260+
$manageStockExpr = $this->stockItem->getManageStockExpr('stock_item');
261+
$backordersExpr = $this->stockItem->getBackordersExpr('stock_item');
262+
$minQtyExpr = $this->getConnection()->getCheckSql(
263+
'selection.selection_can_change_qty',
264+
$this->stockItem->getMinSaleQtyExpr('stock_item'),
265+
'selection.selection_qty'
266+
);
267+
268+
$where = $manageStockExpr . ' = 0';
269+
$where .= ' OR ('
270+
. 'stock_item.is_in_stock = ' . \Magento\CatalogInventory\Model\Stock::STOCK_IN_STOCK
271+
. ' AND ('
272+
. $backordersExpr . ' != ' . \Magento\CatalogInventory\Model\Stock::BACKORDERS_NO
273+
. ' OR '
274+
. $minQtyExpr . ' <= stock_item.qty'
275+
. ')'
276+
. ')';
277+
175278
$this->getSelect()
176279
->joinInner(
177-
['stock' => $stockStatusTable],
178-
'selection.product_id = stock.product_id',
179-
[]
180-
)->joinInner(
181-
['stock_item' => $stockItemTable],
280+
['stock_item' => $this->stockItem->getMainTable()],
182281
'selection.product_id = stock_item.product_id',
183282
[]
184-
)
185-
->where(
186-
'('
187-
. 'selection.selection_can_change_qty'
188-
. ' or '
189-
. 'selection.selection_qty <= stock.qty'
190-
. ' or '
191-
.'stock_item.manage_stock = 0'
192-
. ') and stock.stock_status = 1'
193-
);
283+
)->where($where);
284+
194285
return $this;
195286
}
196287

0 commit comments

Comments
 (0)