function set_chart_details($id, $code_chart, $description, $chart_type)
 {
     log_debug("accounts_charts_manage", "Executing set_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);
         $obj_chart->data["code_chart"] = @security_script_input_predefined("int", $code_chart);
         $obj_chart->data["description"] = @security_script_input_predefined("any", $description);
         $obj_chart->data["chart_type"] = @security_script_input_predefined("int", $chart_type);
         foreach (array_keys($obj_chart->data) as $key) {
             if ($obj_chart->data[$key] == "error") {
                 throw new SoapFault("Sender", "INVALID_INPUT");
             }
         }
         /*
         	Error Handling
         */
         // verify chart ID (if editing an existing chart)
         if ($obj_chart->id) {
             if (!$obj_chart->verify_id()) {
                 throw new SoapFault("Sender", "INVALID_ID");
             }
         }
         // make sure we don't choose a chart code that has already been taken
         if (!$obj_chart->verify_code_chart()) {
             throw new SoapFault("Sender", "DUPLICATE_CODE_CHART");
         }
         /*
         	Perform Changes
         */
         if ($obj_chart->action_update_details()) {
             return $obj_chart->id;
         } else {
             throw new SoapFault("Sender", "UNEXPECTED_ACTION_ERROR");
         }
     } else {
         throw new SoapFault("Sender", "ACCESS DENIED");
     }
 }
Example #2
0
 $sql_obj_menu->fetch_array();
 foreach ($sql_obj_menu->data as $data_menu) {
     $obj_chart->data["menuoptions"][$data_menu["value"]] = @security_form_input_predefined("any", $data_menu["value"], 0, "Form provided invalid input!");
 }
 unset($sql_obj_menu);
 /*
 	Error Handling
 */
 // verify the account exists (if editing an existing one)
 if ($obj_chart->id) {
     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 we don't choose a chart code number that is already in use
 if (!$obj_chart->verify_code_chart()) {
     log_write("error", "process", "This account code has already been used by another account - please enter a unique code.");
     $_SESSION["error"]["name_chart-error"] = 1;
 }
 // return to the input page in the event of an error
 if ($_SESSION["error"]["message"]) {
     if ($obj_chart->id) {
         $_SESSION["error"]["form"]["chart_view"] = "failed";
         header("Location: ../../index.php?page=accounts/charts/view.php&id=" . $obj_chart->id);
         exit(0);
     } else {
         $_SESSION["error"]["form"]["chart_add"] = "failed";
         header("Location: ../../index.php?page=accounts/charts/add.php");
         exit(0);
     }
 }