Skip to content

Commit 6d3dab2

Browse files
🔃 [EngCom] Public Pull Requests - 2.3-develop
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
2 parents 7fac89a + e1eebe4 commit 6d3dab2

File tree

19 files changed

+216
-71
lines changed

19 files changed

+216
-71
lines changed

app/code/Magento/Catalog/Model/Product/Option/Validator/DefaultValidator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,9 @@ protected function isValidOptionTitle($title, $storeId)
106106
if ($storeId > \Magento\Store\Model\Store::DEFAULT_STORE_ID && $title === null) {
107107
return true;
108108
}
109-
if ($this->isEmpty($title)) {
109+
110+
// checking whether title is null and is empty string
111+
if ($title === null || $title === '') {
110112
return false;
111113
}
112114

app/code/Magento/Catalog/Model/ResourceModel/Product/Option/Value.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,8 @@ protected function _saveValueTitles(AbstractModel $object)
256256
$object->unsetData('title');
257257
}
258258

259-
if ($object->getTitle()) {
259+
/*** Checking whether title is not null ***/
260+
if ($object->getTitle()!= null) {
260261
if ($existInCurrentStore) {
261262
if ($storeId == $object->getStoreId()) {
262263
$where = [

app/code/Magento/CatalogInventory/Model/StockStateProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function checkQuoteItemQty(StockItemInterface $stockItem, $qty, $summaryQ
160160
}
161161

162162
if (!$this->checkQty($stockItem, $summaryQty) || !$this->checkQty($stockItem, $qty)) {
163-
$message = __('We don\'t have as many "%1" as you requested.', $stockItem->getProductName());
163+
$message = __('The requested qty is not available');
164164
$result->setHasError(true)->setMessage($message)->setQuoteMessage($message)->setQuoteMessageIndex('qty');
165165
return $result;
166166
} else {
@@ -212,7 +212,7 @@ public function checkQuoteItemQty(StockItemInterface $stockItem, $qty, $summaryQ
212212
}
213213
} elseif ($stockItem->getShowDefaultNotificationMessage()) {
214214
$result->setMessage(
215-
__('We don\'t have as many "%1" as you requested.', $stockItem->getProductName())
215+
__('The requested qty is not available')
216216
);
217217
}
218218
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Cms\Model\Config\Source;
9+
10+
use Magento\Cms\Model\ResourceModel\Block\CollectionFactory;
11+
use Magento\Framework\Data\OptionSourceInterface;
12+
13+
/**
14+
* Class Block
15+
*/
16+
class Block implements OptionSourceInterface
17+
{
18+
/**
19+
* @var array
20+
*/
21+
private $options;
22+
23+
/**
24+
* @var \Magento\Cms\Model\ResourceModel\Block\CollectionFactory
25+
*/
26+
private $collectionFactory;
27+
28+
/**
29+
* @param \Magento\Cms\Model\ResourceModel\Block\CollectionFactory $collectionFactory
30+
*/
31+
public function __construct(
32+
CollectionFactory $collectionFactory
33+
) {
34+
$this->collectionFactory = $collectionFactory;
35+
}
36+
37+
/**
38+
* {@inheritdoc}
39+
*/
40+
public function toOptionArray()
41+
{
42+
if (!$this->options) {
43+
$this->options = $this->collectionFactory->create()->toOptionIdArray();
44+
}
45+
46+
return $this->options;
47+
}
48+
}

app/code/Magento/Cms/Model/ResourceModel/AbstractCollection.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,4 +176,32 @@ public function getSelectCountSql()
176176

177177
return $countSelect;
178178
}
179+
180+
/**
181+
* Returns pairs identifier - title for unique identifiers
182+
* and pairs identifier|entity_id - title for non-unique after first
183+
*
184+
* @return array
185+
*/
186+
public function toOptionIdArray()
187+
{
188+
$res = [];
189+
$existingIdentifiers = [];
190+
foreach ($this as $item) {
191+
$identifier = $item->getData('identifier');
192+
193+
$data['value'] = $identifier;
194+
$data['label'] = $item->getData('title');
195+
196+
if (in_array($identifier, $existingIdentifiers)) {
197+
$data['value'] .= '|' . $item->getData($this->getIdFieldName());
198+
} else {
199+
$existingIdentifiers[] = $identifier;
200+
}
201+
202+
$res[] = $data;
203+
}
204+
205+
return $res;
206+
}
179207
}

app/code/Magento/Cms/Model/ResourceModel/Page/Collection.php

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -51,34 +51,6 @@ protected function _construct()
5151
$this->_map['fields']['store'] = 'store_table.store_id';
5252
}
5353

54-
/**
55-
* Returns pairs identifier - title for unique identifiers
56-
* and pairs identifier|page_id - title for non-unique after first
57-
*
58-
* @return array
59-
*/
60-
public function toOptionIdArray()
61-
{
62-
$res = [];
63-
$existingIdentifiers = [];
64-
foreach ($this as $item) {
65-
$identifier = $item->getData('identifier');
66-
67-
$data['value'] = $identifier;
68-
$data['label'] = $item->getData('title');
69-
70-
if (in_array($identifier, $existingIdentifiers)) {
71-
$data['value'] .= '|' . $item->getData('page_id');
72-
} else {
73-
$existingIdentifiers[] = $identifier;
74-
}
75-
76-
$res[] = $data;
77-
}
78-
79-
return $res;
80-
}
81-
8254
/**
8355
* Set first store flag
8456
*
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\Cms\Test\Unit\Model\Config\Source;
9+
10+
/**
11+
* Class BlockTest
12+
*/
13+
class BlockTest extends \PHPUnit\Framework\TestCase
14+
{
15+
/**
16+
* @var \Magento\Cms\Model\ResourceModel\Block\CollectionFactory|\PHPUnit_Framework_MockObject_MockObject
17+
*/
18+
protected $collectionFactory;
19+
20+
/**
21+
* @var \Magento\Cms\Model\Config\Source\Block
22+
*/
23+
protected $block;
24+
25+
/**
26+
* Set up
27+
*
28+
* @return void
29+
*/
30+
protected function setUp()
31+
{
32+
$objectManager = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
33+
34+
$this->collectionFactory = $this->createPartialMock(
35+
\Magento\Cms\Model\ResourceModel\Block\CollectionFactory::class,
36+
['create']
37+
);
38+
39+
$this->block = $objectManager->getObject(
40+
\Magento\Cms\Model\Config\Source\Block::class,
41+
[
42+
'collectionFactory' => $this->collectionFactory,
43+
]
44+
);
45+
}
46+
47+
/**
48+
* Run test toOptionArray method
49+
*
50+
* @return void
51+
*/
52+
public function testToOptionArray()
53+
{
54+
$blockCollectionMock = $this->createMock(\Magento\Cms\Model\ResourceModel\Block\Collection::class);
55+
56+
$this->collectionFactory->expects($this->once())
57+
->method('create')
58+
->will($this->returnValue($blockCollectionMock));
59+
60+
$blockCollectionMock->expects($this->once())
61+
->method('toOptionIdArray')
62+
->will($this->returnValue('return-value'));
63+
64+
$this->assertEquals('return-value', $this->block->toOptionArray());
65+
}
66+
}

app/code/Magento/Customer/etc/acl.xml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,15 @@
1212
<resource id="Magento_Customer::customer" title="Customers" translate="title" sortOrder="40">
1313
<resource id="Magento_Customer::manage" title="All Customers" translate="title" sortOrder="10" />
1414
<resource id="Magento_Customer::online" title="Now Online" translate="title" sortOrder="20" />
15+
<resource id="Magento_Customer::group" title="Customer Groups" translate="title" sortOrder="30" />
1516
</resource>
1617
<resource id="Magento_Backend::stores">
1718
<resource id="Magento_Backend::stores_settings">
1819
<resource id="Magento_Config::config">
1920
<resource id="Magento_Customer::config_customer" title="Customers Section" translate="title" sortOrder="50" />
2021
</resource>
2122
</resource>
22-
<resource id="Magento_Backend::stores_other_settings">
23-
<resource id="Magento_Customer::group" title="Customer Groups" translate="title" sortOrder="10" />
24-
</resource>
25-
</resource>
23+
</resource>
2624
</resource>
2725
</resources>
2826
</acl>

app/code/Magento/CustomerGraphQl/etc/schema.graphqls

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ type Customer @doc(description: "Customer defines the customer name and address
1919
dob: String @doc(description: "The customer's date of birth")
2020
taxvat: String @doc(description: "The customer's Tax/VAT number (for corporate customers)")
2121
id: Int @doc(description: "The ID assigned to the customer")
22-
is_subscribed: Boolean @doc(description: "An array containing the customer's shipping and billing addresses")
23-
addresses: [CustomerAddress] @doc(description: "Indicates whether the customer is subscribed to the company's newsletter")
24-
}
22+
is_subscribed: Boolean @doc(description: "Indicates whether the customer is subscribed to the company's newsletter")
23+
addresses: [CustomerAddress] @doc(description: "An array containing the customer's shipping and billing addresses")
24+
}
2525

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

0 commit comments

Comments
 (0)