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 | app/Controllers/SingleTripController.php +17 -6 3.0.7 → 3.0.16 View file →
@@ -396,13 +396,14 @@
396 396 {
397 397 // Use centralized AvailabilityResolutionService
398 398 $resolutionService = new \Yatra\Services\AvailabilityResolutionService();
399 399
400 - // Get dates for next 12 months
400 + // From today up to the configurable booking horizon (Settings → Booking;
401 + // 12 months unless changed — the previous hard-coded value).
401 402 $fromDate = date('Y-m-d');
402 - $toDate = date('Y-m-d', strtotime('+12 months'));
403 + $toDate = yatra_get_availability_horizon_date($fromDate);
403 404
404 - $availability = $resolutionService->getAllAvailabilityDates($trip_id, $fromDate, $toDate);
405 + $availability = $resolutionService->getAllAvailabilityDates($trip_id, $fromDate, $toDate, \Yatra\Services\SettingsService::isEnabled('show_sold_out'));
405 406
406 407 // Add calculated fields
407 408 foreach ($availability as $avail) {
408 409 // Calculate if limited availability
@@ -1094,9 +1095,13 @@
1094 1095 $patterns = [
1095 1096 '/youtube\.com\/watch\?v=([^&]+)/',
1096 1097 '/youtube\.com\/embed\/([^?]+)/',
1097 1098 '/youtu\.be\/([^?]+)/',
1098 - '/youtube\.com\/v\/([^?]+)/'
1099 + '/youtube\.com\/v\/([^?]+)/',
1100 + // Shorts + live URLs (e.g. youtube.com/shorts/XFR9Ti-4RbM?si=...).
1101 + // ID stops at ?, & or / so trailing query params are excluded.
1102 + '/youtube\.com\/shorts\/([^?&\/]+)/',
1103 + '/youtube\.com\/live\/([^?&\/]+)/'
1099 1104 ];
1100 1105
1101 1106 foreach ($patterns as $pattern) {
1102 1107 if (preg_match($pattern, $url, $matches)) {
@@ -1228,13 +1233,19 @@
1228 1233 */
1229 1234 private function getSimilarTrips(object $trip): array
1230 1235 {
1231 1236 $trip_id = (int) $trip->id;
1237 +
1238 + // Hour-based day tours (3.0.14+ column) — guarded so an install whose
1239 + // upgrade ALTER has not run yet keeps rendering similar trips.
1240 + $duration_hours_col = (new \Yatra\Repositories\TripRepository())->hasTripColumn('duration_hours')
1241 + ? ', duration_hours'
1242 + : '';
1232 1243
1233 1244 // Get similar trips based on category or difficulty
1234 1245 $similar = $this->wpdb->get_results(
1235 1246 $this->wpdb->prepare(
1236 - "SELECT id, title, slug, featured_image AS featured_image_id, '' AS featured_image_url, duration_days, duration_nights,
1247 + "SELECT id, title, slug, featured_image AS featured_image_id, '' AS featured_image_url, duration_days, duration_nights{$duration_hours_col},
1237 1248 original_price, sale_price, difficulty_level,
1238 1249 short_description
1239 1250 FROM {$this->table_trips} t
1240 1251 WHERE t.id != %d
@@ -1265,9 +1276,9 @@
1265 1276 // Fallback: Get any published trips if no similar found
1266 1277 if (empty($similar)) {
1267 1278 $similar = $this->wpdb->get_results(
1268 1279 $this->wpdb->prepare(
1269 - "SELECT id, title, slug, featured_image AS featured_image_id, '' AS featured_image_url, duration_days, duration_nights,
1280 + "SELECT id, title, slug, featured_image AS featured_image_id, '' AS featured_image_url, duration_days, duration_nights{$duration_hours_col},
1270 1281 original_price, sale_price, difficulty_level,
1271 1282 short_description
1272 1283 FROM {$this->table_trips}
1273 1284 WHERE id != %d