PluginProbe
Yatra – Travel Booking & Tour Operator Software / 3.0.16
Yatra – Travel Booking & Tour Operator Software v3.0.16
3.0.16 3.0.15 3.0.14 3.0.14.1 3.0.14.2 3.0.12 3.0.13 3.0.11 3.0.10 3.0.9 3.0.8 3.0.7 3.0.6 3.0.5 3.0.5.1 3.0.4 3.0.3 3.0.2.9 3.0.2.7 3.0.2.8 3.0.2.6 trunk 1.0.0 2.0.0 2.0.1 All 84 releases
← All changes | templates/pdf/voucher.php +32 -8 3.0.6 → 3.0.16 View file →
@@ -1,8 +1,19 @@
1 1 <?php
2 2
3 3 $companyName = (string) ($company_name ?? '');
4 4 $companyAddress = (string) ($company_address ?? '');
5 +// Settings keep the business address in separate fields (street, city, state,
6 +// postcode, country); documents only ever printed the street, so everything after
7 +// it was missing and the address looked cut off at its last line. Prefer the
8 +// composed lines, falling back to the raw street for any caller not passing them.
9 +$companyAddressLines = (isset($company_address_lines) && is_array($company_address_lines))
10 + ? array_values(array_filter(array_map('strval', $company_address_lines), static function ($line) {
11 + return trim($line) !== '';
12 + }))
13 + : array_values(array_filter(preg_split('/\R/', $companyAddress) ?: [], static function ($line) {
14 + return trim($line) !== '';
15 + }));
5 16 $companyEmail = (string) ($company_email ?? '');
6 17 $companyPhone = (string) ($company_phone ?? '');
7 18
8 19 $customerName = (string) ($customer_name ?? '');
@@ -28,8 +39,17 @@
28 39 $travelerCount = (int) ($traveler_count ?? 1);
29 40 $departureLocation = (string) ($departure_location ?? '');
30 41 $destination = (string) ($destination ?? '');
31 42
43 +
44 +// Optional logo + header colour supplied by the White Label module.
45 +// Unbranded sites keep this document's original header colour and show no logo.
46 +$pdfBranding = function_exists('yatra_get_pdf_branding')
47 + ? yatra_get_pdf_branding('#059669')
48 + : ['logo_url' => '', 'header_color' => '#059669'];
49 +$brandLogoUrl = (string) ($pdfBranding['logo_url'] ?? '');
50 +$brandHeaderColor = (string) ($pdfBranding['header_color'] ?? '#059669');
51 +
32 52 ?><!DOCTYPE html>
33 53 <html lang="en">
34 54 <head>
35 55 <meta charset="UTF-8">
@@ -42,9 +62,10 @@
42 62 .content { padding: 12mm 12mm 14mm 12mm; }
43 63
44 64 .header { width: 100%; border-collapse: collapse; }
45 65 .header td { vertical-align: top; }
46 - .brand { background: #059669; color: #fff; padding: 6mm 6mm; }
66 + .brand { background: <?php echo htmlspecialchars($brandHeaderColor, ENT_QUOTES, 'UTF-8'); ?>; color: #fff; padding: 6mm 6mm; }
67 + .brand-logo { max-height: 18mm; max-width: 60mm; margin-bottom: 3mm; }
47 68 .brand h1 { font-size: 20px; font-weight: 700; margin: 0; }
48 69 .brand p { font-size: 12px; margin-top: 4px; font-weight: 400; }
49 70
50 71 .voucher-number { background: #f3f4f6; padding: 4mm 6mm; border-bottom: 2px solid #059669; }
@@ -59,9 +80,9 @@
59 80 .trip-info h4 { color: #059669; font-size: 14px; margin-bottom: 4mm; }
60 81
61 82 .details { width: 100%; border-collapse: collapse; }
62 83 .details td { padding: 1.5mm 0; vertical-align: top; }
63 - .details .k { width: 20mm; white-space: nowrap; font-weight: 700; }
84 + .details .k { width: 20mm; white-space: nowrap; font-weight: 700; padding-right: 3mm; }
64 85 .details .v { white-space: nowrap; }
65 86 .details .v-wrap { white-space: normal; }
66 87
67 88 .badge { display: inline-block; padding: 2px 10px; font-size: 10px; border-radius: 12px; border: 1px solid #e5e7eb; margin-left: 6px; vertical-align: middle; line-height: 1.4; }
@@ -86,8 +107,11 @@
86 107 <body>
87 108 <table class="header">
88 109 <tr>
89 110 <td class="brand">
111 + <?php if ($brandLogoUrl !== ''): ?>
112 + <img class="brand-logo" src="<?php echo htmlspecialchars($brandLogoUrl, ENT_QUOTES, 'UTF-8'); ?>" alt="">
113 + <?php endif; ?>
90 114 <h1><?php echo htmlspecialchars($companyName, ENT_QUOTES, 'UTF-8'); ?></h1>
91 115 <p><?php esc_html_e('Travel Voucher', 'yatra'); ?></p>
92 116 </td>
93 117 </tr>
@@ -125,11 +149,11 @@
125 149 </td>
126 150 <td style="width: 30%;">
127 151 <h3><?php esc_html_e('Company', 'yatra'); ?></h3>
128 152 <div><?php echo htmlspecialchars($companyName, ENT_QUOTES, 'UTF-8'); ?></div>
129 - <?php if ($companyAddress !== ''): ?>
130 - <div class="muted"><?php echo htmlspecialchars($companyAddress, ENT_QUOTES, 'UTF-8'); ?></div>
131 - <?php endif; ?>
153 + <?php foreach ($companyAddressLines as $companyAddressLine): ?>
154 + <div class="muted"><?php echo htmlspecialchars($companyAddressLine, ENT_QUOTES, 'UTF-8'); ?></div>
155 + <?php endforeach; ?>
132 156 <?php if ($companyEmail !== ''): ?>
133 157 <div class="muted"><?php echo htmlspecialchars($companyEmail, ENT_QUOTES, 'UTF-8'); ?></div>
134 158 <?php endif; ?>
135 159 <?php if ($companyPhone !== ''): ?>
@@ -179,17 +203,17 @@
179 203
180 204 <table class="totals">
181 205 <tr>
182 206 <td class="label"><?php esc_html_e('Total Amount', 'yatra'); ?></td>
183 - <td class="value"><?php echo $currencySymbol . htmlspecialchars($totalAmount, ENT_QUOTES, 'UTF-8'); ?></td>
207 + <td class="value"><?php echo htmlspecialchars($totalAmount, ENT_QUOTES, 'UTF-8'); ?></td>
184 208 </tr>
185 209 <tr>
186 210 <td class="label"><?php esc_html_e('Amount Paid', 'yatra'); ?></td>
187 - <td class="value"><?php echo $currencySymbol . htmlspecialchars($amountPaid, ENT_QUOTES, 'UTF-8'); ?></td>
211 + <td class="value"><?php echo htmlspecialchars($amountPaid, ENT_QUOTES, 'UTF-8'); ?></td>
188 212 </tr>
189 213 <tr>
190 214 <td class="label"><?php esc_html_e('Balance Due', 'yatra'); ?></td>
191 - <td class="value"><?php echo $currencySymbol . htmlspecialchars($amountDue, ENT_QUOTES, 'UTF-8'); ?></td>
215 + <td class="value"><?php echo htmlspecialchars($amountDue, ENT_QUOTES, 'UTF-8'); ?></td>
192 216 </tr>
193 217 </table>
194 218 </div>
195 219