Пример #1
0
            $corres = new CCorrespondantCourrier();
            $corres->compte_rendu_id = $do->_obj->_id;
            $corres->tag = $_dest->tag;
            $corres->object_id = $object_id;
            $corres->object_class = $object_class;
            $corres->quantite = $_POST["_count_{$class}_{$i}"];
            if ($msg = $corres->store()) {
                CAppUI::setMsg($msg, UI_MSG_ERROR);
            }
            unset($_POST["_dest_{$class}_{$i}"]);
        }
    }
    // Correspondants courrier ajoutés par autocomplete
    foreach ($_POST as $key => $value) {
        if (preg_match("/_dest_([a-zA-Z]*)_([0-9]+)/", $key, $matches)) {
            $corres = new CCorrespondantCourrier();
            $corres->compte_rendu_id = $do->_obj->_id;
            $corres->tag = "correspondant";
            $corres->object_id = $matches[2];
            $corres->object_class = $matches[1];
            if ($msg = $corres->store()) {
                CAppUI::setMsg($msg, UI_MSG_ERROR);
            }
        }
    }
}
if (strlen($ids_corres)) {
    $do->_obj->_ids_corres = $ids_corres;
}
if ($do->ajax) {
    $do->doCallback();
 * @license  GNU General Public License, see http://www.gnu.org/licenses/gpl.html
 * @version  SVN: $Id:\$
 * @link     http://www.mediboard.org
 */
$object_guid = CValue::get("object_guid");
$compte_rendu_id = CValue::get("compte_rendu_id");
$compte_rendu = new CCompteRendu();
$compte_rendu->load($compte_rendu_id);
$object = CMbObject::loadFromGuid($object_guid);
$compte_rendu->_ref_object = $object;
$compte_rendu->loadRefsCorrespondantsCourrierByTagGuid();
$destinataires = array();
CDestinataire::makeAllFor($object);
$destinataires = CDestinataire::$destByClass;
if (!isset($destinataires["CMedecin"])) {
    $destinataires["CMedecin"] = array();
}
// Fusion avec les correspondants ajoutés par l'autocomplete
$compte_rendu->mergeCorrespondantsCourrier($destinataires);
$empty_corres = new CCorrespondantCourrier();
$empty_corres->valueDefaults();
$patient = new CPatient();
if (CDestinataire::$_patient != null) {
    $patient = CDestinataire::$_patient;
}
$smarty = new CSmartyDP();
$smarty->assign("compte_rendu", $compte_rendu);
$smarty->assign("destinataires", $destinataires);
$smarty->assign("empty_corres", $empty_corres);
$smarty->assign("patient", $patient);
$smarty->display("inc_edit_correspondants_courrier.tpl");