fix: ignore past travels in list view when patching data

This commit is contained in:
Björn Fromme
2025-10-04 11:49:36 +02:00
parent fba9edc931
commit cd82b70139
+11 -6
View File
@@ -170,8 +170,8 @@ class TravelLoader extends AbstractLoader
*
* @return Travel The loaded travel object
*
* @throws TravelNotFoundException When travel ID is not found
* @throws HotelNotInTravelException When hotel ID exists but not for this travel
* @throws TravelNotFoundException When travel ID is not found
* @throws HotelNotInTravelException When hotel ID exists but not for this travel
*/
public function loadById(int $dateId, ?int $hotelId = null, ?string $filename = null): Travel
{
@@ -208,8 +208,8 @@ class TravelLoader extends AbstractLoader
*
* @return Travel The loaded travel object
*
* @throws TravelNotFoundException When travel ID is not found in XML
* @throws HotelNotInTravelException When hotel ID is not found in travel XML
* @throws TravelNotFoundException When travel ID is not found in XML
* @throws HotelNotInTravelException When hotel ID is not found in travel XML
*/
private function loadXml(int $dateId, ?int $hotelId, string $filename): Travel
{
@@ -311,8 +311,13 @@ class TravelLoader extends AbstractLoader
continue;
}
$travelData = $this->loadById($travelId);
$booking->travelData = $travelData;
try {
$travelData = $this->loadById($travelId);
$booking->travelData = $travelData;
} catch (TravelNotFoundException) {
// Travel data not available (likely past travel) - skip patching
continue;
}
if (null === $travelData->dateFrom) {
continue;