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:
 - #17642: Change error message about low stock (by @vkublytskyi)
 - #17620: [Forwardport] Fix type error in Cart/Totals. (by @nmalevanec)
 - #17598: [Forwardport] Introduce Block Config Source (by @thomas-blackbird)
 - #17607: [Forwardport] 6305 - Resolved product custom option title save issue (by @jignesh-baldha)
 - #17232: Improve code quality subscriber new action (by @arnoudhgz)
 - #17574: [Forwardport] Solution for User role issue with customer group (by @jignesh-baldha)
 - magento/graphql-ce#138: Corrected field descriptions (by @keharper)


Fixed GitHub Issues:
 - #12819: CartTotalRepository cannot handle extension attributes in quote addresses in 2.2.2 (reported by @marius-bica) has been fixed in #17620 by @nmalevanec in 2.3-develop branch
   Related commits:
     1. 370dc84

 - #12993: Type error in Cart/Totals (reported by @andrewhowdencom) has been fixed in #17620 by @nmalevanec in 2.3-develop branch
   Related commits:
     1. 370dc84

 - #6305: Can't save Customizable options (reported by @bachlee89) has been fixed in #17607 by @jignesh-baldha in 2.3-develop branch
   Related commits:
     1. d60b3cf
     2. 71ce3fa
     3. 170d029
     4. 6aebfe8

 - #16499: User role issue with customer group (reported by @emiprotech) has been fixed in #17574 by @jignesh-baldha in 2.3-develop branch
   Related commits:
     1. 0d7dc6c
  • Loading branch information
magento-engcom-team authored Aug 19, 2018
2 parents 7fac89a + e1eebe4 commit 6d3dab2
Show file tree
Hide file tree
Showing 19 changed files with 216 additions and 71 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ protected function isValidOptionTitle($title, $storeId)
if ($storeId > \Magento\Store\Model\Store::DEFAULT_STORE_ID && $title === null) {
return true;
}
if ($this->isEmpty($title)) {

// checking whether title is null and is empty string
if ($title === null || $title === '') {
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ protected function _saveValueTitles(AbstractModel $object)
$object->unsetData('title');
}

if ($object->getTitle()) {
/*** Checking whether title is not null ***/
if ($object->getTitle()!= null) {
if ($existInCurrentStore) {
if ($storeId == $object->getStoreId()) {
$where = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ public function checkQuoteItemQty(StockItemInterface $stockItem, $qty, $summaryQ
}

if (!$this->checkQty($stockItem, $summaryQty) || !$this->checkQty($stockItem, $qty)) {
$message = __('We don\'t have as many "%1" as you requested.', $stockItem->getProductName());
$message = __('The requested qty is not available');
$result->setHasError(true)->setMessage($message)->setQuoteMessage($message)->setQuoteMessageIndex('qty');
return $result;
} else {
Expand Down Expand Up @@ -212,7 +212,7 @@ public function checkQuoteItemQty(StockItemInterface $stockItem, $qty, $summaryQ
}
} elseif ($stockItem->getShowDefaultNotificationMessage()) {
$result->setMessage(
__('We don\'t have as many "%1" as you requested.', $stockItem->getProductName())
__('The requested qty is not available')
);
}
}
Expand Down
48 changes: 48 additions & 0 deletions app/code/Magento/Cms/Model/Config/Source/Block.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Cms\Model\Config\Source;

use Magento\Cms\Model\ResourceModel\Block\CollectionFactory;
use Magento\Framework\Data\OptionSourceInterface;

/**
* Class Block
*/
class Block implements OptionSourceInterface
{
/**
* @var array
*/
private $options;

/**
* @var \Magento\Cms\Model\ResourceModel\Block\CollectionFactory
*/
private $collectionFactory;

/**
* @param \Magento\Cms\Model\ResourceModel\Block\CollectionFactory $collectionFactory
*/
public function __construct(
CollectionFactory $collectionFactory
) {
$this->collectionFactory = $collectionFactory;
}

/**
* {@inheritdoc}
*/
public function toOptionArray()
{
if (!$this->options) {
$this->options = $this->collectionFactory->create()->toOptionIdArray();
}

return $this->options;
}
}
28 changes: 28 additions & 0 deletions app/code/Magento/Cms/Model/ResourceModel/AbstractCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -176,4 +176,32 @@ public function getSelectCountSql()

return $countSelect;
}

/**
* Returns pairs identifier - title for unique identifiers
* and pairs identifier|entity_id - title for non-unique after first
*
* @return array
*/
public function toOptionIdArray()
{
$res = [];
$existingIdentifiers = [];
foreach ($this as $item) {
$identifier = $item->getData('identifier');

$data['value'] = $identifier;
$data['label'] = $item->getData('title');

if (in_array($identifier, $existingIdentifiers)) {
$data['value'] .= '|' . $item->getData($this->getIdFieldName());
} else {
$existingIdentifiers[] = $identifier;
}

$res[] = $data;
}

return $res;
}
}
28 changes: 0 additions & 28 deletions app/code/Magento/Cms/Model/ResourceModel/Page/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,34 +51,6 @@ protected function _construct()
$this->_map['fields']['store'] = 'store_table.store_id';
}

/**
* Returns pairs identifier - title for unique identifiers
* and pairs identifier|page_id - title for non-unique after first
*
* @return array
*/
public function toOptionIdArray()
{
$res = [];
$existingIdentifiers = [];
foreach ($this as $item) {
$identifier = $item->getData('identifier');

$data['value'] = $identifier;
$data['label'] = $item->getData('title');

if (in_array($identifier, $existingIdentifiers)) {
$data['value'] .= '|' . $item->getData('page_id');
} else {
$existingIdentifiers[] = $identifier;
}

$res[] = $data;
}

return $res;
}

/**
* Set first store flag
*
Expand Down
66 changes: 66 additions & 0 deletions app/code/Magento/Cms/Test/Unit/Model/Config/Source/BlockTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
declare(strict_types=1);

namespace Magento\Cms\Test\Unit\Model\Config\Source;

/**
* Class BlockTest
*/
class BlockTest extends \PHPUnit\Framework\TestCase
{
/**
* @var \Magento\Cms\Model\ResourceModel\Block\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
*/
protected $collectionFactory;

/**
* @var \Magento\Cms\Model\Config\Source\Block
*/
protected $block;

/**
* Set up
*
* @return void
*/
protected function setUp()
{
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);

$this->collectionFactory = $this->createPartialMock(
\Magento\Cms\Model\ResourceModel\Block\CollectionFactory::class,
['create']
);

$this->block = $objectManager->getObject(
\Magento\Cms\Model\Config\Source\Block::class,
[
'collectionFactory' => $this->collectionFactory,
]
);
}

/**
* Run test toOptionArray method
*
* @return void
*/
public function testToOptionArray()
{
$blockCollectionMock = $this->createMock(\Magento\Cms\Model\ResourceModel\Block\Collection::class);

$this->collectionFactory->expects($this->once())
->method('create')
->will($this->returnValue($blockCollectionMock));

$blockCollectionMock->expects($this->once())
->method('toOptionIdArray')
->will($this->returnValue('return-value'));

$this->assertEquals('return-value', $this->block->toOptionArray());
}
}
6 changes: 2 additions & 4 deletions app/code/Magento/Customer/etc/acl.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,15 @@
<resource id="Magento_Customer::customer" title="Customers" translate="title" sortOrder="40">
<resource id="Magento_Customer::manage" title="All Customers" translate="title" sortOrder="10" />
<resource id="Magento_Customer::online" title="Now Online" translate="title" sortOrder="20" />
<resource id="Magento_Customer::group" title="Customer Groups" translate="title" sortOrder="30" />
</resource>
<resource id="Magento_Backend::stores">
<resource id="Magento_Backend::stores_settings">
<resource id="Magento_Config::config">
<resource id="Magento_Customer::config_customer" title="Customers Section" translate="title" sortOrder="50" />
</resource>
</resource>
<resource id="Magento_Backend::stores_other_settings">
<resource id="Magento_Customer::group" title="Customer Groups" translate="title" sortOrder="10" />
</resource>
</resource>
</resource>
</resource>
</resources>
</acl>
Expand Down
6 changes: 3 additions & 3 deletions app/code/Magento/CustomerGraphQl/etc/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ type Customer @doc(description: "Customer defines the customer name and address
dob: String @doc(description: "The customer's date of birth")
taxvat: String @doc(description: "The customer's Tax/VAT number (for corporate customers)")
id: Int @doc(description: "The ID assigned to the customer")
is_subscribed: Boolean @doc(description: "An array containing the customer's shipping and billing addresses")
addresses: [CustomerAddress] @doc(description: "Indicates whether the customer is subscribed to the company's newsletter")
}
is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter")
addresses: [CustomerAddress] @doc(description: "An array containing the customer's shipping and billing addresses")
}

type CustomerAddress @doc(description: "CustomerAddress contains detailed information about a customer's billing and shipping addresses"){
id: Int @doc(description: "The ID assigned to the address object")
Expand Down
Loading

0 comments on commit 6d3dab2

Please sign in to comment.