<?php

/**
 * $Id: ajax_reload_infos_interv.php 26537 2014-12-22 15:14:01Z aurelie17 $
 *  
 * @category SalleOp
 * @package  Mediboard
 * @author   SARL OpenXtrem <*****@*****.**>
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  $Revision: 26537 $
 * @link     http://www.mediboard.org
 */
CCanDo::checkEdit();
$operation_id = CValue::get("operation_id");
$operation = new COperation();
$operation->load($operation_id);
$operation->canDo();
$operation->countAlertsNotHandled();
$operation->loadLiaisonLibelle();
$smarty = new CSmartyDP();
$smarty->assign("operation", $operation);
$smarty->display("inc_reload_infos_interv.tpl");
    $sejour->grossesse_id = $grossesse->_id;
    $sejour->_ref_grossesse = $grossesse;
    $patient = $grossesse->loadRefParturiente();
}
// On récupère l'opération
$op = new COperation();
$op->load($operation_id);
if ($op->_id) {
    $op->loadRefSejour();
    if (CAppUI::conf("dPplanningOp COperation use_session_praticien")) {
        CValue::setSession("chir_id", $op->chir_id);
    }
    if (CBrisDeGlace::isBrisDeGlaceRequired()) {
        $canAccess = CAccessMedicalData::checkForSejour($op->_ref_sejour);
        if (!$canAccess) {
            if (!$op->canDo()->read) {
                global $m, $tab;
                CAppUI::setMsg("Vous n'avez pas accés à cette intervention hors plage", UI_MSG_WARNING);
                CAppUI::redirect("m={$m}&tab={$tab}&operation_id=0");
            }
        }
    } else {
        if (!$op->canDo()->read) {
            global $m, $tab;
            CAppUI::setMsg("Vous n'avez pas accés à cette intervention hors plage", UI_MSG_WARNING);
            CAppUI::redirect("m={$m}&tab={$tab}&operation_id=0");
        }
    }
    // Chargement des régérences
    $op->loadRefs();
    $op->loadRefsNotes();
        $smarty->assign("listValidateurs", $listValidateurs);
        // Daily check lists
        $smarty->assign("require_check_list", $require_check_list);
        $smarty->assign("daily_check_lists", $daily_check_lists);
        $smarty->assign("daily_check_list_types", $daily_check_list_types);
        $smarty->display("inc_operation.tpl");
        CApp::rip();
    }
}
// Pre-anesth, pre-op, post-op
// Don't load them if we have a daily check list to fill...
$operation_check_lists = $operation_check_item_categories = array();
$check_lists_no_has = $check_items_no_has_categories = $listValidateurs_no_has = array();
$listAnesthType = array();
if ($selOp->_id) {
    $selOp->canDo();
    $selOp->loadRefs();
    $selOp->loadRefsFiles();
    $selOp->loadRefsDocs();
    $consult_anesth = $selOp->loadRefsConsultAnesth();
    $consult_anesth->countDocItems();
    $consultation = $consult_anesth->loadRefConsultation();
    $consultation->countDocItems();
    $consultation->canRead();
    $consultation->canEdit();
    $selOp->loadRefPlageOp(true);
    $selOp->loadRefChir()->loadRefFunction();
    $selOp->loadRefPatient();
    $selOp->loadRefCommande();
    $date = CMbDT::date($selOp->_datetime);
    // Récupération de l'utilisateur courant