/** * Prevent user from aborting script */ $oldAbort = ignore_user_abort(true); /** * Delete medical problems connections */ $connQ = new Query_Connection(); $numRows = $connQ->select($idProblem); $conn = array(); for ($i = 0; $i < $numRows; $i++) { $conn[] = $connQ->fetch(); } $connQ->freeResult(); while ($aux = array_shift($conn)) { $connQ->delete($idProblem, $aux[1]); } $connQ->close(); unset($connQ); unset($conn); /** * Delete problem */ $problemQ = new Query_Page_Problem(); if (defined("OPEN_DEMO") && !OPEN_DEMO) { if (!$problemQ->select($idProblem)) { $problemQ->close(); FlashMsg::add(_("That medical problem does not exist."), OPEN_MSG_ERROR); header("Location: " . $returnLocation); exit; }
$wording = Check::safeText($_POST["wording"]); /** * Prevent user from aborting script */ $oldAbort = ignore_user_abort(true); /** * Delete relative */ $connQ = new Query_Connection(); /** * Record log process (before deleting process) */ $recordQ = new Query_Page_Record(); $recordQ->log("Query_Connection", "DELETE", array($idProblem, $idConnection)); $recordQ->close(); unset($recordQ); $connQ->delete($idProblem, $idConnection); $connQ->close(); unset($connQ); /** * Reset abort setting */ ignore_user_abort($oldAbort); /** * Redirect to $returnLocation to avoid reload problem */ FlashMsg::add(sprintf(_("Connection with medical problem, %s, has been deleted."), $wording)); // To header, without & //$returnLocation = "../medical/connection_list.php?id_problem=" . $idProblem . "&id_patient=" . $idPatient; $returnLocation = "../medical/connection_list.php"; header("Location: " . $returnLocation);