From e9cafbf42622eedd45b8a9c468a7e9a0cc31d290 Mon Sep 17 00:00:00 2001 From: adametz Date: Thu, 11 Oct 2018 13:08:46 +0000 Subject: [PATCH] Preis ab xxx Ausgebuchte nicht mit auswerten git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3470 f459cee4-fb09-11de-96c3-f9c5f16c3c76 --- trunk/src/AppBundle/Entity/TravelDate.php | 19 ++++++++++--------- .../Entity/TravelPeriodRepository.php | 2 +- trunk/src/AppBundle/Entity/TravelProgram.php | 3 +++ 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/trunk/src/AppBundle/Entity/TravelDate.php b/trunk/src/AppBundle/Entity/TravelDate.php index 42a9d61e..15635e10 100644 --- a/trunk/src/AppBundle/Entity/TravelDate.php +++ b/trunk/src/AppBundle/Entity/TravelDate.php @@ -299,15 +299,16 @@ final class TravelDate $lowest = -1; foreach ($this->getPrices() as $price) { - if ($price->getPriceTypeId() == 3) - { - // Use double room if available (#1076) - return $price->getEffectiveDiscountPrice() ?? $price->getEffectivePrice(); - } - if ($lowest < 0 || $price->getEffectivePrice() < 0) - { - $lowest = $price->getEffectivePrice(); - } + if ($price->getPriceTypeId() == 3) + { + // Use double room if available (#1076) + return $price->getEffectiveDiscountPrice() ?? $price->getEffectivePrice(); + } + if ($lowest < 0 || $price->getEffectivePrice() < 0) + { + $lowest = $price->getEffectivePrice(); + } + } return $lowest == -1 ? null : $lowest; } diff --git a/trunk/src/AppBundle/Entity/TravelPeriodRepository.php b/trunk/src/AppBundle/Entity/TravelPeriodRepository.php index 502d6e9d..8b5ea75f 100644 --- a/trunk/src/AppBundle/Entity/TravelPeriodRepository.php +++ b/trunk/src/AppBundle/Entity/TravelPeriodRepository.php @@ -57,7 +57,7 @@ class TravelPeriodRepository extends \Doctrine\ORM\EntityRepository $qb->addSelect('d'); $qb->where("((p.isSeason = 0 AND d.startDate >= '$startDateStr' AND d.endDate <= '$endDateStr') OR". " (p.isSeason = 1 AND d.endDate >= '$startDateStr' AND". - " DATE_ADD(d.startDate, tp.programDuration, 'DAY') <= '$endDateStr' AND p.status >= 0))"); + " DATE_ADD(d.startDate, tp.programDuration, 'DAY') <= '$endDateStr' AND p.status > 0))"); // Prices // Instead of a single join to prices we add one join per price type. This reduces the execution time by diff --git a/trunk/src/AppBundle/Entity/TravelProgram.php b/trunk/src/AppBundle/Entity/TravelProgram.php index fdd114c9..c1e5db2a 100644 --- a/trunk/src/AppBundle/Entity/TravelProgram.php +++ b/trunk/src/AppBundle/Entity/TravelProgram.php @@ -1685,6 +1685,9 @@ class TravelProgram $lowestPrice = -1; foreach ($this->getTravelDates() as $travelDate) { + if($travelDate->getStatus() == 0){ + continue; + } $curLowestPrice = $travelDate->getLowestPrice(); if ($lowestPrice < 0 || $curLowestPrice < $lowestPrice) {