| @@ -259,8 +259,11 @@ | ||
| 259 | 259 | 'trip_id' => (int) $request->get_param('trip_id'), |
| 260 | 260 | 'search' => $request->get_param('search') ?: '', |
| 261 | 261 | 'date_from' => $request->get_param('date_from') ?: '', |
| 262 | 262 | 'date_to' => $request->get_param('date_to') ?: '', |
| 263 | + // Column sorting from the table headers — whitelisted in the repository. | |
| 264 | + 'orderby' => $request->get_param('orderby') ?: '', | |
| 265 | + 'order' => $request->get_param('order') ?: '', | |
| 263 | 266 | ]; |
| 264 | 267 | |
| 265 | 268 | // Delegate to service |
| 266 | 269 | $result = $this->bookingService->getBookings($filters); |
| @@ -805,8 +808,9 @@ | ||
| 805 | 808 | |
| 806 | 809 | $templateData = [ |
| 807 | 810 | 'company_name' => $companyName, |
| 808 | 811 | 'company_address' => $companyAddress, |
| 812 | + 'company_address_lines' => \Yatra\Helpers\FormatHelper::companyAddressLines(), | |
| 809 | 813 | 'company_email' => $companyEmail, |
| 810 | 814 | 'company_phone' => $companyPhone, |
| 811 | 815 | 'customer_name' => $customerName, |
| 812 | 816 | 'customer_email' => (string) ($booking['contact_email'] ?? $booking['customer_email'] ?? ''), |
| @@ -819,9 +823,15 @@ | ||
| 819 | 823 | 'trip_title' => $trip ? ($trip->title ?? $booking['trip_title'] ?? __('Trip Booking', 'yatra')) : ($booking['trip_title'] ?? __('Trip Booking', 'yatra')), |
| 820 | 824 | // Trip duration comes from duration_days/duration_nights (there is no |
| 821 | 825 | // `duration` column — accessing it caused a blank value + PHP notice). |
| 822 | 826 | 'trip_duration' => $trip |
| 823 | - ? yatra_format_duration((int) ($trip->duration_days ?? 0), isset($trip->duration_nights) ? (int) $trip->duration_nights : null) | |
| 827 | + ? yatra_format_duration( | |
| 828 | + (int) ($trip->duration_days ?? 0), | |
| 829 | + isset($trip->duration_nights) ? (int) $trip->duration_nights : null, | |
| 830 | + // Hour-based day tours: "8 hours" instead of "1 day". Absent | |
| 831 | + // or NULL on every day-based trip, which keeps its wording. | |
| 832 | + (int) ($trip->duration_hours ?? 0) | |
| 833 | + ) | |
| 824 | 834 | : '', |
| 825 | 835 | 'trip_difficulty' => $trip ? ($trip->difficulty_name ?? '') : '', |
| 826 | 836 | 'departure_location' => $trip ? ($trip->departure_location ?? '') : '', |
| 827 | 837 | 'destination' => $trip ? ($trip->destination ?? '') : '', |