diff --git a/trunk/src/AppBundle/Controller/BookingController.php b/trunk/src/AppBundle/Controller/BookingController.php index 075dd29d..40528f0c 100644 --- a/trunk/src/AppBundle/Controller/BookingController.php +++ b/trunk/src/AppBundle/Controller/BookingController.php @@ -70,12 +70,17 @@ class BookingController extends Controller // #TODO Consider changing key of travel dates foreach ($travelProgram->getTravelDates() as $curTravelDate) { - if ($curTravelDate->getName() == $request->query->get('nr')) - { - $travelDate = $curTravelDate; - break; + + + if($curTravelDate->getStatus() != 0){ + if ($curTravelDate->getName() == $request->query->get('nr')) + { + $travelDate = $curTravelDate; + break; + } } } + if (!isset($travelDate)) { throw $this->createNotFoundException(); diff --git a/trunk/src/AppBundle/Entity/TravelDate.php b/trunk/src/AppBundle/Entity/TravelDate.php index 627862c1..42a9d61e 100644 --- a/trunk/src/AppBundle/Entity/TravelDate.php +++ b/trunk/src/AppBundle/Entity/TravelDate.php @@ -105,6 +105,7 @@ final class TravelDate $this->travelProgram = $travelPeriod->getProgram(); $this->key = $key; $this->travelPeriod = $travelPeriod; + if ($end === null) { $this->end = clone $this->start; diff --git a/trunk/src/AppBundle/Entity/TravelPeriodRepository.php b/trunk/src/AppBundle/Entity/TravelPeriodRepository.php index c4d2315a..f0857e28 100644 --- a/trunk/src/AppBundle/Entity/TravelPeriodRepository.php +++ b/trunk/src/AppBundle/Entity/TravelPeriodRepository.php @@ -225,6 +225,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository $doQueryVirtualAndNonVirtual = $flags & self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL == self::TD_QUERY_VIRTUAL_AND_NON_VIRTUAL; + /** @var TravelPeriod[] $periods */ $qb = $this->createQueryBuilder('p'); $qb @@ -257,8 +258,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository if (!($flags & self::TD_QUERY_OUTDATED)) { $startDate = new \DateTime('tomorrow'); - $qb->andWhere("((p.isSeason = 0 AND d.startDate >= CURRENT_TIMESTAMP()) OR". - " (p.isSeason = 1 AND d.endDate >= CURRENT_TIMESTAMP()))"); + } if ($class) { @@ -292,7 +292,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository $entities = $qb->getQuery()->execute(); - $flightPeriodByKey = null; + $flightPeriodByKey = null; if (!$program->getIsMediated()) { if (!$program->getTravelArrivalPoint()) @@ -337,7 +337,6 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository } } } - $this->addTravelDatesToProgram($program, $entities, $flightPeriodByKey, $startDate, null); return $program->getTravelDates(); } @@ -410,6 +409,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository $doTestStartDate = false; if ($isPossibleDate) { + // #TODO Do we need the travel date key? $travelDateEnd = (clone $date)->modify('+'.$travelProgram->getProgramDuration().' day'); $travelDateKey = $this->createTravelDateKey($date, $travelDateEnd); @@ -463,8 +463,10 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository } else { - $travelProgram->addTravelDateFromNonSeasonTravelPeriod($travelDateKey, $travelPeriod, $flightPeriod, + $TravelDate = $travelProgram->addTravelDateFromNonSeasonTravelPeriod($travelDateKey, $travelPeriod, $flightPeriod, $currencyFactor); + + } } } diff --git a/trunk/src/AppBundle/Entity/TravelProgram.php b/trunk/src/AppBundle/Entity/TravelProgram.php index 69ccf80a..2892c3e9 100644 --- a/trunk/src/AppBundle/Entity/TravelProgram.php +++ b/trunk/src/AppBundle/Entity/TravelProgram.php @@ -1583,6 +1583,8 @@ class TravelProgram $this->assertTravelDateNotDefinedYet($key); $this->travelDateByKey[$key] = TravelDate::createForNonSeasonTravelPeriod($key, $travelPeriod, $flightPeriod, $currencyFactor); + + return $this->travelDateByKey[$key]; } public function addTravelDateFromSeasonTravelPeriod($key, TravelPeriod $travelPeriod, $index, \DateTime $start,