Skip to content

Commit 0a5218e

Browse files
Merge remote-tracking branch '36030/fix-for-issue-27474' into comm_jul
2 parents 2aac852 + 55f2a23 commit 0a5218e

File tree

15 files changed

+292
-86
lines changed

15 files changed

+292
-86
lines changed

app/code/Magento/Sales/Block/Adminhtml/Order/AbstractOrder.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,11 @@
2020
class AbstractOrder extends \Magento\Backend\Block\Widget
2121
{
2222
/**
23-
* Core registry
24-
*
2523
* @var \Magento\Framework\Registry
2624
*/
2725
protected $_coreRegistry = null;
2826

2927
/**
30-
* Admin helper
31-
*
3228
* @var \Magento\Sales\Helper\Admin
3329
*/
3430
protected $_adminHelper;

app/code/Magento/Sales/Block/Adminhtml/Order/View/Info.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ class Info extends \Magento\Sales\Block\Adminhtml\Order\AbstractOrder
3131
protected $groupRepository;
3232

3333
/**
34-
* Metadata element factory
35-
*
3634
* @var \Magento\Customer\Model\Metadata\ElementFactory
3735
*/
3836
protected $_metadataElementFactory;
@@ -161,8 +159,7 @@ public function getViewUrl($orderId)
161159
}
162160

163161
/**
164-
* Find sort order for account data
165-
* Sort Order used as array key
162+
* Find sort order for account data. Sort Order used as array key
166163
*
167164
* @param array $data
168165
* @param int $sortOrder
@@ -178,10 +175,10 @@ protected function _prepareAccountDataSortOrder(array $data, $sortOrder)
178175
}
179176

180177
/**
181-
* Return array of additional account data
182-
* Value is option style array
178+
* Return array of additional account data. Value is option style array
183179
*
184180
* @return array
181+
* @throws \Magento\Framework\Exception\LocalizedException
185182
*/
186183
public function getCustomerAccountData()
187184
{
@@ -286,6 +283,7 @@ public function getTimezoneForStore($store)
286283
*
287284
* @param string $createdAt
288285
* @return \DateTime
286+
* @throws \Exception
289287
*/
290288
public function getOrderAdminDate($createdAt)
291289
{

app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/View.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class View extends \Magento\Backend\App\Action implements HttpGetActionInterface
1515
*
1616
* @see _isAllowed()
1717
*/
18-
const ADMIN_RESOURCE = 'Magento_Sales::sales_creditmemo';
18+
public const ADMIN_RESOURCE = 'Magento_Sales::sales_creditmemo';
1919

2020
/**
2121
* @var \Magento\Sales\Controller\Adminhtml\Order\CreditmemoLoader
@@ -69,10 +69,12 @@ public function execute()
6969
$resultPage->setActiveMenu('Magento_Sales::sales_creditmemo');
7070
if ($creditmemo->getInvoice()) {
7171
$resultPage->getConfig()->getTitle()->prepend(
72-
__("View Memo for #%1", $creditmemo->getInvoice()->getIncrementId())
72+
__("View Credit Memo for #%1", $creditmemo->getInvoice()->getIncrementId())
7373
);
7474
} else {
75-
$resultPage->getConfig()->getTitle()->prepend(__("View Memo"));
75+
$resultPage->getConfig()->getTitle()->prepend(
76+
__('View Credit Memo #%1', $creditmemo->getIncrementId())
77+
);
7678
}
7779
return $resultPage;
7880
} else {

app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/View.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function execute()
5454
$resultPage = $this->resultPageFactory->create();
5555
$resultPage->setActiveMenu('Magento_Sales::sales_order');
5656
$resultPage->getConfig()->getTitle()->prepend(__('Invoices'));
57-
$resultPage->getConfig()->getTitle()->prepend(sprintf("#%s", $invoice->getIncrementId()));
57+
$resultPage->getConfig()->getTitle()->prepend(__('View Invoice #%1', $invoice->getIncrementId()));
5858
$resultPage->getLayout()->getBlock(
5959
'sales_invoice_view'
6060
)->updateBackButtonUrl(

app/code/Magento/Sales/Test/Mftf/Section/AdminInvoiceOrderInformationSection.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,7 @@
1717
<element name="customerEmail" type="text" selector=".order-account-information table tr:nth-of-type(2) > td a"/>
1818
<element name="customerGroup" type="text" selector=".order-account-information table tr:nth-of-type(3) > td"/>
1919
<element name="invoiceNoteComment" type="text" selector="div.note-list-comment"/>
20+
<element name="sendEmail" type="button" selector=".send-email"/>
21+
<element name="invoiceTitle" type="text" selector=".invoice-information .title"/>
2022
</section>
21-
</sections>
23+
</sections>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
9+
<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
10+
xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
11+
<test name="AdminInvoiceOrderInvoiceEmailSentTest" extends="AdminInvoiceOrderTest">
12+
<annotations>
13+
<features value="Sales"/>
14+
<stories value="Create an Invoice via the Admin and send email see confirmation"/>
15+
<title value="Admin should be able to see confirmation message Of invoice email"/>
16+
<description value="Admin should be able to see confirmation message Of invoice email"/>
17+
<severity value="MAJOR"/>
18+
<testCaseId value="git-36030"/>
19+
<group value="sales"/>
20+
<group value="cloud"/>
21+
</annotations>
22+
<remove keyForRemoval="checkIfOrderStatusIsProcessing"/>
23+
<click selector="{{AdminInvoiceOrderInformationSection.sendEmail}}" stepKey="clickSendEmail"/>
24+
<waitForElementVisible selector="{{AdminConfirmationModalSection.ok}}" stepKey="waitForConfirmationSendEmail"/>
25+
<click selector="{{AdminConfirmationModalSection.ok}}" stepKey="confirmSendEmail" />
26+
<grabTextFrom selector="{{AdminInvoiceOrderInformationSection.invoiceTitle}}" stepKey="grabTitle"/>
27+
<assertStringContainsString stepKey="assertSendEmailConfirmation">
28+
<actualResult type="const">$grabTitle</actualResult>
29+
<expectedResult type="string">The invoice confirmation email was sent</expectedResult>
30+
</assertStringContainsString>
31+
</test>
32+
</tests>

app/code/Magento/Sales/i18n/en_US.csv

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ Sales,Sales
216216
"You created the credit memo.","You created the credit memo."
217217
"We can't save the credit memo right now.","We can't save the credit memo right now."
218218
"We can't update the item's quantity right now.","We can't update the item's quantity right now."
219-
"View Memo for #%1","View Memo for #%1"
220-
"View Memo","View Memo"
219+
"View Credit Memo for #%1","View Credit Memo for #%1"
220+
"View Credit Memo #%1","View Credit Memo #%1"
221221
"You voided the credit memo.","You voided the credit memo."
222222
"We can't void the credit memo.","We can't void the credit memo."
223223
"The order no longer exists.","The order no longer exists."
@@ -807,6 +807,16 @@ If set YES Email field will be required during Admin order creation for new Cust
807807
"The coupon code has been removed.","The coupon code has been removed."
808808
"This creditmemo no longer exists.","This creditmemo no longer exists."
809809
"Add to address book","Add to address book"
810+
"View Invoice # %1","View Invoice # %1"
811+
"Invoice Information","Invoice Information"
812+
"The invoice confirmation email was sent","The invoice confirmation email was sent"
813+
"The invoice confirmation email is not sent","The invoice confirmation email is not sent"
814+
"Invoice # %1","Invoice # %1"
815+
"Credit Memo Information","Credit Memo Information"
816+
"The credit memo confirmation email was sent","The credit memo confirmation email was sent"
817+
"The credit memo confirmation email is not sent","The credit memo confirmation email is not sent"
818+
"Memo # %1","Memo # %1"
819+
"Credit Memo Date","Credit Memo Date"
810820
"Logo for PDF Print-outs","Logo for PDF Print-outs"
811821
"Please provide a comment text or update the order status to be able to submit a comment for this order.", "Please provide a comment text or update the order status to be able to submit a comment for this order."
812822
"A status change or comment text is required to submit a comment.", "A status change or comment text is required to submit a comment."

app/code/Magento/Sales/view/adminhtml/templates/order/creditmemo/view/form.phtml

Lines changed: 82 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,88 +7,142 @@
77
// phpcs:disable Magento2.Templates.ThisInTemplate
88

99
/* @var \Magento\Sales\Block\Adminhtml\Order\Creditmemo\View\Form $block */
10+
/* @var \Magento\Tax\Helper\Data $helper */
11+
/* @var \Magento\Framework\Escaper $escaper */
1012
?>
11-
<?php $_order = $block->getCreditmemo()->getOrder() ?>
13+
14+
<?php $helper = $this->helper(\Magento\Tax\Helper\Data::class); ?>
15+
<?php $_creditMemo = $block->getCreditmemo(); ?>
16+
<?php $_order = $_creditMemo->getOrder() ?>
17+
18+
<?php
19+
$creditMemoStatus = isset($_creditMemo->getStates()[$_creditMemo->getState()])
20+
? $_creditMemo->getStates()[$_creditMemo->getState()]
21+
: null;
22+
$memoAdminDate = $block->formatDate($_creditMemo->getCreatedAt(), \IntlDateFormatter::MEDIUM);
23+
?>
24+
25+
<div class="admin__page-section creditmemo-view-information">
26+
<div class="admin__page-section-title">
27+
<span class="title"><?= $escaper->escapeHtml(__('Credit Memo Information')) ?></span>
28+
</div>
29+
<div class="admin__page-section-content">
30+
<div class="admin__page-section-item creditmemo-information">
31+
<div class="admin__page-section-item-title">
32+
<?php $confirmationEmailStatusMessage = $_creditMemo->getEmailSent()
33+
? __('The credit memo confirmation email was sent')
34+
: __('The credit memo confirmation email is not sent');
35+
?>
36+
<span class="title">
37+
<?= $escaper->escapeHtml(__('Memo # %1', $_creditMemo->getIncrementId())) ?>
38+
(<span><?= $escaper->escapeHtml($confirmationEmailStatusMessage) ?></span>)
39+
</span>
40+
</div>
41+
<div class="admin__page-section-item-content">
42+
<table class="admin__table-secondary creditmemo-information-table">
43+
<tr>
44+
<th><?= $escaper->escapeHtml(__('Credit Memo Date')) ?></th>
45+
<td><?= $escaper->escapeHtml($memoAdminDate) ?></td>
46+
</tr>
47+
<?php if ($creditMemoStatus): ?>
48+
<tr>
49+
<th><?= $escaper->escapeHtml(__('Status')) ?></th>
50+
<td><?= $escaper->escapeHtml($creditMemoStatus) ?></td>
51+
</tr>
52+
<?php endif; ?>
53+
</table>
54+
</div>
55+
</div>
56+
</div>
57+
</div>
58+
1259
<?= $block->getChildHtml('order_info') ?>
60+
1361
<section class="admin__page-section">
1462
<div class="admin__page-section-title">
15-
<span class="title"><?= $block->escapeHtml(__('Payment &amp; Shipping Method')) ?></span>
63+
<span class="title"><?= $escaper->escapeHtml(__('Payment &amp; Shipping Method')) ?></span>
1664
</div>
1765
<div class="admin__page-section-content">
1866

19-
<?php if (!$_order->getIsVirtual()) : ?>
67+
<?php if (!$_order->getIsVirtual()): ?>
2068
<div class="admin__page-section-item order-payment-method">
21-
<?php else : ?>
69+
<?php else: ?>
2270
<div class="admin__page-section-item order-payment-method order-payment-method-virtual">
2371
<?php endif; ?>
2472
<?php /* Billing Address */?>
2573
<div class="admin__page-section-item-title">
26-
<span class="title"><?= $block->escapeHtml(__('Payment Information')) ?></span>
74+
<span class="title"><?= $escaper->escapeHtml(__('Payment Information')) ?></span>
2775
</div>
2876
<div class="admin__page-section-item-content">
2977
<div class="order-payment-method-title"><?= $block->getChildHtml('order_payment') ?></div>
30-
<div class="order-payment-currency"><?= $block->escapeHtml(__('The order was placed using %1.', $_order->getOrderCurrencyCode())) ?></div>
78+
<div class="order-payment-currency">
79+
<?= $escaper->escapeHtml(
80+
__('The order was placed using %1.', $_order->getOrderCurrencyCode())
81+
); ?>
82+
</div>
3183
<div class="order-payment-additional"><?= $block->getChildHtml('order_payment_additional') ?></div>
3284
</div>
3385
</div>
3486

35-
<?php if (!$_order->getIsVirtual()) : ?>
87+
<?php if (!$_order->getIsVirtual()): ?>
3688
<div class="admin__page-section-item order-shipping-address">
3789
<?php /* Shipping Address */ ?>
3890
<div class="admin__page-section-item-title">
39-
<span class="title"><?= $block->escapeHtml(__('Shipping Information')) ?></span>
91+
<span class="title"><?= $escaper->escapeHtml(__('Shipping Information')) ?></span>
4092
</div>
4193
<div class="shipping-description-wrapper admin__page-section-item-content">
42-
<div class="shipping-description-title"><?= $block->escapeHtml($_order->getShippingDescription()) ?></div>
94+
<div class="shipping-description-title">
95+
<?= $escaper->escapeHtml($_order->getShippingDescription()) ?>
96+
</div>
4397
<div class="shipping-description-content">
44-
<?= $block->escapeHtml(__('Total Shipping Charges')) ?>:
98+
<?= $escaper->escapeHtml(__('Total Shipping Charges')) ?>:
4599

46-
<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displayShippingPriceIncludingTax()) : ?>
100+
<?php if ($helper->displayShippingPriceIncludingTax()): ?>
47101
<?php $_excl = $block->displayShippingPriceInclTax($_order); ?>
48-
<?php else : ?>
102+
<?php else: ?>
49103
<?php $_excl = $block->displayPriceAttribute('shipping_amount', false, ' '); ?>
50104
<?php endif; ?>
51105
<?php $_incl = $block->displayShippingPriceInclTax($_order); ?>
52106

53107
<?= /* @noEscape */ $_excl ?>
54-
<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displayShippingBothPrices() && $_incl != $_excl) : ?>
55-
(<?= $block->escapeHtml(__('Incl. Tax')) ?> <?= /* @noEscape */ $_incl ?>)
108+
<?php if ($helper->displayShippingBothPrices() && $_incl != $_excl): ?>
109+
(<?= $escaper->escapeHtml(__('Incl. Tax')) ?> <?= /* @noEscape */ $_incl ?>)
56110
<?php endif; ?>
57111
</div>
58112
</div>
59113
</div>
60114
<?php endif; ?>
61115
</div>
62116
</section>
63-
<?php $_items = $block->getCreditmemo()->getAllItems() ?>
64117

65-
<?php if (count($_items)) : ?>
66-
<div id="creditmemo_items_container">
67-
<?= $block->getChildHtml('creditmemo_items') ?>
68-
</div>
69-
<?php else : ?>
70-
<section class="admin__page-section">
71-
<div class="admin__page-section-title">
72-
<span class="title"><?= $block->escapeHtml(__('Items Refunded')) ?></span>
118+
<?php $_items = $block->getCreditmemo()->getAllItems() ?>
119+
<?php if (count($_items)): ?>
120+
<div id="creditmemo_items_container">
121+
<?= $block->getChildHtml('creditmemo_items') ?>
73122
</div>
74-
<div class="no-items admin__page-section-content"><?= $block->escapeHtml(__('No Items')) ?></div>
75-
</section>
123+
<?php else: ?>
124+
<section class="admin__page-section">
125+
<div class="admin__page-section-title">
126+
<span class="title"><?= $escaper->escapeHtml(__('Items Refunded')) ?></span>
127+
</div>
128+
<div class="no-items admin__page-section-content"><?= $escaper->escapeHtml(__('No Items')) ?></div>
129+
</section>
76130
<?php endif; ?>
77131

78132
<section class="admin__page-section">
79133
<div class="admin__page-section-title">
80-
<span class="title"><?= $block->escapeHtml(__('Memo Total')) ?></span>
134+
<span class="title"><?= $escaper->escapeHtml(__('Memo Total')) ?></span>
81135
</div>
82136
<div class="admin__page-section-content">
83137
<div class="admin__page-section-item order-comments-history">
84138
<div class="admin__page-section-item-title">
85-
<span class="title"><?= $block->escapeHtml(__('Credit Memo History')) ?></span>
139+
<span class="title"><?= $escaper->escapeHtml(__('Credit Memo History')) ?></span>
86140
</div>
87141
<div class="admin__page-section-item-content"><?= $block->getChildHtml('order_comments') ?></div>
88142
</div>
89143
<div class="admin__page-section-item order-totals" id="history_form">
90144
<div class="admin__page-section-item-title">
91-
<span class="title"><?= $block->escapeHtml(__('Credit Memo Totals')) ?></span>
145+
<span class="title"><?= $escaper->escapeHtml(__('Credit Memo Totals')) ?></span>
92146
</div>
93147
<div class="admin__page-section-content"><?= $block->getChildHtml('creditmemo_totals') ?></div>
94148
</div>

0 commit comments

Comments
 (0)