Rabatt export, optimize

This commit is contained in:
Kevin Adametz 2019-11-07 17:09:18 +01:00
parent 54fc46ace4
commit f2be8e54b4
23 changed files with 552 additions and 34 deletions

View file

@ -147,9 +147,11 @@
{% if site_loading is defined and page is defined %}
{{ render(controller('AppBundle:Component:makeSidebarWidget', {'site_loading': site_loading, 'page': page})) }}
{% elseif site_loading is defined and api is defined %}
{{ render(controller('AppBundle:Component:makeSidebarWidget', {'site_loading': site_loading, 'page': null, 'api': api})) }}
{% else %}
{% if site_loading is defined %}
{{ render(controller('AppBundle:Component:makeSidebarWidget', {'site_loading': site_loading, 'page': null, 'search_form': search_form})) }}
{% if site_loading is defined and search_form is defined %}
{{ render(controller('AppBundle:Component:makeSidebarWidget', {'site_loading': site_loading, 'page': null, 'api': null, 'search_form': search_form})) }}
{% else %}
{{ render(controller('AppBundle:Component:makeSidebarWidget', {'site_loading': 'default'})) }}
{% endif %}

View file

@ -1,3 +1,8 @@
<style>
.modal-content .wrapper-nav-tabs {
display: none;
}
</style>
<div class="modal fade" tabindex="-1" role="dialog" id="st-{{ id }}-modal">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">

View file

@ -0,0 +1,64 @@
{% if api.navi is defined %}
<style>
#sidebar #side-navigation .side-menu li.lvl_deep_1 {
padding-left: 10px!important;
}
#sidebar #side-navigation .side-menu li.lvl_deep_2 {
padding-left: 30px!important;
}
#sidebar #side-navigation .side-menu li.lvl_deep_3 {
padding-left: 50px!important;
}
#sidebar #side-navigation .side-menu li.lvl_deep_4 {
padding-left: 70px!important;
}
</style>
<div class="widget clearfix">
<div class="widget-title">
<a class="collapse-widget" href="#side-navigation" data-toggle="collapse">{{ title }}</a>
</div><!-- end title -->
<nav id="side-navigation" class="navbar collapse in" role="navigation" itemscope
itemtype="https://schema.org/SiteNavigationElement"
>
<ul class="side-menu" role="menu">
{% for nav in api.navi %}
{% if nav.lvl == 0 %}
<li {% if nav.active == 1 %} class ="active"{% endif %} role="menuitem" itemprop="name">
<a itemprop="url" href="{{ nav.url }}" title="{{ nav.name }}">
{{ nav.name }}
</a>
</li>
{% else %}
<li class="sub-menu-item{% if nav.active == 1 %} active{% endif %} lvl_deep_{{ nav.lvl }}" role="menuitem" itemprop="name">
<i class="fa fa-star"></i>
<a itemprop="url" href="{{ nav.url }}" title="{{ nav.name }}">
{{ nav.name }}
</a>
</li>
{% endif %}
{#
{% if nav.children is defined %}
{% for child in nav.children %}
<li class="sub-menu-item{% if child.active == 1 %} active{% endif %}" role="menuitem" itemprop="name">
<i class="fa fa-star"></i>
<a itemprop="url" href="{{ child.url }}" title="{{ child.name }}">
{{ child.name }}
</a>
</li>
{% endfor %}
{% endif %}
#}
{% endfor %}
</ul>
</nav>
</div>
{% endif %}

View file

@ -2,3 +2,7 @@
{% if page is not empty %}
{{ render(controller('AppBundle:Component:navSidebarWidget', {page: page, title:widget.name})) }}
{% endif %}
{% if api is not empty %}
{{ render(controller('AppBundle:Component:navSidebarApiWidget', {api: api, title:widget.name})) }}
{% endif %}

View file

@ -7,9 +7,11 @@
{{ include('default/components/sidebar/ttSearchSidebarWidget.html.twig') }}
{# END WORKAROUND #}
{% elseif page is not empty %}
{% elseif page is defined and page is not empty %}
{# #HACK Dont display the search in FEWO #}
{% if page.title != 'Ferienwohnungen' %}
{{ render(controller('AppBundle:Component:searchSidebarWidget', {page: page, title:widget.name})) }}
{{ render(controller('AppBundle:Component:searchSidebarWidget', {page:page, title:widget.name})) }}
{% endif %}
{% elseif api is defined and api is not empty %}
{{ render(controller('AppBundle:Component:searchSidebarApiWidget', {api:api, title:widget.name})) }}
{% endif %}

View file

@ -1,9 +1,9 @@
{# @var booking_request \AppBundle\Entity\BookingRequest #}
Sehr geehrte{{ booking_request.salutation == 1 ? 'r Herr' : ' Frau' }} {{ booking_request.lastName }},
vielen Dank für Ihre Online-Buchung . Dieser wird schnellstmöglich bearbeitet und stellt noch keine{#
#} Mietbestätigung dar. Bitte prüfen Sie noch einmal Ihre Angaben und kontaktieren Sie uns bitte, wenn ein Fehler{#
#} enthalten ist.
vielen Dank für Ihren verbindlichen Buchungsauftrag. Dieser wird schnellstmöglich bearbeitet und stellt noch keine{#
#} Reisebestätigung dar. Bitte prüfen Sie noch einmal Ihre Angaben und kontaktieren Sie uns bitte, wenn ein Fehler{#
#} enthalten ist.
{% include 'default/email/components/bookingSummary.txt.twig' %}

View file

@ -91,7 +91,7 @@ Nr., Zimmertyp, Geschlecht, Vorname, Nachname, Geburtsdatum
{% endfor %}
=====================================================================================
Mitteilungen / Sonstiges:
Unverbindliche Anmerkungen:
=====================================================================================
{{ booking_request.notes ?? '-' }}

View file

@ -37,7 +37,7 @@ Erwachsene: {{ fewo_booking_request.travelerCountAdult }}
Kinder: {{ fewo_booking_request.travelerCountChild }}
Gesamt: {{ fewo_booking_request.travelerCount }}
=======================================================
Mitteilungen / Sonstiges:
Unverbindliche Anmerkungen:
{{ fewo_booking_request.notes ?? '-' }}
=======================================================

View file

@ -219,15 +219,20 @@
{% if extraDays == 1 and travel_program.drafts.count() > 0 %}
<tr>
{% else %}
<tr style="display:none">
<tr style="display:none;">
{% endif %}
<td>Verlängerung buchen</td>
<td>
<p>{{ getContextBySlug('verlaengerung-vor') }}</p>
{% for country in travel_program.countries %}
<p>{{ country.textBefore }}</p>
{% endfor %}
{{ form_widget(form.extraBookingDaysBefore) }}
{{ form_errors(form.extraBookingDaysBefore) }}
<br>
<p>{{ getContextBySlug('verlaengerung-nach') }}</p>
{% for country in travel_program.countries %}
<p>{{ country.textAfter }}</p>
{% endfor %}
{{ form_widget(form.extraBookingDaysAfter) }}
{{ form_errors(form.extraBookingDaysAfter) }}

View file

@ -356,7 +356,7 @@
<div class="form-box">
<div class="">
<div class="col-md-12 col-sm-12 col-xs-12">
<h5>Mitteilungen / Sonstiges (optional)</h5>
<h5>Unverbindliche Anmerkungen</h5>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<p>{{ booking.comments }}</p>

View file

@ -0,0 +1,96 @@
{% extends get_base_template() %}
{% block body %}
<section class="clearfix">
{% if(api is defined) %}
{% if api.sites|length > 1 %}
<div class="wrapper-nav-tabs">
<ul class="nav nav-tabs nav-justified list-nav-tabs">
{% for site in api.sites %}
<li class="{% if loop.index==1 %} active {% endif %}">
<a href="#travel_guide_content_{{ site.id }}" aria-controls="travel_guide_content_{{ site.id }}" role="tab" data-toggle="tab">
{% if(site.scope == 0) %}
Zusammenfassung <i class="hidden-xs">für eilige Leser</i>
{% else %}
Ausführliche Darstellung <i class="hidden-xs">für Interessierte</i>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
<div class="tab-content">
{% for site in api.sites %}
<div role="tabpanel" class="tab-pane {% if loop.index==1 %} active {% endif %}" id="travel_guide_content_{{ site.id }}">
<h1>{{ site.name }}</h1>
{{ site.full_text|raw|keywords|lozad }}
</div>
{% endfor %}
</div>
<div class="wrapper-nav-tabs">
<ul class="nav nav-tabs nav-justified list-nav-tabs">
{% for site in api.sites %}
<li class="{% if loop.index==1 %} active {% endif %}">
<a href="#travel_guide_content_{{ site.id }}" aria-controls="travel_guide_content_{{ site.id }}" role="tab" data-toggle="tab">
{% if(site.scope == 0) %}
Zusammenfassung <i class="hidden-xs">für eilige Leser</i>
{% else %}
Ausführliche Darstellung <i class="hidden-xs">für Interessierte</i>
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
{% else %}
{% for site in api.sites %}
<h1>{{ site.name }}</h1>
{{ site.full_text|raw|keywords|lozad }}
{% endfor %}
{% endif %}
{% endif %}
</section>
<hr>
{% if(api is defined and api.children is defined and api.children is not empty) %}
<section class="clearfix">
<h2></h2>
<div class="row">
{% for child_page in api.children %}
{% if(child_page.active) %}
<div class="col-md-4 col-sm-6">
<div class="travel-wrapper get-box-link">
<div class="item text-left">
{% if(false and child_page.box_image_url is defined and child_page.box_image_url is not empty) %}
<div class="item-img" style="height: 220px;">
{% if child_page.box_image_url is defined and child_page.box_image_url is not empty %}
{% set image_url = child_page.box_image_url %}
{% set image_alt = child_page.name %}
{% else %}
{% set image_url = asset('/bundles/app/images/no-picture.png')%}
{% set image_alt = 'Kein Vorschaubild vorhanden' %}
{% endif %}
<div class="img-background lozad" data-background-image="{{ image(image_url|trim('/')).cropResize(960).guess(90) }}" style="background-image:url({{ asset('images/placeholder-image.png') }}); height: 220px;"></div>
<noscript>
<img width="234" height="180" src="{{ image(image_url|trim('/')).cropResize(960).guess(90) }}" class="img-responsiv img-responsiv-item" style="">
</noscript>
</div>
{% endif %}
<div class="box_mid">
<div class="hl5">{{ child_page.name }}</div>
<p>{{ child_page.description }}</p>
</div>
<a class="item-button is-box-link dobble_line" href="{{ child_page.url }}" title="{{ child_page.name }}">
<span>{{ child_page.name }}</span>
</a>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</section>
{% endif %}
{% endblock %}

View file

@ -213,7 +213,7 @@
<div class="form-box">
<div class="">
<div class="col-md-12 col-sm-12 col-xs-12">
<h5>Mitteilungen / Sonstiges (optional)</h5>
<h5>Unverbindliche Anmerkungen</h5>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
{{ form_field(form.notes, 'Mitteilungen / Sonstiges (optional)', {

View file

@ -133,7 +133,7 @@
<div class="form-box">
<div class="">
<div class="col-md-12 col-sm-12 col-xs-12">
<h5>Mitteilungen / Sonstiges (optional)</h5>
<h5>Unverbindliche Anmerkungen</h5>
</div>
<div class="col-md-12 col-sm-12 col-xs-12">
<p>{{ fewo_booking_request.notes }}</p>

View file

@ -0,0 +1,94 @@
{% extends get_base_template() %}
{% block body %}
<section class="clearfix">
{% if(api is defined) %}
{% if api.sites|length > 1 %}
<div class="wrapper-nav-tabs">
<ul class="nav nav-tabs nav-justified list-nav-tabs">
{% for site in api.sites %}
<li class="">
<a href="#travel_guide_content_{{ site.id }}" aria-controls="travel_guide_content_{{ site.id }}" role="tab" data-toggle="tab">
{% if(site.scope == 0) %}
Kurzer Inhalt
{% else %}
Langer Inhalt
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
<div class="tab-content">
{% for site in api.sites %}
<div role="tabpanel" class="tab-pane active" id="travel_guide_content_{{ site.id }}">
{{ site.full_text|raw|keywords|lozad }}
</div>
{% endfor %}
</div>
<div class="wrapper-nav-tabs">
<ul class="nav nav-tabs nav-justified list-nav-tabs">
{% for site in api.sites %}
<li class="">
<a href="#travel_guide_content_{{ site.id }}" aria-controls="travel_guide_content_{{ site.id }}" role="tab" data-toggle="tab">
{% if(site.scope == 0) %}
Kurzer Inhalt
{% else %}
Langer Inhalt
{% endif %}
</a>
</li>
{% endfor %}
</ul>
</div>
{% else %}
{% for site in api.sites %}
{{ site.full_text|raw|keywords|lozad }}
{% endfor %}
{% endif %}
{% endif %}
</section>
<hr>
{% if(api is defined and api.children is defined and api.children is not empty) %}
<section class="clearfix">
<h2></h2>
<div class="row">
{% for child_page in api.children %}
{% if(child_page.active) %}
<div class="col-md-4 col-sm-6">
<div class="travel-wrapper get-box-link">
<div class="item text-left">
{% if(false and child_page.box_image_url is defined and child_page.box_image_url is not empty) %}
<div class="item-img" style="height: 220px;">
{% if child_page.box_image_url is defined and child_page.box_image_url is not empty %}
{% set image_url = child_page.box_image_url %}
{% set image_alt = child_page.name %}
{% else %}
{% set image_url = asset('/bundles/app/images/no-picture.png')%}
{% set image_alt = 'Kein Vorschaubild vorhanden' %}
{% endif %}
<div class="img-background lozad" data-background-image="{{ image(image_url|trim('/')).cropResize(960).guess(90) }}" style="background-image:url({{ asset('images/placeholder-image.png') }}); height: 220px;"></div>
<noscript>
<img width="234" height="180" src="{{ image(image_url|trim('/')).cropResize(960).guess(90) }}" class="img-responsiv img-responsiv-item" style="">
</noscript>
</div>
{% endif %}
<div class="box_mid">
<div class="hl5">{{ child_page.name }}</div>
<p>{{ child_page.description }}</p>
</div>
<a class="item-button is-box-link dobble_line" href="{{ child_page.url }}" title="{{ child_page.name }}">
<span>{{ child_page.name }}</span>
</a>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</section>
{% endif %}
{% endblock %}

View file

@ -145,6 +145,7 @@ class BookingController extends Controller
$form->handleRequest($request);
$bookingRequest = $form->getData();
}
$htmlSummary = [];
$bookingPriceInfo = [];
$totalPrice = $this->calculatePrice($travelDate, $bookingRequest, $travelProgram->getCategory()->getId(), $travelProgram->getDepositPercent(), $htmlSummary, $bookingPriceInfo);
@ -171,7 +172,6 @@ class BookingController extends Controller
$em->flush();
$crmBookingUrl = $this->get('app.booking_exporter')->process($bookingRequest, $travelDate, $bookingPriceInfo);
if (!$crmBookingUrl)
{
$crmBookingUrl = '[CRM-EXPORT FEHLGESCHLAGEN]';
@ -199,6 +199,7 @@ class BookingController extends Controller
)
);
$this->get('mailer')->send(\Swift_Message::newInstance()
->setSubject('BUCHUNG: '. $travelProgram->getTitle() .'('. $travelDate->getName() .')')
->setFrom('stern@stern-tours.de', 'STERN TOURS')
@ -221,7 +222,6 @@ class BookingController extends Controller
);
// #TODO This will lead to multiple bookings due to multiple form submission. Redirect instead!
return $this->render('default/pages/bookingConfirmation.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
@ -276,6 +276,7 @@ class BookingController extends Controller
elseif ($action == '/berechne-gesamtpreis')
{
return $this->render('default/components/booking/summary.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
'summary' => $htmlSummary,
@ -536,7 +537,7 @@ class BookingController extends Controller
}
$tempExtraDaysAfterHTML = array();
//days before
//days after
if($bookingRequest->getExtraBookingDaysAfter()){
$newDay = clone $travelDate->getEnd();
@ -631,6 +632,9 @@ class BookingController extends Controller
'price' => $singleDiscountPrice ?? $singleFullPrice,
'price_children' => $singleChildDiscountPrice ?? $childPrice,
'price_total' => $roomPrice + $discount + $childDiscount,
'price_full' => $singleFullPrice,
'price_children_full' => $childPrice,
'price_total_full' => $roomPrice,
];
}
@ -692,6 +696,7 @@ class BookingController extends Controller
}else{
$outPriceInfo['discount'][$key] = array(
'value' => $discount,
'price_discount' => ($singleFullPrice - $singleDiscountPrice),
'label_first' => 'Rabatt',
'label_last' => Util::formatPrice($singleFullPrice - $singleDiscountPrice) . ' pro Person',
'count' => $adultCount,
@ -718,12 +723,15 @@ class BookingController extends Controller
//Versicherung price + html
if ($bookingRequest->getInsurance() && $adultCount > 0)
{
$curAssessmentBasis = $insuranceAssessmentBasis + ($singleDiscountPrice ?? $singleFullPrice);
$curAssessmentChildBasis = $insuranceAssessmentChildBasis + ($singleChildDiscountPrice ?? $childPrice);
$insurancePrice = $this->getDoctrine()->getRepository('AppBundle:TravelInsurancePrice')
->findOneByInsuranceIdAndAssessmentBasis($bookingRequest->getInsurance()->getId(), $curAssessmentBasis);
$insuranceChildPrice = $this->getDoctrine()->getRepository('AppBundle:TravelInsurancePrice')
->findOneByInsuranceIdAndAssessmentBasis($bookingRequest->getInsurance()->getId(), $curAssessmentChildBasis);
$insurancePriceValue = $insurancePrice->getPrice() > 0 ? $insurancePrice->getPrice() : round($insurancePrice->getPercent() * $curAssessmentBasis / 100, 2);
$insuranceChildPriceValue = $insuranceChildPrice->getPrice() > 0 ? $insuranceChildPrice->getPrice() : round($insuranceChildPrice->getPercent() * $curAssessmentChildBasis / 100, 2);
@ -804,8 +812,6 @@ class BookingController extends Controller
}
//ROOMS
if(count($tempRoomHTML) > 0){
foreach ($tempRoomHTML as $item) {

View file

@ -11,6 +11,7 @@ use AppBundle\Entity\FewoPrice;
use AppBundle\Entity\Page;
use AppBundle\Entity\SunstarTravelProgram;
use AppBundle\Entity\FewoLodgingGroup;
use AppBundle\Form\SearchRequestType;
use AppBundle\Form\TtSearchRequestType;
use AppBundle\Listener\KernelControllerListener;
use Doctrine\ORM\EntityManager;
@ -51,6 +52,28 @@ class CmsController extends Controller
}
public function iqTravelGuideAction($api, $template = 'TravelGuide')
{
/* $travel_guide_content = false;
if($page->getTravelGuideContentId() > 0){
$repo = $this->getEntityManager()->getRepository('AppBundle:TravelGuides');
$travel_guide_content = $repo->findByID($page->getTravelGuideContentId());
}
*/
return $this->render('default/pages/cms/iq'. $template .'.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
'site_loading' => 'default',
'api' => $api,
'breadcrumb_entries' => $api->bread_crumb,
// 'search_form' => $this->createForm(SearchRequestType::class)->createView(),
]);
}
public function travelGuideAction(Page $page, $template = 'default')
{
if(!empty($page->getTemplate())) {
@ -62,7 +85,6 @@ class CmsController extends Controller
$travel_guide_content = $repo->findByID($page->getTravelGuideContentId());
}
return $this->render('default/pages/cms/'. $template .'.html.twig', [
'base_dir' => realpath($this->getParameter('kernel.root_dir').'/..').DIRECTORY_SEPARATOR,
'site_loading' => 'default',

View file

@ -41,6 +41,16 @@ class ComponentController extends Controller
]);
}
public function navSidebarApiWidgetAction($api, $title = 'Reiseführer')
{
return $this->render('default/components/sidebar/navSidebarApiWidgetInner.html.twig', [
'api'=>$api,
'title' => "Reiseführer",
]);
}
public function navSidebarWidgetAction(Page $page, $title = 'Reiseprogramme')
{
if(!empty($page->getTitle())){
@ -95,6 +105,26 @@ class ComponentController extends Controller
return $this->render('default/components/sidebar/navSidebarWidgetInner.html.twig', $view);
}
public function searchSidebarApiWidgetAction($api, $title = 'Suche')
{
$combinedDestination = null;
$destination = null;
//todo need Country by name
if(isset($api->sites[0]->country_id)){
$repo = $this->getEntityManager()->getRepository('AppBundle:TravelCountry');
$destination = $repo->find($api->sites[0]->country_id);
}
return $this->render('default/components/sidebar/searchSidebarWidgetInner.html.twig', [
'slider_title' => "suche",
'search_form' => $this->createForm(SearchRequestType::class, [
'c' =>$destination,
'c2' => $combinedDestination,
])->createView()
]);
}
public function searchSidebarWidgetAction(Page $page, $title = 'Suche')
{
$combinedDestination = null;
@ -111,6 +141,7 @@ class ComponentController extends Controller
{
$destination = $page->getCountry();
}
return $this->render('default/components/sidebar/searchSidebarWidgetInner.html.twig', [
'slider_title' => "suche",
'search_form' => $this->createForm(SearchRequestType::class, [
@ -190,7 +221,7 @@ class ComponentController extends Controller
]);
}
public function makeSidebarWidgetAction($site_loading = 'default', Page $page = null, $search_form = null){
public function makeSidebarWidgetAction($site_loading = 'default', Page $page = null, $api=null, $search_form = null){
$show_seal_of_approval = false;
//default
@ -226,6 +257,7 @@ class ComponentController extends Controller
$widgets = $sidebarRepo->findWidgetsBy($site);
$vars = [ 'page' => $page,
'api' => $api,
'site_loading' => $site_loading,
'widgets' => $widgets,
'show_seal_of_approval' => $show_seal_of_approval,

View file

@ -20,6 +20,27 @@ class TravelCountry
*/
private $name;
/**
* @var string
*
* @ORM\Column(name="slug", type="string", length=255, nullable=true)
*/
private $slug;
/**
* @var string
*
* @ORM\Column(name="text_before", type="string", length=255, nullable=true)
*/
private $text_before;
/**
* @var string
*
* @ORM\Column(name="text_after", type="string", length=255, nullable=true)
*/
private $text_after;
/**
* @var string
*
@ -99,6 +120,80 @@ class TravelCountry
return $this->name;
}
/**
* Set slug
*
* @param string $slug
*
* @return TravelCountry
*/
public function setSlug($slug)
{
$this->slug = $slug;
return $this;
}
/**
* Get slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Set text_before
*
* @param string $text_before
*
* @return TravelCountry
*/
public function setTextBefore($text_before)
{
$this->text_before = $text_before;
return $this;
}
/**
* Get text_before
*
* @return string
*/
public function getTextBefore()
{
return $this->text_before;
}
/**
* Set text_after
*
* @param string $text_after
*
* @return TravelCountry
*/
public function setTextAfter($text_after)
{
$this->text_after = $text_after;
return $this;
}
/**
* Get text_after
*
* @return string
*/
public function getTextAfter()
{
return $this->text_after;
}
/**
* Set htmlInformation
*

View file

@ -141,10 +141,14 @@ class BookingSternToursCrmExporter extends SternToursCrmExporter
'adult' => $room['adults'],
'children' => 0,
'price_children' => 0,
'price_children_full' => 0,
'price_adult_full' => $room['price_full'],
];
if($room['children'] > 0){
$rooms[$i]['children'] = $room['children'];
$rooms[$i]['price_children'] = $room['price_children'];
$rooms[$i]['price_children_full'] = $room['price_children_full'];
}
$i++;
}
@ -169,13 +173,23 @@ class BookingSternToursCrmExporter extends SternToursCrmExporter
'children' => 0,
'price_children' => 0,
];
if($option->getPriceChildren() > 0){
if($bookingRequest->getChildrenCount() > 0){
$travel_options[$i]['children'] = $bookingRequest->getChildrenCount();
$travel_options[$i]['price_children'] = $option->getPriceChildren();
}
$i++;
}
$dis = [];
$i = 0;
foreach ($bookingPriceInfo['discount'] as $discount)
{
$dis[$i] = [
'count' => $discount['count'],
'value' => $discount['value'],
'price' => $discount['price_discount']
];
$i++;
}
$resp = $this->httpPostAPIv3('draft/create_drafts_from_booking', [
'travel_program_id' => $tp->getId(),
'comfort' => $bookingRequest->getComfort(),
@ -193,6 +207,7 @@ class BookingSternToursCrmExporter extends SternToursCrmExporter
'rooms' => $rooms,
'class_options' => $class_options,
'travel_options' => $travel_options,
'discount' => $dis,
]);
if (count($resp) == 0)
{

View file

@ -10,6 +10,7 @@ namespace AppBundle\Listener;
use AppBundle\AppBundle;
use AppBundle\Controller\DefaultController;
use AppBundle\Entity\Page;
use AppBundle\Util;
use Doctrine\ORM\EntityManager;
use Doctrine\ORM\PersistentCollection;
use Symfony\Bundle\FrameworkBundle\Routing\Router;
@ -31,6 +32,7 @@ class KernelControllerListener
$this->controllerResolver = $controllerResolver;
}
public function onKernelController(FilterControllerEvent $event)
{
$request = $event->getRequest();
@ -42,6 +44,7 @@ class KernelControllerListener
}
$session->set('time', time());
if ($request->get('_controller') == 'AppBundle\Controller\DefaultController::defaultAction')
{
$repo = $this->em->getRepository('AppBundle:Page');
@ -56,18 +59,20 @@ class KernelControllerListener
$pathArray = explode('/', $path);
$restOfPath = '';
$curPath = $path;
$api = Util::loadFromApi('cms/search', ['url'=>$curPath]);
while (!empty($pathArray))
{
$node = $repo->findOneBy(['realUrlPath' => '/'. $curPath]);
if ($node)
{
break;
if(!$api){
$node = $repo->findOneBy(['realUrlPath' => '/'. $curPath]);
if ($node)
{
break;
}
}
$restOfPath = '/'. array_pop($pathArray) . $restOfPath;
$curPath = implode('/', $pathArray);
}
//find and try 301
//find => to
$redirects = [
@ -96,9 +101,26 @@ class KernelControllerListener
}
}
//load content from API!
if($api){
$request->attributes->set('_controller', 'AppBundle:Cms:iqTravelGuide');
$request->attributes->set('api', $api);
$request->attributes->set('template', 'TravelGuide');
try
{
$controller = $this->controllerResolver->getController($request);
}
catch (\LogicException $e)
{
// If there is no controller action, call the default action and pass the template name
$request->attributes->set('_controller', 'AppBundle:Cms:Default');
$request->attributes->set('template', "Default");
}
$event->setController($controller ?? $this->controllerResolver->getController($request));
return;
}
if (!$node)
{
// Now try to find a page by tracing a page node path using the page nodes' slugs
@ -236,4 +258,6 @@ class KernelControllerListener
$event->setController($controller ?? $this->controllerResolver->getController($request));
}
}
}

View file

@ -9,6 +9,7 @@ namespace AppBundle\Service;
use AppBundle\Entity\Keyword;
use AppBundle\Entity\Page;
use AppBundle\Util;
use Doctrine\ORM\EntityManager;
class KeywordService
@ -134,8 +135,7 @@ class KeywordService
if($dict === null)
{
$dict = [];
$keywords = $this->entityManager->getRepository('AppBundle:Keyword')->findAll();
/** @var Keyword $keyword */
/* $keywords = $this->entityManager->getRepository('AppBundle:Keyword')->findAll();
foreach($keywords as $keyword)
{
if(isset($dict[$keyword->getValue()]))
@ -156,7 +156,6 @@ class KeywordService
->getQuery()
->execute()
;
/** @var Page $page */
foreach($pages as $page)
{
if(isset($dict[$page->getKeyword()]))
@ -169,6 +168,23 @@ class KeywordService
$dict[$page->getKeyword()] = $dictEntry;
}
}
*/
/** @var Page $page */
$keywords = Util::loadFromApi('cms/keywords', ['url'=>'']);
foreach($keywords as $keyword => $url)
{
if(isset($dict[$keyword]))
{
continue;
}
$dictEntry = $this->createKeywordDictEntry("/".$url, $keyword, $classes);
if ($dictEntry !== null)
{
$dict[$keyword] = $dictEntry;
}
}
}
return $dict;
}

View file

@ -86,8 +86,9 @@ class AppExtension extends \Twig_Extension
return date("Ymd", time());
}
public function getContentBySlug($slug)
public function getContentBySlug($slug, $to = "")
{
$slug = $slug.$to;
$repo = $this->em->getRepository('AppBundle:CMSContent');
$re = $repo->findBySlug($slug);
if($re){

View file

@ -28,6 +28,7 @@ class Util
return array_reverse($ret);
}
public static function reAttachRelatedCollection($entity, $field, $collection)
{
$cls = new \ReflectionClass(get_class($entity));
@ -168,6 +169,40 @@ class Util
return self::httpRequest($url, 'GET', '', $headers, $withRespHeaders, $cookieJarPath);
}
public static function loadFromApi($action, $postData){
$baseUrl = 'https://mein.sterntours.de/api/';
if($_SERVER['HTTP_HOST'] == 'sterntours.local') {
$baseUrl = 'http://mein.sterntours.local/api/';
}
$postData['key'] = 'f6077389c9ce710e554763a5de02c8ec';
$data = $postData;
$result = "";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 20);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_URL, $baseUrl.$action);
$result = curl_exec($ch);
/* var_dump($result);
die();
*/
$r = json_decode($result);
curl_close($ch);
if(isset($r->success)) {
return $r->ret;
}
if(isset($r->error)) {
//$this->logger->warn('*** v3 Error: '.$r->error);
return false;
}
}
/**
* Prints formatted back-trace. CLI-output is colorized as well.
*