function addReservation() { $reservation = new Reservations(); $Sessions = new Sessions(); $reservation->setValues($_REQUEST); $reservation->setReservationClientId($Sessions->getClientId()); if ($Sessions->clientIsLogged()) { $id = $reservation->newReservations(); if ($id != 0) { Common::jsonSuccess(array("id" => $id)); } else { Common::jsonError("Error"); } } else { $Sessions->setReservationsDetails($_REQUEST); Common::jsonError(array("login" => 500)); } }