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:
 - #22465: [Backport] [Fixed] Full Tax Summary missing calculation Admin create order (by @saphaljha)
 - #22108: [Backport] #21786 Fix the issue with asynchronous email sending for the sales entities (by @serhiyzhovnir)
 - #22473: [Backport] Qty box visibility issue in wishlist when product is out of stock (by @niravkrish)
 - #22471: [Backport] Fixed Changing sample for downloadable product failure (by @ravi-chandra3197)


Fixed GitHub Issues:
 - #21786: Asynchronous email sending for the sales entities which were created with disabled email sending (reported by @serhiyzhovnir) has been fixed in #22108 by @serhiyzhovnir in 2.2-develop branch
   Related commits:
     1. 3751e4b

 - #6272: Changing sample for downloadable product failure (reported by @bartoszkubicki) has been fixed in #22471 by @ravi-chandra3197 in 2.2-develop branch
   Related commits:
     1. 9aff2a9
     2. 03db558
  • Loading branch information
magento-engcom-team authored Apr 25, 2019
2 parents 238f457 + 81576b6 commit c1aa3b2
Show file tree
Hide file tree
Showing 17 changed files with 52 additions and 35 deletions.
7 changes: 5 additions & 2 deletions app/code/Magento/Downloadable/Model/SampleRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,11 @@ protected function updateSample(
$existingSample->setTitle($sample->getTitle());
}

if ($sample->getSampleType() === 'file' && $sample->getSampleFileContent() === null) {
$sample->setSampleFile($existingSample->getSampleFile());
if ($sample->getSampleType() === 'file'
&& $sample->getSampleFileContent() === null
&& $sample->getSampleFile() !== null
) {
$existingSample->setSampleFile($sample->getSampleFile());
}
$this->saveSample($product, $sample, $isGlobalScopeContent);
return $existingSample->getId();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ public function __construct(
* @param bool $forceSyncMode
*
* @return bool
* @throws \Exception
*/
public function send(
\Magento\Sales\Api\Data\OrderInterface $order,
\Magento\Sales\Api\Data\CreditmemoInterface $creditmemo,
\Magento\Sales\Api\Data\CreditmemoCommentCreationInterface $comment = null,
$forceSyncMode = false
) {
$creditmemo->setSendEmail(true);
$creditmemo->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$transport = [
Expand Down Expand Up @@ -145,6 +146,7 @@ public function send(
* @param \Magento\Sales\Api\Data\OrderInterface $order
*
* @return string
* @throws \Exception
*/
private function getPaymentHtml(\Magento\Sales\Api\Data\OrderInterface $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ public function __construct(
* @param Creditmemo $creditmemo
* @param bool $forceSyncMode
* @return bool
* @throws \Exception
*/
public function send(Creditmemo $creditmemo, $forceSyncMode = false)
{
$creditmemo->setSendEmail(true);
$creditmemo->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$order = $creditmemo->getOrder();
Expand Down Expand Up @@ -146,6 +147,7 @@ public function send(Creditmemo $creditmemo, $forceSyncMode = false)
*
* @param Order $order
* @return string
* @throws \Exception
*/
protected function getPaymentHtml(Order $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ public function __construct(
* @param Invoice $invoice
* @param bool $forceSyncMode
* @return bool
* @throws \Exception
*/
public function send(Invoice $invoice, $forceSyncMode = false)
{
$invoice->setSendEmail(true);
$invoice->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$order = $invoice->getOrder();
Expand Down Expand Up @@ -146,6 +147,7 @@ public function send(Invoice $invoice, $forceSyncMode = false)
*
* @param Order $order
* @return string
* @throws \Exception
*/
protected function getPaymentHtml(Order $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,11 @@ public function __construct(
* @param Shipment $shipment
* @param bool $forceSyncMode
* @return bool
* @throws \Exception
*/
public function send(Shipment $shipment, $forceSyncMode = false)
{
$shipment->setSendEmail(true);
$shipment->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$order = $shipment->getOrder();
Expand Down Expand Up @@ -146,6 +147,7 @@ public function send(Shipment $shipment, $forceSyncMode = false)
*
* @param Order $order
* @return string
* @throws \Exception
*/
protected function getPaymentHtml(Order $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ public function __construct(
* @param bool $forceSyncMode
*
* @return bool
* @throws \Exception
*/
public function send(
\Magento\Sales\Api\Data\OrderInterface $order,
\Magento\Sales\Api\Data\InvoiceInterface $invoice,
\Magento\Sales\Api\Data\InvoiceCommentCreationInterface $comment = null,
$forceSyncMode = false
) {
$invoice->setSendEmail(true);
$invoice->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$transport = [
Expand Down Expand Up @@ -145,6 +146,7 @@ public function send(
* @param \Magento\Sales\Api\Data\OrderInterface $order
*
* @return string
* @throws \Exception
*/
private function getPaymentHtml(\Magento\Sales\Api\Data\OrderInterface $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,15 @@ public function __construct(
* @param bool $forceSyncMode
*
* @return bool
* @throws \Exception
*/
public function send(
\Magento\Sales\Api\Data\OrderInterface $order,
\Magento\Sales\Api\Data\ShipmentInterface $shipment,
\Magento\Sales\Api\Data\ShipmentCommentCreationInterface $comment = null,
$forceSyncMode = false
) {
$shipment->setSendEmail(true);
$shipment->setSendEmail($this->identityContainer->isEnabled());

if (!$this->globalConfig->getValue('sales_email/general/async_sending') || $forceSyncMode) {
$transport = [
Expand Down Expand Up @@ -145,6 +146,7 @@ public function send(
* @param \Magento\Sales\Api\Data\OrderInterface $order
*
* @return string
* @throws \Exception
*/
private function getPaymentHtml(\Magento\Sales\Api\Data\OrderInterface $order)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending

$this->creditmemoMock->expects($this->once())
->method('setSendEmail')
->with(true);
->with($emailSendingResult);

if (!$configValue || $forceSyncMode) {
$transport = [
Expand Down Expand Up @@ -279,7 +279,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending
->method('setTemplateVars')
->with($transport->getData());

$this->identityContainerMock->expects($this->once())
$this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn($emailSendingResult);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $ema

$this->creditmemoMock->expects($this->once())
->method('setSendEmail')
->with(true);
->with($emailSendingResult);

$this->globalConfig->expects($this->once())
->method('getValue')
Expand Down Expand Up @@ -130,7 +130,7 @@ public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $ema
]
);

$this->identityContainerMock->expects($this->once())
$this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn($emailSendingResult);

Expand Down Expand Up @@ -197,6 +197,8 @@ public function sendDataProvider()
* @param bool $isVirtualOrder
* @param int $formatCallCount
* @param string|null $expectedShippingAddress
*
* @return void
* @dataProvider sendVirtualOrderDataProvider
*/
public function testSendVirtualOrder($isVirtualOrder, $formatCallCount, $expectedShippingAddress)
Expand All @@ -207,7 +209,7 @@ public function testSendVirtualOrder($isVirtualOrder, $formatCallCount, $expecte

$this->creditmemoMock->expects($this->once())
->method('setSendEmail')
->with(true);
->with(false);

$this->globalConfig->expects($this->once())
->method('getValue')
Expand Down Expand Up @@ -242,7 +244,7 @@ public function testSendVirtualOrder($isVirtualOrder, $formatCallCount, $expecte
]
);

$this->identityContainerMock->expects($this->once())
$this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $ema

$this->invoiceMock->expects($this->once())
->method('setSendEmail')
->with(true);
->with($emailSendingResult);

$this->globalConfig->expects($this->once())
->method('getValue')
Expand Down Expand Up @@ -136,7 +136,7 @@ public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $ema
]
);

$this->identityContainerMock->expects($this->once())
$this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn($emailSendingResult);

Expand Down Expand Up @@ -212,7 +212,7 @@ public function testSendVirtualOrder($isVirtualOrder, $formatCallCount, $expecte

$this->invoiceMock->expects($this->once())
->method('setSendEmail')
->with(true);
->with(false);

$this->globalConfig->expects($this->once())
->method('getValue')
Expand Down Expand Up @@ -247,7 +247,7 @@ public function testSendVirtualOrder($isVirtualOrder, $formatCallCount, $expecte
]
);

$this->identityContainerMock->expects($this->once())
$this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn(false);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $ema

$this->shipmentMock->expects($this->once())
->method('setSendEmail')
->with(true);
->with($emailSendingResult);

$this->globalConfig->expects($this->once())
->method('getValue')
Expand Down Expand Up @@ -136,7 +136,7 @@ public function testSend($configValue, $forceSyncMode, $customerNoteNotify, $ema
]
);

$this->identityContainerMock->expects($this->once())
$this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn($emailSendingResult);

Expand Down Expand Up @@ -212,7 +212,7 @@ public function testSendVirtualOrder($isVirtualOrder, $formatCallCount, $expecte

$this->shipmentMock->expects($this->once())
->method('setSendEmail')
->with(true);
->with(false);

$this->globalConfig->expects($this->once())
->method('getValue')
Expand Down Expand Up @@ -247,7 +247,7 @@ public function testSendVirtualOrder($isVirtualOrder, $formatCallCount, $expecte
]
);

$this->identityContainerMock->expects($this->once())
$this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn(false);
$this->shipmentResourceMock->expects($this->once())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending

$this->invoiceMock->expects($this->once())
->method('setSendEmail')
->with(true);
->with($emailSendingResult);

if (!$configValue || $forceSyncMode) {
$transport = [
Expand Down Expand Up @@ -277,7 +277,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending
->method('setTemplateVars')
->with($transport->getData());

$this->identityContainerMock->expects($this->once())
$this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn($emailSendingResult);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending

$this->shipmentMock->expects($this->once())
->method('setSendEmail')
->with(true);
->with($emailSendingResult);

if (!$configValue || $forceSyncMode) {
$transport = [
Expand Down Expand Up @@ -279,7 +279,7 @@ public function testSend($configValue, $forceSyncMode, $isComment, $emailSending
->method('setTemplateVars')
->with($transport->getData());

$this->identityContainerMock->expects($this->once())
$this->identityContainerMock->expects($this->exactly(2))
->method('isEnabled')
->willReturn($emailSendingResult);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ $taxAmount = $block->getTotal()->getValue();
<?php $percent = $info['percent']; ?>
<?php $amount = $info['amount']; ?>
<?php $rates = $info['rates']; ?>
<?php $isFirst = 1; ?>

<?php foreach ($rates as $rate): ?>
<tr class="summary-details-<?= /* @escapeNotVerified */ $taxIter ?> summary-details<?php if ($isTop): echo ' summary-details-first'; endif; ?>" style="display:none;">
Expand All @@ -44,13 +43,10 @@ $taxAmount = $block->getTotal()->getValue();
<?php endif; ?>
<br />
</td>
<?php if ($isFirst): ?>
<td style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="admin__total-amount" rowspan="<?= count($rates) ?>">
<?= /* @escapeNotVerified */ $block->formatPrice($amount) ?>
</td>
<?php endif; ?>
<td style="<?= /* @escapeNotVerified */ $block->getTotal()->getStyle() ?>" class="admin__total-amount">
<?= /* @escapeNotVerified */ $block->formatPrice(($amount*(float)$rate['percent'])/$percent) ?>
</td>
</tr>
<?php $isFirst = 0; ?>
<?php $isTop = 0; ?>
<?php endforeach; ?>
<?php endforeach; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ $allowedQty = $viewModel->setItem($item)->getMinMaxQty();
<label class="label" for="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]"><span><?= $block->escapeHtml(__('Qty')) ?></span></label>
<div class="control">
<input type="number" data-role="qty" id="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" class="input-text qty" data-validate="{'required-number':true,'validate-greater-than-zero':true,'validate-item-quantity':{'minAllowed':<?= /* @noEscape */ $allowedQty['minAllowed'] ?>,'maxAllowed':<?= /* @noEscape */ $allowedQty['maxAllowed'] ?>}}"
name="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" value="<?= /* @noEscape */ (int)($block->getAddToCartQty($item) * 1) ?>">
name="qty[<?= $block->escapeHtmlAttr($item->getId()) ?>]" value="<?= /* @noEscape */ (int)($block->getAddToCartQty($item) * 1) ?>" <?= $product->isSaleable() ? '' : 'disabled="disabled"' ?>>
</div>
</div>
<?php endif; ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ $item = $block->getItem();
<span><?= $block->escapeHtml(__('Comment')) ?></span>
</label>
<div class="control">
<textarea id="product-item-comment-<?= $block->escapeHtmlAttr($item->getWishlistItemId()) ?>" placeholder="<?= /* @noEscape */ $this->helper('Magento\Wishlist\Helper\Data')->defaultCommentString() ?>" name="description[<?= $block->escapeHtmlAttr($item->getWishlistItemId()) ?>]" title="<?= $block->escapeHtmlAttr(__('Comment')) ?>" class="product-item-comment"><?= ($block->escapeHtml($item->getDescription())) ?></textarea>
<textarea id="product-item-comment-<?= $block->escapeHtmlAttr($item->getWishlistItemId()) ?>" placeholder="<?= /* @noEscape */ $this->helper('Magento\Wishlist\Helper\Data')->defaultCommentString() ?>" name="description[<?= $block->escapeHtmlAttr($item->getWishlistItemId()) ?>]" title="<?= $block->escapeHtmlAttr(__('Comment')) ?>" class="product-item-comment" <?= $item->getProduct()->isSaleable() ? '' : 'disabled="disabled"' ?>><?= ($block->escapeHtml($item->getDescription())) ?></textarea>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,10 @@ public function testUpdateDownloadableProductSamplesWithNewFile()
'title' => 'sample2_updated',
'sort_order' => 2,
'sample_type' => 'file',
'sample_file_content' => [
'name' => 'sample2.jpg',
'file_data' => base64_encode(file_get_contents($this->testImagePath)),
],
];

$response[ExtensibleDataInterface::EXTENSION_ATTRIBUTES_KEY]["downloadable_product_samples"] =
Expand Down

0 comments on commit c1aa3b2

Please sign in to comment.