function passagerChange($passager, $depart, $destination) { $tarif = getTarif($passager, $depart, $destination); if ($tarif != "") { echo $tarif->getTarif(); } else { echo ""; } }
session_unset($_SESSION['success']); goto footer; } ?> <div id="reservation"> <?php if (!isset($_POST['depart']) || !isset($_POST['destination']) || !isset($_POST['passager']) || !isset($_POST['retour'])) { echo ""; } else { echo '<div class="ResInformation">'; echo '<img alt="car logo" src="img/car.jpg"/> Transport de ' . $_POST["depart"] . " vers " . $_POST["destination"] . " pour " . $_POST["passager"]; echo '</div>'; echo '<div class="ResInformation">'; $tarif = getTarif($_POST['passager'], $_POST['depart'], $_POST['destination']); if ($tarif === "") { echo "Veuillez SVP vérifier vos données de reservation ! "; echo '</div>'; echo '</div>'; goto footer; } if ($_POST['retour'] === "Aller") { echo "Prix total pour Un " . $_POST['retour'] . " est de " . $tarif->getTarif() . "dhs"; } if ($_POST['retour'] === "Aller-Retour") { echo "Prix total pour Un " . $_POST['retour'] . " est de <strong>" . intVal($tarif->getTarif()) * 2 . "dhs</strong>"; } echo '</div>'; } ?>
$station_destination = getStationObjByName($_POST['destination']); $reservation = new Reservation(); $format = 'Y-m-d H:i'; $date_depart = DateTime::createFromFormat($format, $_POST['clientPickUP'] . ' ' . $_POST['clientPickTimeHUP'] . ':' . $_POST['clientPickTimeMUP']); $date_retour; if ($_POST['retour'] == "Aller-Retour") { $date_retour = DateTime::createFromFormat($format, $_POST['clientPickBackUP'] . ' ' . $_POST['clientPickBackTimeHUP'] . ':' . $_POST['clientPickBackTimeMUP']); $reservation->setReturnDate($date_retour); } $reservation->setConsumer($consumer); $reservation->setStationFrom($station_depart); $reservation->setStationTo($station_destination); $reservation->setStatus(getNonConfirmedReservationStatus()); $reservation->setPickupDate($date_depart); $reservation->setNbrPassengers(getValidatedPassager()); $tarif = getTarif($_POST['passager'], $station_depart->getName(), $station_destination->getName()); if (is_object($tarif)) { if ($_POST['retour'] == "Aller-Retour") { $reservation->setPriceTotal($tarif->getTarif() * 2); } else { $reservation->setPriceTotal($tarif->getTarif()); } } if (isset($_POST['extra'])) { $reservation->setExtra($_POST['extra']); } EManager::getEntityManager()->persist($reservation); EManager::getEntityManager()->flush(); if (error_get_last() == null) { mailSender($consumer, '*****@*****.**', 'Reservation réussie, Merci à vous :)'); $_SESSION['success'] = "Votre Reservation est enregistrée avec succès";