Example #1
0
 function get_tax_details($id)
 {
     log_debug("taxes_manage_soap", "Executing get_tax_details({$id})");
     if (user_permissions_get("accounts_taxes_view")) {
         $obj_tax = new tax();
         // sanitise input
         $obj_tax->id = @security_script_input_predefined("int", $id);
         if (!$obj_tax->id || $obj_tax->id == "error") {
             throw new SoapFault("Sender", "INVALID_INPUT");
         }
         // verify that the ID is valid
         if (!$obj_tax->verify_id()) {
             throw new SoapFault("Sender", "INVALID_ID");
         }
         // load data from DB for this tax
         if (!$obj_tax->load_data()) {
             throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
         }
         // to save SOAP users from having to do another lookup to find out what the chart name is,
         // we fetch the details here
         if ($obj_tax->data["chartid"]) {
             $obj_tax->data["chartid_label"] = sql_get_singlevalue("SELECT CONCAT_WS('--', code_chart, description) as value FROM account_charts WHERE id='" . $obj_tax->data["chartid"] . "'");
         }
         // return data
         $return = array($obj_tax->data["name_tax"], $obj_tax->data["taxrate"], $obj_tax->data["chartid"], $obj_tax->data["chartid_label"], $obj_tax->data["taxnumber"], $obj_tax->data["description"]);
         return $return;
     } else {
         throw new SoapFault("Sender", "ACCESS_DENIED");
     }
 }