function delete_tax($id) { log_debug("taxes", "Executing delete_tax_details({$id}, values...)"); if (user_permissions_get("accounts_taxes_write")) { $obj_tax = new tax(); /* Load SOAP Data */ $obj_tax->id = @security_script_input_predefined("int", $id); if (!$obj_tax->id || $obj_tax->id == "error") { throw new SoapFault("Sender", "INVALID_INPUT"); } /* Error Handling */ // verify tax ID if (!$obj_tax->verify_id()) { throw new SoapFault("Sender", "INVALID_ID"); } // check that the tax can be safely deleted if ($obj_tax->check_delete_lock()) { throw new SoapFault("Sender", "LOCKED"); } /* Perform Changes */ if ($obj_tax->action_delete()) { return 1; } else { throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR"); } } else { throw new SoapFault("Sender", "ACCESS DENIED"); } }
//default settings $obj_tax->data["default_customers"] = @security_form_input_predefined("checkbox", "default_customers", 0, ""); $obj_tax->data["default_vendors"] = @security_form_input_predefined("checkbox", "default_vendors", 0, ""); $obj_tax->data["default_services"] = @security_form_input_predefined("checkbox", "default_services", 0, ""); $obj_tax->data["default_products"] = @security_form_input_predefined("checkbox", "default_products", 0, ""); // only used when adding new taxes $obj_tax->data["autoenable_tax_customers"] = @security_form_input_predefined("checkbox", "autoenable_tax_customers", 0, ""); $obj_tax->data["autoenable_tax_vendors"] = @security_form_input_predefined("checkbox", "autoenable_tax_vendors", 0, ""); $obj_tax->data["autoenable_tax_services"] = @security_form_input_predefined("checkbox", "autoenable_tax_services", 0, ""); $obj_tax->data["autoenable_tax_products"] = @security_form_input_predefined("checkbox", "autoenable_tax_products", 0, ""); /* Error Handling */ if ($obj_tax->id) { // make sure the tax actually exists if (!$obj_tax->verify_id()) { log_write("error", "process", "The tax you have attempted to edit - " . $obj_tax->id . " - does not exist in this system."); } } // make sure we don't choose a tax name that is already in use if (!$obj_tax->verify_name_tax()) { log_write("error", "process", "Another tax already exists with the same name - please choose a unique name."); $_SESSION["error"]["name_tax-error"] = 1; } // make sure the selected chart exists if (!$obj_tax->verify_valid_chart()) { log_write("error", "process", "The requested chart ID does not exist"); $_SESSION["error"]["chartid-error"] = 1; } // return to input page in the event of an error if ($_SESSION["error"]["message"]) {