<?php
/*******************************************************************************
 *                    _ _ _ _
 *                   / _ _  /
 *            _ _   / /__/ /_ _   ____ _ _   _ _ _    __
 *           / _ ` /   _ _// _ ` / __// _ ` / _ \\ \ / /
 *          / _ _// /\ \  / _ _/ \_ \/ _ _// / \/ \ ` /
 *          \_ , /_/  \_\ \_ ,  /__ /\_ , /_/      \_/
 *
 *******************************************************************************
 *    Application:  eReserv
 *    Version:      6
 *    Author:       David Di Certo
 *    Website:      http://www.cogites.com
 *    Email:        contact@cogites.com
 *    Copyright:    2013 - David Di Certo
 *******************************************************************************
 *    == FR ==      La revente et la redistribution de l'application sont
 *                  strictement interdites.
 *
 *                  Vous êtes tenu d'avoir pris connaissance des
 *                  Conditions Générales de Vente disponibles sur Cogites.com
 *                  (y compris pour la version Free).
 *
 *    == EN ==      Resale and redistribution of the application are
 *                  Strictly prohibited.
 *
 *                  You are required to have read the Terms and Conditions
 *                  available on Cogites.com (including the Free version).
 *
 *******************************************************************************
*/

require_once('dao/ReservationDao.php');

class ReservationMgr {
	const RESERV_NEW = 0;
	const RESERV_OPTION = 1;
	const RESERV_LEASE_SENT = 2;
	const RESERV_VALIDATE = 3;
	const RESERV_CLOSED = 4;

	function insert ($reservation) {
		$res = ReservationDao::insert ($reservation);
		return $res;
	}
	function update ($reservation) {
		return ReservationDao::update ($reservation);
	}
	function delete ($reservationId) {
		require_once ('business/PaymentMgr.php');
		$paymentMgr = new PaymentMgr();
		$paymentMgr->deletePaymentFromReservation($reservationId);
		return ReservationDao::delete ($reservationId);
	}
	function getReservations ($str = null) {
		return ReservationDao::getReservations ($str);
	}
	function searchReservation ($str) {
		return ReservationDao::searchReservation ($str);
	}
	function getReservation ($id) {
		return ReservationDao::getReservation ($id);
	}
	function getReservationRange ($from, $to, $id = null) {
		return ReservationDao::getReservationRange ($from, $to, $id);
	}
	function isReservationAvailable ($from, $to, $id, $status = "") {
		return ReservationDao::isReservationAvailable ($from, $to, $id, $status);
	}
	function getReservationFromTenant ($id) {
		return ReservationDao::getReservationFromTenant ($id);
	}
	function getReservationFromTenancy ($id) {
		return ReservationDao::getReservationFromTenancy ($id);
	}
	function getCurrentReservations ($nb) {
		return ReservationDao::getCurrentReservations ($nb);
	}
	function getNextReservations ($nb) {
		return ReservationDao::getNextReservations ($nb);
	}
	function getTodayDepartureReservations () {
		return ReservationDao::getTodayDepartureReservations ();
	}
	function getTodayArrivalReservations () {
		return ReservationDao::getTodayArrivalReservations ();
	}
	function getReservationsPerYear($year) {
		return ReservationDao::getReservationsPerYear($year);
	}
	function getReservationsOmniresa($id, $date){
		return ReservationDao::getReservationsOmniresa($id, $date);
	}
}
