Skip to content

Commit fe31d26

Browse files
committed
Merge branch '2.4-develop' of https://github.com/magento-commerce/magento2ce into ACP2E-1025
2 parents 982d7ac + 2854866 commit fe31d26

File tree

27 files changed

+232
-199
lines changed

27 files changed

+232
-199
lines changed

app/code/Magento/Catalog/Model/Indexer/Product/Price/AbstractAction.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ public function __construct(
164164
*/
165165
abstract public function execute($ids);
166166

167+
// phpcs:disable
167168
/**
168169
* Synchronize data between index storage and original storage
169170
*
@@ -196,6 +197,7 @@ protected function _syncData(array $processIds = [])
196197
return $this;
197198
}
198199

200+
// phpcs:enable
199201
/**
200202
* Prepare website current dates table
201203
*
@@ -456,6 +458,7 @@ private function deleteOutdatedData(array $entityIds, string $temporaryTable, st
456458
*/
457459
private function deleteIndexData(array $entityIds)
458460
{
461+
$entityIds = array_unique(array_map('intval', $entityIds));
459462
foreach ($this->dimensionCollectionFactory->create() as $dimensions) {
460463
$select = $this->getConnection()->select()->from(
461464
['index_price' => $this->tableMaintainer->getMainTableByDimensions($dimensions)],
@@ -466,6 +469,7 @@ private function deleteIndexData(array $entityIds)
466469
}
467470
}
468471

472+
// phpcs:disable
469473
/**
470474
* Copy relations product index from primary index to temporary index table by parent entity
471475
*
@@ -516,6 +520,7 @@ protected function _copyRelationIndexData($parentIds, $excludeIds = null)
516520
return $this;
517521
}
518522

523+
// phpcs:enable
519524
/**
520525
* Retrieve index table by dimension that will be used for write operations.
521526
*

app/code/Magento/Catalog/view/adminhtml/ui_component/product_listing.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,16 @@
192192
<label translate="true">Websites</label>
193193
</settings>
194194
</column>
195+
<column name="updated_at"
196+
class="Magento\Ui\Component\Listing\Columns\Date"
197+
component="Magento_Ui/js/grid/columns/date"
198+
sortOrder="110">
199+
<settings>
200+
<filter>dateRange</filter>
201+
<dataType>date</dataType>
202+
<label translate="true">Last Updated At</label>
203+
</settings>
204+
</column>
195205
<actionsColumn name="actions" class="Magento\Catalog\Ui\Component\Listing\Columns\ProductActions" sortOrder="200">
196206
<settings>
197207
<indexField>entity_id</indexField>

app/code/Magento/ConfigurableProduct/view/adminhtml/web/js/components/dynamic-rows-configurable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ define([
412412
product = {
413413
'id': row.productId,
414414
'product_link': row.productUrl,
415-
'name': $('<i></i>').text(row.name).html(),
415+
'name': row.name,
416416
'sku': row.sku,
417417
'status': row.status,
418418
'price': row.price,

app/code/Magento/Dhl/Model/Carrier.php

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Carrier extends \Magento\Dhl\Model\AbstractDhl implements \Magento\Shippin
5757
*
5858
* @var string[]
5959
*/
60-
protected $_customizableContainerTypes = [self::DHL_CONTENT_TYPE_NON_DOC];
60+
protected $_customizableContainerTypes = [self::DHL_CONTENT_TYPE_NON_DOC, self::DHL_CONTENT_TYPE_DOC];
6161

6262
/**
6363
* Code of the carrier
@@ -1533,7 +1533,7 @@ protected function _doRequest()
15331533
' xmlns:req="http://www.dhl.com"' .
15341534
' xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' .
15351535
' xsi:schemaLocation="http://www.dhl.com ship-val-global-req.xsd"' .
1536-
' schemaVersion="6.2" />';
1536+
' schemaVersion="10.0" />';
15371537
$xml = $this->_xmlElFactory->create(['data' => $xmlStr]);
15381538

15391539
$nodeRequest = $xml->addChild('Request', '', '');
@@ -1562,13 +1562,11 @@ protected function _doRequest()
15621562
$xml->addChild('RegionCode', $originRegion, '');
15631563
}
15641564
$xml->addChild('RequestedPickupTime', 'N', '');
1565-
$xml->addChild('NewShipper', 'N', '');
15661565
$xml->addChild('LanguageCode', 'EN', '');
1567-
$xml->addChild('PiecesEnabled', 'Y', '');
15681566

15691567
/** Billing */
15701568
$nodeBilling = $xml->addChild('Billing', '', '');
1571-
$nodeBilling->addChild('ShipperAccountNumber', (string)$this->getConfigData('account'));
1569+
$nodeBilling->addChild('ShipperAccountNumber', (string)substr($this->getConfigData('account'), 0, 9));
15721570
/**
15731571
* Method of Payment:
15741572
* S (Shipper)
@@ -1580,13 +1578,12 @@ protected function _doRequest()
15801578
/**
15811579
* Shipment bill to account – required if Shipping PaymentType is other than 'S'
15821580
*/
1583-
$nodeBilling->addChild('BillingAccountNumber', (string)$this->getConfigData('account'));
1581+
$nodeBilling->addChild('BillingAccountNumber', (string)substr($this->getConfigData('account'), 0, 9));
15841582
if ($this->isDutiable(
15851583
$rawRequest->getShipperAddressCountryCode(),
15861584
$rawRequest->getRecipientAddressCountryCode()
15871585
)) {
1588-
$nodeBilling->addChild('DutyPaymentType', 'S');
1589-
$nodeBilling->addChild('DutyAccountNumber', (string)$this->getConfigData('account'));
1586+
$nodeBilling->addChild('DutyAccountNumber', (string)substr($this->getConfigData('account'), 0, 9));
15901587
}
15911588

15921589
/** Receiver */
@@ -1601,11 +1598,16 @@ protected function _doRequest()
16011598
$address = $rawRequest->getRecipientAddressStreet1() . ' ' . $rawRequest->getRecipientAddressStreet2();
16021599
$address = $this->string->split($address, 45, false, true);
16031600
if (is_array($address)) {
1601+
$addressLineNumber = 1;
16041602
foreach ($address as $addressLine) {
1605-
$nodeConsignee->addChild('AddressLine', $addressLine);
1603+
if ($addressLineNumber > 3) {
1604+
break;
1605+
}
1606+
$nodeConsignee->addChild('AddressLine'.$addressLineNumber, $addressLine);
1607+
$addressLineNumber++;
16061608
}
16071609
} else {
1608-
$nodeConsignee->addChild('AddressLine', $address);
1610+
$nodeConsignee->addChild('AddressLine1', $address);
16091611
}
16101612

16111613
$nodeConsignee->addChild('City', $rawRequest->getRecipientAddressCity());
@@ -1633,7 +1635,7 @@ protected function _doRequest()
16331635
* value should lie in between 1 to 9999.This field is mandatory.
16341636
*/
16351637
$nodeCommodity = $xml->addChild('Commodity', '', '');
1636-
$nodeCommodity->addChild('CommodityCode', '1');
1638+
$nodeCommodity->addChild('CommodityCode', substr('01', 0, 18));
16371639

16381640
/** Dutiable */
16391641
if ($this->isDutiable(
@@ -1647,6 +1649,7 @@ protected function _doRequest()
16471649
);
16481650
$baseCurrencyCode = $this->_storeManager->getWebsite($rawRequest->getWebsiteId())->getBaseCurrencyCode();
16491651
$nodeDutiable->addChild('DeclaredCurrency', $baseCurrencyCode);
1652+
$nodeDutiable->addChild('TermsOfTrade', 'DAP');
16501653
}
16511654

16521655
/**
@@ -1663,18 +1666,23 @@ protected function _doRequest()
16631666

16641667
/** Shipper */
16651668
$nodeShipper = $xml->addChild('Shipper', '', '');
1666-
$nodeShipper->addChild('ShipperID', (string)$this->getConfigData('account'));
1669+
$nodeShipper->addChild('ShipperID', (string)substr($this->getConfigData('account'), 0, 9));
16671670
$nodeShipper->addChild('CompanyName', $rawRequest->getShipperContactCompanyName());
1668-
$nodeShipper->addChild('RegisteredAccount', (string)$this->getConfigData('account'));
1671+
$nodeShipper->addChild('RegisteredAccount', (string)substr($this->getConfigData('account'), 0, 9));
16691672

16701673
$address = $rawRequest->getShipperAddressStreet1() . ' ' . $rawRequest->getShipperAddressStreet2();
16711674
$address = $this->string->split($address, 45, false, true);
16721675
if (is_array($address)) {
1676+
$addressLineNumber = 1;
16731677
foreach ($address as $addressLine) {
1674-
$nodeShipper->addChild('AddressLine', $addressLine);
1678+
if ($addressLineNumber > 3) {
1679+
break;
1680+
}
1681+
$nodeShipper->addChild('AddressLine'.$addressLineNumber, $addressLine);
1682+
$addressLineNumber++;
16751683
}
16761684
} else {
1677-
$nodeShipper->addChild('AddressLine', $address);
1685+
$nodeShipper->addChild('AddressLine1', $address);
16781686
}
16791687

16801688
$nodeShipper->addChild('City', $rawRequest->getShipperAddressCity());
@@ -1742,7 +1750,6 @@ protected function _doRequest()
17421750
protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
17431751
{
17441752
$nodeShipmentDetails = $xml->addChild('ShipmentDetails', '', '');
1745-
$nodeShipmentDetails->addChild('NumberOfPieces', count($rawRequest->getPackages()));
17461753

17471754
$nodePieces = $nodeShipmentDetails->addChild('Pieces', '', '');
17481755

@@ -1776,7 +1783,6 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
17761783
$nodePiece->addChild('PieceContents', $this->string->substr(implode(',', $content), 0, 34));
17771784
}
17781785

1779-
$nodeShipmentDetails->addChild('Weight', sprintf('%.3f', $rawRequest->getPackageWeight()));
17801786
$nodeShipmentDetails->addChild('WeightUnit', substr($this->_getWeightUnit(), 0, 1));
17811787
$nodeShipmentDetails->addChild('GlobalProductCode', $rawRequest->getShippingMethod());
17821788
$nodeShipmentDetails->addChild('LocalProductCode', $rawRequest->getShippingMethod());
@@ -1785,12 +1791,7 @@ protected function _shipmentDetails($xml, $rawRequest, $originRegion = '')
17851791
$this->_coreDate->date('Y-m-d', strtotime('now + 1day'))
17861792
);
17871793
$nodeShipmentDetails->addChild('Contents', 'DHL Parcel');
1788-
/**
1789-
* The DoorTo Element defines the type of delivery service that applies to the shipment.
1790-
* The valid values are DD (Door to Door), DA (Door to Airport) , AA and DC (Door to
1791-
* Door non-compliant)
1792-
*/
1793-
$nodeShipmentDetails->addChild('DoorTo', 'DD');
1794+
17941795
$nodeShipmentDetails->addChild('DimensionUnit', substr($this->_getDimensionUnit(), 0, 1));
17951796
$contentType = isset($package['params']['container']) ? $package['params']['container'] : '';
17961797
$packageType = $contentType === self::DHL_CONTENT_TYPE_NON_DOC ? 'CP' : 'EE';

app/code/Magento/Quote/Model/Cart/AddProductsToCart.php

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
namespace Magento\Quote\Model\Cart;
99

1010
use Magento\Catalog\Api\ProductRepositoryInterface;
11+
use Magento\Framework\Api\SearchCriteriaBuilder;
12+
use Magento\Framework\App\ObjectManager;
1113
use Magento\Framework\Exception\NoSuchEntityException;
1214
use Magento\Quote\Api\CartRepositoryInterface;
1315
use Magento\Quote\Model\Cart\BuyRequest\BuyRequestBuilder;
@@ -65,22 +67,32 @@ class AddProductsToCart
6567
*/
6668
private $requestBuilder;
6769

70+
/**
71+
* @var SearchCriteriaBuilder
72+
*/
73+
private $searchCriteriaBuilder;
74+
6875
/**
6976
* @param ProductRepositoryInterface $productRepository
7077
* @param CartRepositoryInterface $cartRepository
7178
* @param MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId
7279
* @param BuyRequestBuilder $requestBuilder
80+
* @param SearchCriteriaBuilder|null $searchCriteriaBuilder
7381
*/
7482
public function __construct(
7583
ProductRepositoryInterface $productRepository,
7684
CartRepositoryInterface $cartRepository,
7785
MaskedQuoteIdToQuoteIdInterface $maskedQuoteIdToQuoteId,
78-
BuyRequestBuilder $requestBuilder
86+
BuyRequestBuilder $requestBuilder,
87+
SearchCriteriaBuilder $searchCriteriaBuilder = null
7988
) {
8089
$this->productRepository = $productRepository;
8190
$this->cartRepository = $cartRepository;
8291
$this->maskedQuoteIdToQuoteId = $maskedQuoteIdToQuoteId;
8392
$this->requestBuilder = $requestBuilder;
93+
$this->searchCriteriaBuilder = $searchCriteriaBuilder ?: ObjectManager::getInstance()->get(
94+
SearchCriteriaBuilder::class
95+
);
8496
}
8597

8698
/**
@@ -145,6 +157,16 @@ public function execute(string $maskedCartId, array $cartItems): AddProductsToCa
145157
public function addItemsToCart(Quote $cart, array $cartItems): array
146158
{
147159
$failedCartItems = [];
160+
$cartItemSkus = \array_map(
161+
function ($item) {
162+
return $item->getSku();
163+
},
164+
$cartItems
165+
);
166+
167+
$searchCriteria = $this->searchCriteriaBuilder->addFilter('sku', $cartItemSkus, 'in')->create();
168+
// getList() call caches product models in runtime cache
169+
$this->productRepository->getList($searchCriteria)->getItems();
148170

149171
foreach ($cartItems as $cartItemPosition => $cartItem) {
150172
$errors = $this->addItemToCart($cart, $cartItem, $cartItemPosition);
@@ -178,7 +200,7 @@ private function addItemToCart(Quote $cart, Data\CartItem $cartItem, int $cartIt
178200
);
179201
} else {
180202
try {
181-
$product = $this->productRepository->get($sku, false, null, true);
203+
$product = $this->productRepository->get($sku, false, $cart->getStoreId(), false);
182204
} catch (NoSuchEntityException $e) {
183205
$errors[] = $this->createError(
184206
__('Could not find a product with SKU "%sku"', ['sku' => $sku])->render(),

app/code/Magento/QuoteGraphQl/Model/Resolver/AddSimpleProductsToCart.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,6 @@ private function run($context, ?array $args): array
9090
$storeId = (int)$context->getExtensionAttributes()->getStore()->getId();
9191
$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
9292
$this->addProductsToCart->execute($cart, $cartItems);
93-
$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
9493

9594
return [
9695
'cart' => [

app/code/Magento/QuoteGraphQl/Model/Resolver/ApplyCouponToCart.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
8585
throw new LocalizedException(__($e->getMessage()), $e);
8686
}
8787

88-
$cart = $this->getCartForUser->execute($maskedCartId, $currentUserId, $storeId);
8988
return [
9089
'cart' => [
9190
'model' => $cart,

app/code/Magento/QuoteGraphQl/Model/Resolver/SetBillingAddressOnCart.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
6969
$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
7070
$this->checkCartCheckoutAllowance->execute($cart);
7171
$this->setBillingAddressOnCart->execute($context, $cart, $billingAddress);
72-
$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
7372

7473
return [
7574
'cart' => [

app/code/Magento/QuoteGraphQl/Model/Resolver/SetPaymentMethodOnCart.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
6969
$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
7070
$this->checkCartCheckoutAllowance->execute($cart);
7171
$this->setPaymentMethodOnCart->execute($cart, $paymentData);
72-
$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
7372

7473
return [
7574
'cart' => [

app/code/Magento/QuoteGraphQl/Model/Resolver/SetShippingAddressesOnCart.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,6 @@ public function resolve(Field $field, $context, ResolveInfo $info, array $value
6969
$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
7070
$this->checkCartCheckoutAllowance->execute($cart);
7171
$this->setShippingAddressesOnCart->execute($context, $cart, $shippingAddresses);
72-
// reload updated cart
73-
$cart = $this->getCartForUser->execute($maskedCartId, $context->getUserId(), $storeId);
7472

7573
return [
7674
'cart' => [

0 commit comments

Comments
 (0)