} $_SESSION['aERROR'] = $chaine; Redirect('reservation.php', false); } else { if ($_POST['retour'] == "Aller-Retour" && (!isset($_POST['clientPickBackUP']) || !isset($_POST['clientPickBackTimeHUP']) || !isset($_POST['clientPickBackTimeMUP']))) { $is_valid = GUMP::is_valid($_POST, array('clientPickBackUP' => 'required|date', 'clientPickBackTimeHUP' => 'required|numeric|max_len,2', 'clientPickBackTimeMUP' => 'required|numeric|max_len,2')); if (!($is_valid === true)) { $_SESSION['aERROR'] = "Vous avez choisi un Aller-Retour mais vous n'avez pas spécifié le champ <strong>Temps Retour</strong> "; Redirect('reservation.php', false); } } $consumer = new Consumer(); $consumer->setName($_POST['clientName']); $consumer->setEmail($_POST['clientEmail']); $consumer->setTelephone($_POST['clientTel']); $consumer->setType(getConsumerTypeByName($_POST['clientType'])); EManager::getEntityManager()->persist($consumer); EManager::getEntityManager()->flush(); $station_depart = getStationObjByName($_POST['depart']); $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);