$ids = explode(",", $_corresp["IDS"]); if (empty($ids)) { continue; } array_unique($ids); sort($ids); array_pop($ids); // Only keep last CAppUI::stepAjax(" -- Patient #" . $_corresp["patient_id"], UI_MSG_OK); $count = 0; foreach ($ids as $_id) { if ($dry_run) { $count++; continue; } $_correspondant = new CCorrespondant(); $_correspondant->load($_id); if ($msg = $_correspondant->delete()) { CAppUI::stepAjax($msg, UI_MSG_WARNING); } else { $count++; } } $count_total += $count; if ($dry_run) { CAppUI::stepAjax("{$count} correspondants à supprimer", UI_MSG_OK); } else { CAppUI::stepAjax("{$count} correspondants supprimés", UI_MSG_OK); } } if ($dry_run) {
/** * Get ROL segment * * @param DOMNode $node Node * @param CPatient $newPatient Person * * @return void */ function getROL(DOMNode $node, CPatient $newPatient) { $sender = $this->_ref_sender; $ROL_4 = $this->queryNodes("ROL.4", $node)->item(0); switch ($this->queryTextNode("ROL.3/CE.1", $node)) { // Médecin traitant case "ODRP": $newPatient->medecin_traitant = $this->getMedecin($ROL_4); break; case "RT": $correspondant = new CCorrespondant(); $correspondant->patient_id = $newPatient->_id; $correspondant->medecin_id = $this->getMedecin($ROL_4); if (!$correspondant->loadMatchingObjectEsc()) { // Notifier les autres destinataires autre que le sender $correspondant->_eai_sender_guid = $sender->_guid; $correspondant->store(); } break; default: } }