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/invoice.php +20 -15 3.0.11 → 3.0.16 View file →
@@ -4,8 +4,19 @@
4 4 if ($companyName === '' && function_exists('yatra_get_brand_name')) {
5 5 $companyName = yatra_get_brand_name();
6 6 }
7 7 $companyAddress = (string) ($company_address ?? '');
8 +// Settings keep the business address in separate fields (street, city, state,
9 +// postcode, country); documents only ever printed the street, so everything after
10 +// it was missing and the address looked cut off at its last line. Prefer the
11 +// composed lines, falling back to the raw street for any caller not passing them.
12 +$companyAddressLines = (isset($company_address_lines) && is_array($company_address_lines))
13 + ? array_values(array_filter(array_map('strval', $company_address_lines), static function ($line) {
14 + return trim($line) !== '';
15 + }))
16 + : array_values(array_filter(preg_split('/\R/', $companyAddress) ?: [], static function ($line) {
17 + return trim($line) !== '';
18 + }));
8 19 $companyEmail = (string) ($company_email ?? '');
9 20 $companyPhone = (string) ($company_phone ?? '');
10 21
11 22 $customerName = (string) ($customer_name ?? '');
@@ -53,9 +64,9 @@
53 64 <html lang="en">
54 65 <head>
55 66 <meta charset="UTF-8">
56 67 <meta name="viewport" content="width=device-width, initial-scale=1.0">
57 - <title><?php echo esc_html__('Invoice', 'yatra'); ?> - <?php echo htmlspecialchars($paymentRef, ENT_QUOTES, 'UTF-8'); ?></title>
68 + <title><?php echo esc_html__('Invoice', 'yatra'); ?> - <?php echo htmlspecialchars($bookingRef !== '' ? $bookingRef : $paymentRef, ENT_QUOTES, 'UTF-8'); ?></title>
58 69 <style>
59 70 @page { size: A4 portrait; margin: 0mm; }
60 71 * { margin: 0; padding: 0; box-sizing: border-box; }
61 72 body { margin: 0; padding: 0; font-family: "Noto Sans Devanagari", "Noto Sans Arabic", "Noto Sans CJK", "DejaVu Sans", sans-serif; font-size: 12px; color: #111; }
@@ -124,9 +135,13 @@
124 135 <h3><?php esc_html_e('Invoice Details', 'yatra'); ?></h3>
125 136 <table class="details">
126 137 <tr>
127 138 <td class="k"><?php esc_html_e('Invoice #:', 'yatra'); ?></td>
128 - <td class="v-wrap"><?php echo htmlspecialchars($paymentRef, ENT_QUOTES, 'UTF-8'); ?></td>
139 + <?php // Always the booking reference — consistent whether the invoice is
140 + // downloaded from the confirmation page or after a payment. Previously
141 + // this used $paymentRef, which the post-payment path set to the payment
142 + // number (PAY-xxxxxx), so the invoice number changed per download. ?>
143 + <td class="v-wrap"><?php echo htmlspecialchars($bookingRef !== '' ? $bookingRef : $paymentRef, ENT_QUOTES, 'UTF-8'); ?></td>
129 144 </tr>
130 145 <tr>
131 146 <td class="k"><?php esc_html_e('Date:', 'yatra'); ?></td>
132 147 <td class="v"><?php echo htmlspecialchars($paymentDate, ENT_QUOTES, 'UTF-8'); ?></td>
@@ -139,21 +154,11 @@
139 154 </td>
140 155 <td style="width: 30%;">
141 156 <h3><?php esc_html_e('Company', 'yatra'); ?></h3>
142 157 <div><?php echo htmlspecialchars($companyName, ENT_QUOTES, 'UTF-8'); ?></div>
143 - <?php if ($companyAddress !== ''): ?>
144 - <?php
145 - // The setting is a textarea, so a full business address arrives
146 - // with newlines. HTML collapses those, which ran the whole
147 - // address onto one line — keep the operator's own line breaks.
148 - foreach (preg_split('/\R/', $companyAddress) as $companyAddressLine):
149 - if (trim($companyAddressLine) === '') {
150 - continue;
151 - }
152 - ?>
153 - <div class="muted"><?php echo htmlspecialchars($companyAddressLine, ENT_QUOTES, 'UTF-8'); ?></div>
154 - <?php endforeach; ?>
155 - <?php endif; ?>
158 + <?php foreach ($companyAddressLines as $companyAddressLine): ?>
159 + <div class="muted"><?php echo htmlspecialchars($companyAddressLine, ENT_QUOTES, 'UTF-8'); ?></div>
160 + <?php endforeach; ?>
156 161 <?php if ($companyEmail !== ''): ?>
157 162 <div class="muted"><?php echo htmlspecialchars($companyEmail, ENT_QUOTES, 'UTF-8'); ?></div>
158 163 <?php endif; ?>
159 164 <?php if ($companyPhone !== ''): ?>