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:
 - #21474: Refactoring the Form class (by @eduard13)
 - #21338: [Catalog] [MediaStorage] Fix watermark in media application (by @progreg)
 - #21443: Fixed #21425 Date design change show not correctly value in backend (by @shikhamis11)
 - #21356: Checkout Page Cancel button is not working #21327 (by @Jitheesh)
 - #20482: [TASK] Remove translation of attribute store label in getAdditionalData (by @c-walter)
 - #20316: Change product_price_value in cart data section based on tax settings (by @NickdeK)
 - #21363: [Catalog] Fixing the Products grid with default values on multi stores (by @eduard13)
 - #21275: Static tests: forbid 'or' instead of '||' #21062. (by @novikor)
 - #21094: Also populate the storesCache when importing product only on storevie� (by @hostep)
 - #21130: Remove unused use statement in Wishlist Allcart Controller (by @oshancp)


Fixed GitHub Issues:
 - #21154: 2.3.0 Watermark not showing on images (reported by @travis5491811) has been fixed in #21338 by @progreg in 2.3-develop branch
   Related commits:
     1. c7930eb
     2. 7190983

 - #21425: Date design change show not correctly value in backend (reported by @mrtuvn) has been fixed in #21443 by @shikhamis11 in 2.3-develop branch
   Related commits:
     1. 68ee3af
     2. 8e95bfd
     3. f0a98a5

 - #21327: Checkout Page Cancel button is not working (reported by @speedy008) has been fixed in #21356 by @Jitheesh in 2.3-develop branch
   Related commits:
     1. 4a598e7
     2. 5372fdc
     3. 642a4eb

 - #20310: Cart section data has wrong product_price_value (reported by @NickdeK) has been fixed in #20316 by @NickdeK in 2.3-develop branch
   Related commits:
     1. 764612e
     2. 7c7b078
     3. 3c8c4a7

 - #13338: Products grid in admin does not display default values? (reported by @VincentMarmiesse) has been fixed in #21363 by @eduard13 in 2.3-develop branch
   Related commits:
     1. a0be69b
     2. 9e657ad
     3. 5d2ffad
     4. edc66ba
     5. 14dbb4f

 - #21062: Static tests: forbid 'or' instead of '||' (reported by @novikor) has been fixed in #21275 by @novikor in 2.3-develop branch
   Related commits:
     1. 23f415a
  • Loading branch information
magento-engcom-team authored Mar 4, 2019
2 parents 9ef2d45 + bccbc02 commit ef58edb
Show file tree
Hide file tree
Showing 14 changed files with 246 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

namespace Magento\Backend\Block\System\Design\Edit\Tab;

/**
* General system tab block.
*/
class General extends \Magento\Backend\Block\Widget\Form\Generic
{
/**
Expand Down Expand Up @@ -90,7 +93,7 @@ protected function _prepareForm()
]
);

$dateFormat = $this->_localeDate->getDateFormat(\IntlDateFormatter::SHORT);
$dateFormat = $this->_localeDate->getDateFormatWithLongYear();
$fieldset->addField(
'date_from',
'date',
Expand Down
2 changes: 1 addition & 1 deletion app/code/Magento/Catalog/Block/Product/View/Attributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function getAdditionalData(array $excludeAttr = [])

if (is_string($value) && strlen(trim($value))) {
$data[$attribute->getAttributeCode()] = [
'label' => __($attribute->getStoreLabel()),
'label' => $attribute->getStoreLabel(),
'value' => $value,
'code' => $attribute->getAttributeCode(),
];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,16 @@ protected function setUp()
->getMockForAbstractClass();
$this->collectionMock = $this->getMockBuilder(AbstractCollection::class)
->disableOriginalConstructor()
->setMethods(['load', 'getSelect', 'getTable', 'getIterator', 'isLoaded', 'toArray', 'getSize'])
->setMethods([
'load',
'getSelect',
'getTable',
'getIterator',
'isLoaded',
'toArray',
'getSize',
'setStoreId'
])
->getMockForAbstractClass();
$this->dbSelectMock = $this->getMockBuilder(DbSelect::class)
->disableOriginalConstructor()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
use Magento\Framework\App\ObjectManager;
use Magento\Store\Model\Store;
use Magento\Ui\DataProvider\Modifier\ModifierInterface;
use Magento\Ui\DataProvider\Modifier\PoolInterface;

Expand Down Expand Up @@ -67,6 +68,7 @@ public function __construct(
$this->addFieldStrategies = $addFieldStrategies;
$this->addFilterStrategies = $addFilterStrategies;
$this->modifiersPool = $modifiersPool ?: ObjectManager::getInstance()->get(PoolInterface::class);
$this->collection->setStoreId(Store::DEFAULT_STORE_ID);
}

/**
Expand Down Expand Up @@ -110,7 +112,7 @@ public function addField($field, $alias = null)
}

/**
* {@inheritdoc}
* @inheritdoc
*/
public function addFilter(\Magento\Framework\Api\Filter $filter)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ protected function _populateForUrlGeneration($rowData)
if ($this->isGlobalScope($product->getStoreId())) {
$this->populateGlobalProduct($product);
} else {
$this->storesCache[$product->getStoreId()] = true;
$this->addProductToImport($product, $product->getStoreId());
}
return $this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,13 @@ function (
}
},

/**
* Manage cancel button visibility
*/
canUseCancelBillingAddress: ko.computed(function () {
return quote.billingAddress() || lastSelectedBillingAddress;
}),

/**
* Restore billing address
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<button class="action action-update" type="button" data-bind="click: updateAddress">
<span data-bind="i18n: 'Update'"></span>
</button>
<button class="action action-cancel" type="button" data-bind="click: cancelAddressEdit">
<button class="action action-cancel" type="button" data-bind="click: cancelAddressEdit, visible: canUseCancelBillingAddress()">
<span data-bind="i18n: 'Cancel'"></span>
</button>
</div>
Expand Down
55 changes: 48 additions & 7 deletions app/code/Magento/MediaStorage/Service/ImageResize.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
use Magento\Framework\App\Filesystem\DirectoryList;

/**
* Image resize service.
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class ImageResize
Expand Down Expand Up @@ -123,7 +125,8 @@ public function __construct(
}

/**
* Create resized images of different sizes from an original image
* Create resized images of different sizes from an original image.
*
* @param string $originalImageName
* @throws NotFoundException
*/
Expand All @@ -141,7 +144,8 @@ public function resizeFromImageName(string $originalImageName)
}

/**
* Create resized images of different sizes from themes
* Create resized images of different sizes from themes.
*
* @param array|null $themes
* @return \Generator
* @throws NotFoundException
Expand Down Expand Up @@ -169,7 +173,8 @@ public function resizeFromThemes(array $themes = null): \Generator
}

/**
* Search the current theme
* Search the current theme.
*
* @return array
*/
private function getThemesInUse(): array
Expand All @@ -187,7 +192,8 @@ private function getThemesInUse(): array
}

/**
* Get view images data from themes
* Get view images data from themes.
*
* @param array $themes
* @return array
*/
Expand All @@ -211,7 +217,8 @@ private function getViewImages(array $themes): array
}

/**
* Get unique image index
* Get unique image index.
*
* @param array $imageData
* @return string
*/
Expand All @@ -223,7 +230,8 @@ private function getUniqueImageIndex(array $imageData): string
}

/**
* Make image
* Make image.
*
* @param string $originalImagePath
* @param array $imageParams
* @return Image
Expand All @@ -241,7 +249,8 @@ private function makeImage(string $originalImagePath, array $imageParams): Image
}

/**
* Resize image
* Resize image.
*
* @param array $viewImage
* @param string $originalImagePath
* @param string $originalImageName
Expand All @@ -257,9 +266,41 @@ private function resize(array $viewImage, string $originalImagePath, string $ori
]
);

if (isset($imageParams['watermark_file'])) {
if ($imageParams['watermark_height'] !== null) {
$image->setWatermarkHeight($imageParams['watermark_height']);
}

if ($imageParams['watermark_width'] !== null) {
$image->setWatermarkWidth($imageParams['watermark_width']);
}

if ($imageParams['watermark_position'] !== null) {
$image->setWatermarkPosition($imageParams['watermark_position']);
}

if ($imageParams['watermark_image_opacity'] !== null) {
$image->setWatermarkImageOpacity($imageParams['watermark_image_opacity']);
}

$image->watermark($this->getWatermarkFilePath($imageParams['watermark_file']));
}

if ($imageParams['image_width'] !== null && $imageParams['image_height'] !== null) {
$image->resize($imageParams['image_width'], $imageParams['image_height']);
}
$image->save($imageAsset->getPath());
}

/**
* Returns watermark file absolute path
*
* @param string $file
* @return string
*/
private function getWatermarkFilePath($file)
{
$path = $this->imageConfig->getMediaPath('/watermark/' . $file);
return $this->mediaDirectory->getAbsolutePath($path);
}
}
50 changes: 41 additions & 9 deletions app/code/Magento/Sales/Controller/Guest/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,40 +4,72 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Sales\Controller\Guest;

class Form extends \Magento\Framework\App\Action\Action
use Magento\Customer\Model\Session as CustomerSession;
use Magento\Framework\App\Action\Context;
use Magento\Framework\App\Action\HttpGetActionInterface;
use Magento\Framework\App\ObjectManager;
use Magento\Framework\Controller\Result\Redirect;
use Magento\Framework\View\Result\Page;
use Magento\Framework\View\Result\PageFactory;
use Magento\Sales\Helper\Guest as GuestHelper;

/**
* Class Form
*/
class Form extends \Magento\Framework\App\Action\Action implements HttpGetActionInterface
{
/**
* @var \Magento\Framework\View\Result\PageFactory
* @var PageFactory
*/
protected $resultPageFactory;

/**
* @param \Magento\Framework\App\Action\Context $context
* @param \Magento\Framework\View\Result\PageFactory $resultPageFactory
* @var CustomerSession|null
*/
private $customerSession;

/**
* @var GuestHelper|null
*/
private $guestHelper;

/**
* @param Context $context
* @param PageFactory $resultPageFactory
* @param CustomerSession|null $customerSession
* @param GuestHelper|null $guestHelper
*/
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
Context $context,
PageFactory $resultPageFactory,
CustomerSession $customerSession = null,
GuestHelper $guestHelper = null
) {
parent::__construct($context);
$this->resultPageFactory = $resultPageFactory;
$this->customerSession = $customerSession ?: ObjectManager::getInstance()->get(CustomerSession::class);
$this->guestHelper = $guestHelper ?: ObjectManager::getInstance()->get(GuestHelper::class);
}

/**
* Order view form page
*
* @return \Magento\Framework\Controller\Result\Redirect|\Magento\Framework\View\Result\Page
* @return Redirect|Page
*/
public function execute()
{
if ($this->_objectManager->get(\Magento\Customer\Model\Session::class)->isLoggedIn()) {
if ($this->customerSession->isLoggedIn()) {
return $this->resultRedirectFactory->create()->setPath('customer/account/');
}

$resultPage = $this->resultPageFactory->create();
$resultPage->getConfig()->getTitle()->set(__('Orders and Returns'));
$this->_objectManager->get(\Magento\Sales\Helper\Guest::class)->getBreadcrumbs($resultPage);
$this->guestHelper->getBreadcrumbs($resultPage);

return $resultPage;
}
}
14 changes: 14 additions & 0 deletions app/code/Magento/Tax/Plugin/Checkout/CustomerData/Cart.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

namespace Magento\Tax\Plugin\Checkout\CustomerData;

/**
* Process quote items price, considering tax configuration.
* @SuppressWarnings(PHPMD.CookieAndSessionMisuse)
*/
class Cart
{
/**
Expand Down Expand Up @@ -68,6 +72,16 @@ public function afterGetSectionData(\Magento\Checkout\CustomerData\Cart $subject
$this->itemPriceRenderer->setItem($item);
$this->itemPriceRenderer->setTemplate('checkout/cart/item/price/sidebar.phtml');
$result['items'][$key]['product_price']=$this->itemPriceRenderer->toHtml();
if ($this->itemPriceRenderer->displayPriceExclTax()) {
$result['items'][$key]['product_price_value'] = $item->getCalculationPrice();
} elseif ($this->itemPriceRenderer->displayPriceInclTax()) {
$result['items'][$key]['product_price_value'] = $item->getPriceInclTax();
} elseif ($this->itemPriceRenderer->displayBothPrices()) {
//unset product price value in case price already has been set as scalar value.
unset($result['items'][$key]['product_price_value']);
$result['items'][$key]['product_price_value']['incl_tax'] = $item->getPriceInclTax();
$result['items'][$key]['product_price_value']['excl_tax'] = $item->getCalculationPrice();
}
}
}
}
Expand Down
7 changes: 5 additions & 2 deletions app/code/Magento/Wishlist/Controller/Index/Allcart.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,17 @@
*/
namespace Magento\Wishlist\Controller\Index;

use Magento\Framework\App\Action\HttpPostActionInterface;
use Magento\Framework\Data\Form\FormKey\Validator;
use Magento\Framework\App\Action;
use Magento\Framework\App\Action\Context;
use Magento\Wishlist\Controller\WishlistProviderInterface;
use Magento\Wishlist\Model\ItemCarrier;
use Magento\Framework\Controller\ResultFactory;

class Allcart extends \Magento\Wishlist\Controller\AbstractIndex
/**
* Action Add All to Cart
*/
class Allcart extends \Magento\Wishlist\Controller\AbstractIndex implements HttpPostActionInterface
{
/**
* @var WishlistProviderInterface
Expand Down
Loading

0 comments on commit ef58edb

Please sign in to comment.