* rel="nofollow" und target="_blank" für verschiedene externe Links

* Mindestpreis im Slider oben im Reiseprogramm nicht anzeigen, wenn keine Termine vorhanden sind
* Tripodo-Export

git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3315 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
uli 2017-03-14 08:01:57 +00:00
parent 42c55d44a1
commit b8ec81329a
17 changed files with 380 additions and 18 deletions

View file

@ -50,6 +50,11 @@ class TravelCountry
*/
private $programs;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelDestination", mappedBy="country")
*/
private $destinations;
/**
@ -181,4 +186,38 @@ class TravelCountry
}
/**
* Add destination
*
* @param \AppBundle\Entity\TravelDestination $destination
*
* @return TravelCountry
*/
public function addDestination(\AppBundle\Entity\TravelDestination $destination)
{
$this->destinations[] = $destination;
return $this;
}
/**
* Remove destination
*
* @param \AppBundle\Entity\TravelDestination $destination
*/
public function removeDestination(\AppBundle\Entity\TravelDestination $destination)
{
$this->destinations->removeElement($destination);
}
/**
* Get destinations
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getDestinations()
{
return $this->destinations;
}
}

View file

@ -6,6 +6,7 @@
namespace AppBundle\Entity;
use AppBundle\Util\DepartureUtil;
use Doctrine\Common\Collections\ArrayCollection;
/**
* TravelDate is a wrapper for TravelPeriod + start date and end date. This entity doesn't represent a database
@ -89,10 +90,16 @@ final class TravelDate
}
$this->start = $start;
$this->index = $index;
$this->prices = [];
foreach ($travelPeriod->getPrices() as $price)
{
$this->prices[$price->getPriceTypeId()] = clone $price;
}
}
else
{
$this->start = $travelPeriod->getStartDate();
$this->prices = $travelPeriod->getPrices();
}
$this->flightPeriod = $flightPeriod;
$this->travelProgram = $travelPeriod->getProgram();
@ -223,14 +230,14 @@ final class TravelDate
$profitMargin = $this->travelProgram->getProfitMargin() / 100 + 1;
}
$currencyFactor = $this->travelProgram->getNettoPricesInEuro() ? 1 : $this->currencyFactor;
foreach ($this->travelPeriod->getPrices() as $price)
foreach ($this->prices as &$price)
{
$price->setEffectivePrice(round(($flightPrice + $price->getPrice() * $currencyFactor) * $profitMargin));
$price->setEffectiveComfortPrice(round($price->getPriceComfort() * $currencyFactor * $profitMargin));
$price->setEffectiveChildPrice(round($price->getPriceChildren() * $currencyFactor * $profitMargin));
}
}
return $this->travelPeriod->getPrices();
return $this->prices;
}
public function getLowestPrice()

View file

@ -31,7 +31,7 @@ class TravelDestination
/**
* @var \AppBundle\Entity\TravelCountry
*
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelCountry")
* @ORM\ManyToOne(targetEntity="AppBundle\Entity\TravelCountry", inversedBy="destinations")
* @ORM\JoinColumns({
* @ORM\JoinColumn(name="country_id", referencedColumnName="id")
* })
@ -39,7 +39,6 @@ class TravelDestination
private $country;
/**
* Set name
*

View file

@ -317,6 +317,15 @@ class TravelProgram
*/
private $countries;
/**
* @ORM\ManyToMany(targetEntity="AppBundle\Entity\TravelDestination")
* @ORM\JoinTable(name="travel_program_destination",
* joinColumns={@ORM\JoinColumn(name="program_id", referencedColumnName="id")},
* inverseJoinColumns={@ORM\JoinColumn(name="destination_id", referencedColumnName="id")}
* )
*/
private $destinations;
/**
* @ORM\OneToMany(targetEntity="AppBundle\Entity\TravelProgramImage", mappedBy="program")
*/
@ -1509,7 +1518,7 @@ class TravelProgram
/**
* Get options
*
* @return \Doctrine\Common\Collections\Collection
* @return TravelOption[]|\Doctrine\Common\Collections\Collection
*/
public function getOptions()
{
@ -1556,4 +1565,38 @@ class TravelProgram
{
return ($this->showMap ?? 0) > 0 && ($this->mapHtml or $this->mapHtml);
}
/**
* Add destination
*
* @param \AppBundle\Entity\TravelDestination $destination
*
* @return TravelProgram
*/
public function addDestination(\AppBundle\Entity\TravelDestination $destination)
{
$this->destinations[] = $destination;
return $this;
}
/**
* Remove destination
*
* @param \AppBundle\Entity\TravelDestination $destination
*/
public function removeDestination(\AppBundle\Entity\TravelDestination $destination)
{
$this->destinations->removeElement($destination);
}
/**
* Get destinations
*
* @return \Doctrine\Common\Collections\Collection
*/
public function getDestinations()
{
return $this->destinations;
}
}

View file

@ -2,6 +2,8 @@
namespace AppBundle\Entity;
use Doctrine\ORM\Query\Expr;
/**
* TravelProgramRepository
*
@ -10,4 +12,26 @@ namespace AppBundle\Entity;
*/
class TravelProgramRepository extends \Doctrine\ORM\EntityRepository
{
/**
* @return TravelProgram[]
*/
public function getProgramsToExport()
{
return $this->createQueryBuilder('tp')
->innerJoin('tp.page', 'page')
->addSelect('page')
->leftJoin('tp.countries', 'country')
->addSelect('country')
->leftJoin('country.destinations', 'destination')
->addSelect('destination')
->leftJoin('tp.options', 'option')
->addSelect('option')
->leftJoin('tp.images', 'image', Expr\Join::WITH, 'image.type = 1')
->addSelect('image')
->where('tp.status = 1')
->andWhere('tp.programType = '. TravelProgram::ORGANIZED_PROGRAM_TYPE)
->getQuery()
->execute()
;
}
}