* Anreise-Wochentag nun per Saison statt Objekt definierbar
* Anreise-Wochentag wird für buchbare Tage im Kalender berücksichtigt
* Kalenderblätter bis zum Ende des spätesten bekannten Saisonende
* Datepicker erlaubt nur noch mögliche Reiseenddaten anzuklicken im Fewo-Buchungsformular
* Algogrithmus zur Bestimmung buchbarer Kalendereinträge komplett umgeschrieben, da bisher Reservierungen von nur einer Nacht nicht berücksichtigt werden konnten
* Upload mehrerer Bilder gleichzeitig nun möglich
* Beim Upload von Bildern werden diese gleich in JPEG umgewandelt, komprimiert und für den Slider zugeschnitten
* Behoben: CRM-Export funktioniert teilweise nicht
* Für CMS-Template "overview" können nun twig-Variablen per JSON in Spalte cms_settings gesetzt werden (=> Kulturreisensuche ausblendbar für Fewo-Übersichtsseite)
* 

Sonstiges:
* Falls CRM-Export nicht funktioniert, wird dies in der Buchungs-Mail für den Service deutlich gemacht

SQL:

ALTER TABLE fewo_lodging DROP only_weekday;
ALTER TABLE fewo_season ADD only_weekday INT DEFAULT NULL;


git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3359 f459cee4-fb09-11de-96c3-f9c5f16c3c76
This commit is contained in:
uli 2017-11-28 06:16:21 +00:00
parent 45977fd4de
commit 1a0388311e
26 changed files with 485 additions and 254 deletions

View file

@ -24,10 +24,13 @@ use AppBundle\Service\FileManager;
use AppBundle\Util;
use Doctrine\Bundle\DoctrineCacheBundle\Tests\Functional\FileSystemCacheTest;
use Doctrine\ORM\EntityManager;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Form\Extension\Core\Type\FileType;
use Symfony\Component\HttpFoundation\File;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\HttpException;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Security\Http\Authentication\AuthenticationUtils;
@ -159,17 +162,17 @@ class AdminController extends Controller
$lodging = null;
$calendarUtil = $this->container->get('app.lodging_calendar_util');
$calendarService = $this->container->get('app.lodging_calendar_util');
$lodging = $fewoLodgingRepo->find($lodgingId);
$reservations = $calendarUtil->getReservations($lodging);
$reservations = $calendarService->getReservations($lodging);
$paddedCalendar = $calendarUtil->getCalendarWithPadding();
$calendar = $calendarUtil->getCalendar();
$paddedCalendar = $calendarService->getCalendarWithPadding($calendarService->getMinCalendarEntriesByLodging($lodging));
$calendar = $calendarService->getCalendar($lodging);
if (count($lodging->getPrices()->toArray()) != 0)
{
$calendar = $calendarUtil->getCalendarWithReservations($lodging);
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
$calendar = $calendarService->createCalendarAndFillDayStates($lodging);
$calendar = $calendarService->mergeWithPaddedCalendar($calendar, $paddedCalendar);
} else {
$calendar = $paddedCalendar;
}
@ -230,16 +233,13 @@ class AdminController extends Controller
$lodging = $fewoLodgingRepo->find($lodgingId);
$calendarUtil = $this->container->get('app.lodging_calendar_util');
$calendarService = $this->container->get('app.lodging_calendar_util');
$reservations = $calendarUtil->getReservations($lodging);
$paddedCalendar = $calendarUtil->getCalendarWithPadding();
$calendar = $calendarUtil->getCalendar();
$paddedCalendar = $calendarService->getCalendarWithPadding($calendarService->getMinCalendarEntriesByLodging($lodging));
if (count($lodging->getPrices()->toArray()) != 0)
{
$calendar = $calendarUtil->getCalendarWithReservations($lodging);
$calendar = $calendarUtil->mergeWithPaddedCalendar($calendar, $paddedCalendar);
$calendar = $calendarService->createCalendarAndFillDayStates($lodging);
$calendar = $calendarService->mergeWithPaddedCalendar($calendar, $paddedCalendar);
} else {
$calendar = $paddedCalendar;
}
@ -771,51 +771,133 @@ class AdminController extends Controller
return $this->redirect('/admin/fewo/seasons');
}
/**
* @Route("/admin/fewo/lodgings/{lodgingId}/images/multi-upload", requirements={"lodgingId": "\d+"})
*/
public function adminFewoImageMultiUploadAction(Request $request, $lodgingId)
{
$em = $this->getEntityManager();
$lodging = $em->getRepository('AppBundle:FewoLodging')->find($lodgingId);
if (!$lodging)
{
throw new HttpException(404, 'Unbekannte lodging-ID: '. $lodgingId);
}
$form = $this->createForm(FileType::class, null, [
'multiple' => true
]);
if ($request->getMethod() == 'POST')
{
$form->handleRequest($request);
if ($form->isValid())
{
$uploader = $this->container->get('app.image_uploader');
foreach ($form->getData() as $uploadedFile)
{
$image = new FewoLodgingImage();
$image->setFile($uploadedFile);
$image->setLodging($lodging);
$image->setFileName('');
$image->setDescription('');
$em->persist($image);
$em->flush();
}
return $this->redirect('/admin/fewo/lodgings/'. $lodging->getId());
}
}
return $this->render('default/admin/fewoImageMultiUpload.html.twig', [
'form' => $form->createView(),
'lodging' => $lodging,
]);
}
/**
* @Route("/admin/fewo/lodgings/{lodgingId}/images/new", requirements={"lodgingId": "\d+"})
*/
public function adminFewoNewImageAction(Request $request, $lodgingId)
{
$lodging = $this->getEntityManager()->getRepository('AppBundle:FewoLodging')->find($lodgingId);
if (!$lodging)
{
throw new HttpException(404, 'Unbekannte lodging-ID: '. $lodgingId);
}
return $this->processImageForm($request, null, $lodging);
}
/**
* @Route("/admin/fewo/lodgings/{lodgingId}/images/{imageId}", requirements={"lodgingId": "\d+", "imageId": "\d+"})
*/
public function adminFewoEditImageAction(Request $request, $lodgingId, $imageId)
{
/** @var FewoLodgingImage $image */
$image = $this->getEntityManager()->getRepository('AppBundle:FewoLodgingImage')->find($imageId);
if (!$image || $image->getLodging()->getId() != $lodgingId)
{
throw new HttpException(404, 'Unbekannte FewoLodgingImage-ID oder lodging-ID passt nicht: '.
$imageId .' / '. $lodgingId);
}
return $this->processImageForm($request, $image);
}
/**
* @param Request $request
* @param FewoLodgingImage $image
* @param FewoLodging|null $lodging
*
* @return \Symfony\Component\HttpFoundation\RedirectResponse|\Symfony\Component\HttpFoundation\Response
*/
public function processImageForm(Request $request, $image, $lodging = null)
{
$em = $this->getEntityManager();
$fewoLodgingRepo = $em->getRepository('AppBundle:FewoLodging');
$lodging = $fewoLodgingRepo->find($lodgingId);
if ($image == null)
{
$isNew = true;
}
else
{
$isNew = false;
$lodging = $image->getLodging();
$imageFileName = $image->getFile();
}
$image = null;
if ($request->getMethod() != 'POST')
if ($request->getMethod() != 'POST' && $image == null)
{
$image = new FewoLodgingImage();
}
$form = $this->createForm(FewoLodgingImageType::class, $image, [
]);
$form = $this->createForm(FewoLodgingImageType::class, $image);
if ($request->getMethod() == 'POST')
{
$form->handleRequest($request);
$image = $form->getData();
}
if ($request->getMethod() == 'POST' && $form->isValid())
{
if($lodging == null)
$image = $form->getData();
if ($isNew)
{
return $this->redirect('/admin/fewo/lodgings');
$image->setLodging($lodging);
}
else
{
$image->setFile($imageFileName);
}
$image->setLodging($lodging);
$em->persist($image);
$em->flush();
return $this->redirect('/admin/fewo/lodgings/'.$lodgingId);
return $this->redirect('/admin/fewo/lodgings/'. ($lodging->getId()));
}
return $this->render('default/admin/imagesNew.html.twig', [
return $this->render('default/admin/fewoImage.html.twig', [
'form' => $form->createView(),
'lodging' => $lodging,
'is_new' => $isNew,
'image_file_name' => $isNew ? null : $imageFileName,
'image' => $image,
]);
}