Skip to content

Commit

Permalink
Merge branch '2.4-develop' into front_order_list
Browse files Browse the repository at this point in the history
  • Loading branch information
engcom-Kilo authored Jun 9, 2020
2 parents 4c3aaf6 + bb176b8 commit b696ab2
Show file tree
Hide file tree
Showing 125 changed files with 3,531 additions and 1,390 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public function getItems()
$this->_compareProduct->setAllowUsedFlat(false);

$this->_items = $this->_itemCollectionFactory->create();
$this->_items->useProductItem(true)->setStoreId($this->_storeManager->getStore()->getId());
$this->_items->useProductItem()->setStoreId($this->_storeManager->getStore()->getId());

if ($this->httpContext->getValue(Context::CONTEXT_AUTH)) {
$this->_items->setCustomerId($this->currentCustomer->getCustomerId());
Expand Down
4 changes: 2 additions & 2 deletions app/code/Magento/Catalog/Helper/Product/Compare.php
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ public function getItemCollection()
// cannot be placed in constructor because of the cyclic dependency which cannot be fixed with proxy class
// collection uses this helper in constructor when calling isEnabledFlat() method
$this->_itemCollection = $this->_itemCollectionFactory->create();
$this->_itemCollection->useProductItem(true)->setStoreId($this->_storeManager->getStore()->getId());
$this->_itemCollection->useProductItem()->setStoreId($this->_storeManager->getStore()->getId());

if ($this->_customerSession->isLoggedIn()) {
$this->_itemCollection->setCustomerId($this->_customerSession->getCustomerId());
Expand Down Expand Up @@ -313,7 +313,7 @@ public function calculate($logout = false)
{
/** @var $collection Collection */
$collection = $this->_itemCollectionFactory->create()
->useProductItem(true);
->useProductItem();
if (!$logout && $this->_customerSession->isLoggedIn()) {
$collection->setCustomerId($this->_customerSession->getCustomerId());
} elseif ($this->_customerId) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminProductFormCategoryExistInCategoryListActionGroup">
<annotations>
<description>Check Category exist in Category list for Assign to Product.</description>
</annotations>
<arguments>
<argument name="categoryName" type="string"/>
</arguments>

<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="{{categoryName}}"
stepKey="fillSearchCategory"/>
<see selector="{{AdminProductFormSection.selectCategory(categoryName)}}" userInput="{{categoryName}}"
stepKey="seeCategory"/>
<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategorySelect"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminProductFormCategoryNotExistInCategoryListActionGroup">
<annotations>
<description>Check Category not exist in Category list for Assign to Product.</description>
</annotations>
<arguments>
<argument name="categoryName" type="string"/>
</arguments>

<click selector="{{AdminProductFormSection.categoriesDropdown}}" stepKey="clickCategoriesDropDown"/>
<fillField selector="{{AdminProductFormSection.searchCategory}}" userInput="{{categoryName}}"
stepKey="fillSearchCategory"/>
<dontSee selector="{{AdminProductFormSection.selectCategory(categoryName)}}" userInput="{{categoryName}}"
stepKey="seeCategory"/>
<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneAdvancedCategorySelect"/>
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<actionGroups xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/actionGroupSchema.xsd">
<actionGroup name="AdminSubmitCategoriesPopupActionGroup">
<annotations>
<description>Clicks the "Done" button on the Search Categories popup.</description>
</annotations>

<click selector="{{AdminProductFormSection.done}}" stepKey="clickOnDoneButton" />
</actionGroup>
</actionGroups>
Original file line number Diff line number Diff line change
Expand Up @@ -572,11 +572,11 @@ public function prepareProductIndex($indexData, $productData, $storeId)
foreach ($indexData as $entityId => $attributeData) {
foreach ($attributeData as $attributeId => $attributeValues) {
$value = $this->getAttributeValue($attributeId, $attributeValues, $storeId);
if (!empty($value)) {
if ($value !== null && $value !== false && $value != '') {
if (!isset($index[$attributeId])) {
$index[$attributeId] = [];
}
$index[$attributeId][$entityId] = $value;
$index[$attributeId][$entityId] = $value;
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<stories value="Use Advanced Search"/>
<title value="Unable negative price use to advanced search"/>
<description value="Check unable negative price use to advanced search by price from and price to"/>
<severity value="MAJOR"/>
</annotations>
<actionGroup ref="StorefrontOpenHomePageActionGroup" stepKey="goToStorefront"/>
<actionGroup ref="StorefrontOpenAdvancedSearchActionGroup" stepKey="openAdvancedSearch"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<stories value="Delete a CMS Page via the Admin"/>
<title value="Admin should be able to delete CMS Pages"/>
<description value="Admin should be able to delete CMS Pages"/>
<severity value="CRITICAL"/>
<group value="Cms"/>
<group value="WYSIWYGDisabled"/>
</annotations>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@
{{trans "We have received a request to change the following information associated with your account at %store_name: email." store_name=$store.frontend_name}}
{{trans 'If you have not authorized this action, please contact us immediately at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
</p>
<br>

<p>{{trans "Thanks,<br>%store_name" store_name=$store.frontend_name |raw}}</p>

{{template config_path="design/email/footer_template"}}
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,5 @@
{{trans "We have received a request to change the following information associated with your account at %store_name: email, password." store_name=$store.frontend_name}}
{{trans 'If you have not authorized this action, please contact us immediately at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
</p>
<br>

<p>{{trans "Thanks,<br>%store_name" store_name=$store.frontend_name |raw}}</p>

{{template config_path="design/email/footer_template"}}
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,5 @@
{{trans "We have received a request to change the following information associated with your account at %store_name: password." store_name=$store.frontend_name}}
{{trans 'If you have not authorized this action, please contact us immediately at <a href="mailto:%store_email">%store_email</a>' store_email=$store_email |raw}}{{depend store_phone}} {{trans 'or call us at <a href="tel:%store_phone">%store_phone</a>' store_phone=$store_phone |raw}}{{/depend}}.
</p>
<br>

<p>{{trans "Thanks,<br>%store_name" store_name=$store.frontend_name |raw}}</p>

{{template config_path="design/email/footer_template"}}
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private function convertAttribute(Attribute $attribute, array $attributeValues,
$productAttributes = [];

$retrievedValue = $this->retrieveFieldValue($attributeValues);
if ($retrievedValue) {
if ($retrievedValue !== null) {
$productAttributes[$attribute->getAttributeCode()] = $retrievedValue;

if ($attribute->getIsSearchable()) {
Expand Down Expand Up @@ -354,7 +354,7 @@ private function getAttributeOptions(Attribute $attribute, int $storeId): array
*/
private function retrieveFieldValue(array $values)
{
$values = \array_filter(\array_unique($values));
$values = \array_unique($values);

return count($values) === 1 ? \array_shift($values) : \array_values($values);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function buildFilter(RequestFilterInterface $filter)
$fieldName .= '.' . $suffix;
}

if ($filter->getValue()) {
if ($filter->getValue() !== false) {
$operator = is_array($filter->getValue()) ? 'terms' : 'term';
$filterQuery []= [
$operator => [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\GiftMessageGraphQl\Model\Resolver\Cart;

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
use Magento\Framework\GraphQl\Query\Resolver\Value;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\GiftMessage\Api\CartRepositoryInterface;
use Magento\GiftMessage\Helper\Message as GiftMessageHelper;

/**
* Class provides ability to get GiftMessage for cart
*/
class GiftMessage implements ResolverInterface
{
/**
* @var CartRepositoryInterface
*/
private $cartRepository;

/**
* @var GiftMessageHelper
*/
private $giftMessageHelper;

/**
* @param CartRepositoryInterface $cartRepository
* @param GiftMessageHelper $giftMessageHelper
*/
public function __construct(
CartRepositoryInterface $cartRepository,
GiftMessageHelper $giftMessageHelper
) {
$this->cartRepository = $cartRepository;
$this->giftMessageHelper = $giftMessageHelper;
}

/**
* Return information about Gift message of cart
*
* @param Field $field
* @param ContextInterface $context
* @param ResolveInfo $info
* @param array|null $value
* @param array|null $args
*
* @return array|Value|mixed
*
* @throws GraphQlInputException
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function resolve(
Field $field,
$context,
ResolveInfo $info,
array $value = null,
array $args = null
) {
if (!isset($value['model'])) {
throw new GraphQlInputException(__('"model" value should be specified'));
}

$cart = $value['model'];

if (!$this->giftMessageHelper->isMessagesAllowed('order', $cart)) {
return null;
}

try {
$giftCartMessage = $this->cartRepository->get($cart->getId());
} catch (LocalizedException $e) {
throw new GraphQlInputException(__('Can\'t load cart.'));
}

if (!isset($giftCartMessage)) {
return null;
}

return [
'to' => $giftCartMessage->getRecipient() ?? '',
'from' => $giftCartMessage->getSender() ?? '',
'message'=> $giftCartMessage->getMessage() ?? ''
];
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\GiftMessageGraphQl\Model\Resolver\Order;

use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Query\Resolver\ContextInterface;
use Magento\Framework\GraphQl\Query\Resolver\Value;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
use Magento\GiftMessage\Api\OrderRepositoryInterface;

/**
* Class for getting GiftMessage from CustomerOrder
*/
class GiftMessage implements ResolverInterface
{
/**
* @var OrderRepositoryInterface
*/
private $orderRepository;

/**
* @param OrderRepositoryInterface $orderRepository
*/
public function __construct(
OrderRepositoryInterface $orderRepository
) {
$this->orderRepository = $orderRepository;
}

/**
* Return information about gift message for order
*
* @param Field $field
* @param ContextInterface $context
* @param ResolveInfo $info
* @param array|null $value
* @param array|null $args
*
* @return array|Value|mixed
* @throws GraphQlInputException
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function resolve(
Field $field,
$context,
ResolveInfo $info,
array $value = null,
array $args = null
) {
if (!isset($value['id'])) {
throw new GraphQlInputException(__('"id" value should be specified'));
}

try {
$orderGiftMessage = $this->orderRepository->get($value['id']);
} catch (LocalizedException $e) {
throw new GraphQlInputException(__('Can\'t load gift message for order'));
}

if (!isset($orderGiftMessage)) {
return null;
}

return [
'to' => $orderGiftMessage->getRecipient() ?? '',
'from' => $orderGiftMessage->getSender() ?? '',
'message'=> $orderGiftMessage->getMessage() ?? ''
];
}
}
3 changes: 3 additions & 0 deletions app/code/Magento/GiftMessageGraphQl/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# GiftMessageGraphQl

**GiftMessageGraphQl** provides information about gift messages for cart, cart items, order and order items.
25 changes: 25 additions & 0 deletions app/code/Magento/GiftMessageGraphQl/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "magento/module-gift-message-graph-ql",
"description": "N/A",
"type": "magento2-module",
"require": {
"php": "~7.3.0||~7.4.0",
"magento/framework": "*",
"magento/module-gift-message": "*"
},
"suggest": {
"magento/module-graph-ql": "*"
},
"license": [
"OSL-3.0",
"AFL-3.0"
],
"autoload": {
"files": [
"registration.php"
],
"psr-4": {
"Magento\\GiftMessageGraphQl\\": ""
}
}
}
Loading

0 comments on commit b696ab2

Please sign in to comment.