/** * @todo dependency exception * @throws OrganisationUnitIDMissingException */ public static function delete() { if ($_GET['id']) { $organisation_unit_id = $_GET['id']; $organisation_unit = new OrganisationUnit($organisation_unit_id); if ($organisation_unit->check_delete_dependencies() == true) { if ($_GET['sure'] != "true") { $template = new HTMLTemplate("organisation_unit/admin/organisation_unit/delete.html"); $paramquery = $_GET; $paramquery['sure'] = "true"; $params = http_build_query($paramquery); $template->set_var("yes_params", $params); $paramquery = $_GET; unset($paramquery['sure']); unset($paramquery['action']); unset($paramquery['id']); $params = http_build_query($paramquery, '', '&'); $template->set_var("no_params", $params); $template->output(); } else { $paramquery = $_GET; unset($paramquery['sure']); unset($paramquery['action']); unset($paramquery['id']); $params = http_build_query($paramquery, '', '&'); if ($organisation_unit->delete()) { Common_IO::step_proceed($params, "Delete Organisation Unit", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Delete Organisation Unit", "Operation Failed", null); } } } else { } } else { throw new OrganisationUnitIDMissingException(); } }