| @@ -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 ?? ''); |
| @@ -138,11 +149,11 @@ | ||
| 138 | 149 | </td> |
| 139 | 150 | <td style="width: 30%;"> |
| 140 | 151 | <h3><?php esc_html_e('Company', 'yatra'); ?></h3> |
| 141 | 152 | <div><?php echo htmlspecialchars($companyName, ENT_QUOTES, 'UTF-8'); ?></div> |
| 142 | - <?php if ($companyAddress !== ''): ?> | |
| 143 | - <div class="muted"><?php echo htmlspecialchars($companyAddress, ENT_QUOTES, 'UTF-8'); ?></div> | |
| 144 | - <?php endif; ?> | |
| 153 | + <?php foreach ($companyAddressLines as $companyAddressLine): ?> | |
| 154 | + <div class="muted"><?php echo htmlspecialchars($companyAddressLine, ENT_QUOTES, 'UTF-8'); ?></div> | |
| 155 | + <?php endforeach; ?> | |
| 145 | 156 | <?php if ($companyEmail !== ''): ?> |
| 146 | 157 | <div class="muted"><?php echo htmlspecialchars($companyEmail, ENT_QUOTES, 'UTF-8'); ?></div> |
| 147 | 158 | <?php endif; ?> |
| 148 | 159 | <?php if ($companyPhone !== ''): ?> |