Skip to content

Commit b3aa13f

Browse files
committed
ACP2E-1216: Large area customizable option not able to render for print invoice PDF
1 parent 56e44be commit b3aa13f

File tree

5 files changed

+32
-9
lines changed

5 files changed

+32
-9
lines changed

app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Creditmemo.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,10 @@ public function draw()
199199
if ($option['value']) {
200200
$text = [];
201201
$printValue = $option['print_value'] ?? $this->filterManager->stripTags($option['value']);
202+
$printValue = str_replace(PHP_EOL, ', ', $printValue);
202203
$values = explode(', ', $printValue);
203204
foreach ($values as $value) {
204-
foreach ($this->string->split($value, 30, true, true) as $subValue) {
205+
foreach ($this->string->split($value, 50, true, true) as $subValue) {
205206
$text[] = $subValue;
206207
}
207208
}

app/code/Magento/Bundle/Model/Sales/Order/Pdf/Items/Shipment.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,20 +169,21 @@ public function draw()
169169
true
170170
),
171171
'font' => 'italic',
172-
'feed' => 60,
172+
'feed' => 110,
173173
];
174174

175175
if ($option['value']) {
176176
$text = [];
177177
$printValue = $option['print_value'] ?? $this->filterManager->stripTags($option['value']);
178+
$printValue = str_replace(PHP_EOL, ', ', $printValue);
178179
$values = explode(', ', $printValue);
179180
foreach ($values as $value) {
180181
foreach ($this->string->split($value, 50, true, true) as $subValue) {
181182
$text[] = $subValue;
182183
}
183184
}
184185

185-
$lines[][] = ['text' => $text, 'feed' => 65];
186+
$lines[][] = ['text' => $text, 'feed' => 115];
186187
}
187188

188189
$drawItems[] = ['lines' => $lines, 'height' => 15, 'shift' => 5];

app/code/Magento/Sales/Model/Order/Pdf/Items/Creditmemo/DefaultCreditmemo.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,11 +140,20 @@ public function draw()
140140
) ? $option['print_value'] : $this->filterManager->stripTags(
141141
$option['value']
142142
);
143-
$lines[][] = ['text' => $this->string->split($printValue, 30, true, true), 'feed' => 40];
143+
144+
$values = explode(PHP_EOL, $printValue);
145+
$text = [];
146+
foreach ($values as $value) {
147+
foreach ($this->string->split($value, 50, true, true) as $subValue) {
148+
$text[] = $subValue;
149+
}
150+
}
151+
152+
$lines[][] = ['text' => $text, 'feed' => 40];
144153
}
145154
}
146155

147-
$lineBlock = ['lines' => $lines, 'height' => 20];
156+
$lineBlock = ['lines' => $lines, 'height' => 20, 'shift' => 5];
148157

149158
$page = $pdf->drawLineBlocks($page, [$lineBlock], ['table_header' => true]);
150159
$this->setPage($page);

app/code/Magento/Sales/Model/Order/Pdf/Items/Invoice/DefaultInvoice.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,15 +151,21 @@ public function draw()
151151
} else {
152152
$printValue = $this->filterManager->stripTags($option['value']);
153153
}
154+
$printValue = str_replace(PHP_EOL, ', ', $printValue);
154155
$values = explode(', ', $printValue);
156+
$text = [];
155157
foreach ($values as $value) {
156-
$lines[][] = ['text' => $this->string->split($value, 30, true, true), 'feed' => 40];
158+
foreach ($this->string->split($value, 50, true, true) as $subValue) {
159+
$text[] = $subValue;
160+
}
157161
}
162+
163+
$lines[][] = ['text' => $text, 'feed' => 40];
158164
}
159165
}
160166
}
161167

162-
$lineBlock = ['lines' => $lines, 'height' => 20];
168+
$lineBlock = ['lines' => $lines, 'height' => 20, 'shift' => 5];
163169

164170
$page = $pdf->drawLineBlocks($page, [$lineBlock], ['table_header' => true]);
165171
$this->setPage($page);

app/code/Magento/Sales/Model/Order/Pdf/Items/Shipment/DefaultShipment.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,21 @@ public function draw()
104104
) ? $option['print_value'] : $this->filterManager->stripTags(
105105
$option['value']
106106
);
107+
$printValue = str_replace(PHP_EOL, ', ', $printValue);
107108
$values = explode(', ', $printValue);
109+
$text = [];
108110
foreach ($values as $value) {
109-
$lines[][] = ['text' => $this->string->split($value, 50, true, true), 'feed' => 115];
111+
foreach ($this->string->split($value, 50, true, true) as $subValue) {
112+
$text[] = $subValue;
113+
}
110114
}
115+
116+
$lines[][] = ['text' => $text, 'feed' => 115];
111117
}
112118
}
113119
}
114120

115-
$lineBlock = ['lines' => $lines, 'height' => 20];
121+
$lineBlock = ['lines' => $lines, 'height' => 20, 'shift' => 5];
116122

117123
$page = $pdf->drawLineBlocks($page, [$lineBlock], ['table_header' => true]);
118124
$this->setPage($page);

0 commit comments

Comments
 (0)