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:
 - #18814: Replace erroneous usage of unsData method (by @t-richards)
 - #19061: Fixed Product Tax total on PDF for 2.3, Reference of PL #18649 (by @maheshWebkul721)
 - #18816: Issue #18150 fixed: Reference Pull Request of #18815 for 2.3-develop  (by @maheshWebkul721)
 - #15961: 14294 - Fixes 'back' functionality after switching a store view. (by @Mobecls)


Fixed GitHub Issues:
 - #18617: Missing Fixed Product Tax total on PDF (reported by @Detzler) has been fixed in #19061 by @maheshWebkul721 in 2.3-develop branch
   Related commits:
     1. 73ff7cb

 - #18150: Backups error from User Roles Permission 2.2.6 (reported by @andy17612) has been fixed in #18816 by @maheshWebkul721 in 2.3-develop branch
   Related commits:
     1. 3d0d8b7

 - #14294: Since MagentoCE2.1.11, after swithing store view, ___store=xx is added to url. Breaks 'back' functionality. (reported by @bobemoe) has been fixed in #15961 by @Mobecls in 2.3-develop branch
   Related commits:
     1. 3feda05
  • Loading branch information
magento-engcom-team authored Nov 12, 2018
2 parents 072ef37 + aaefd08 commit 57d7010
Show file tree
Hide file tree
Showing 10 changed files with 111 additions and 12 deletions.
7 changes: 5 additions & 2 deletions app/code/Magento/Backup/Controller/Adminhtml/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,24 @@
*/
namespace Magento\Backup\Controller\Adminhtml;

use Magento\Backend\App\Action;
use Magento\Framework\App\Action\HttpGetActionInterface;

/**
* Backup admin controller
*
* @author Magento Core Team <core@magentocommerce.com>
* @api
* @since 100.0.2
*/
abstract class Index extends \Magento\Backend\App\Action
abstract class Index extends Action implements HttpGetActionInterface
{
/**
* Authorization level of a basic admin session
*
* @see _isAllowed()
*/
const ADMIN_RESOURCE = 'Magento_Backend::backup';
const ADMIN_RESOURCE = 'Magento_Backup::backup';

/**
* Core registry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ public function getAssociatedProducts($product)
*/
public function flushAssociatedProductsCache($product)
{
return $product->unsData($this->_keyAssociatedProducts);
return $product->unsetData($this->_keyAssociatedProducts);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -611,9 +611,9 @@ public function testPrepareForCartAdvancedZeroQty()

public function testFlushAssociatedProductsCache()
{
$productMock = $this->createPartialMock(\Magento\Catalog\Model\Product::class, ['unsData']);
$productMock = $this->createPartialMock(\Magento\Catalog\Model\Product::class, ['unsetData']);
$productMock->expects($this->once())
->method('unsData')
->method('unsetData')
->with('_cache_instance_associated_products')
->willReturnSelf();
$this->assertEquals($productMock, $this->_model->flushAssociatedProductsCache($productMock));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public function beforeSave()
/**
* Retrieve visitor id
*
* if don't exists return current visitor id
* If don't exists return current visitor id
*
* @return int
*/
Expand All @@ -128,7 +128,7 @@ public function getVisitorId()
/**
* Retrieve customer id
*
* if customer don't logged in return null
* If customer don't logged in return null
*
* @return int
*/
Expand All @@ -143,7 +143,7 @@ public function getCustomerId()
/**
* Retrieve store id
*
* default return current store id
* Default return current store id
*
* @return int
*/
Expand Down Expand Up @@ -246,13 +246,14 @@ public function clean()

/**
* Add product ids to current visitor/customer log
*
* @param string[] $productIds
* @return $this
*/
public function registerIds($productIds)
{
$this->_getResource()->registerIds($this, $productIds);
$this->_getSession()->unsData($this->_countCacheKey);
$this->_getSession()->unsetData($this->_countCacheKey);
return $this;
}
}
72 changes: 72 additions & 0 deletions app/code/Magento/Store/ViewModel/SwitcherUrlProvider.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

declare(strict_types=1);

namespace Magento\Store\ViewModel;

use Magento\Framework\App\ActionInterface;
use Magento\Framework\Url\EncoderInterface;
use Magento\Framework\UrlInterface;
use Magento\Store\Model\Store;
use Magento\Store\Model\StoreManagerInterface;

/**
* Provides target store redirect url.
*/
class SwitcherUrlProvider implements \Magento\Framework\View\Element\Block\ArgumentInterface
{
/**
* @var EncoderInterface
*/
private $encoder;

/**
* @var StoreManagerInterface
*/
private $storeManager;

/**
* @var UrlInterface
*/
private $urlBuilder;

/**
* @param EncoderInterface $encoder
* @param StoreManagerInterface $storeManager
* @param UrlInterface $urlBuilder
*/
public function __construct(
EncoderInterface $encoder,
StoreManagerInterface $storeManager,
UrlInterface $urlBuilder
) {
$this->encoder = $encoder;
$this->storeManager = $storeManager;
$this->urlBuilder = $urlBuilder;
}

/**
* Returns target store redirect url.
*
* @param Store $store
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
public function getTargetStoreRedirectUrl(Store $store): string
{
return $this->urlBuilder->getUrl(
'stores/store/redirect',
[
'___store' => $store->getCode(),
'___from_store' => $this->storeManager->getStore()->getCode(),
ActionInterface::PARAM_NAME_URL_ENCODED => $this->encoder->encode(
$store->getCurrentUrl(false)
),
]
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<?php foreach ($block->getStores() as $_lang): ?>
<?php if ($_lang->getId() != $block->getCurrentStoreId()): ?>
<li class="view-<?= $block->escapeHtml($_lang->getCode()) ?> switcher-option">
<a href="#" data-post='<?= /* @noEscape */ $block->getTargetStorePostData($_lang) ?>'>
<a href="<?= $block->escapeUrl($block->getViewModel()->getTargetStoreRedirectUrl($_lang)) ?>">
<?= $block->escapeHtml($_lang->getName()) ?>
</a>
</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,9 @@
<severity value="CRITICAL"/>
<testCaseId value="MC-297"/>
<group value="Tax"/>
<skip>
<issueId value="MAGETWO-96266"/>
</skip>
</annotations>
<before>
<actionGroup ref="LoginAsAdmin" stepKey="loginAsAdmin"/>
Expand Down
7 changes: 6 additions & 1 deletion app/code/Magento/Theme/view/frontend/layout/default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
<argument name="label" translate="true" xsi:type="string">Skip to Content</argument>
</arguments>
</block>
<block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="Magento_Store::switch/languages.phtml"/>
<block class="Magento\Store\Block\Switcher" name="store_language" as="store_language" template="Magento_Store::switch/languages.phtml">
<arguments>
<argument name="view_model" xsi:type="object">Magento\Store\ViewModel\SwitcherUrlProvider</argument>
</arguments>
</block>
<block class="Magento\Customer\Block\Account\Navigation" name="top.links">
<arguments>
<argument name="css_class" xsi:type="string">header links</argument>
Expand Down Expand Up @@ -82,6 +86,7 @@
<block class="Magento\Store\Block\Switcher" name="store.settings.language" template="Magento_Store::switch/languages.phtml">
<arguments>
<argument name="id_modifier" xsi:type="string">nav</argument>
<argument name="view_model" xsi:type="object">Magento\Store\ViewModel\SwitcherUrlProvider</argument>
</arguments>
</block>
<block class="Magento\Directory\Block\Currency" name="store.settings.currency" template="Magento_Directory::currency.phtml">
Expand Down
15 changes: 15 additions & 0 deletions app/code/Magento/Weee/Model/Sales/Pdf/Weee.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ public function __construct(
/**
* Check if weee total amount should be included
*
* Example:
* array(
* $index => array(
* 'amount' => $amount,
* 'label' => $label,
* 'font_size'=> $font_size
* )
* )
*
* @return array
*/
public function getTotalsForDisplay()
Expand Down Expand Up @@ -70,4 +72,17 @@ public function getTotalsForDisplay()

return $totals;
}

/**
* Check if we can display Weee total information in PDF
*
* @return bool
*/
public function canDisplay()
{
$items = $this->getSource()->getAllItems();
$store = $this->getSource()->getStore();
$amount = $this->_weeeData->getTotalAmounts($items, $store);
return $this->getDisplayZero() === 'true' || $amount != 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function setUp()
protected function tearDown()
{
$this->customerSession->setCustomerId(null);
$this->coreSession->unsData('_form_key');
$this->coreSession->unsetData('_form_key');
}

/**
Expand Down

0 comments on commit 57d7010

Please sign in to comment.