Skip to content

Commit

Permalink
🔃 [EngCom] Public Pull Requests - 2.2-develop
Browse files Browse the repository at this point in the history
Accepted Public Pull Requests:
 - #22086: [Backport] Fix eav form foreach error #21134 (by @wojtekn)
 - #21512: [Backport] Fix: Cart is emptied when enter is pressed after changing product quantity (by @lfluvisotto)
 - #22037: [Backport] Root exception not logged on QuoteManagement::submitQuote (by @larsroettig)


Fixed GitHub Issues:
 - #21134: Invalid argument supplied for foreach thrown in EAV code  (reported by @wojtekn) has been fixed in #22086 by @wojtekn in 2.2-develop branch
   Related commits:
     1. a1d6ed6
     2. a7511e0

 - #21499: Cart is emptied when enter is pressed after changing product quantity (reported by @wojtekn) has been fixed in #21512 by @lfluvisotto in 2.2-develop branch
   Related commits:
     1. 5a73640
     2. f4a83f6
     3. 5d0245d

 - #14926: "Rolled back transaction has not been completed correctly" on Magento 2.2.3 (reported by @Poonika) has been fixed in #22037 by @larsroettig in 2.2-develop branch
   Related commits:
     1. d91acbe
     2. 9141077
     3. 0168b1f

 - #18752: Rolled back transaction has not been completed correctly" on Magento 2.1.15 (reported by @adammprost) has been fixed in #22037 by @larsroettig in 2.2-develop branch
   Related commits:
     1. d91acbe
     2. 9141077
     3. 0168b1f
  • Loading branch information
magento-engcom-team authored Apr 5, 2019
2 parents 1117583 + 452e823 commit 9d4f9a0
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ define([
_create: function () {
var items, i;

$(this.options.emptyCartButton).on('click', $.proxy(function () {
$(this.options.emptyCartButton).on('click', $.proxy(function (event) {
if (event.detail === 0) {
return;
}

$(this.options.emptyCartButton).attr('name', 'update_cart_action_temp');
$(this.options.updateCartActionContainer)
.attr('name', 'update_cart_action').attr('value', 'empty_cart');
Expand Down
5 changes: 4 additions & 1 deletion app/code/Magento/Eav/Model/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,8 @@ public function getFormCode()
}

/**
* Return entity type instance
* Return entity type instance.
*
* Return EAV entity type if entity type is not defined
*
* @return \Magento\Eav\Model\Entity\Type
Expand Down Expand Up @@ -323,6 +324,8 @@ public function getAttributes()
if ($this->_attributes === null) {
$this->_attributes = [];
$this->_userAttributes = [];
$this->_systemAttributes = [];
$this->_allowedAttributes = [];
/** @var $attribute \Magento\Eav\Model\Attribute */
foreach ($this->_getFilteredFormAttributeCollection() as $attribute) {
$this->_attributes[$attribute->getAttributeCode()] = $attribute;
Expand Down
51 changes: 38 additions & 13 deletions app/code/Magento/Quote/Model/QuoteManagement.php
Original file line number Diff line number Diff line change
Expand Up @@ -529,19 +529,7 @@ protected function submitQuote(QuoteEntity $quote, $orderData = [])
);
$this->quoteRepository->save($quote);
} catch (\Exception $e) {
if (!empty($this->addressesToSync)) {
foreach ($this->addressesToSync as $addressId) {
$this->addressRepository->deleteById($addressId);
}
}
$this->eventManager->dispatch(
'sales_model_service_quote_submit_failure',
[
'order' => $order,
'quote' => $quote,
'exception' => $e
]
);
$this->rollbackAddresses($quote, $order, $e);
throw $e;
}
return $order;
Expand Down Expand Up @@ -608,4 +596,41 @@ protected function _prepareCustomerQuote($quote)
$shipping->setIsDefaultBilling(true);
}
}

/**
* Remove related to order and quote addresses and submit exception to further processing.
*
* @param Quote $quote
* @param \Magento\Sales\Api\Data\OrderInterface $order
* @param \Exception $e
* @throws \Exception
*/
private function rollbackAddresses(
QuoteEntity $quote,
\Magento\Sales\Api\Data\OrderInterface $order,
\Exception $e
): void {
try {
if (!empty($this->addressesToSync)) {
foreach ($this->addressesToSync as $addressId) {
$this->addressRepository->deleteById($addressId);
}
}
$this->eventManager->dispatch(
'sales_model_service_quote_submit_failure',
[
'order' => $order,
'quote' => $quote,
'exception' => $e,
]
);
} catch (\Exception $consecutiveException) {
$message = sprintf(
"An exception occurred on 'sales_model_service_quote_submit_failure' event: %s",
$consecutiveException->getMessage()
);

throw new \Exception($message, 0, $e);
}
}
}

0 comments on commit 9d4f9a0

Please sign in to comment.