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 CCorrespondantPatient(); $_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) { CAppUI::stepAjax("{$count_total} correspondants à supprimer au total", UI_MSG_OK);
/** * $Id: ajax_form_correspondant.php 28237 2015-05-11 16:06:01Z flaviencrochard $ * * @package Mediboard * @subpackage Patients * @author SARL OpenXtrem <*****@*****.**> * @license GNU General Public License, see http://www.gnu.org/licenses/gpl.html * @version $Revision: 28237 $ */ $correspondant_id = CValue::get("correspondant_id"); $patient_id = CValue::get("patient_id"); $duplicate = CValue::get("duplicate"); $correspondant = new CCorrespondantPatient(); $patient = new CPatient(); if ($correspondant_id) { $correspondant->load($correspondant_id); $patient = $correspondant->loadRefPatient(); if ($duplicate) { $correspondant->_id = ""; } } else { if ($patient_id) { $patient->load($patient_id); $correspondant->patient_id = $patient_id; $correspondant->_duplicate = $duplicate; $correspondant->updatePlainFields(); } if (CAppUI::conf("ref_pays") == 2) { $correspondant->relation = "assurance"; } }