Skip to content

Commit 0799600

Browse files
authored
Merge pull request #175 from magento-commerce/1.1.55-release
1.1.55 Release
2 parents 3dc08f7 + 6179e61 commit 0799600

26 files changed

+4019
-41
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "magento/quality-patches",
33
"description": "Provides quality patches for AdobeCommerce & Magento OpenSource",
44
"type": "magento2-component",
5-
"version": "1.1.54",
5+
"version": "1.1.55",
66
"license": "proprietary",
77
"repositories": {
88
"repo": {

patches-info.json

+1-1
Large diffs are not rendered by default.
+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/vendor/magento/module-banner/Model/Banner/Data.php b/vendor/magento/module-banner/Model/Banner/Data.php
2+
index 271fb8d5befc..cbc136116d3f 100644
3+
--- a/vendor/magento/module-banner/Model/Banner/Data.php
4+
+++ b/vendor/magento/module-banner/Model/Banner/Data.php
5+
@@ -290,7 +290,7 @@ private function getBannerIdsByCatalogRules()
6+
private function getProductRelatedBannerIds(int $productId): array
7+
{
8+
$result = $this->catalogRule->getRulesFromProduct(
9+
- $this->dateTime->scopeDate($this->storeManager->getStore()->getId()),
10+
+ $this->dateTime->scopeDate($this->storeManager->getStore()->getId(), includeTime: true)->getTimestamp(),
11+
$this->storeManager->getWebsite()->getId(),
12+
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),
13+
$productId
+59
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
diff --git a/vendor/magento/module-purchase-order/Model/CommentManagement.php b/vendor/magento/module-purchase-order/Model/CommentManagement.php
2+
index d5cbb7b9fe8e..228d9216b3eb 100644
3+
--- a/vendor/magento/module-purchase-order/Model/CommentManagement.php
4+
+++ b/vendor/magento/module-purchase-order/Model/CommentManagement.php
5+
@@ -6,6 +6,7 @@
6+
7+
namespace Magento\PurchaseOrder\Model;
8+
9+
+use Magento\Framework\App\ObjectManager;
10+
use Magento\Framework\Exception\LocalizedException;
11+
use Magento\PurchaseOrder\Api\Data\CommentInterface;
12+
use Magento\PurchaseOrder\Api\Data\CommentInterfaceFactory;
13+
@@ -25,7 +26,7 @@ class CommentManagement
14+
private $commentCollectionFactory;
15+
16+
/**
17+
- * @var CommentFactory
18+
+ * @var CommentInterfaceFactory
19+
*/
20+
private $commentFactory;
21+
22+
@@ -34,19 +35,28 @@ class CommentManagement
23+
*/
24+
private $notifier;
25+
26+
+ /**
27+
+ * @var CommentRepositoryInterface
28+
+ */
29+
+ private $commentRepository;
30+
+
31+
/**
32+
* @param CommentInterfaceFactory $commentFactory
33+
* @param CommentCollectionFactory $commentCollectionFactory
34+
* @param NotifierInterface $notifier
35+
+ * @param CommentRepositoryInterface|null $commentRepository
36+
*/
37+
public function __construct(
38+
CommentInterfaceFactory $commentFactory,
39+
CommentCollectionFactory $commentCollectionFactory,
40+
- NotifierInterface $notifier
41+
+ NotifierInterface $notifier,
42+
+ ?CommentRepositoryInterface $commentRepository = null
43+
) {
44+
$this->commentFactory = $commentFactory;
45+
$this->commentCollectionFactory = $commentCollectionFactory;
46+
$this->notifier = $notifier;
47+
+ $this->commentRepository = $commentRepository ?:
48+
+ ObjectManager::getInstance()->get(CommentRepositoryInterface::class);
49+
}
50+
51+
/**
52+
@@ -71,6 +81,7 @@ public function addComment(
53+
54+
$comment->save();
55+
56+
+ $comment = $this->commentRepository->get($comment->getEntityId());
57+
$this->notifier->notifyOnAction($comment->getEntityId(), CommentAdded::class);
58+
59+
return $comment;
+207
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,207 @@
1+
diff --git a/vendor/magento/module-purchase-order/Model/PurchaseOrderManagement.php b/vendor/magento/module-purchase-order/Model/PurchaseOrderManagement.php
2+
index 26c100baa1..2c52beab06 100644
3+
--- a/vendor/magento/module-purchase-order/Model/PurchaseOrderManagement.php
4+
+++ b/vendor/magento/module-purchase-order/Model/PurchaseOrderManagement.php
5+
@@ -171,7 +171,20 @@ class PurchaseOrderManagement implements PurchaseOrderManagementInterface
6+
/**
7+
* @inheritdoc
8+
*/
9+
- public function createSalesOrder(PurchaseOrderInterface $purchaseOrder, $actorId = null) : OrderInterface
10+
+ public function createSalesOrder(PurchaseOrderInterface $purchaseOrder, $actorId = null): OrderInterface
11+
+ {
12+
+ $this->validatePurchaseOrderAndUpdateStatus($purchaseOrder);
13+
+ $quote = $this->getQuote($purchaseOrder->getQuoteId(), (string)$purchaseOrder->getIncrementId());
14+
+ return $this->processOrder($purchaseOrder, $quote, $actorId);
15+
+ }
16+
+
17+
+ /**
18+
+ * Validate purchase order and set correct status
19+
+ *
20+
+ * @param PurchaseOrderInterface $purchaseOrder
21+
+ * @throws LocalizedException
22+
+ */
23+
+ private function validatePurchaseOrderAndUpdateStatus(PurchaseOrderInterface $purchaseOrder): void
24+
{
25+
if (!$this->validatorLocator->getValidator('placeorder')->validate($purchaseOrder)) {
26+
throw new LocalizedException(
27+
@@ -180,64 +193,57 @@ class PurchaseOrderManagement implements PurchaseOrderManagementInterface
28+
$purchaseOrder->getIncrementId()
29+
)
30+
);
31+
- };
32+
+ }
33+
34+
$purchaseOrder->setStatus(PurchaseOrderInterface::STATUS_ORDER_IN_PROGRESS);
35+
$this->purchaseOrderRepository->save($purchaseOrder);
36+
+ }
37+
38+
+ /**
39+
+ * Fetch quote using quiteId
40+
+ *
41+
+ * @param int|string $quoteId
42+
+ * @param string $purchaseOrderIncrementId
43+
+ * @return CartInterface
44+
+ * @throws LocalizedException
45+
+ */
46+
+ private function getQuote($quoteId, string $purchaseOrderIncrementId): CartInterface
47+
+ {
48+
try {
49+
- $quote = $this->quoteRepository->get($purchaseOrder->getQuoteId());
50+
+ return $this->quoteRepository->get((int)$quoteId);
51+
} catch (NoSuchEntityException $e) {
52+
throw new LocalizedException(
53+
__(
54+
'Order cannot be placed with purchase order #%1.',
55+
- $purchaseOrder->getIncrementId()
56+
+ $purchaseOrderIncrementId
57+
)
58+
);
59+
}
60+
+ }
61+
62+
+ /**
63+
+ * Process order and send email for order confirmation
64+
+ *
65+
+ * @param PurchaseOrderInterface $purchaseOrder
66+
+ * @param CartInterface $quote
67+
+ * @param mixed $actorId
68+
+ * @return OrderInterface
69+
+ * @throws LocalizedException
70+
+ */
71+
+ private function processOrder(
72+
+ PurchaseOrderInterface $purchaseOrder,
73+
+ CartInterface $quote,
74+
+ $actorId = null
75+
+ ): OrderInterface {
76+
try {
77+
$this->storeManager->setCurrentStore($quote->getStore()->getId());
78+
$order = $this->placeOrder($quote);
79+
- $purchaseOrder->setOrderId($order->getId());
80+
- $purchaseOrder->setOrderIncrementId($order->getIncrementId());
81+
- $purchaseOrder->setStatus(PurchaseOrderInterface::STATUS_ORDER_PLACED);
82+
- $this->purchaseOrderRepository->save($purchaseOrder);
83+
- $this->purchaseOrderLogManagement->logAction(
84+
- $purchaseOrder,
85+
- 'place_order',
86+
- [
87+
- 'increment_id' => $purchaseOrder->getIncrementId(),
88+
- 'order_increment_id' => $order->getIncrementId()
89+
- ],
90+
- $actorId
91+
- );
92+
-
93+
- /** @var NegotiableQuoteInterface $negotiableQuote */
94+
- $negotiableQuote = $quote->getExtensionAttributes()->getNegotiableQuote();
95+
-
96+
- if ($negotiableQuote !== null && $negotiableQuote->getQuoteId() !== null) {
97+
- $negotiableQuote->setStatus(NegotiableQuoteInterface::STATUS_ORDERED);
98+
- $this->quoteRepository->save($quote);
99+
- $this->negotiableQuoteHistory->updateLog($negotiableQuote->getQuoteId());
100+
- }
101+
-
102+
- $purchaseOrderIncrementId = $purchaseOrder->getIncrementId();
103+
- $orderIncrementId = $order->getIncrementId();
104+
- $grandTotal = $quote->getGrandTotal();
105+
- $this->logger->info(
106+
- "Purchase Order Id: {$purchaseOrderIncrementId} & Order Id: {$orderIncrementId} & Total: {$grandTotal}"
107+
- );
108+
- $this->orderEmailSender->send($order);
109+
-
110+
- /** @var NegotiableQuoteInterface $negotiableQuote */
111+
- $negotiableQuote = $quote->getExtensionAttributes()->getNegotiableQuote();
112+
-
113+
- if ($negotiableQuote !== null && $negotiableQuote->getQuoteId() !== null) {
114+
- $negotiableQuote->setStatus(NegotiableQuoteInterface::STATUS_ORDERED);
115+
- $this->quoteRepository->save($quote);
116+
- $this->negotiableQuoteHistory->updateLog($negotiableQuote->getQuoteId());
117+
+ $this->updatePurchaseOrderAfterOrderPlacement($purchaseOrder, $order, $actorId);
118+
+ $this->logPurchaseOrder($purchaseOrder, $order, $quote);
119+
+ if (!$order->getEmailSent()) {
120+
+ $this->orderEmailSender->send($order);
121+
}
122+
+ $this->updateNegotiableQuoteStatus($quote);
123+
return $order;
124+
} catch (LocalizedException $e) {
125+
$purchaseOrder->setStatus(PurchaseOrderInterface::STATUS_ORDER_FAILED);
126+
@@ -245,7 +251,7 @@ class PurchaseOrderManagement implements PurchaseOrderManagementInterface
127+
throw $e;
128+
} catch (\Exception $exception) {
129+
$this->logger->critical($exception);
130+
- $this->failOrderPlace($purchaseOrder, 'An error occurred on the server. Please try again.');
131+
+ $this->failOrderPlace($purchaseOrder, __('An error occurred on the server. Please try again.'));
132+
throw new LocalizedException(
133+
__('An error occurred on the server. Please try again.'),
134+
$exception
135+
@@ -253,6 +259,72 @@ class PurchaseOrderManagement implements PurchaseOrderManagementInterface
136+
}
137+
}
138+
139+
+ /**
140+
+ * Update purchase order once order is placed
141+
+ *
142+
+ * @param PurchaseOrderInterface $purchaseOrder
143+
+ * @param OrderInterface $order
144+
+ * @param mixed|null $actorId
145+
+ * @throws CouldNotSaveException
146+
+ * @throws InputException
147+
+ */
148+
+ private function updatePurchaseOrderAfterOrderPlacement(
149+
+ PurchaseOrderInterface $purchaseOrder,
150+
+ OrderInterface $order,
151+
+ $actorId = null
152+
+ ): void {
153+
+ $purchaseOrder->setOrderId($order->getId());
154+
+ $purchaseOrder->setOrderIncrementId($order->getIncrementId());
155+
+ $purchaseOrder->setStatus(PurchaseOrderInterface::STATUS_ORDER_PLACED);
156+
+ $this->purchaseOrderRepository->save($purchaseOrder);
157+
+ $this->purchaseOrderLogManagement->logAction(
158+
+ $purchaseOrder,
159+
+ 'place_order',
160+
+ [
161+
+ 'increment_id' => $purchaseOrder->getIncrementId(),
162+
+ 'order_increment_id' => $order->getIncrementId()
163+
+ ],
164+
+ $actorId
165+
+ );
166+
+ }
167+
+
168+
+ /**
169+
+ * Record purchase order log
170+
+ *
171+
+ * @param PurchaseOrderInterface $purchaseOrder
172+
+ * @param OrderInterface $order
173+
+ * @param CartInterface $quote
174+
+ */
175+
+ private function logPurchaseOrder(
176+
+ PurchaseOrderInterface $purchaseOrder,
177+
+ OrderInterface $order,
178+
+ CartInterface $quote
179+
+ ): void {
180+
+ $purchaseOrderIncrementId = $purchaseOrder->getIncrementId();
181+
+ $orderIncrementId = $order->getIncrementId();
182+
+ $grandTotal = $quote->getGrandTotal();
183+
+ $this->logger->info(
184+
+ "Purchase Order Id: {$purchaseOrderIncrementId} & Order Id: {$orderIncrementId} & Total: {$grandTotal}"
185+
+ );
186+
+ }
187+
+
188+
+ /**
189+
+ * Update negotiable quote if exits
190+
+ *
191+
+ * @param CartInterface $quote
192+
+ */
193+
+ private function updateNegotiableQuoteStatus(CartInterface $quote): void
194+
+ {
195+
+ /** @var NegotiableQuoteInterface $negotiableQuote */
196+
+ $negotiableQuote = $quote->getExtensionAttributes()->getNegotiableQuote();
197+
+
198+
+ if ($negotiableQuote !== null && $negotiableQuote->getQuoteId() !== null) {
199+
+ $negotiableQuote->setStatus(NegotiableQuoteInterface::STATUS_ORDERED);
200+
+ $this->quoteRepository->save($quote);
201+
+ $this->negotiableQuoteHistory->updateLog($negotiableQuote->getQuoteId());
202+
+ }
203+
+ }
204+
+
205+
/**
206+
* Process order placement failure.
207+
*
+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git a/vendor/magento/module-reward/etc/di.xml b/vendor/magento/module-reward/etc/di.xml
2+
index 8f22890357ae..c8731777c4cc 100644
3+
--- a/vendor/magento/module-reward/etc/di.xml
4+
+++ b/vendor/magento/module-reward/etc/di.xml
5+
@@ -1,8 +1,22 @@
6+
<?xml version="1.0"?>
7+
<!--
8+
-/**
9+
- * Copyright © Magento, Inc. All rights reserved.
10+
- * See COPYING.txt for license details.
11+
+/************************************************************************
12+
+ *
13+
+ * ADOBE CONFIDENTIAL
14+
+ * ___________________
15+
+ *
16+
+ * Copyright 2014 Adobe
17+
+ * All Rights Reserved.
18+
+ *
19+
+ * NOTICE: All information contained herein is, and remains
20+
+ * the property of Adobe and its suppliers, if any. The intellectual
21+
+ * and technical concepts contained herein are proprietary to Adobe
22+
+ * and its suppliers and are protected by all applicable intellectual
23+
+ * property laws, including trade secret and copyright laws.
24+
+ * Dissemination of this information or reproduction of this material
25+
+ * is strictly forbidden unless prior written permission is obtained
26+
+ * from Adobe.
27+
+ * ************************************************************************
28+
*/
29+
-->
30+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
31+
@@ -38,6 +52,7 @@
32+
<arguments>
33+
<argument name="systemAttributes" xsi:type="array">
34+
<item name="reward_update_notification" xsi:type="string">reward_update_notification</item>
35+
+ <item name="reward_warning_notification" xsi:type="string">reward_warning_notification</item>
36+
</argument>
37+
</arguments>
38+
</type>
39+

0 commit comments

Comments
 (0)