Пример #1
0
function api_ovo_manager($return_type, $params)
{
    $values[0] = $params[0];
    //title
    $values[1] = $params[1];
    //id group
    $values[2] = $params[2];
    //priority
    $values[3] = $params[3];
    //description
    $values[4] = $params[4];
    //id inventory
    $values[5] = $params[5];
    //id incident type
    $values[6] = '';
    //email
    $values[7] = '';
    //owner
    $values[8] = 0;
    //id parent
    $values[9] = 1;
    //status
    $values[10] = $params[6];
    //info extra
    $prioridad = $params[2];
    $descripcion = $params[3];
    $extra_data = $params[6];
    $msg_group = $params[7];
    //~ $sql = "SELECT * FROM tincidencia WHERE extra_data = '".$extra_data."' AND estado <> 7";
    $sql = "SELECT * FROM tincidencia WHERE extra_data = '" . $extra_data . "'";
    $incidents = get_db_all_rows_sql($sql);
    if ($incidents == false) {
        if ($prioridad == 2 || $prioridad == 3 || $prioridad == 4) {
            //minor, major o critical
            $values[1] = 11;
            //grupo M112 GM24. Hay que ponerlo a mano
            $new_id = api_create_incident('int', 'ovo', $values);
            $values_update[0] = $new_id;
            $values_update[1] = $params[0];
            //title
            $values_update[2] = $params[3];
            //description
            $values_update[3] = "";
            //epilog
            $values_update[4] = 11;
            //group
            $values_update[5] = $params[2];
            //prority
            $values_update[7] = 3;
            //estado asignado
            $values_update[8] = "";
            //owner
            $values_update[9] = 0;
            //id parent
            $values_update[10] = $params[5];
            //id incident type
            $values_update[11] = $params[6];
            //info extra
            api_update_incident($return_type, 'ovo', $values_update);
        }
    } else {
        foreach ($incidents as $incident) {
            switch ($incident['estado']) {
                case 7:
                    //cerrada
                    if ($incident['resolution'] == 1 || $incident['resolution'] == 2) {
                        //resolución arreglado o no válido
                        if ($prioridad == 2 || $prioridad == 3 || $prioridad == 4) {
                            //minor, major o critical
                            $values[1] = 11;
                            //grupo M112 GM24. Hay que ponerlo a mano
                            $new_id = api_create_incident('int', 'ovo', $values);
                            $values_update[0] = $new_id;
                            $values_update[1] = $params[0];
                            //title
                            $values_update[2] = $params[3];
                            //description
                            $values_update[3] = "";
                            //epilog
                            $values_update[4] = 11;
                            //group
                            $values_update[5] = $params[2];
                            $values_update[7] = 3;
                            //estado asignado
                            $values_update[8] = "";
                            //owner
                            $values_update[9] = 0;
                            //id parent
                            $values_update[10] = $params[5];
                            //id incident type
                            $values_update[11] = $params[6];
                            //info extra
                            api_update_incident($return_type, 'ovo', $values_update);
                        }
                    } else {
                        if ($incident['resolution'] == 9) {
                            if ($prioridad == 2 || $prioridad == 3 || $prioridad == 4) {
                                //minor, major o critical
                                //update ticket
                                $values_update[0] = $incident['id_incidencia'];
                                $values_update[1] = $incident['titulo'];
                                //title
                                $values_update[2] = $incident['descripcion'];
                                //description
                                $values_update[3] = $incident['epilog'];
                                //epilog
                                $values_update[4] = $incident['id_grupo'];
                                //id grupo
                                if ($prioridad > $incident['prioridad']) {
                                    $values_update[5] = $prioridad;
                                } else {
                                    $values_update[5] = $incident['prioridad'];
                                }
                                $values_update[6] = 9;
                                //in process
                                $values_update[7] = 4;
                                //re opened
                                $values_update[8] = $incident['id_usuario'];
                                //owner
                                $values_update[9] = $incident['id_parent'];
                                //id parent
                                $values_update[10] = $incident['id_incident_type'];
                                //id incident type
                                $values_update[11] = $incident['extra_data'];
                                //info extra
                                api_update_incident($return_type, 'ovo', $values_update);
                                //add wu
                                $workunit[0] = $incident['id_incidencia'];
                                // id ticket
                                $workunit[1] = $descripcion;
                                // descripcion
                                $workunit[2] = 0;
                                // duracion
                                $workunit[3] = 0;
                                // coste
                                $workunit[4] = 1;
                                // publico
                                $workunit[5] = 2;
                                // perfil
                                api_create_incident_workunit($return_type, 'ovo', $workunit);
                            }
                        }
                    }
                    break;
                default:
                    if ($prioridad == 2 || $prioridad == 3 || $prioridad == 4) {
                        //minor, major o critical
                        //update ticket
                        $values_update[0] = $incident['id_incidencia'];
                        $values_update[1] = $incident['titulo'];
                        //title
                        $values_update[2] = $incident['descripcion'];
                        //description
                        $values_update[3] = $incident['epilog'];
                        //epilog
                        $values_update[4] = $incident['id_grupo'];
                        //id grupo
                        if ($prioridad > $incident['prioridad']) {
                            $values_update[5] = $prioridad;
                        } else {
                            $values_update[5] = $incident['prioridad'];
                        }
                        $values_update[6] = $incident['resolution'];
                        //resolution
                        $values_update[7] = $incident['estado'];
                        //status
                        $values_update[8] = $incident['id_usuario'];
                        //owner
                        $values_update[9] = $incident['id_parent'];
                        //id parent
                        $values_update[10] = $incident['id_incident_type'];
                        //id incident type
                        $values_update[11] = $incident['extra_data'];
                        //info extra
                        api_update_incident($return_type, 'ovo', $values_update);
                        //add wu
                        $workunit[0] = $incident['id_incidencia'];
                        // id ticket
                        $workunit[1] = $descripcion;
                        // descripcion
                        $workunit[2] = 0;
                        // duracion
                        $workunit[3] = 0;
                        // coste
                        $workunit[4] = 1;
                        // publico
                        $workunit[5] = 2;
                        // perfil
                        api_create_incident_workunit($return_type, 'ovo', $workunit);
                    }
                    //~ if ($prioridad == 0) { //normal
                    if ($prioridad != 2 && $prioridad != 3 && $prioridad != 4) {
                        //normal
                        if ($msg_group == "AutoResolved") {
                            //update ticket
                            $values_update[0] = $incident['id_incidencia'];
                            $values_update[1] = $incident['titulo'];
                            //title
                            $values_update[2] = $incident['descripcion'];
                            //description
                            $values_update[3] = $incident['epilog'];
                            //epilog
                            $values_update[4] = $incident['id_grupo'];
                            //id grupo
                            $values_update[5] = $incident['prioridad'];
                            //priority
                            $values_update[6] = 9;
                            //in process
                            $values_update[7] = 7;
                            //closed
                            $values_update[8] = $incident['id_usuario'];
                            //owner
                            $values_update[9] = $incident['id_parent'];
                            //id parent
                            $values_update[10] = $incident['id_incident_type'];
                            //id incident type
                            $values_update[11] = $incident['extra_data'];
                            //info extra
                            api_update_incident($return_type, 'ovo', $values_update);
                            //add wu
                            $workunit[0] = $incident['id_incidencia'];
                            // id ticket
                            $workunit[1] = $descripcion;
                            // descripcion
                            $workunit[2] = 0;
                            // duracion
                            $workunit[3] = 0;
                            // coste
                            $workunit[4] = 1;
                            // publico
                            $workunit[5] = 2;
                            // perfil
                            api_create_incident_workunit($return_type, 'ovo', $workunit);
                        } else {
                            //add wu
                            $workunit[0] = $incident['id_incidencia'];
                            // id ticket
                            $workunit[1] = $descripcion;
                            // descripcion
                            $workunit[2] = 0;
                            // duracion
                            $workunit[3] = 0;
                            // coste
                            $workunit[4] = 1;
                            // publico
                            $workunit[5] = 2;
                            // perfil
                            api_create_incident_workunit($return_type, 'ovo', $workunit);
                        }
                    }
                    break;
            }
        }
    }
    echo $result;
    return;
}
Пример #2
0
     $params = explode($token, $params);
     api_create_incident($return_type, $user, $params);
     break;
 case "update_incident":
     $params = explode($token, $params);
     echo api_update_incident($return_type, $user, $params);
     break;
 case "delete_incident":
     echo api_delete_incident($return_type, $user, $params);
     break;
 case "get_incident_workunits":
     echo api_get_incident_workunits($return_type, $user, $params);
     break;
 case "create_workunit":
     $params = explode($token, $params);
     api_create_incident_workunit($return_type, $user, $params);
     break;
 case "get_incident_files":
     echo api_get_incident_files($return_type, $user, $params);
     break;
 case "download_file":
     echo api_download_file($return_type, $user, $params);
     break;
 case "attach_file":
     $params = explode($token, $params);
     echo api_attach_file($return_type, $user, $params);
     break;
 case "delete_file":
     echo api_delete_file($return_type, $user, $params);
     break;
 case "get_incident_tracking":