/* Error Handling */ // make sure the chart actually exists if (!$obj_chart->verify_id()) { log_write("error", "process", "The account you have attempted to edit - " . $obj_chart->id . " - does not exist in this system."); } // make sure chart is safe to delete if ($obj_chart->check_delete_lock()) { log_write("error", "process", "The account can not be deleted because it is locked."); } // return to the input page in event of an error if ($_SESSION["error"]["message"]) { $_SESSION["error"]["form"]["chart_delete"] = "failed"; header("Location: ../../index.php?page=accounts/charts/delete.php&id=" . $obj_chart->id); exit(0); } /* Delete Account */ $obj_chart->action_delete(); // return to chart of accounts header("Location: ../../index.php?page=accounts/charts/charts.php"); exit(0); } else { // user does not have perms to view this page/isn't logged on error_render_noperms(); header("Location: ../index.php?page=message.php"); exit(0); }
function delete_chart($id) { log_debug("charts", "Executing delete_chart_details({$id}, values...)"); if (user_permissions_get("accounts_charts_write")) { $obj_chart = new chart(); /* Load SOAP Data */ $obj_chart->id = @security_script_input_predefined("int", $id); if (!$obj_chart->id || $obj_chart->id == "error") { throw new SoapFault("Sender", "INVALID_INPUT"); } /* Error Handling */ // verify chart ID if (!$obj_chart->verify_id()) { throw new SoapFault("Sender", "INVALID_ID"); } // check that the chart can be safely deleted if ($obj_chart->check_delete_lock()) { throw new SoapFault("Sender", "LOCKED"); } /* Perform Changes */ if ($obj_chart->action_delete()) { return 1; } else { throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR"); } } else { throw new SoapFault("Sender", "ACCESS DENIED"); } }