$plageconsult_id = CValue::getOrSession("plageconsult_id", null); $plageSel = new CPlageconsult(); if ($plageconsult_id === null && $chirSel && $is_in_period) { $nowTime = CMbDT::time(); $where = array("chir_id = '{$chirSel}' OR remplacant_id = '{$chirSel}' OR pour_compte_id = '{$chirSel}'", "date" => "= '{$today}'", "debut" => "<= '{$nowTime}'", "fin" => ">= '{$nowTime}'"); $plageSel->loadObject($where); } if (!$plageSel->plageconsult_id) { $plageSel->load($plageconsult_id); } else { $plageconsult_id = $plageSel->plageconsult_id; } $plageSel->loadRefChir(); $plageSel->loadRefRemplacant(); $plageSel->loadRefPourCompte(); $plageSel->loadRefsNotes(); $plageSel->loadRefsBack($show_annulees, true, $show_payees); if ($plageSel->_affected && count($plageSel->_ref_consultations)) { $firstconsult = reset($plageSel->_ref_consultations); $_firstconsult_time = substr($firstconsult->heure, 0, 5); $lastconsult = end($plageSel->_ref_consultations); $_lastconsult_time = substr($lastconsult->heure, 0, 5); } $consults = $plageSel->_ref_consultations; CStoredObject::massLoadFwdRef($consults, "sejour_id"); $patients = CMbObject::massLoadFwdRef($consults, "patient_id"); CStoredObject::massCountBackRefs($patients, "notes"); CStoredObject::massLoadFwdRef($consults, "categorie_id"); // Détails sur les consultation affichées foreach ($plageSel->_ref_consultations as $keyConsult => &$consultation) { $consultation->_ref_plageconsult = $plageSel;
*/ CCanDo::checkRead(); $ds = CSQLDataSource::get("std"); // Initialisation des variables $plageconsult_id = CValue::get("plageconsult_id"); $consult_id = CValue::get("consult_id"); $slot_id = CValue::get("slot_id"); $heure = CValue::get("heure"); $multiple = CValue::get("multipleMode", false); $display_nb_consult = CAppUI::conf("dPcabinet display_nb_consult"); $quotas = null; // Récupération des consultations de la plage séléctionnée $plage = new CPlageconsult(); if ($plageconsult_id) { $plage->load($plageconsult_id); $plage->loadRefsNotes(); $date = $plage->date; } else { $date = CValue::get("date", CMbDT::date()); } // consultation précise $consultation_target = new CConsultation(); if ($consult_id) { $consultation_target->load($consult_id); } elseif ($heure) { $consultation_target->heure = $heure; } $consultation_target->loadRefElementPrescription(); // Chargement des places disponibles $listPlace = array(); $listBefore = array();
$ljoin["users"] = "users.user_id = plageconsult.chir_id OR users.user_id = plageconsult.remplacant_id "; $order = "date, user_last_name, user_first_name, debut"; // Chargement des plages disponibles /** @var CPlageconsult[] $listPlage */ $listPlage = $plage->loadList($where, $order, null, "plageconsult_id", $ljoin); if (!array_key_exists($plageconsult_id, $listPlage)) { $plage->_id = $plageconsult_id = null; } $currPlage = new CPlageconsult(); foreach ($listPlage as $currPlage) { if (!$plageconsult_id && $date == $currPlage->date) { $plageconsult_id = $currPlage->_id; } $currPlage->_ref_chir = $listPrat[$currPlage->chir_id]; $currPlage->loadCategorieFill(); $currPlage->loadRefsNotes(); $currPlage->countPatients(); $currPlage->loadRefsConsultations(false); $currPlage->loadDisponibilities(); } // Création du template $smarty = new CSmartyDP(); $smarty->assign("period", $period); $smarty->assign("periods", $periods); $smarty->assign("hour", $hour); $smarty->assign("hours", CPlageconsult::$hours); $smarty->assign("hide_finished", $hide_finished); $smarty->assign("date", $date); $smarty->assign("today", CMbDT::date()); $smarty->assign("refDate", $refDate); $smarty->assign("ndate", $ndate);