Skip to content
This repository was archived by the owner on Apr 29, 2019. It is now read-only.

Commit b99f6f7

Browse files
authored
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - magento-engcom/magento2ce#1287: [EngCom Team] Batch 6. Forwardports to 2.3-develop (by @magento-engcom-team) - magento-engcom/magento2ce#1282: [EngCom Team] Batch 1. Forwardports to 2.3-develop (by @magento-engcom-team) Fixed GitHub Issues: - magento/magento2#6661: XHTML templates Don't Use Schema URNs (reported by @astorm) has been fixed in magento-engcom/magento2ce#1287 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#6802: Magento\Search\Helper\getSuggestUrl() not used in search template (reported by @schmengler) has been fixed in magento-engcom/magento2ce#1287 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#10811: Replace FollowSymLinks with SymLinksIfOwnerMatch (reported by @s3rj1k) has been fixed in magento-engcom/magento2ce#1287 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#10920: Sku => Entity_id relations are fetched inefficiently when inserting attributes values during product import (reported by @diwipl) has been fixed in magento-engcom/magento2ce#1287 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#11230: Unit test fails after fresh installation (reported by @bnymn) has been fixed in magento-engcom/magento2ce#1287 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#11793: Magento2.1.5 admin shipping report shows wrong currency code (reported by @pushparaj100) has been fixed in magento-engcom/magento2ce#1287 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#11880: Magento 2.1.9 Configurable::getUsedProducts returns a different array after product collections is cached (reported by @apedicdev) has been fixed in magento-engcom/magento2ce#1287 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#12079: Products in cart report error when we have grouped or bundle product (reported by @mihaifaget) has been fixed in magento-engcom/magento2ce#1287 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#5105: Error While send Invoice with Grouped Products (reported by @srbarba) has been fixed in magento-engcom/magento2ce#1282 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#7582: Payment methods in payments title in wrong language (reported by @Bartlomiejsz) has been fixed in magento-engcom/magento2ce#1282 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#8958: Hint mistake in english language (reported by @MighT-W315H31T) has been fixed in magento-engcom/magento2ce#1282 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#9920: stripped-min-length Validation via UI Component Fails with "special" characters (reported by @bap14) has been fixed in magento-engcom/magento2ce#1282 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#10317: Region is being overridden when changing from a required-state country to one that is not required (reported by @nei) has been fixed in magento-engcom/magento2ce#1282 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#10775: 404 Forbidden sounds not right (reported by @irinikp) has been fixed in magento-engcom/magento2ce#1282 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#11163: Magento 2.2.0 Pages showing error: Data key is missing: code-entity (reported by @kfaer) has been fixed in magento-engcom/magento2ce#1282 by @magento-engcom-team in 2.3-develop branch Related commits: - magento/magento2#11231: Can't close mobile search bar once typed (reported by @BenSpace48) has been fixed in magento-engcom/magento2ce#1282 by @magento-engcom-team in 2.3-develop branch Related commits:
2 parents c7207f6 + 4164cb8 commit b99f6f7

File tree

33 files changed

+428
-104
lines changed

33 files changed

+428
-104
lines changed

.htaccess.sample

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,8 @@
111111
############################################
112112
## enable rewrites
113113

114-
Options +FollowSymLinks
114+
# The following line has better security but add some performance overhead - see https://httpd.apache.org/docs/2.4/en/misc/perf-tuning.html
115+
Options -FollowSymLinks +SymLinksIfOwnerMatch
115116
RewriteEngine on
116117

117118
############################################

app/code/Magento/Backend/Controller/Adminhtml/Noroute/Index.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function execute()
3434
{
3535
/** @var \Magento\Backend\Model\View\Result\Page $resultPage */
3636
$resultPage = $this->resultPageFactory->create();
37-
$resultPage->setStatusHeader(404, '1.1', 'Forbidden');
37+
$resultPage->setStatusHeader(404, '1.1', 'Not Found');
3838
$resultPage->setHeader('Status', '404 File not found');
3939
$resultPage->addHandle('adminhtml_noroute');
4040
return $resultPage;

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
<div class="messages">
8686
<div class="message message-notice notice">
8787
<span
88-
translate="'Search strings are either normal strings or regular exceptions (PCRE). They are matched in the same order as entered.'"></span>
88+
translate="'Search strings are either normal strings or regular expressions (PCRE). They are matched in the same order as entered.'"></span>
8989
<br>
9090
<span
9191
translate="'Examples'"></span>:

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@
55
*/
66
namespace Magento\CatalogImportExport\Model\Import;
77

8+
use Magento\Catalog\Model\Config as CatalogConfig;
89
use Magento\Catalog\Model\Product\Visibility;
910
use Magento\CatalogImportExport\Model\Import\Product\RowValidatorInterface as ValidatorInterface;
1011
use Magento\Framework\App\Filesystem\DirectoryList;
11-
use Magento\Framework\App\ObjectManager;
12+
use Magento\Framework\Filesystem;
1213
use Magento\Framework\Model\ResourceModel\Db\ObjectRelationProcessor;
1314
use Magento\Framework\Model\ResourceModel\Db\TransactionManagerInterface;
1415
use Magento\Framework\Stdlib\DateTime;
15-
use Magento\Framework\Filesystem;
1616
use Magento\ImportExport\Model\Import;
1717
use Magento\ImportExport\Model\Import\Entity\AbstractEntity;
1818
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingError;
1919
use Magento\ImportExport\Model\Import\ErrorProcessing\ProcessingErrorAggregatorInterface;
20-
use Magento\Catalog\Model\Config as CatalogConfig;
2120

2221
/**
2322
* Import entity product model
@@ -1298,20 +1297,15 @@ protected function _saveLinks()
12981297
*/
12991298
protected function _saveProductAttributes(array $attributesData)
13001299
{
1300+
$linkField = $this->getProductEntityLinkField();
13011301
foreach ($attributesData as $tableName => $skuData) {
13021302
$tableData = [];
13031303
foreach ($skuData as $sku => $attributes) {
1304-
$linkId = $this->_connection->fetchOne(
1305-
$this->_connection->select()
1306-
->from($this->getResource()->getTable('catalog_product_entity'))
1307-
->where('sku = ?', (string)$sku)
1308-
->columns($this->getProductEntityLinkField())
1309-
);
1310-
1304+
$linkId = $this->_oldSku[strtolower($sku)][$linkField];
13111305
foreach ($attributes as $attributeId => $storeValues) {
13121306
foreach ($storeValues as $storeId => $storeValue) {
13131307
$tableData[] = [
1314-
$this->getProductEntityLinkField() => $linkId,
1308+
$linkField => $linkId,
13151309
'attribute_id' => $attributeId,
13161310
'store_id' => $storeId,
13171311
'value' => $storeValue,
@@ -1321,6 +1315,7 @@ protected function _saveProductAttributes(array $attributesData)
13211315
}
13221316
$this->_connection->insertOnDuplicate($tableName, $tableData, ['value']);
13231317
}
1318+
13241319
return $this;
13251320
}
13261321

app/code/Magento/CatalogImportExport/Test/Unit/Model/Import/ProductTest.php

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace Magento\CatalogImportExport\Test\Unit\Model\Import;
77

88
use Magento\Framework\App\Filesystem\DirectoryList;
9-
use Magento\Framework\Stdlib\DateTime;
109
use Magento\ImportExport\Model\Import;
1110

1211
/**
@@ -513,25 +512,6 @@ public function testSaveProductAttributes()
513512
]
514513
]
515514
];
516-
$entityTable = 'catalog_product_entity';
517-
$resource = $this->getMockBuilder(\Magento\CatalogImportExport\Model\Import\Proxy\Product\ResourceModel::class)
518-
->disableOriginalConstructor()
519-
->setMethods(['getTable'])
520-
->getMock();
521-
$resource->expects($this->once())->method('getTable')->with($entityTable)->willReturnArgument(0);
522-
$this->_resourceFactory->expects($this->once())->method('create')->willReturn($resource);
523-
$selectMock = $this->getMockBuilder(\Magento\Framework\DB\Select::class)
524-
->disableOriginalConstructor()
525-
->getMock();
526-
$selectMock->expects($this->once())->method('from')->with($entityTable, '*', null)->willReturnSelf();
527-
$selectMock->expects($this->once())->method('where')->with('sku = ?', $testSku)->willReturnSelf();
528-
$selectMock->expects($this->once())->method('columns')->with('entity_id')->willReturnSelf();
529-
$this->_connection->expects($this->any())->method('fetchOne')->willReturn(self::ENTITY_ID);
530-
$this->_connection->expects($this->any())->method('select')->willReturn($selectMock);
531-
$this->_connection->expects($this->any())
532-
->method('quoteInto')
533-
->willReturnCallback([$this, 'returnQuoteCallback']);
534-
535515
$tableData[] = [
536516
'entity_id' => self::ENTITY_ID,
537517
'attribute_id' => $attributeId,
@@ -541,6 +521,7 @@ public function testSaveProductAttributes()
541521
$this->_connection->expects($this->once())
542522
->method('insertOnDuplicate')
543523
->with($testTable, $tableData, ['value']);
524+
$this->setPropertyValue($this->importProduct, '_oldSku', [$testSku => ['entity_id' => self::ENTITY_ID]]);
544525
$object = $this->invokeMethod($this->importProduct, '_saveProductAttributes', [$attributesData]);
545526
$this->assertEquals($this->importProduct, $object);
546527
}

app/code/Magento/Checkout/view/frontend/web/js/region-updater.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ define([
206206
regionInput.removeClass('required-entry');
207207
}
208208

209-
regionList.removeClass('required-entry').hide();
209+
regionList.removeClass('required-entry').prop('disabled', 'disabled').hide();
210210
regionInput.show();
211211
label.attr('for', regionInput.attr('id'));
212212
}

app/code/Magento/ConfigurableProduct/Model/Product/Type/Configurable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1296,7 +1296,7 @@ private function loadUsedProducts(\Magento\Catalog\Model\Product $product, $cach
12961296
if ($salableOnly) {
12971297
$collection = $this->salableProcessor->process($collection);
12981298
}
1299-
$usedProducts = $collection->getItems();
1299+
$usedProducts = array_values($collection->getItems());
13001300
$this->saveUsedProductsCacheData($product, $usedProducts, $cacheKey);
13011301
}
13021302
$product->setData($dataFieldName, $usedProducts);

app/code/Magento/CustomerImportExport/Model/Import/Customer.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,29 @@ protected function _saveCustomerEntities(array $entitiesToCreate, array $entitie
270270
$this->_connection->insertOnDuplicate(
271271
$this->_entityTable,
272272
$entitiesToUpdate,
273-
$this->customerFields
273+
$this->getCustomerEntityFieldsToUpdate($entitiesToUpdate)
274274
);
275275
}
276276

277277
return $this;
278278
}
279279

280+
/**
281+
* Filter the entity that are being updated so we only change fields found in the importer file
282+
*
283+
* @param array $entitiesToUpdate
284+
* @return array
285+
*/
286+
private function getCustomerEntityFieldsToUpdate(array $entitiesToUpdate): array
287+
{
288+
$firstCustomer = reset($entitiesToUpdate);
289+
$columnsToUpdate = array_keys($firstCustomer);
290+
$customerFieldsToUpdate = array_filter($this->customerFields, function ($field) use ($columnsToUpdate) {
291+
return in_array($field, $columnsToUpdate);
292+
});
293+
return $customerFieldsToUpdate;
294+
}
295+
280296
/**
281297
* Save customer attributes.
282298
*

app/code/Magento/GoogleOptimizer/view/adminhtml/ui_component/cms_page_form.xml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,12 @@
1313
</settings>
1414
<container name="google_experiment_container" sortOrder="250">
1515
<htmlContent name="html_content">
16-
<block name="googleOptimizerBlockAdminhtmlFormCmsPage" class="Magento\GoogleOptimizer\Block\Adminhtml\Form\CmsPage" />
16+
<block name="googleOptimizerBlockAdminhtmlFormCmsPage" class="Magento\GoogleOptimizer\Block\Adminhtml\Form\CmsPage">
17+
<arguments>
18+
<argument name="code-entity" xsi:type="string">Magento\GoogleOptimizer\Block\Adminhtml\Cms\Page\EntityCmsPage</argument>
19+
<argument name="form-name" xsi:type="string">cms_page_form</argument>
20+
</arguments>
21+
</block>
1722
</htmlContent>
1823
</container>
1924
</fieldset>

app/code/Magento/NewRelicReporting/Model/NewRelicWrapper.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,19 @@ public function addCustomParameter($param, $value)
2828
return false;
2929
}
3030

31+
/**
32+
* Wrapper for 'newrelic_notice_error' function
33+
*
34+
* @param Exception $exception
35+
* @return void
36+
*/
37+
public function reportError($exception)
38+
{
39+
if (extension_loaded('newrelic')) {
40+
newrelic_notice_error($exception->getMessage(), $exception);
41+
}
42+
}
43+
3144
/**
3245
* Checks whether newrelic-php5 agent is installed
3346
*
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\NewRelicReporting\Model\Observer;
7+
8+
use Magento\Framework\Event\Observer;
9+
use Magento\Framework\Event\ObserverInterface;
10+
use Magento\NewRelicReporting\Model\Config;
11+
use Magento\NewRelicReporting\Model\NewRelicWrapper;
12+
13+
/**
14+
* Class ReportApplicationHandledExceptionToNewRelic
15+
*/
16+
class ReportApplicationHandledExceptionToNewRelic implements ObserverInterface
17+
{
18+
/**
19+
* @var Config
20+
*/
21+
private $config;
22+
23+
/**
24+
* @var NewRelicWrapper
25+
*/
26+
private $newRelicWrapper;
27+
28+
/**
29+
* @param Config $config
30+
* @param NewRelicWrapper $newRelicWrapper
31+
*/
32+
public function __construct(
33+
Config $config,
34+
NewRelicWrapper $newRelicWrapper
35+
) {
36+
$this->config = $config;
37+
$this->newRelicWrapper = $newRelicWrapper;
38+
}
39+
40+
public function execute(Observer $observer)
41+
{
42+
if ($this->config->isNewRelicEnabled()) {
43+
$exception = $observer->getEvent()->getException();
44+
$this->newRelicWrapper->reportError($exception);
45+
}
46+
}
47+
}
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\NewRelicReporting\Plugin;
7+
8+
use Magento\Framework\App\Bootstrap;
9+
use Magento\Framework\App\Http;
10+
use Magento\NewRelicReporting\Model\Config;
11+
use Magento\NewRelicReporting\Model\NewRelicWrapper;
12+
13+
class HttpPlugin
14+
{
15+
/**
16+
* @var Config
17+
*/
18+
private $config;
19+
20+
/**
21+
* @var NewRelicWrapper
22+
*/
23+
private $newRelicWrapper;
24+
25+
/**
26+
* @param Config $config
27+
* @param NewRelicWrapper $newRelicWrapper
28+
*/
29+
public function __construct(
30+
Config $config,
31+
NewRelicWrapper $newRelicWrapper
32+
) {
33+
$this->config = $config;
34+
$this->newRelicWrapper = $newRelicWrapper;
35+
}
36+
37+
/**
38+
* Report exception to New Relic
39+
*
40+
* @param Http $subject
41+
* @param Bootstrap $bootstrap
42+
* @param \Exception $exception
43+
* @return void
44+
*
45+
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
46+
*/
47+
public function beforeCatchException(Http $subject, Bootstrap $bootstrap, \Exception $exception)
48+
{
49+
if ($this->config->isNewRelicEnabled()) {
50+
$this->newRelicWrapper->reportError($exception);
51+
}
52+
}
53+
}

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@
2727
</argument>
2828
</arguments>
2929
</type>
30+
<type name="Magento\Framework\App\Http">
31+
<plugin name="framework-http-newrelic" type="Magento\NewRelicReporting\Plugin\HttpPlugin"/>
32+
</type>
3033
</config>

app/code/Magento/Quote/Model/QuoteRepository.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ protected function loadQuote($loadMethod, $loadField, $identifier, array $shared
212212
if ($sharedStoreIds) {
213213
$quote->setSharedStoreIds($sharedStoreIds);
214214
}
215-
$quote->setStoreId($this->storeManager->getStore()->getId())->$loadMethod($identifier);
215+
$quote->$loadMethod($identifier)->setStoreId($this->storeManager->getStore()->getId());
216216
if (!$quote->getId()) {
217217
throw NoSuchEntityException::singleField($loadField, $identifier);
218218
}

app/code/Magento/Reports/Block/Adminhtml/Grid/AbstractGrid.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -363,12 +363,11 @@ public function setStoreIds($storeIds)
363363
public function getCurrentCurrencyCode()
364364
{
365365
if ($this->_currentCurrencyCode === null) {
366-
$this->_currentCurrencyCode = count(
367-
$this->_storeIds
368-
) > 0 ? $this->_storeManager->getStore(
369-
array_shift($this->_storeIds)
370-
)->getBaseCurrencyCode() : $this->_storeManager->getStore()->getBaseCurrencyCode();
366+
$this->_currentCurrencyCode = count($this->_storeIds) > 0
367+
? $this->_storeManager->getStore(array_shift($this->_storeIds))->getCurrentCurrencyCode()
368+
: $this->_storeManager->getStore()->getBaseCurrencyCode();
371369
}
370+
372371
return $this->_currentCurrencyCode;
373372
}
374373

app/code/Magento/Reports/Model/ResourceModel/Quote/Item/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ protected function getProductData(array $productIds)
192192
. ' AND product_name.attribute_id = ' . $productAttrNameId
193193
. ' AND product_name.store_id = ' . \Magento\Store\Model\Store::DEFAULT_STORE_ID,
194194
['name' => 'product_name.value']
195-
)->joinInner(
195+
)->joinLeft(
196196
['product_price' => $productAttrPrice->getBackend()->getTable()],
197197
"product_price.{$linkField} = main_table.{$linkField}"
198198
." AND product_price.attribute_id = {$productAttrPriceId}",

0 commit comments

Comments
 (0)