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/Services/DepartureService.php +24 -2 3.0.14.1 → 3.0.16 View file →
@@ -342,8 +342,27 @@
342 342 return $this->repository->findByTripId($tripId, $filters);
343 343 }
344 344
345 345 /**
346 + * Count departures across all trips for the same filters as
347 + * getAllDepartures() (pagination keys ignored) — the true total behind a
348 + * paginated list.
349 + */
350 + public function countAllDepartures(array $filters = []): int
351 + {
352 + return $this->repository->countAll($filters);
353 + }
354 +
355 + /**
356 + * Count departures for one trip for the same filters as getByTripId()
357 + * (pagination keys ignored).
358 + */
359 + public function countByTripId(int $tripId, array $filters = []): int
360 + {
361 + return $this->repository->countByTripId($tripId, $filters);
362 + }
363 +
364 + /**
346 365 * Get past departures by trip ID
347 366 */
348 367 public function getPastByTripId(int $tripId, array $filters = []): array
349 368 {
@@ -363,15 +382,18 @@
363 382 * Combines manual departures and dynamically generated recurring rule dates
364 383 *
365 384 * @param int $tripId Trip ID
366 385 * @param string $fromDate Start date (default: today)
367 - * @param string $toDate End date (default: +12 months)
386 + * @param string $toDate End date (default: today + the configurable booking horizon, 12 months unless changed)
368 387 * @return array Available dates with pricing and capacity info
369 388 */
370 389 public function getAvailableDates(int $tripId, ?string $fromDate = null, ?string $toDate = null): array
371 390 {
372 391 $fromDate = $fromDate ?? date('Y-m-d');
373 - $toDate = $toDate ?? date('Y-m-d', strtotime('+12 months'));
392 + // Default counted from today (not $fromDate), exactly as the previous
393 + // hard-coded '+12 months' was, so callers passing only a start date
394 + // keep the same window.
395 + $toDate = $toDate ?? yatra_get_availability_horizon_date();
374 396
375 397 // Get all manual departures
376 398 $manualDepartures = $this->repository->findByTripId($tripId, [
377 399 'date_from' => $fromDate,