Skip to content

Commit 2dc3722

Browse files
committed
Merge remote-tracking branch 'origin/2.3-qwerty' into MC-11046
2 parents 2035cf8 + f626d3b commit 2dc3722

File tree

68 files changed

+2408
-3273
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+2408
-3273
lines changed

app/code/Magento/Braintree/view/frontend/templates/paypal/button.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
* @var \Magento\Braintree\Block\Paypal\Button $block
99
*/
1010

11-
$id = $block->getContainerId() . mt_rand();
11+
$id = $block->getContainerId() . random_int(0, PHP_INT_MAX);
1212

1313
$config = [
1414
'Magento_Braintree/js/paypal/button' => [

app/code/Magento/Config/Console/Command/ConfigSet/DefaultProcessor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ public function process($path, $value, $scope, $scopeCode)
9090
}
9191

9292
try {
93-
$config = $this->configFactory->create([
93+
$config = $this->configFactory->create(['data' => [
9494
'scope' => $scope,
9595
'scope_code' => $scopeCode,
96-
]);
96+
]]);
9797
$config->setDataByPath($path, $value);
9898
$config->save();
9999
} catch (\Exception $exception) {

app/code/Magento/Config/Test/Unit/Console/Command/ConfigSet/DefaultProcessorTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public function testProcess($path, $value, $scope, $scopeCode)
103103
$config = $this->createMock(Config::class);
104104
$this->configFactory->expects($this->once())
105105
->method('create')
106-
->with(['scope' => $scope, 'scope_code' => $scopeCode])
106+
->with(['data' => ['scope' => $scope, 'scope_code' => $scopeCode]])
107107
->willReturn($config);
108108
$config->expects($this->once())
109109
->method('setDataByPath')

app/code/Magento/Customer/Test/Unit/Model/AccountManagementTest.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1238,8 +1238,7 @@ public function testInitiatePasswordResetEmailReminder()
12381238

12391239
$storeId = 1;
12401240

1241-
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
1242-
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
1241+
$hash = hash("sha256", uniqid(microtime() . random_int(0, PHP_INT_MAX), true));
12431242

12441243
$this->emailNotificationMock->expects($this->once())
12451244
->method('passwordReminder')
@@ -1263,8 +1262,7 @@ public function testInitiatePasswordResetEmailReset()
12631262
$templateIdentifier = 'Template Identifier';
12641263
$sender = 'Sender';
12651264

1266-
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
1267-
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
1265+
$hash = hash("sha256", uniqid(microtime() . random_int(0, PHP_INT_MAX), true));
12681266

12691267
$this->emailNotificationMock->expects($this->once())
12701268
->method('passwordResetConfirmation')
@@ -1288,8 +1286,7 @@ public function testInitiatePasswordResetNoTemplate()
12881286
$templateIdentifier = 'Template Identifier';
12891287
$sender = 'Sender';
12901288

1291-
mt_srand(mt_rand() + (100000000 * (float)microtime()) % PHP_INT_MAX);
1292-
$hash = md5(uniqid(microtime() . mt_rand(0, mt_getrandmax()), true));
1289+
$hash = hash("sha256", uniqid(microtime() . random_int(0, PHP_INT_MAX), true));
12931290

12941291
$this->prepareInitiatePasswordReset($email, $templateIdentifier, $sender, $storeId, $customerId, $hash);
12951292

app/code/Magento/ImportExport/Model/Import.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,11 @@ class Import extends \Magento\ImportExport\Model\AbstractModel
126126
*/
127127
protected $_importExportData = null;
128128

129+
/**
130+
* @var \Magento\Framework\App\Config\ScopeConfigInterface
131+
*/
132+
private $_coreConfig;
133+
129134
/**
130135
* @var \Magento\ImportExport\Model\Import\ConfigInterface
131136
*/

app/code/Magento/Paypal/etc/adminhtml/system/paypal_payflowpro_with_express_checkout.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
*/
77
-->
88
<include xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_include.xsd">
9-
<group id="paypal_payflowpro_with_express_checkout" translate="label comment" extends="payment_all_paypal/paypal_payflowpro">
9+
<group id="paypal_payflowpro_with_express_checkout" translate="label" extends="payment_all_paypal/paypal_payflowpro">
1010
<label>Payflow Pro</label>
1111
<attribute type="paypal_ec_separate">0</attribute>
1212
<group id="paypal_payflow_required" translate="label" showInDefault="1" showInWebsite="1" sortOrder="10">
@@ -30,7 +30,7 @@
3030
<field id="enable_paypal_payflow"/>
3131
</requires>
3232
</field>
33-
<field id="enable_express_checkout_bml_payflow" translate="label" type="select" sortOrder="21" showInWebsite="1" showInDefault="1">
33+
<field id="enable_express_checkout_bml_payflow" translate="label comment" type="select" sortOrder="21" showInWebsite="1" showInDefault="1">
3434
<label>Enable PayPal Credit</label>
3535
<comment><![CDATA[PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
3636
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.

app/code/Magento/Paypal/i18n/en_US.csv

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -697,6 +697,11 @@ User,User
697697
The PayPal Advertising Program has been shown to generate additional purchases as well as increase consumer's average purchase sizes by 15%
698698
or more. <a href=""https://financing.paypal.com/ppfinportal/content/forrester"" target=""_blank"">See Details</a>.
699699
"
700+
"PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
701+
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
702+
<a href=""https://www.paypal.com/webapps/mpp/promotional-financing"" target=""_blank"">Learn More</a>","PayPal Express Checkout Payflow Edition lets you give customers access to financing through PayPal Credit&#174; - at no additional cost to you.
703+
You get paid up front, even though customers have more time to pay. A pre-integrated payment button lets customers pay quickly with PayPal Credit&#174;.
704+
<a href=""https://www.paypal.com/webapps/mpp/promotional-financing"" target=""_blank"">Learn More</a>"
700705
"Customize Smart Buttons","Customize Smart Buttons"
701706
"Checkout Page","Checkout Page"
702707
"Label","Label"
@@ -731,4 +736,4 @@ User,User
731736
"PayPal will automatically display each enabled funding option to eligible buyers. For example, PayPal Credit is only shown to buyers in countries where PayPal Credit is offered and the currency offered by the merchant is USD.","PayPal will automatically display each enabled funding option to eligible buyers. For example, PayPal Credit is only shown to buyers in countries where PayPal Credit is offered and the currency offered by the merchant is USD."
732737
"PayPal Credit","PayPal Credit"
733738
"PayPal Guest Checkout Credit Card Icons","PayPal Guest Checkout Credit Card Icons"
734-
"Elektronisches Lastschriftverfahren - German ELV","Elektronisches Lastschriftverfahren - German ELV"
739+
"Elektronisches Lastschriftverfahren - German ELV","Elektronisches Lastschriftverfahren - German ELV"

app/code/Magento/QuoteGraphQl/Model/Cart/GetCartForUser.php

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Magento\Quote\Api\CartRepositoryInterface;
1414
use Magento\Quote\Model\MaskedQuoteIdToQuoteIdInterface;
1515
use Magento\Quote\Model\Quote;
16+
use Magento\Store\Model\StoreManagerInterface;
1617

1718
/**
1819
* Get cart
@@ -29,16 +30,24 @@ class GetCartForUser
2930
*/
3031
private $cartRepository;
3132

33+
/**
34+
* @var StoreManagerInterface
35+
*/
36+
private $storeManager;
37+
3238
/**
3339
* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId
3440
* @param CartRepositoryInterface $cartRepository
41+
* @param StoreManagerInterface $storeManager
3542
*/
3643
public function __construct(
3744
MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId,
38-
CartRepositoryInterface $cartRepository
45+
CartRepositoryInterface $cartRepository,
46+
StoreManagerInterface $storeManager
3947
) {
4048
$this->maskedQuoteIdToQuoteId = $maskedQuoteIdToQuoteId;
4149
$this->cartRepository = $cartRepository;
50+
$this->storeManager = $storeManager;
4251
}
4352

4453
/**
@@ -75,6 +84,15 @@ public function execute(string $cartHash, ?int $customerId): Quote
7584
);
7685
}
7786

87+
if ((int)$cart->getStoreId() !== (int)$this->storeManager->getStore()->getId()) {
88+
throw new GraphQlNoSuchEntityException(
89+
__(
90+
'Wrong store code specified for cart "%masked_cart_id"',
91+
['masked_cart_id' => $cartHash]
92+
)
93+
);
94+
}
95+
7896
$cartCustomerId = (int)$cart->getCustomerId();
7997

8098
/* Guest cart, allow operations */

app/code/Magento/QuoteGraphQl/Model/Cart/QuoteAddressFactory.php

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
namespace Magento\QuoteGraphQl\Model\Cart;
99

10+
use Magento\Customer\Helper\Address as AddressHelper;
1011
use Magento\CustomerGraphQl\Model\Customer\Address\GetCustomerAddress;
1112
use Magento\Framework\Exception\LocalizedException;
1213
use Magento\Framework\GraphQl\Exception\GraphQlAuthorizationException;
@@ -30,28 +31,44 @@ class QuoteAddressFactory
3031
*/
3132
private $getCustomerAddress;
3233

34+
/**
35+
* @var AddressHelper
36+
*/
37+
private $addressHelper;
38+
3339
/**
3440
* @param BaseQuoteAddressFactory $quoteAddressFactory
3541
* @param GetCustomerAddress $getCustomerAddress
42+
* @param AddressHelper $addressHelper
3643
*/
3744
public function __construct(
3845
BaseQuoteAddressFactory $quoteAddressFactory,
39-
GetCustomerAddress $getCustomerAddress
46+
GetCustomerAddress $getCustomerAddress,
47+
AddressHelper $addressHelper
4048
) {
4149
$this->quoteAddressFactory = $quoteAddressFactory;
4250
$this->getCustomerAddress = $getCustomerAddress;
51+
$this->addressHelper = $addressHelper;
4352
}
4453

4554
/**
4655
* Create QuoteAddress based on input data
4756
*
4857
* @param array $addressInput
4958
* @return QuoteAddress
59+
* @throws GraphQlInputException
5060
*/
5161
public function createBasedOnInputData(array $addressInput): QuoteAddress
5262
{
5363
$addressInput['country_id'] = $addressInput['country_code'] ?? '';
5464

65+
$maxAllowedLineCount = $this->addressHelper->getStreetLines();
66+
if (is_array($addressInput['street']) && count($addressInput['street']) > $maxAllowedLineCount) {
67+
throw new GraphQlInputException(
68+
__('"Street Address" cannot contain more than %1 lines.', $maxAllowedLineCount)
69+
);
70+
}
71+
5572
$quoteAddress = $this->quoteAddressFactory->create();
5673
$quoteAddress->addData($addressInput);
5774
return $quoteAddress;

app/code/Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid.php

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,17 @@
55
*/
66
namespace Magento\Sales\Block\Adminhtml\Order\Create\Search;
77

8+
use Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid\DataProvider\ProductCollection
9+
as ProductCollectionDataProvider;
10+
use Magento\Framework\App\ObjectManager;
11+
812
/**
913
* Adminhtml sales order create search products block
1014
*
1115
* @api
1216
* @author Magento Core Team <core@magentocommerce.com>
1317
* @since 100.0.2
18+
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
1419
*/
1520
class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
1621
{
@@ -42,6 +47,11 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
4247
*/
4348
protected $_productFactory;
4449

50+
/**
51+
* @var ProductCollectionDataProvider $productCollectionProvider
52+
*/
53+
private $productCollectionProvider;
54+
4555
/**
4656
* @param \Magento\Backend\Block\Template\Context $context
4757
* @param \Magento\Backend\Helper\Data $backendHelper
@@ -50,6 +60,7 @@ class Grid extends \Magento\Backend\Block\Widget\Grid\Extended
5060
* @param \Magento\Backend\Model\Session\Quote $sessionQuote
5161
* @param \Magento\Sales\Model\Config $salesConfig
5262
* @param array $data
63+
* @param ProductCollectionDataProvider|null $productCollectionProvider
5364
*/
5465
public function __construct(
5566
\Magento\Backend\Block\Template\Context $context,
@@ -58,12 +69,15 @@ public function __construct(
5869
\Magento\Catalog\Model\Config $catalogConfig,
5970
\Magento\Backend\Model\Session\Quote $sessionQuote,
6071
\Magento\Sales\Model\Config $salesConfig,
61-
array $data = []
72+
array $data = [],
73+
ProductCollectionDataProvider $productCollectionProvider = null
6274
) {
6375
$this->_productFactory = $productFactory;
6476
$this->_catalogConfig = $catalogConfig;
6577
$this->_sessionQuote = $sessionQuote;
6678
$this->_salesConfig = $salesConfig;
79+
$this->productCollectionProvider = $productCollectionProvider
80+
?: ObjectManager::getInstance()->get(ProductCollectionDataProvider::class);
6781
parent::__construct($context, $backendHelper, $data);
6882
}
6983

@@ -140,20 +154,18 @@ protected function _addColumnFilterToCollection($column)
140154
*/
141155
protected function _prepareCollection()
142156
{
157+
143158
$attributes = $this->_catalogConfig->getProductAttributes();
159+
$store = $this->getStore();
160+
144161
/* @var $collection \Magento\Catalog\Model\ResourceModel\Product\Collection */
145-
$collection = $this->_productFactory->create()->getCollection();
146-
$collection->setStore(
147-
$this->getStore()
148-
)->addAttributeToSelect(
162+
$collection = $this->productCollectionProvider->getCollectionForStore($store);
163+
$collection->addAttributeToSelect(
149164
$attributes
150-
)->addAttributeToSelect(
151-
'sku'
152-
)->addStoreFilter()->addAttributeToFilter(
165+
);
166+
$collection->addAttributeToFilter(
153167
'type_id',
154168
$this->_salesConfig->getAvailableProductTypes()
155-
)->addAttributeToSelect(
156-
'gift_message_available'
157169
);
158170

159171
$this->setCollection($collection);

0 commit comments

Comments
 (0)