Skip to content
This repository has been archived by the owner on Dec 19, 2019. It is now read-only.

Commit

Permalink
Merge pull request #3 from magento/2.3-develop
Browse files Browse the repository at this point in the history
merge latest changes
  • Loading branch information
khodu authored Nov 14, 2018
2 parents 3ba9281 + 877bffd commit dd965b9
Show file tree
Hide file tree
Showing 22 changed files with 297 additions and 113 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 @@ -7,17 +7,17 @@

namespace Magento\CatalogGraphQl\Model\Resolver\Product;

use Magento\Catalog\Model\Product;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\Catalog\Model\Product;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Catalog\Helper\Output as OutputHelper;

/**
* Resolve rendered content for attributes where HTML content is allowed
*/
class ProductHtmlAttribute implements ResolverInterface
class ProductComplexTextAttribute implements ResolverInterface
{
/**
* @var OutputHelper
Expand All @@ -42,7 +42,7 @@ public function resolve(
ResolveInfo $info,
array $value = null,
array $args = null
) {
): array {
if (!isset($value['model'])) {
throw new GraphQlInputException(__('"model" value should be specified'));
}
Expand All @@ -51,6 +51,7 @@ public function resolve(
$product = $value['model'];
$fieldName = $field->getName();
$renderedValue = $this->outputHelper->productAttribute($product, $product->getData($fieldName), $fieldName);
return $renderedValue;

return ['html' => $renderedValue ?? ''];
}
}
4 changes: 2 additions & 2 deletions app/code/Magento/CatalogGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,8 @@ interface ProductInterface @typeResolver(class: "Magento\\CatalogGraphQl\\Model\
id: Int @doc(description: "The ID number assigned to the product") @resolver(class: "Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\EntityIdToId")
name: String @doc(description: "The product name. Customers use this name to identify the product.")
sku: String @doc(description: "A number or code assigned to a product to identify the product, options, price, and manufacturer")
description: String @doc(description: "Detailed information about the product. The value can include simple HTML tags.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductHtmlAttribute")
short_description: String @doc(description: "A short description of the product. Its use depends on the theme.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductHtmlAttribute")
description: ComplexTextValue @doc(description: "Detailed information about the product. The value can include simple HTML tags.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute")
short_description: ComplexTextValue @doc(description: "A short description of the product. Its use depends on the theme.") @resolver(class: "\\Magento\\CatalogGraphQl\\Model\\Resolver\\Product\\ProductComplexTextAttribute")
special_price: Float @doc(description: "The discounted price of the product")
special_from_date: String @doc(description: "The beginning date that a product has a special price")
special_to_date: String @doc(description: "The end date that a product has a special price")
Expand Down
4 changes: 4 additions & 0 deletions app/code/Magento/GraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,7 @@ enum SortEnum @doc(description: "This enumeration indicates whether to return re
ASC
DESC
}

type ComplexTextValue {
html: String! @doc(description: "HTML format")
}
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 @@ -27,6 +27,7 @@
<click selector="{{AdminProductGridSection.changeStatus('status')}}" stepKey="clickChangeStatusDisabled"/>
<waitForPageLoad stepKey="waitForDisable"/>
<see selector="{{AdminMessagesSection.success}}" userInput="A total of 1 record(s) have been updated." stepKey="seeSuccessMessage"/>
<waitForLoadingMaskToDisappear stepKey="waitForMaskToDisappear"/>
<conditionalClick selector="{{AdminProductGridFilterSection.clearFilters}}" dependentSelector="{{AdminProductGridFilterSection.clearFilters}}" visible="true" stepKey="clickClearFiltersInitial2"/>
</actionGroup>
</actionGroups>
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;
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
"require-dev": {
"friendsofphp/php-cs-fixer": "~2.13.0",
"lusitanian/oauth": "~0.8.10",
"magento/magento2-functional-testing-framework": "2.3.9",
"magento/magento2-functional-testing-framework": "2.3.11",
"pdepend/pdepend": "2.5.2",
"phpmd/phpmd": "@stable",
"phpunit/phpunit": "~6.5.0",
Expand Down
12 changes: 6 additions & 6 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ public function testCategoryProducts()
attribute_set_id
country_of_manufacture
created_at
description
description {
html
}
gift_message_available
id
categories {
Expand Down Expand Up @@ -222,7 +224,9 @@ public function testCategoryProducts()
position
sku
}
short_description
short_description {
html
}
sku
small_image { url, label }
thumbnail { url, label }
Expand Down
Loading

0 comments on commit dd965b9

Please sign in to comment.