Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.3-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - magento#18545: [Forwardport] Fix type hint of @message declaration as the "setWidgetParameters" method allows arrays too (by @mage2pratik)
 - magento#18538: [Forwardport] Admin > Footer > Aligning Proportionally (by @dmytro-ch)
 - magento#18540: Fixed typo from heght to height for image validation rule (by @peterjaap)
 - magento#18065: Fix bool scope config and update throws and update use clases (by @hryvinskyi)
 - magento#18529: Create empty modelData array to avoid undefined var error (by @peterjaap)
 - magento#18522:  Fix typo on product details causing Validation error.  (by @BezV8)
 - magento#18393: Fix for magento#12969 - server port detection for errors (by @loganstellway)
 - magento#18365: move hardcoded MIME types from class private to DI configuration. (by @tufahu)
 - magento#18476: Fix Typo in Data\Form\Element\Factory.php (by @zack6849)
 - magento#18494: Checkout - Fix "Cannot read property 'code' on undefined" issue (by @ihor-sviziev)
 - magento#18507: [Forwardport] add error message in else condition (by @vaibhavahalpara)
 - magento#18437: MAGENTO-18131: Fixed EAV attributes values query (by @strell)
 - magento#18370: [Forwardport] ConfigurableProduct show prices in select options (by @ihor-sviziev)
 - magento#18210: [Forwardport] Fixes saving product in single-store mode if website_id <> 1 (by @eduard13)
 - magento#18160: Fix of saving "clone_field" fields  (by @higi90)


Fixed GitHub Issues:
 - magento#12969: processor.php getHostUrl() does not detect the server port correctly (reported by @boldhedgehog) has been fixed in magento#18393 by @loganstellway in 2.3-develop branch
   Related commits:
     1. 422d244
     2. 1e28a8e
     3. 7d921b6

 - magento#18164: Checkout - Cannot read property 'code' of undefined (reported by @bruno-serfe) has been fixed in magento#18494 by @ihor-sviziev in 2.3-develop branch
   Related commits:
     1. 47978d7
     2. 0fcbe12

 - magento#17977: Show Method if Not Applicable for Free Shipping doesn't work. (reported by @vaibhavahalpara) has been fixed in magento#18507 by @vaibhavahalpara in 2.3-develop branch
   Related commits:
     1. 9b7d4ac
     2. 67e1b01
     3. 4938bbc

 - magento#18131: Entity Type ID at Join (reported by @akimatze) has been fixed in magento#18437 by @strell in 2.3-develop branch
   Related commits:
     1. 2f4ad2f

 - magento#13405: No such entity error when saving product in single-store mode if website_id <> 1 (reported by @kyegil) has been fixed in magento#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
  • Loading branch information
Stanislav Idolov authored Oct 16, 2018
2 parents 1548cc2 + 441cd70 commit 515218f
Show file tree
Hide file tree
Showing 57 changed files with 457 additions and 217 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
use Magento\Search\Model\QueryInterface;
use Magento\AdvancedSearch\Model\SuggestedQueriesInterface;

/**
* Class DataProvider
*/
class DataProvider implements SuggestedQueriesInterface
{
/**
Expand Down Expand Up @@ -51,6 +54,8 @@ class DataProvider implements SuggestedQueriesInterface
private $recommendationsFactory;

/**
* DataProvider constructor.
*
* @param ScopeConfigInterface $scopeConfig
* @param \Magento\Catalog\Model\Layer\Resolver $layerResolver
* @param \Magento\AdvancedSearch\Model\ResourceModel\RecommendationsFactory $recommendationsFactory
Expand All @@ -69,18 +74,20 @@ public function __construct(
}

/**
* Is Results Count Enabled
*
* @return bool
*/
public function isResultsCountEnabled()
{
return (bool)$this->scopeConfig->getValue(
return $this->scopeConfig->isSetFlag(
self::CONFIG_RESULTS_COUNT_ENABLED,
ScopeInterface::SCOPE_STORE
);
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function getItems(QueryInterface $query)
{
Expand All @@ -102,6 +109,8 @@ public function getItems(QueryInterface $query)
}

/**
* Return Search Recommendations
*
* @param QueryInterface $query
* @return array
*/
Expand All @@ -126,17 +135,21 @@ private function getSearchRecommendations(\Magento\Search\Model\QueryInterface $
}

/**
* Is Search Recommendations Enabled
*
* @return bool
*/
private function isSearchRecommendationsEnabled()
{
return (bool)$this->scopeConfig->getValue(
return $this->scopeConfig->isSetFlag(
self::CONFIG_IS_ENABLED,
ScopeInterface::SCOPE_STORE
);
}

/**
* Return Search Recommendations Count
*
* @return int
*/
private function getSearchRecommendationsCount()
Expand Down
16 changes: 7 additions & 9 deletions app/code/Magento/Catalog/Model/ImageUploader.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,9 @@ class ImageUploader
/**
* List of allowed image mime types
*
* @var array
* @var string[]
*/
private $allowedMimeTypes = [
'image/jpg',
'image/jpeg',
'image/gif',
'image/png',
];
private $allowedMimeTypes;

/**
* ImageUploader constructor
Expand All @@ -87,6 +82,7 @@ class ImageUploader
* @param string $baseTmpPath
* @param string $basePath
* @param string[] $allowedExtensions
* @param string[] $allowedMimeTypes
*/
public function __construct(
\Magento\MediaStorage\Helper\File\Storage\Database $coreFileStorageDatabase,
Expand All @@ -96,7 +92,8 @@ public function __construct(
\Psr\Log\LoggerInterface $logger,
$baseTmpPath,
$basePath,
$allowedExtensions
$allowedExtensions,
$allowedMimeTypes = []
) {
$this->coreFileStorageDatabase = $coreFileStorageDatabase;
$this->mediaDirectory = $filesystem->getDirectoryWrite(\Magento\Framework\App\Filesystem\DirectoryList::MEDIA);
Expand All @@ -106,6 +103,7 @@ public function __construct(
$this->baseTmpPath = $baseTmpPath;
$this->basePath = $basePath;
$this->allowedExtensions = $allowedExtensions;
$this->allowedMimeTypes = $allowedMimeTypes;
}

/**
Expand Down Expand Up @@ -165,7 +163,7 @@ public function getBasePath()
}

/**
* Retrieve base path
* Retrieve allowed extensions
*
* @return string[]
*/
Expand Down
20 changes: 13 additions & 7 deletions app/code/Magento/Catalog/Model/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,7 @@ public function getPrice()
* @see \Magento\Catalog\Model\Product\Visibility
*
* @return int
* @codeCoverageIgnoreStart
*/
public function getVisibility()
{
Expand Down Expand Up @@ -818,6 +819,9 @@ public function getStoreIds()
if (!$this->hasStoreIds()) {
$storeIds = [];
if ($websiteIds = $this->getWebsiteIds()) {
if ($this->_storeManager->isSingleStoreMode()) {
$websiteIds = array_keys($websiteIds);
}
foreach ($websiteIds as $websiteId) {
$websiteStores = $this->_storeManager->getWebsite($websiteId)->getStoreIds();
$storeIds = array_merge($storeIds, $websiteStores);
Expand Down Expand Up @@ -1049,7 +1053,8 @@ public function reindex()
*
* Register indexing event before delete product
*
* @return \Magento\Catalog\Model\Product
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function beforeDelete()
{
Expand Down Expand Up @@ -1723,8 +1728,6 @@ public function getIsSalable()
/**
* Check is a virtual product
*
* Data helper wrapper
*
* @return bool
*/
public function isVirtual()
Expand Down Expand Up @@ -2033,7 +2036,7 @@ public function getIsVirtual()
*
* @param string $code Option code
* @param mixed $value Value of the option
* @param int|Product $product Product ID
* @param int|Product|null $product Product ID
* @return $this
*/
public function addCustomOption($code, $value, $product = null)
Expand Down Expand Up @@ -2227,9 +2230,9 @@ public function getPreconfiguredValues()
}

/**
* Prepare product custom options.
* Prepare product custom options
*
* To be sure that all product custom options does not has ID and has product instance
* To be sure that all product custom options does not has ID and has product instance.
*
* @return \Magento\Catalog\Model\Product
*/
Expand Down Expand Up @@ -2586,10 +2589,11 @@ public function setExtensionAttributes(\Magento\Catalog\Api\Data\ProductExtensio
//@codeCoverageIgnoreEnd

/**
* Convert array to media gallery interface
* Convert Image to ProductAttributeMediaGalleryEntryInterface
*
* @param array $mediaGallery
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]
* @throws \Magento\Framework\Exception\LocalizedException
*/
protected function convertToMediaGalleryInterface(array $mediaGallery)
{
Expand All @@ -2608,6 +2612,7 @@ protected function convertToMediaGalleryInterface(array $mediaGallery)
* Returns media gallery entries
*
* @return \Magento\Catalog\Api\Data\ProductAttributeMediaGalleryEntryInterface[]|null
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function getMediaGalleryEntries()
{
Expand All @@ -2625,6 +2630,7 @@ public function getMediaGalleryEntries()
*
* @param ProductAttributeMediaGalleryEntryInterface[] $mediaGalleryEntries
* @return $this
* @throws \Magento\Framework\Exception\LocalizedException
*/
public function setMediaGalleryEntries(array $mediaGalleryEntries = null)
{
Expand Down
13 changes: 11 additions & 2 deletions app/code/Magento/Catalog/Test/Unit/Model/ImageUploaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,17 @@ class ImageUploaderTest extends \PHPUnit\Framework\TestCase
/**
* Allowed extensions
*
* @var string
* @var array
*/
private $allowedExtensions;

/**
* Allowed mime types
*
* @var array
*/
private $allowedMimeTypes;

protected function setUp()
{
$this->coreFileStorageDatabaseMock = $this->createMock(
Expand All @@ -97,6 +104,7 @@ protected function setUp()
$this->baseTmpPath = 'base/tmp/';
$this->basePath = 'base/real/';
$this->allowedExtensions = ['.jpg'];
$this->allowedMimeTypes = ['image/jpg', 'image/jpeg', 'image/gif', 'image/png'];

$this->imageUploader =
new \Magento\Catalog\Model\ImageUploader(
Expand All @@ -107,7 +115,8 @@ protected function setUp()
$this->loggerMock,
$this->baseTmpPath,
$this->basePath,
$this->allowedExtensions
$this->allowedExtensions,
$this->allowedMimeTypes
);
}

Expand Down
6 changes: 6 additions & 0 deletions app/code/Magento/Catalog/etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,12 @@
<item name="gif" xsi:type="string">gif</item>
<item name="png" xsi:type="string">png</item>
</argument>
<argument name="allowedMimeTypes" xsi:type="array">
<item name="jpg" xsi:type="string">image/jpg</item>
<item name="jpeg" xsi:type="string">image/jpeg</item>
<item name="gif" xsi:type="string">image/gif</item>
<item name="png" xsi:type="string">image/png</item>
</argument>
</arguments>
</virtualType>
<type name="Magento\Catalog\Controller\Adminhtml\Category\Image\Upload">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
$label = $block->getChildData($alias, 'title');
?>
<div class="data item title"
aria-labeledby="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title"
aria-labelledby="tab-label-<?= /* @escapeNotVerified */ $alias ?>-title"
data-role="collapsible" id="tab-label-<?= /* @escapeNotVerified */ $alias ?>">
<a class="data switch"
tabindex="-1"
Expand Down
Loading

0 comments on commit 515218f

Please sign in to comment.