Skip to content

Commit 439e229

Browse files
committed
AC:11798::Shipping price showing diffrent in printed pdf
1 parent e25c01f commit 439e229

File tree

1 file changed

+59
-51
lines changed

1 file changed

+59
-51
lines changed

app/code/Magento/Sales/Model/Order/Pdf/AbstractPdf.php

Lines changed: 59 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,20 @@
66

77
namespace Magento\Sales\Model\Order\Pdf;
88

9+
use Magento\Framework\App\Config\ScopeConfigInterface;
10+
use Magento\Framework\Filesystem;
11+
use Magento\Framework\Filesystem\Directory\ReadInterface;
12+
use Magento\Framework\Filesystem\Directory\WriteInterface;
13+
use Magento\Framework\Stdlib\DateTime\TimezoneInterface;
14+
use Magento\Framework\Translate\Inline\StateInterface;
15+
use Magento\Payment\Helper\Data;
16+
use Magento\Framework\Stdlib\StringUtils;
917
use Magento\Framework\App\Filesystem\DirectoryList;
1018
use Magento\Framework\App\ObjectManager;
1119
use Magento\Framework\File\Pdf\Image;
1220
use Magento\MediaStorage\Helper\File\Storage\Database;
21+
use Magento\Sales\Model\Order\Address\Renderer;
22+
use Magento\Sales\Model\Order\Pdf\Total\Factory;
1323
use Magento\Sales\Model\RtlTextHandler;
1424
use Magento\Store\Model\ScopeInterface;
1525
use Magento\Tax\Helper\Data as TaxHelper;
@@ -56,17 +66,17 @@ abstract class AbstractPdf extends \Magento\Framework\DataObject
5666
*
5767
* @var \Zend_Pdf
5868
*/
59-
protected $_pdf;
69+
protected \Zend_Pdf $_pdf;
6070

6171
/**
6272
* @var RtlTextHandler
6373
*/
64-
private $rtlTextHandler;
74+
private mixed $rtlTextHandler;
6575

6676
/**
67-
* @var \Magento\Framework\File\Pdf\Image
77+
* @var Image
6878
*/
69-
private $image;
79+
private mixed $image;
7080

7181
/**
7282
* Retrieve PDF
@@ -76,108 +86,108 @@ abstract class AbstractPdf extends \Magento\Framework\DataObject
7686
abstract public function getPdf();
7787

7888
/**
79-
* @var \Magento\Payment\Helper\Data
89+
* @var Data
8090
*/
81-
protected $_paymentData;
91+
protected Data $_paymentData;
8292

8393
/**
84-
* @var \Magento\Framework\Stdlib\StringUtils
94+
* @var StringUtils
8595
*/
86-
protected $string;
96+
protected StringUtils $string;
8797

8898
/**
89-
* @var \Magento\Framework\Stdlib\DateTime\TimezoneInterface
99+
* @var TimezoneInterface
90100
*/
91-
protected $_localeDate;
101+
protected TimezoneInterface $_localeDate;
92102

93103
/**
94104
* Core store config
95105
*
96-
* @var \Magento\Framework\App\Config\ScopeConfigInterface
106+
* @var ScopeConfigInterface
97107
*/
98-
protected $_scopeConfig;
108+
protected ScopeConfigInterface $_scopeConfig;
99109

100110
/**
101-
* @var \Magento\Framework\Filesystem\Directory\WriteInterface
111+
* @var WriteInterface
102112
*/
103-
protected $_mediaDirectory;
113+
protected WriteInterface $_mediaDirectory;
104114

105115
/**
106-
* @var \Magento\Framework\Filesystem\Directory\ReadInterface
116+
* @var ReadInterface
107117
*/
108-
protected $_rootDirectory;
118+
protected ReadInterface $_rootDirectory;
109119

110120
/**
111121
* @var Config
112122
*/
113-
protected $_pdfConfig;
123+
protected Config $_pdfConfig;
114124

115125
/**
116-
* @var \Magento\Sales\Model\Order\Pdf\Total\Factory
126+
* @var Factory
117127
*/
118-
protected $_pdfTotalFactory;
128+
protected Factory $_pdfTotalFactory;
119129

120130
/**
121-
* @var \Magento\Sales\Model\Order\Pdf\ItemsFactory
131+
* @var ItemsFactory
122132
*/
123-
protected $_pdfItemsFactory;
133+
protected ItemsFactory $_pdfItemsFactory;
124134

125135
/**
126-
* @var \Magento\Framework\Translate\Inline\StateInterface
136+
* @var StateInterface
127137
*/
128-
protected $inlineTranslation;
138+
protected StateInterface $inlineTranslation;
129139

130140
/**
131-
* @var \Magento\Sales\Model\Order\Address\Renderer
141+
* @var Renderer
132142
*/
133-
protected $addressRenderer;
143+
protected Renderer $addressRenderer;
134144

135145
/**
136-
* @var \Magento\Tax\Helper\Data
146+
* @var TaxHelper|Data
137147
*/
138-
protected $taxHelper;
148+
protected TaxHelper|Data $taxHelper;
139149

140150
/**
141151
* @var array $pageSettings
142152
*/
143-
private $pageSettings;
153+
private array $pageSettings;
144154

145155
/**
146156
* @var Database
147157
*/
148-
private $fileStorageDatabase;
158+
private mixed $fileStorageDatabase;
149159

150160
/**
151-
* @param \Magento\Payment\Helper\Data $paymentData
152-
* @param \Magento\Framework\Stdlib\StringUtils $string
153-
* @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig
154-
* @param \Magento\Framework\Filesystem $filesystem
161+
* @param Data $paymentData
162+
* @param StringUtils $string
163+
* @param ScopeConfigInterface $scopeConfig
164+
* @param Filesystem $filesystem
155165
* @param Config $pdfConfig
156166
* @param Total\Factory $pdfTotalFactory
157167
* @param ItemsFactory $pdfItemsFactory
158-
* @param \Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate
159-
* @param \Magento\Framework\Translate\Inline\StateInterface $inlineTranslation
160-
* @param \Magento\Sales\Model\Order\Address\Renderer $addressRenderer
161-
* @param \Magento\Tax\Helper\Data $taxHelper
168+
* @param TimezoneInterface $localeDate
169+
* @param StateInterface $inlineTranslation
170+
* @param Renderer $addressRenderer
171+
* @param TaxHelper $taxHelper
162172
* @param array $data
163173
* @param Database $fileStorageDatabase
164174
* @param RtlTextHandler|null $rtlTextHandler
165175
* @param Image $image
166176
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
167177
*/
168178
public function __construct(
169-
\Magento\Payment\Helper\Data $paymentData,
170-
\Magento\Framework\Stdlib\StringUtils $string,
171-
\Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig,
172-
\Magento\Framework\Filesystem $filesystem,
179+
Data $paymentData,
180+
StringUtils $string,
181+
ScopeConfigInterface $scopeConfig,
182+
Filesystem $filesystem,
173183
Config $pdfConfig,
174-
\Magento\Sales\Model\Order\Pdf\Total\Factory $pdfTotalFactory,
175-
\Magento\Sales\Model\Order\Pdf\ItemsFactory $pdfItemsFactory,
176-
\Magento\Framework\Stdlib\DateTime\TimezoneInterface $localeDate,
177-
\Magento\Framework\Translate\Inline\StateInterface $inlineTranslation,
178-
\Magento\Sales\Model\Order\Address\Renderer $addressRenderer,
179-
TaxHelper $taxHelper = null,
180-
array $data = [],
184+
Factory $pdfTotalFactory,
185+
ItemsFactory $pdfItemsFactory,
186+
TimezoneInterface $localeDate,
187+
StateInterface $inlineTranslation,
188+
Renderer $addressRenderer,
189+
TaxHelper $taxHelper,
190+
array $data = [],
181191
Database $fileStorageDatabase = null,
182192
?RtlTextHandler $rtlTextHandler = null,
183193
?Image $image = null
@@ -620,9 +630,7 @@ protected function insertOrder(&$page, $obj, $putOrderId = true)
620630
$totalShippingChargesText .= $order->formatPriceTxt($order->getShippingAmount());
621631
}
622632

623-
if ($this->taxHelper->displayShippingBothPrices()
624-
&& $order->getShippingInclTax() != $order->getShippingAmount()
625-
) {
633+
if($this->taxHelper->displayShippingBothPrices() && $order->getShippingInclTax() != $order->getShippingAmount()) {
626634
$totalShippingChargesText .= "(Incl. Tax " . $order->getShippingInclTax() . ")";
627635
}
628636
$totalShippingChargesText .= ")";

0 commit comments

Comments
 (0)