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

Commit 515218f

Browse files
author
Stanislav Idolov
authored
🔃 [EngCom] Public Pull Requests - 2.3-develop
Accepted Public Pull Requests: - magento/magento2#18545: [Forwardport] Fix type hint of @message declaration as the "setWidgetParameters" method allows arrays too (by @mage2pratik) - magento/magento2#18538: [Forwardport] Admin > Footer > Aligning Proportionally (by @dmytro-ch) - magento/magento2#18540: Fixed typo from heght to height for image validation rule (by @peterjaap) - magento/magento2#18065: Fix bool scope config and update throws and update use clases (by @hryvinskyi) - magento/magento2#18529: Create empty modelData array to avoid undefined var error (by @peterjaap) - magento/magento2#18522: Fix typo on product details causing Validation error. (by @BezV8) - magento/magento2#18393: Fix for #12969 - server port detection for errors (by @loganstellway) - magento/magento2#18365: move hardcoded MIME types from class private to DI configuration. (by @tufahu) - magento/magento2#18476: Fix Typo in Data\Form\Element\Factory.php (by @zack6849) - magento/magento2#18494: Checkout - Fix "Cannot read property 'code' on undefined" issue (by @ihor-sviziev) - magento/magento2#18507: [Forwardport] add error message in else condition (by @vaibhavahalpara) - magento/magento2#18437: MAGENTO-18131: Fixed EAV attributes values query (by @strell) - magento/magento2#18370: [Forwardport] ConfigurableProduct show prices in select options (by @ihor-sviziev) - magento/magento2#18210: [Forwardport] Fixes saving product in single-store mode if website_id <> 1 (by @eduard13) - magento/magento2#18160: Fix of saving "clone_field" fields (by @higi90) Fixed GitHub Issues: - magento/magento2#12969: processor.php getHostUrl() does not detect the server port correctly (reported by @boldhedgehog) has been fixed in magento/magento2#18393 by @loganstellway in 2.3-develop branch Related commits: 1. 422d244 2. 1e28a8e 3. 7d921b6 - magento/magento2#18164: Checkout - Cannot read property 'code' of undefined (reported by @bruno-serfe) has been fixed in magento/magento2#18494 by @ihor-sviziev in 2.3-develop branch Related commits: 1. 47978d7 2. 0fcbe12 - magento/magento2#17977: Show Method if Not Applicable for Free Shipping doesn't work. (reported by @vaibhavahalpara) has been fixed in magento/magento2#18507 by @vaibhavahalpara in 2.3-develop branch Related commits: 1. 9b7d4ac 2. 67e1b01 3. 4938bbc - magento/magento2#18131: Entity Type ID at Join (reported by @akimatze) has been fixed in magento/magento2#18437 by @strell in 2.3-develop branch Related commits: 1. 2f4ad2f - magento/magento2#13405: No such entity error when saving product in single-store mode if website_id <> 1 (reported by @kyegil) has been fixed in magento/magento2#18210 by @eduard13 in 2.3-develop branch Related commits: 1. 765f88f 2. 558d527 3. deebbc0 4. ae2917c 5. e068783 6. 7cd36de 7. 0e7f779 8. 1133391
2 parents 1548cc2 + 441cd70 commit 515218f

File tree

57 files changed

+457
-217
lines changed

Some content is hidden

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

57 files changed

+457
-217
lines changed

app/code/Magento/AdvancedSearch/Model/Recommendations/DataProvider.php

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
use Magento\Search\Model\QueryInterface;
1111
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;
1212

13+
/**
14+
* Class DataProvider
15+
*/
1316
class DataProvider implements SuggestedQueriesInterface
1417
{
1518
/**
@@ -51,6 +54,8 @@ class DataProvider implements SuggestedQueriesInterface
5154
private $recommendationsFactory;
5255

5356
/**
57+
* DataProvider constructor.
58+
*
5459
* @param ScopeConfigInterface $scopeConfig
5560
* @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
5661
* @param \Magento\AdvancedSearch\Model\ResourceModel\RecommendationsFactory $recommendationsFactory
@@ -69,18 +74,20 @@ public function __construct(
6974
}
7075

7176
/**
77+
* Is Results Count Enabled
78+
*
7279
* @return bool
7380
*/
7481
public function isResultsCountEnabled()
7582
{
76-
return (bool)$this->scopeConfig->getValue(
83+
return $this->scopeConfig->isSetFlag(
7784
self::CONFIG_RESULTS_COUNT_ENABLED,
7885
ScopeInterface::SCOPE_STORE
7986
);
8087
}
8188

8289
/**
83-
* {@inheritdoc}
90+
* @inheritdoc
8491
*/
8592
public function getItems(QueryInterface $query)
8693
{
@@ -102,6 +109,8 @@ public function getItems(QueryInterface $query)
102109
}
103110

104111
/**
112+
* Return Search Recommendations
113+
*
105114
* @param QueryInterface $query
106115
* @return array
107116
*/
@@ -126,17 +135,21 @@ private function getSearchRecommendations(\Magento\Search\Model\QueryInterface $
126135
}
127136

128137
/**
138+
* Is Search Recommendations Enabled
139+
*
129140
* @return bool
130141
*/
131142
private function isSearchRecommendationsEnabled()
132143
{
133-
return (bool)$this->scopeConfig->getValue(
144+
return $this->scopeConfig->isSetFlag(
134145
self::CONFIG_IS_ENABLED,
135146
ScopeInterface::SCOPE_STORE
136147
);
137148
}
138149

139150
/**
151+
* Return Search Recommendations Count
152+
*
140153
* @return int
141154
*/
142155
private function getSearchRecommendationsCount()

app/code/Magento/Catalog/Model/ImageUploader.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,9 @@ class ImageUploader
6767
/**
6868
* List of allowed image mime types
6969
*
70-
* @var array
70+
* @var string[]
7171
*/
72-
private $allowedMimeTypes = [
73-
'image/jpg',
74-
'image/jpeg',
75-
'image/gif',
76-
'image/png',
77-
];
72+
private $allowedMimeTypes;
7873

7974
/**
8075
* ImageUploader constructor
@@ -87,6 +82,7 @@ class ImageUploader
8782
* @param string $baseTmpPath
8883
* @param string $basePath
8984
* @param string[] $allowedExtensions
85+
* @param string[] $allowedMimeTypes
9086
*/
9187
public function __construct(
9288
\Magento\MediaStorage\Helper\File\Storage\Database $coreFileStorageDatabase,
@@ -96,7 +92,8 @@ public function __construct(
9692
\Psr\Log\LoggerInterface $logger,
9793
$baseTmpPath,
9894
$basePath,
99-
$allowedExtensions
95+
$allowedExtensions,
96+
$allowedMimeTypes = []
10097
) {
10198
$this->coreFileStorageDatabase = $coreFileStorageDatabase;
10299
$this->mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
@@ -106,6 +103,7 @@ public function __construct(
106103
$this->baseTmpPath = $baseTmpPath;
107104
$this->basePath = $basePath;
108105
$this->allowedExtensions = $allowedExtensions;
106+
$this->allowedMimeTypes = $allowedMimeTypes;
109107
}
110108

111109
/**
@@ -165,7 +163,7 @@ public function getBasePath()
165163
}
166164

167165
/**
168-
* Retrieve base path
166+
* Retrieve allowed extensions
169167
*
170168
* @return string[]
171169
*/

app/code/Magento/Catalog/Model/Product.php

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,7 @@ public function getPrice()
596596
* @see \Magento\Catalog\Model\Product\Visibility
597597
*
598598
* @return int
599+
* @codeCoverageIgnoreStart
599600
*/
600601
public function getVisibility()
601602
{
@@ -818,6 +819,9 @@ public function getStoreIds()
818819
if (!$this->hasStoreIds()) {
819820
$storeIds = [];
820821
if ($websiteIds = $this->getWebsiteIds()) {
822+
if ($this->_storeManager->isSingleStoreMode()) {
823+
$websiteIds = array_keys($websiteIds);
824+
}
821825
foreach ($websiteIds as $websiteId) {
822826
$websiteStores = $this->_storeManager->getWebsite($websiteId)->getStoreIds();
823827
$storeIds = array_merge($storeIds, $websiteStores);
@@ -1049,7 +1053,8 @@ public function reindex()
10491053
*
10501054
* Register indexing event before delete product
10511055
*
1052-
* @return \Magento\Catalog\Model\Product
1056+
* @return $this
1057+
* @throws \Magento\Framework\Exception\LocalizedException
10531058
*/
10541059
public function beforeDelete()
10551060
{
@@ -1723,8 +1728,6 @@ public function getIsSalable()
17231728
/**
17241729
* Check is a virtual product
17251730
*
1726-
* Data helper wrapper
1727-
*
17281731
* @return bool
17291732
*/
17301733
public function isVirtual()
@@ -2033,7 +2036,7 @@ public function getIsVirtual()
20332036
*
20342037
* @param string $code Option code
20352038
* @param mixed $value Value of the option
2036-
* @param int|Product $product Product ID
2039+
* @param int|Product|null $product Product ID
20372040
* @return $this
20382041
*/
20392042
public function addCustomOption($code, $value, $product = null)
@@ -2227,9 +2230,9 @@ public function getPreconfiguredValues()
22272230
}
22282231

22292232
/**
2230-
* Prepare product custom options.
2233+
* Prepare product custom options
22312234
*
2232-
* To be sure that all product custom options does not has ID and has product instance
2235+
* To be sure that all product custom options does not has ID and has product instance.
22332236
*
22342237
* @return \Magento\Catalog\Model\Product
22352238
*/
@@ -2586,10 +2589,11 @@ public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductExtensio
25862589
//@codeCoverageIgnoreEnd
25872590

25882591
/**
2589-
* Convert array to media gallery interface
2592+
* Convert Image to ProductAttributeMediaGalleryEntryInterface
25902593
*
25912594
* @param array $mediaGallery
25922595
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]
2596+
* @throws \Magento\Framework\Exception\LocalizedException
25932597
*/
25942598
protected function convertToMediaGalleryInterface(array $mediaGallery)
25952599
{
@@ -2608,6 +2612,7 @@ protected function convertToMediaGalleryInterface(array $mediaGallery)
26082612
* Returns media gallery entries
26092613
*
26102614
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]|null
2615+
* @throws \Magento\Framework\Exception\LocalizedException
26112616
*/
26122617
public function getMediaGalleryEntries()
26132618
{
@@ -2625,6 +2630,7 @@ public function getMediaGalleryEntries()
26252630
*
26262631
* @param ProductAttributeMediaGalleryEntryInterface[] $mediaGalleryEntries
26272632
* @return $this
2633+
* @throws \Magento\Framework\Exception\LocalizedException
26282634
*/
26292635
public function setMediaGalleryEntries(array $mediaGalleryEntries = null)
26302636
{

app/code/Magento/Catalog/Test/Unit/Model/ImageUploaderTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,17 @@ class ImageUploaderTest extends \PHPUnit\Framework\TestCase
6969
/**
7070
* Allowed extensions
7171
*
72-
* @var string
72+
* @var array
7373
*/
7474
private $allowedExtensions;
7575

76+
/**
77+
* Allowed mime types
78+
*
79+
* @var array
80+
*/
81+
private $allowedMimeTypes;
82+
7683
protected function setUp()
7784
{
7885
$this->coreFileStorageDatabaseMock = $this->createMock(
@@ -97,6 +104,7 @@ protected function setUp()
97104
$this->baseTmpPath = 'base/tmp/';
98105
$this->basePath = 'base/real/';
99106
$this->allowedExtensions = ['.jpg'];
107+
$this->allowedMimeTypes = ['image/jpg', 'image/jpeg', 'image/gif', 'image/png'];
100108

101109
$this->imageUploader =
102110
new \Magento\Catalog\Model\ImageUploader(
@@ -107,7 +115,8 @@ protected function setUp()
107115
$this->loggerMock,
108116
$this->baseTmpPath,
109117
$this->basePath,
110-
$this->allowedExtensions
118+
$this->allowedExtensions,
119+
$this->allowedMimeTypes
111120
);
112121
}
113122

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,12 @@
220220
<item name="gif" xsi:type="string">gif</item>
221221
<item name="png" xsi:type="string">png</item>
222222
</argument>
223+
<argument name="allowedMimeTypes" xsi:type="array">
224+
<item name="jpg" xsi:type="string">image/jpg</item>
225+
<item name="jpeg" xsi:type="string">image/jpeg</item>
226+
<item name="gif" xsi:type="string">image/gif</item>
227+
<item name="png" xsi:type="string">image/png</item>
228+
</argument>
223229
</arguments>
224230
</virtualType>
225231
<type name="Magento\Catalog\Controller\Adminhtml\Category\Image\Upload">

app/code/Magento/Catalog/view/frontend/templates/product/view/details.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
$label = $block->getChildData($alias, 'title');
2222
?>
2323
<div class="data item title"
24-
aria-labeledby="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title"
24+
aria-labelledby="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title"
2525
data-role="collapsible" id="tab-label-<?= /* @escapeNotVerified */ $alias ?>">
2626
<a class="data switch"
2727
tabindex="-1"

0 commit comments

Comments
 (0)