Skip to content

Commit

Permalink
Merge pull request magento#4272 from magento-obsessive-owls/MAGETWO-5…
Browse files Browse the repository at this point in the history
…5806

[Owls] MAGETWO-55806: Eliminate @escapeNotVerified in Tax-related Modules
  • Loading branch information
davemacaulay authored Jun 4, 2019
2 parents db740df + de38bd1 commit 514e3d0
Show file tree
Hide file tree
Showing 47 changed files with 650 additions and 692 deletions.
24 changes: 11 additions & 13 deletions app/code/Magento/Tax/view/adminhtml/templates/items/price/row.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,28 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

// phpcs:disable Magento2.Templates.ThisInTemplate
?>
<?php
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */

$_item = $block->getItem();
?>

<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()): ?>
<?php if ($block->displayBothPrices() || $block->displayPriceExclTax()) : ?>
<div class="price-excl-tax">
<?php if ($block->displayBothPrices()): ?>
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
<?php if ($block->displayBothPrices()) : ?>
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
<?php endif; ?>
<?= /* @escapeNotVerified */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
<?= /* @noEscape */ $block->displayPrices($_item->getBaseRowTotal(), $_item->getRowTotal()) ?>
</div>
<?php endif; ?>
<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()): ?>
<?php if ($block->displayBothPrices() || $block->displayPriceInclTax()) : ?>
<div class="price-incl-tax">
<?php if ($block->displayBothPrices()): ?>
<span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
<?php if ($block->displayBothPrices()) : ?>
<span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
<?php endif; ?>
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?>
<?php $_baseIncl = $this->helper('Magento\Checkout\Helper\Data')->getBaseSubtotalInclTax($_item); ?>
<?= /* @escapeNotVerified */ $block->displayPrices($_baseIncl, $_incl) ?>
<?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getSubtotalInclTax($_item); ?>
<?php $_baseIncl = $this->helper(\Magento\Checkout\Helper\Data::class)->getBaseSubtotalInclTax($_item); ?>
<?= /* @noEscape */ $block->displayPrices($_baseIncl, $_incl) ?>
</div>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

?>
<?php
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */

$_item = $block->getItem();
?>

<?= /* @escapeNotVerified */ $block->displayPrices($block->getBaseTotalAmount($_item), $block->getTotalAmount($_item)) ?>
<?= /* @noEscape */ $block->displayPrices($block->getBaseTotalAmount($_item), $block->getTotalAmount($_item)) ?>
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,32 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

// phpcs:disable Magento2.Templates.ThisInTemplate
?>
<?php
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */

$_item = $block->getItem();
?>

<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceExclTax()): ?>
<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices() || $this->helper(\Magento\Tax\Helper\Data::class)->displaySalesPriceExclTax()) : ?>
<div class="price-excl-tax">
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices()): ?>
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices()) : ?>
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
<?php endif; ?>

<?= /* @escapeNotVerified */ $block->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
<?= /* @noEscape */ $block->displayPrices($_item->getBasePrice(), $_item->getPrice()) ?>
</div>
<?php endif; ?>
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices() || $this->helper('Magento\Tax\Helper\Data')->displaySalesPriceInclTax()): ?>
<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices() || $this->helper(\Magento\Tax\Helper\Data::class)->displaySalesPriceInclTax()) : ?>
<div class="price-incl-tax">
<?php if ($this->helper('Magento\Tax\Helper\Data')->displaySalesBothPrices()): ?>
<span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
<?php if ($this->helper(\Magento\Tax\Helper\Data::class)->displaySalesBothPrices()) : ?>
<span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
<?php endif; ?>
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?>
<?php $_baseIncl = $this->helper('Magento\Checkout\Helper\Data')->getBasePriceInclTax($_item); ?>
<?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getPriceInclTax($_item); ?>
<?php $_baseIncl = $this->helper(\Magento\Checkout\Helper\Data::class)->getBasePriceInclTax($_item); ?>

<?= /* @escapeNotVerified */ $block->displayPrices($_baseIncl, $_incl) ?>
<?= /* @noEscape */ $block->displayPrices($_baseIncl, $_incl) ?>

</div>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -4,26 +4,25 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

// phpcs:disable Magento2.Templates.ThisInTemplate
?>
<?php
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */

$_item = $block->getItem();
?>

<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?>
<?php if ($block->displayBothPrices($block->getStore())): ?>
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?>
<?php if ($block->displayBothPrices($block->getStore())) : ?>
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
<?php endif; ?>
<?= /* @escapeNotVerified */ $block->formatPrice($_item->getRowTotal()) ?>
<?= /* @noEscape */ $block->formatPrice($_item->getRowTotal()) ?>
<?php endif; ?>

<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?>
<?php if ($block->displayBothPrices()): ?>
<br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?>
<?php if ($block->displayBothPrices()) : ?>
<br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
<?php endif; ?>
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getSubtotalInclTax($_item); ?>
<?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?>
<?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getSubtotalInclTax($_item); ?>
<?= /* @noEscape */ $block->formatPrice($_incl) ?>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,26 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

?>
<?php
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */

$_item = $block->getItem();
?>

<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?>
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?>
<?php $_rowTotalWithoutDiscount = $_item->getRowTotal() - $_item->getTotalDiscountAmount(); ?>
<?php if ($block->displayBothPrices()): ?>
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
<?php if ($block->displayBothPrices()) : ?>
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
<?php endif; ?>
<?= /* @escapeNotVerified */ $block->formatPrice(max(0, $_rowTotalWithoutDiscount)) ?>
<?= /* @noEscape */ $block->formatPrice(max(0, $_rowTotalWithoutDiscount)) ?>
<?php endif; ?>


<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?>
<?php if ($block->displayBothPrices($block->getStore())): ?>
<br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?>
<?php if ($block->displayBothPrices($block->getStore())) : ?>
<br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
<?php endif; ?>
<?php $_incl = $block->getTotalAmount($_item); ?>
<?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?>
<?= /* @noEscape */ $block->formatPrice($_incl) ?>
<?php endif; ?>
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,26 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

// phpcs:disable Magento2.Templates.ThisInTemplate
?>
<?php
/** @var \Magento\Tax\Block\Adminhtml\Items\Price\Renderer $block */

$_item = $block->getItem();
?>

<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()): ?>
<?php if ($block->displayBothPrices()): ?>
<span class="label"><?= /* @escapeNotVerified */ __('Excl. Tax') ?>:</span>
<?php if ($block->displayPriceExclTax() || $block->displayBothPrices()) : ?>
<?php if ($block->displayBothPrices()) : ?>
<span class="label"><?= $block->escapeHtml(__('Excl. Tax')) ?>:</span>
<?php endif; ?>
<?= /* @escapeNotVerified */ $block->formatPrice($_item->getCalculationPrice()) ?>
<?= /* @noEscape */ $block->formatPrice($_item->getCalculationPrice()) ?>
<?php endif; ?>


<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()): ?>
<?php if ($block->displayBothPrices()): ?>
<br /><span class="label"><?= /* @escapeNotVerified */ __('Incl. Tax') ?>:</span>
<?php if ($block->displayPriceInclTax() || $block->displayBothPrices()) : ?>
<?php if ($block->displayBothPrices()) : ?>
<br /><span class="label"><?= $block->escapeHtml(__('Incl. Tax')) ?>:</span>
<?php endif; ?>
<?php $_incl = $this->helper('Magento\Checkout\Helper\Data')->getPriceInclTax($_item); ?>
<?= /* @escapeNotVerified */ $block->formatPrice($_incl) ?>
<?php $_incl = $this->helper(\Magento\Checkout\Helper\Data::class)->getPriceInclTax($_item); ?>
<?= /* @noEscape */ $block->formatPrice($_incl) ?>
<?php endif; ?>
3 changes: 0 additions & 3 deletions app/code/Magento/Tax/view/adminhtml/templates/rate/form.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

?>
<div class="entry-edit form-inline">
<?= $block->getFormHtml() ?>
Expand Down
5 changes: 2 additions & 3 deletions app/code/Magento/Tax/view/adminhtml/templates/rate/js.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,15 @@
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

// phpcs:disable Magento2.Templates.ThisInTemplate
?>
<script>
require([
"jquery",
"mage/adminhtml/form"
], function(jQuery){

var updater = new RegionUpdater('tax_country_id', 'tax_region', 'tax_region_id', <?= /* @escapeNotVerified */ $this->helper('Magento\Directory\Helper\Data')->getRegionJson() ?>, 'disable');
var updater = new RegionUpdater('tax_country_id', 'tax_region', 'tax_region_id', <?= /* @noEscape */ $this->helper(\Magento\Directory\Helper\Data::class)->getRegionJson() ?>, 'disable');
updater.disableRegionValidation();

(function ($) {
Expand Down
19 changes: 9 additions & 10 deletions app/code/Magento/Tax/view/adminhtml/templates/rate/title.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,29 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/

// @codingStandardsIgnoreFile

?>
<fieldset id="tax-rate-titles-table" class="admin__fieldset">
<?php $_labels = $block->getTitles() ?>
<?php foreach ($block->getStores() as $_store): ?>
<?php foreach ($block->getStores() as $_store) : ?>
<div class="admin__field">
<label class="admin__field-label"><span><?= /* @escapeNotVerified */ $_store->getName() ?></span></label>
<label class="admin__field-label">
<span><?= $block->escapeHtml($_store->getName()) ?></span>
</label>
<div class="admin__field-control">
<input
class="admin__control-text<?php if ($_store->getId() == 0): ?> required-entry<?php endif; ?>"
class="admin__control-text<?php if ($_store->getId() == 0) : ?> required-entry<?php endif; ?>"
type="text"
name="title[<?= /* @escapeNotVerified */ $_store->getId() ?>]"
value="<?= /* @escapeNotVerified */ $_labels[$_store->getId()] ?>" />
name="title[<?= (int) $_store->getId() ?>]"
value="<?= $block->escapeHtmlAttr($_labels[(int) $_store->getId()]) ?>" />
</div>
</div>
<?php endforeach; ?>

<div class="messages">
<div class="message message-notice">
<div>
<strong><?= /* @escapeNotVerified */ __('Note:') ?></strong>
<?= /* @escapeNotVerified */ __('Leave this field empty if you wish to use the tax identifier.') ?>
<strong><?= $block->escapeHtml(__('Note:')) ?></strong>
<?= $block->escapeHtml(__('Leave this field empty if you wish to use the tax identifier.')) ?>
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 514e3d0

Please sign in to comment.