-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #175 from magento-commerce/1.1.55-release
1.1.55 Release
- Loading branch information
Showing
26 changed files
with
4,019 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
diff --git a/vendor/magento/module-banner/Model/Banner/Data.php b/vendor/magento/module-banner/Model/Banner/Data.php | ||
index 271fb8d5befc..cbc136116d3f 100644 | ||
--- a/vendor/magento/module-banner/Model/Banner/Data.php | ||
+++ b/vendor/magento/module-banner/Model/Banner/Data.php | ||
@@ -290,7 +290,7 @@ private function getBannerIdsByCatalogRules() | ||
private function getProductRelatedBannerIds(int $productId): array | ||
{ | ||
$result = $this->catalogRule->getRulesFromProduct( | ||
- $this->dateTime->scopeDate($this->storeManager->getStore()->getId()), | ||
+ $this->dateTime->scopeDate($this->storeManager->getStore()->getId(), includeTime: true)->getTimestamp(), | ||
$this->storeManager->getWebsite()->getId(), | ||
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP), | ||
$productId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
diff --git a/vendor/magento/module-purchase-order/Model/CommentManagement.php b/vendor/magento/module-purchase-order/Model/CommentManagement.php | ||
index d5cbb7b9fe8e..228d9216b3eb 100644 | ||
--- a/vendor/magento/module-purchase-order/Model/CommentManagement.php | ||
+++ b/vendor/magento/module-purchase-order/Model/CommentManagement.php | ||
@@ -6,6 +6,7 @@ | ||
|
||
namespace Magento\PurchaseOrder\Model; | ||
|
||
+use Magento\Framework\App\ObjectManager; | ||
use Magento\Framework\Exception\LocalizedException; | ||
use Magento\PurchaseOrder\Api\Data\CommentInterface; | ||
use Magento\PurchaseOrder\Api\Data\CommentInterfaceFactory; | ||
@@ -25,7 +26,7 @@ class CommentManagement | ||
private $commentCollectionFactory; | ||
|
||
/** | ||
- * @var CommentFactory | ||
+ * @var CommentInterfaceFactory | ||
*/ | ||
private $commentFactory; | ||
|
||
@@ -34,19 +35,28 @@ class CommentManagement | ||
*/ | ||
private $notifier; | ||
|
||
+ /** | ||
+ * @var CommentRepositoryInterface | ||
+ */ | ||
+ private $commentRepository; | ||
+ | ||
/** | ||
* @param CommentInterfaceFactory $commentFactory | ||
* @param CommentCollectionFactory $commentCollectionFactory | ||
* @param NotifierInterface $notifier | ||
+ * @param CommentRepositoryInterface|null $commentRepository | ||
*/ | ||
public function __construct( | ||
CommentInterfaceFactory $commentFactory, | ||
CommentCollectionFactory $commentCollectionFactory, | ||
- NotifierInterface $notifier | ||
+ NotifierInterface $notifier, | ||
+ ?CommentRepositoryInterface $commentRepository = null | ||
) { | ||
$this->commentFactory = $commentFactory; | ||
$this->commentCollectionFactory = $commentCollectionFactory; | ||
$this->notifier = $notifier; | ||
+ $this->commentRepository = $commentRepository ?: | ||
+ ObjectManager::getInstance()->get(CommentRepositoryInterface::class); | ||
} | ||
|
||
/** | ||
@@ -71,6 +81,7 @@ public function addComment( | ||
|
||
$comment->save(); | ||
|
||
+ $comment = $this->commentRepository->get($comment->getEntityId()); | ||
$this->notifier->notifyOnAction($comment->getEntityId(), CommentAdded::class); | ||
|
||
return $comment; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,207 @@ | ||
diff --git a/vendor/magento/module-purchase-order/Model/PurchaseOrderManagement.php b/vendor/magento/module-purchase-order/Model/PurchaseOrderManagement.php | ||
index 26c100baa1..2c52beab06 100644 | ||
--- a/vendor/magento/module-purchase-order/Model/PurchaseOrderManagement.php | ||
+++ b/vendor/magento/module-purchase-order/Model/PurchaseOrderManagement.php | ||
@@ -171,7 +171,20 @@ class PurchaseOrderManagement implements PurchaseOrderManagementInterface | ||
/** | ||
* @inheritdoc | ||
*/ | ||
- public function createSalesOrder(PurchaseOrderInterface $purchaseOrder, $actorId = null) : OrderInterface | ||
+ public function createSalesOrder(PurchaseOrderInterface $purchaseOrder, $actorId = null): OrderInterface | ||
+ { | ||
+ $this->validatePurchaseOrderAndUpdateStatus($purchaseOrder); | ||
+ $quote = $this->getQuote($purchaseOrder->getQuoteId(), (string)$purchaseOrder->getIncrementId()); | ||
+ return $this->processOrder($purchaseOrder, $quote, $actorId); | ||
+ } | ||
+ | ||
+ /** | ||
+ * Validate purchase order and set correct status | ||
+ * | ||
+ * @param PurchaseOrderInterface $purchaseOrder | ||
+ * @throws LocalizedException | ||
+ */ | ||
+ private function validatePurchaseOrderAndUpdateStatus(PurchaseOrderInterface $purchaseOrder): void | ||
{ | ||
if (!$this->validatorLocator->getValidator('placeorder')->validate($purchaseOrder)) { | ||
throw new LocalizedException( | ||
@@ -180,64 +193,57 @@ class PurchaseOrderManagement implements PurchaseOrderManagementInterface | ||
$purchaseOrder->getIncrementId() | ||
) | ||
); | ||
- }; | ||
+ } | ||
|
||
$purchaseOrder->setStatus(PurchaseOrderInterface::STATUS_ORDER_IN_PROGRESS); | ||
$this->purchaseOrderRepository->save($purchaseOrder); | ||
+ } | ||
|
||
+ /** | ||
+ * Fetch quote using quiteId | ||
+ * | ||
+ * @param int|string $quoteId | ||
+ * @param string $purchaseOrderIncrementId | ||
+ * @return CartInterface | ||
+ * @throws LocalizedException | ||
+ */ | ||
+ private function getQuote($quoteId, string $purchaseOrderIncrementId): CartInterface | ||
+ { | ||
try { | ||
- $quote = $this->quoteRepository->get($purchaseOrder->getQuoteId()); | ||
+ return $this->quoteRepository->get((int)$quoteId); | ||
} catch (NoSuchEntityException $e) { | ||
throw new LocalizedException( | ||
__( | ||
'Order cannot be placed with purchase order #%1.', | ||
- $purchaseOrder->getIncrementId() | ||
+ $purchaseOrderIncrementId | ||
) | ||
); | ||
} | ||
+ } | ||
|
||
+ /** | ||
+ * Process order and send email for order confirmation | ||
+ * | ||
+ * @param PurchaseOrderInterface $purchaseOrder | ||
+ * @param CartInterface $quote | ||
+ * @param mixed $actorId | ||
+ * @return OrderInterface | ||
+ * @throws LocalizedException | ||
+ */ | ||
+ private function processOrder( | ||
+ PurchaseOrderInterface $purchaseOrder, | ||
+ CartInterface $quote, | ||
+ $actorId = null | ||
+ ): OrderInterface { | ||
try { | ||
$this->storeManager->setCurrentStore($quote->getStore()->getId()); | ||
$order = $this->placeOrder($quote); | ||
- $purchaseOrder->setOrderId($order->getId()); | ||
- $purchaseOrder->setOrderIncrementId($order->getIncrementId()); | ||
- $purchaseOrder->setStatus(PurchaseOrderInterface::STATUS_ORDER_PLACED); | ||
- $this->purchaseOrderRepository->save($purchaseOrder); | ||
- $this->purchaseOrderLogManagement->logAction( | ||
- $purchaseOrder, | ||
- 'place_order', | ||
- [ | ||
- 'increment_id' => $purchaseOrder->getIncrementId(), | ||
- 'order_increment_id' => $order->getIncrementId() | ||
- ], | ||
- $actorId | ||
- ); | ||
- | ||
- /** @var NegotiableQuoteInterface $negotiableQuote */ | ||
- $negotiableQuote = $quote->getExtensionAttributes()->getNegotiableQuote(); | ||
- | ||
- if ($negotiableQuote !== null && $negotiableQuote->getQuoteId() !== null) { | ||
- $negotiableQuote->setStatus(NegotiableQuoteInterface::STATUS_ORDERED); | ||
- $this->quoteRepository->save($quote); | ||
- $this->negotiableQuoteHistory->updateLog($negotiableQuote->getQuoteId()); | ||
- } | ||
- | ||
- $purchaseOrderIncrementId = $purchaseOrder->getIncrementId(); | ||
- $orderIncrementId = $order->getIncrementId(); | ||
- $grandTotal = $quote->getGrandTotal(); | ||
- $this->logger->info( | ||
- "Purchase Order Id: {$purchaseOrderIncrementId} & Order Id: {$orderIncrementId} & Total: {$grandTotal}" | ||
- ); | ||
- $this->orderEmailSender->send($order); | ||
- | ||
- /** @var NegotiableQuoteInterface $negotiableQuote */ | ||
- $negotiableQuote = $quote->getExtensionAttributes()->getNegotiableQuote(); | ||
- | ||
- if ($negotiableQuote !== null && $negotiableQuote->getQuoteId() !== null) { | ||
- $negotiableQuote->setStatus(NegotiableQuoteInterface::STATUS_ORDERED); | ||
- $this->quoteRepository->save($quote); | ||
- $this->negotiableQuoteHistory->updateLog($negotiableQuote->getQuoteId()); | ||
+ $this->updatePurchaseOrderAfterOrderPlacement($purchaseOrder, $order, $actorId); | ||
+ $this->logPurchaseOrder($purchaseOrder, $order, $quote); | ||
+ if (!$order->getEmailSent()) { | ||
+ $this->orderEmailSender->send($order); | ||
} | ||
+ $this->updateNegotiableQuoteStatus($quote); | ||
return $order; | ||
} catch (LocalizedException $e) { | ||
$purchaseOrder->setStatus(PurchaseOrderInterface::STATUS_ORDER_FAILED); | ||
@@ -245,7 +251,7 @@ class PurchaseOrderManagement implements PurchaseOrderManagementInterface | ||
throw $e; | ||
} catch (\Exception $exception) { | ||
$this->logger->critical($exception); | ||
- $this->failOrderPlace($purchaseOrder, 'An error occurred on the server. Please try again.'); | ||
+ $this->failOrderPlace($purchaseOrder, __('An error occurred on the server. Please try again.')); | ||
throw new LocalizedException( | ||
__('An error occurred on the server. Please try again.'), | ||
$exception | ||
@@ -253,6 +259,72 @@ class PurchaseOrderManagement implements PurchaseOrderManagementInterface | ||
} | ||
} | ||
|
||
+ /** | ||
+ * Update purchase order once order is placed | ||
+ * | ||
+ * @param PurchaseOrderInterface $purchaseOrder | ||
+ * @param OrderInterface $order | ||
+ * @param mixed|null $actorId | ||
+ * @throws CouldNotSaveException | ||
+ * @throws InputException | ||
+ */ | ||
+ private function updatePurchaseOrderAfterOrderPlacement( | ||
+ PurchaseOrderInterface $purchaseOrder, | ||
+ OrderInterface $order, | ||
+ $actorId = null | ||
+ ): void { | ||
+ $purchaseOrder->setOrderId($order->getId()); | ||
+ $purchaseOrder->setOrderIncrementId($order->getIncrementId()); | ||
+ $purchaseOrder->setStatus(PurchaseOrderInterface::STATUS_ORDER_PLACED); | ||
+ $this->purchaseOrderRepository->save($purchaseOrder); | ||
+ $this->purchaseOrderLogManagement->logAction( | ||
+ $purchaseOrder, | ||
+ 'place_order', | ||
+ [ | ||
+ 'increment_id' => $purchaseOrder->getIncrementId(), | ||
+ 'order_increment_id' => $order->getIncrementId() | ||
+ ], | ||
+ $actorId | ||
+ ); | ||
+ } | ||
+ | ||
+ /** | ||
+ * Record purchase order log | ||
+ * | ||
+ * @param PurchaseOrderInterface $purchaseOrder | ||
+ * @param OrderInterface $order | ||
+ * @param CartInterface $quote | ||
+ */ | ||
+ private function logPurchaseOrder( | ||
+ PurchaseOrderInterface $purchaseOrder, | ||
+ OrderInterface $order, | ||
+ CartInterface $quote | ||
+ ): void { | ||
+ $purchaseOrderIncrementId = $purchaseOrder->getIncrementId(); | ||
+ $orderIncrementId = $order->getIncrementId(); | ||
+ $grandTotal = $quote->getGrandTotal(); | ||
+ $this->logger->info( | ||
+ "Purchase Order Id: {$purchaseOrderIncrementId} & Order Id: {$orderIncrementId} & Total: {$grandTotal}" | ||
+ ); | ||
+ } | ||
+ | ||
+ /** | ||
+ * Update negotiable quote if exits | ||
+ * | ||
+ * @param CartInterface $quote | ||
+ */ | ||
+ private function updateNegotiableQuoteStatus(CartInterface $quote): void | ||
+ { | ||
+ /** @var NegotiableQuoteInterface $negotiableQuote */ | ||
+ $negotiableQuote = $quote->getExtensionAttributes()->getNegotiableQuote(); | ||
+ | ||
+ if ($negotiableQuote !== null && $negotiableQuote->getQuoteId() !== null) { | ||
+ $negotiableQuote->setStatus(NegotiableQuoteInterface::STATUS_ORDERED); | ||
+ $this->quoteRepository->save($quote); | ||
+ $this->negotiableQuoteHistory->updateLog($negotiableQuote->getQuoteId()); | ||
+ } | ||
+ } | ||
+ | ||
/** | ||
* Process order placement failure. | ||
* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
diff --git a/vendor/magento/module-reward/etc/di.xml b/vendor/magento/module-reward/etc/di.xml | ||
index 8f22890357ae..c8731777c4cc 100644 | ||
--- a/vendor/magento/module-reward/etc/di.xml | ||
+++ b/vendor/magento/module-reward/etc/di.xml | ||
@@ -1,8 +1,22 @@ | ||
<?xml version="1.0"?> | ||
<!-- | ||
-/** | ||
- * Copyright © Magento, Inc. All rights reserved. | ||
- * See COPYING.txt for license details. | ||
+/************************************************************************ | ||
+ * | ||
+ * ADOBE CONFIDENTIAL | ||
+ * ___________________ | ||
+ * | ||
+ * Copyright 2014 Adobe | ||
+ * All Rights Reserved. | ||
+ * | ||
+ * NOTICE: All information contained herein is, and remains | ||
+ * the property of Adobe and its suppliers, if any. The intellectual | ||
+ * and technical concepts contained herein are proprietary to Adobe | ||
+ * and its suppliers and are protected by all applicable intellectual | ||
+ * property laws, including trade secret and copyright laws. | ||
+ * Dissemination of this information or reproduction of this material | ||
+ * is strictly forbidden unless prior written permission is obtained | ||
+ * from Adobe. | ||
+ * ************************************************************************ | ||
*/ | ||
--> | ||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> | ||
@@ -38,6 +52,7 @@ | ||
<arguments> | ||
<argument name="systemAttributes" xsi:type="array"> | ||
<item name="reward_update_notification" xsi:type="string">reward_update_notification</item> | ||
+ <item name="reward_warning_notification" xsi:type="string">reward_warning_notification</item> | ||
</argument> | ||
</arguments> | ||
</type> | ||
|
Oops, something went wrong.