foreach ($_POST as $key => $value) { // Remplacement des destinataires if (preg_match("/_dest_([\\w]+)_([0-9]+)/", $key, $dest)) { $destinataires[] = $dest; } } if (count($destinataires) && $do_merge) { $object = new $_POST["object_class"](); /** @var $object CMbObject */ $object->load($_POST["object_id"]); CDestinataire::makeAllFor($object); $allDest = CDestinataire::$destByClass; // Récupération des correspondants ajoutés par l'autocomplete $cr_dest = new CCompteRendu(); $cr_dest->load($_POST["compte_rendu_id"]); $cr_dest->mergeCorrespondantsCourrier($allDest); $bodyTag = '<div id="body">'; // On sort l'en-tête et le pied de page $posBody = strpos($_POST["_source"], $bodyTag); if ($posBody) { $headerfooter = substr($_POST["_source"], 0, $posBody); $index_div = strrpos($_POST["_source"], "</div>") - ($posBody + strlen($bodyTag)); $body = substr($_POST["_source"], $posBody + strlen($bodyTag), $index_div); } else { $headerfooter = ""; $body = $_POST["_source"]; } // On fait le doBind avant le foreach si la config est à 1. if (CAppUI::conf("dPcompteRendu CCompteRendu multiple_doc_correspondants")) { $do->doBind(); }
* @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");