} } else { $services_ids_suggest = explode(",", $services_ids_suggest); } $sortie = $affectation->sortie; $where = array(); $where["chambre.service_id"] = CSQLDataSource::prepareIn($services_ids_suggest); $ljoin = array(); $ljoin["chambre"] = "lit.chambre_id = chambre.chambre_id"; $lit = new C**t(); /** @var C**t[] $lits */ $lits = $lit->loadList($where, null, null, null, $ljoin); //unset($lits[$affectation->lit_id]); $max_entree = 0; $max_sortie = 0; $ds = $lit->getDS(); foreach ($lits as $key => $_lit) { $_lit->_ref_affectations = array(); $_lit->loadCompleteView(); if ($_lit->_id == $affectation->lit_id) { $_lit->_ref_last_dispo = new CAffectation(); $_lit->_ref_last_dispo->sortie = $entree; $_lit->_dispo_depuis = 0; } else { $where = array(); $where["lit_id"] = "= '{$_lit->_id}'"; $where["entree"] = "<= '{$sortie}'"; $where["sortie"] = ">= '{$entree}'"; $affectation_collide = new CAffectation(); $affectation_collide->loadObject($where); if ($affectation_collide->_id) {