| @@ -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 ?? ''); |