Example #1
0
 function get_gl_details($id)
 {
     log_debug("gl_manage_soap", "Executing get_gl_details({$id})");
     if (user_permissions_get("accounts_gl_view")) {
         $obj_gl = new gl_transaction();
         // sanitise input
         $obj_gl->id = @security_script_input_predefined("int", $id);
         if (!$obj_gl->id || $obj_gl->id == "error") {
             throw new SoapFault("Sender", "INVALID_INPUT");
         }
         // verify that the ID is valid
         if (!$obj_gl->verify_id()) {
             throw new SoapFault("Sender", "INVALID_ID");
         }
         // load data from DB for this transaction
         if (!$obj_gl->load_data()) {
             throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
         }
         // to save SOAP users from having to do another lookup to find out what
         // the employee name is, we fetch it for them now.
         if ($obj_gl->data["employeeid"]) {
             $obj_gl->data["employeeid_label"] = sql_get_singlevalue("SELECT name_staff as value FROM staff WHERE id='" . $obj_gl->data["employeeid"] . "'");
         }
         // return data
         $return = array($obj_gl->data["code_gl"], $obj_gl->data["date_trans"], $obj_gl->data["employeeid"], $obj_gl->data["employeeid_label"], $obj_gl->data["description"], $obj_gl->data["notes"]);
         return $return;
     } else {
         throw new SoapFault("Sender", "ACCESS_DENIED");
     }
 }