From 7e8a53baceb9aafe6f20fa091eb908693ca7bbc1 Mon Sep 17 00:00:00 2001 From: adametz Date: Wed, 4 Jul 2018 14:48:49 +0000 Subject: [PATCH] Anzahlungen / Restzahlungen Restzahlung, wenn kleiner als 4 Wochen, dann sofort git-svn-id: http://78.47.251.156/svn/dev/sterntours-3@3427 f459cee4-fb09-11de-96c3-f9c5f16c3c76 --- .../default/components/booking/summary.html.twig | 2 +- trunk/src/AppBundle/Controller/BookingController.php | 1 + trunk/src/AppBundle/Entity/TravelDate.php | 11 ++++++++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/trunk/app/Resources/views/default/components/booking/summary.html.twig b/trunk/app/Resources/views/default/components/booking/summary.html.twig index 0647c852..87f6809e 100644 --- a/trunk/app/Resources/views/default/components/booking/summary.html.twig +++ b/trunk/app/Resources/views/default/components/booking/summary.html.twig @@ -27,7 +27,7 @@ {{ booking_price_info.final_payment|number_format(2) }} € - Restzahlung (bis zum {{ booking_price_info.final_payment_date}}) + Restzahlung ({{ booking_price_info.final_payment_date_str}}) diff --git a/trunk/src/AppBundle/Controller/BookingController.php b/trunk/src/AppBundle/Controller/BookingController.php index 576cb9ec..ead210fd 100644 --- a/trunk/src/AppBundle/Controller/BookingController.php +++ b/trunk/src/AppBundle/Controller/BookingController.php @@ -227,6 +227,7 @@ class BookingController extends Controller $outPriceInfo['departure_extra'] = 0; $outPriceInfo['flight_price'] = 0; $outPriceInfo['final_payment_date'] = $travelDate->getFinalPaymentDate(); + $outPriceInfo['final_payment_date_str'] = $travelDate->getFinalPaymentDateStr(); } if($bookingRequest->getDeparture() != null) diff --git a/trunk/src/AppBundle/Entity/TravelDate.php b/trunk/src/AppBundle/Entity/TravelDate.php index 3cc80eda..adeac521 100644 --- a/trunk/src/AppBundle/Entity/TravelDate.php +++ b/trunk/src/AppBundle/Entity/TravelDate.php @@ -165,11 +165,20 @@ final class TravelDate { $pDate = strtotime('-4 week', $this->getStart()->getTimestamp()); if($pDate <= time()){ - $pDate = strtotime('+1 day', $this->getStart()->getTimestamp()); + $pDate = time(); } return date('d.m.Y',$pDate); } + public function getFinalPaymentDateStr() + { + $pDate = strtotime('-4 week', $this->getStart()->getTimestamp()); + if($pDate <= time()){ + return "ist sofort fällig"; + } + return "bis zum ".date('d.m.Y',$pDate); + } + /** * @return \DateTime