function credit_form_delete_process($type, $returnpage_error, $returnpage_success)
{
    log_debug("inc_credits_forms", "Executing credit_form_delete_process({$type}, {$mode}, {$returnpage_error}, {$returnpage_success})");
    $credit = new credit();
    $credit->type = $type;
    /*
    	Import POST Data
    */
    $credit->id = @security_form_input_predefined("int", "id_credit", 1, "");
    $data["delete_confirm"] = @security_form_input_predefined("any", "delete_confirm", 1, "You must confirm the deletion");
    // we don't use this value (since we can't trust it) but we need to read it
    // in here to work around a limitation in the Amberphplib framework
    $data["code_credit"] = @security_form_input_predefined("any", "code_credit", 1, "");
    /*
    	Error Handling
    */
    // make sure the credit actually exists
    if (!$credit->verify_credit()) {
        log_write("error", "process", "The credit note you have attempted to delete - " . $credit->id . " - does not exist in this system.");
    }
    // check if credit is locked or not
    if ($credit->check_delete_lock()) {
        log_write("error", "process", "The credit note can not be deleted because it is locked.");
    }
    // return to input page in event of an error
    if ($_SESSION["error"]["message"]) {
        $_SESSION["error"]["form"][$type . "_credit_delete"] = "failed";
        header("Location: ../../index.php?page={$returnpage_error}&id=" . $credit->id);
        exit(0);
    }
    /*
    	Delete Credit Note
    */
    $credit->load_data();
    if ($credit->action_delete()) {
        $_SESSION["notification"]["message"] = array("Credit note has been successfully deleted.");
    } else {
        $_SESSION["error"]["message"][] = "Some problems were experienced while deleting the credit note.";
    }
    // display updated details
    header("Location: ../../index.php?page={$returnpage_success}&id={$id}");
    exit(0);
}