예제 #1
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     if (Auth::guest()) {
         return view('login');
     } else {
         if (isset($_GET['org'])) {
             $org = \Ermtool\Organization::where('id', $_GET['org'])->value('name');
             //obtenemos stakeholders de la misma organización
             $stakes = DB::table('stakeholders')->join('organization_stakeholder', 'organization_stakeholder.stakeholder_id', '=', 'stakeholders.id')->where('organization_stakeholder.organization_id', '=', $_GET['org'])->select('stakeholders.id', DB::raw('CONCAT(name, " ", surnames) AS full_name'))->orderBy('name')->lists('full_name', 'id');
             if ($_GET['kind'] == 0) {
                 $processes = \Ermtool\Process::where('processes.status', 0)->join('subprocesses', 'subprocesses.process_id', '=', 'processes.id')->join('organization_subprocess', 'organization_subprocess.subprocess_id', '=', 'subprocesses.id')->where('organization_subprocess.organization_id', '=', $_GET['org'])->lists('processes.name', 'processes.id');
                 if (Session::get('languaje') == 'en') {
                     return view('en.hallazgos.create', ['org' => $org, 'processes' => $processes, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                 } else {
                     return view('hallazgos.create', ['org' => $org, 'processes' => $processes, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                 }
             } else {
                 if ($_GET['kind'] == 1) {
                     $subprocesses = \Ermtool\Subprocess::where('subprocesses.status', 0)->join('organization_subprocess', 'organization_subprocess.subprocess_id', '=', 'subprocesses.id')->where('organization_subprocess.organization_id', '=', $_GET['org'])->lists('subprocesses.name', 'subprocesses.id');
                     if (Session::get('languaje') == 'en') {
                         return view('en.hallazgos.create', ['org' => $org, 'subprocesses' => $subprocesses, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                     } else {
                         return view('hallazgos.create', ['org' => $org, 'subprocesses' => $subprocesses, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                     }
                 } else {
                     if ($_GET['kind'] == 2) {
                         if (Session::get('languaje') == 'en') {
                             return view('en.hallazgos.create', ['org' => $org, 'kind' => $_GET['kind'], 'org_id' => $_GET['org'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                         } else {
                             return view('hallazgos.create', ['org' => $org, 'kind' => $_GET['kind'], 'org_id' => $_GET['org'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                         }
                     } else {
                         if ($_GET['kind'] == 3) {
                             $controls = DB::table('controls')->join('control_risk_subprocess', 'control_risk_subprocess.control_id', '=', 'controls.id')->join('risk_subprocess', 'risk_subprocess.id', '=', 'control_risk_subprocess.risk_subprocess_id')->join('organization_subprocess', 'organization_subprocess.subprocess_id', '=', 'risk_subprocess.subprocess_id')->where('organization_subprocess.organization_id', '=', $_GET['org'])->lists('controls.name', 'controls.id');
                             if (Session::get('languaje') == 'en') {
                                 return view('en.hallazgos.create', ['org' => $org, 'controls' => $controls, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                             } else {
                                 return view('hallazgos.create', ['org' => $org, 'controls' => $controls, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                             }
                         } else {
                             if ($_GET['kind'] == 4) {
                                 $controls = DB::table('controls')->join('control_objective_risk', 'control_objective_risk.control_id', '=', 'controls.id')->join('objective_risk', 'objective_risk.id', '=', 'control_objective_risk.objective_risk_id')->join('objectives', 'objectives.id', '=', 'objective_risk.objective_id')->where('objectives.organization_id', '=', $_GET['org'])->select('controls.*')->lists('controls.name', 'controls.id');
                                 if (Session::get('languaje') == 'en') {
                                     return view('en.hallazgos.create', ['org' => $org, 'controls' => $controls, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                                 } else {
                                     return view('hallazgos.create', ['org' => $org, 'controls' => $controls, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                                 }
                             } else {
                                 if ($_GET['kind'] == 5) {
                                     $audit_programs = DB::table('audit_programs')->join('audit_audit_plan_audit_program', 'audit_audit_plan_audit_program.audit_program_id', '=', 'audit_programs.id')->join('audit_audit_plan', 'audit_audit_plan.id', '=', 'audit_audit_plan_audit_program.audit_audit_plan_id')->join('audit_plans', 'audit_plans.id', '=', 'audit_audit_plan.audit_plan_id')->where('audit_plans.organization_id', '=', $_GET['org'])->lists('audit_programs.name', 'audit_audit_plan_audit_program.id');
                                     if (Session::get('languaje') == 'en') {
                                         return view('en.hallazgos.create', ['org' => $org, 'audit_programs' => $audit_programs, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                                     } else {
                                         return view('hallazgos.create', ['org' => $org, 'audit_programs' => $audit_programs, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                                     }
                                 } else {
                                     if ($_GET['kind'] == 6) {
                                         $audits = DB::table('audit_audit_plan')->join('audits', 'audits.id', '=', 'audit_audit_plan.audit_id')->join('audit_plans', 'audit_plans.id', '=', 'audit_audit_plan.audit_plan_id')->where('audit_plans.organization_id', '=', $_GET['org'])->select('audit_audit_plan.id', DB::raw('CONCAT(audit_plans.name, " - ", audits.name) AS audit_name'))->lists('audit_name', 'audit_audit_plan.id');
                                         if (Session::get('languaje') == 'en') {
                                             return view('en.hallazgos.create', ['org' => $org, 'audits' => $audits, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                                         } else {
                                             return view('hallazgos.create', ['org' => $org, 'audits' => $audits, 'kind' => $_GET['kind'], 'stakeholders' => $stakes, 'org_id' => $_GET['org']]);
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         } else {
             if (isset($_GET['test'])) {
                 $org = \Ermtool\Organization::getOrgIdByTestId($_GET['test']);
                 //obtenemos stakeholders de la misma organización
                 $stakes = \Ermtool\Stakeholder::listStakeholders($org);
                 $test = \Ermtool\Audit_test::getTestNameById($_GET['test']);
                 if (Session::get('languaje') == 'en') {
                     return view('en.hallazgos.create', ['test' => $test, 'test_id' => $_GET['test'], 'stakeholders' => $stakes]);
                 } else {
                     return view('hallazgos.create', ['test' => $test, 'test_id' => $_GET['test'], 'stakeholders' => $stakes]);
                 }
             } else {
                 if (isset($_GET['evaluation'])) {
                     $evaluation = \Ermtool\Control_evaluation::find($_GET['evaluation']);
                     $org = \Ermtool\Organization::getOrganizationIdFromControl($evaluation->control_id);
                     //obtenemos stakeholders de la misma organización
                     $stakes = \Ermtool\Stakeholder::listStakeholders($org->id);
                     $control = \Ermtool\Control::name($evaluation->control_id);
                     if (Session::get('languaje') == 'en') {
                         return view('en.hallazgos.create', ['control' => $control, 'evaluation_id' => $_GET['evaluation'], 'stakeholders' => $stakes]);
                     } else {
                         return view('hallazgos.create', ['control' => $control, 'evaluation_id' => $_GET['evaluation'], 'stakeholders' => $stakes]);
                     }
                 }
             }
         }
     }
 }
예제 #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     if (Auth::guest()) {
         return view('login');
     } else {
         $orgs_selected = array();
         $subproceso = \Ermtool\Subprocess::find($id);
         $procesos = \Ermtool\Process::where('status', 0)->lists('name', 'id');
         //obtenemos organizaciones del subproceso
         $orgs = DB::table('organization_subprocess')->where('subprocess_id', '=', $id)->select('organization_id')->get();
         $i = 0;
         foreach ($orgs as $org) {
             $orgs_selected[$i] = $org->organization_id;
             $i += 1;
         }
         //Seleccionamos subprocesos que pueden ser padres
         $subprocesos = \Ermtool\Subprocess::where('subprocess_id', NULL)->where('status', 0)->where('id', '<>', $id)->lists('name', 'id');
         $organizaciones = \Ermtool\Organization::where('status', 0)->lists('name', 'id');
         if (Session::get('languaje') == 'en') {
             return view('en.datos_maestros.subprocesos.edit', ['procesos' => $procesos, 'subprocesos' => $subprocesos, 'subproceso' => $subproceso, 'organizaciones' => $organizaciones, 'orgs_selected' => $orgs_selected]);
         } else {
             return view('datos_maestros.subprocesos.edit', ['procesos' => $procesos, 'subprocesos' => $subprocesos, 'subproceso' => $subproceso, 'organizaciones' => $organizaciones, 'orgs_selected' => $orgs_selected]);
         }
     }
 }
예제 #3
0
 public function getTests($kind, $id)
 {
     $i = 0;
     //contador de pruebas
     $audit_plan = \Ermtool\Audit_plan::where('id', $id)->value('name');
     $pruebas_ejec = 0;
     //pruebas en ejecución
     $pruebas_abiertas = 0;
     //pruebas abiertas
     $pruebas_cerradas = 0;
     //pruebas cerradas
     $type = NULL;
     //identifica si es una prueba asociada a un riesgo, subproceso o control (1=Riesgo, 2=Subproceso, 3=Control)
     $audit_tests = array();
     $tests = DB::table('audit_tests')->join('audit_audit_plan_audit_program', 'audit_audit_plan_audit_program.id', '=', 'audit_tests.audit_audit_plan_audit_program_id')->join('audit_programs', 'audit_programs.id', '=', 'audit_audit_plan_audit_program.audit_program_id')->join('audit_audit_plan', 'audit_audit_plan.id', '=', 'audit_audit_plan_audit_program.audit_audit_plan_id')->join('audits', 'audits.id', '=', 'audit_audit_plan.audit_id')->join('audit_plans', 'audit_plans.id', '=', 'audit_audit_plan.audit_plan_id')->where('audit_plans.id', '=', $id)->select('audit_plans.name AS audit_plan_name', 'audits.name AS audit_name', 'audit_programs.name as audit_program_name', 'audit_tests.description AS description', 'audit_tests.name AS name', 'audit_tests.type', 'audit_tests.status', 'audit_tests.results', 'audit_tests.hh', 'audit_tests.control_id', 'audit_tests.subprocess_id', 'audit_tests.risk_id', 'audit_tests.stakeholder_id')->get();
     foreach ($tests as $test) {
         //sumamos a prueba ejec abierta o cerrada según el estado que posea
         if ($test->status == 0) {
             $pruebas_abiertas += 1;
         } else {
             if ($test->status == 1) {
                 $pruebas_ejec += 1;
             } else {
                 if ($test->status == 2) {
                     $pruebas_cerradas += 1;
                 }
             }
         }
         //obtenemos nombre de stakeholder
         $resp = \Ermtool\Stakeholder::find($test->stakeholder_id);
         $resp = $resp['name'] . ' ' . $resp['surnames'];
         //obtenemos nombre de riesgo, control o subproceso según corresponda
         if ($test->risk_id != NULL) {
             $relacionado = \Ermtool\Risk::where('id', $test->risk_id)->value('name');
             $type = 1;
         } else {
             if ($test->subprocess_id != NULL) {
                 $relacionado = \Ermtool\Subprocess::where('id', $test->subprocess_id)->value('name');
                 $type = 2;
             } else {
                 if ($test->control_id != NULL) {
                     $relacionado = \Ermtool\Control::where('id', $test->control_id)->value('name');
                     $type = 3;
                 }
             }
         }
         if (strstr($_SERVER["REQUEST_URI"], 'genexcelgraficosdinamicos')) {
             if (Session::get('languaje') == 'en') {
                 if ($kind == 1 && $test->status == 0) {
                     //tipo
                     if ($test->type == 0) {
                         $test_type = 'Design test';
                     } else {
                         if ($test->type == 1) {
                             $test_type = 'Operationa effectiveness test';
                         } else {
                             if ($test->type == 2) {
                                 $test_type = 'Compliance test';
                             } else {
                                 if ($test->type == 3) {
                                     $test_type = 'Sustantive tests';
                                 } else {
                                     $test_type = 'Not defined';
                                 }
                             }
                         }
                     }
                     //resultado
                     if ($test->results == 0) {
                         $results = 'Ineffective';
                     } else {
                         if ($test->results == 1) {
                             $results = 'Effective';
                         } else {
                             if ($test->results == 2) {
                                 $results = 'In process';
                             }
                         }
                     }
                     if ($type == 1) {
                         $related = 'Risk: ' . $relacionado;
                     } else {
                         if ($type == 2) {
                             $related = 'Subprocess: ' . $relacionado;
                         } else {
                             if ($type == 3) {
                                 $related = 'Control: ' . $relacionado;
                             }
                         }
                     }
                     $audit_tests[$i] = ['Audit plan' => $audit_plan, 'Audit' => $test->audit_name, 'Program' => $test->audit_program_name, 'Test' => $test->name, 'Description' => $test->description, 'Kind' => $test_type, 'Results' => $results, 'Hours-man' => $test->hh, 'Responsable' => $resp, 'Related object' => $related];
                 } else {
                     if ($kind == 2 && $test->status == 1) {
                         //tipo
                         if ($test->type == 0) {
                             $test_type = 'Design test';
                         } else {
                             if ($test->type == 1) {
                                 $test_type = 'Operationa effectiveness test';
                             } else {
                                 if ($test->type == 2) {
                                     $test_type = 'Compliance test';
                                 } else {
                                     if ($test->type == 3) {
                                         $test_type = 'Sustantive tests';
                                     } else {
                                         $test_type = 'Not defined';
                                     }
                                 }
                             }
                         }
                         //resultado
                         if ($test->results == 0) {
                             $results = 'Ineffective';
                         } else {
                             if ($test->results == 1) {
                                 $results = 'Effective';
                             } else {
                                 if ($test->results == 2) {
                                     $results = 'In process';
                                 }
                             }
                         }
                         if ($type == 1) {
                             $related = 'Risk: ' . $relacionado;
                         } else {
                             if ($type == 2) {
                                 $related = 'Subprocess: ' . $relacionado;
                             } else {
                                 if ($type == 3) {
                                     $related = 'Control: ' . $relacionado;
                                 }
                             }
                         }
                         $audit_tests[$i] = ['Audit plan' => $audit_plan, 'Audit' => $test->audit_name, 'Program' => $test->audit_program_name, 'Test' => $test->name, 'Description' => $test->description, 'Kind' => $test_type, 'Results' => $results, 'Hours-man' => $test->hh, 'Responsable' => $resp, 'Related object' => $related];
                     } else {
                         if ($kind == 3 && $test->status == 2) {
                             //tipo
                             if ($test->type == 0) {
                                 $test_type = 'Design test';
                             } else {
                                 if ($test->type == 1) {
                                     $test_type = 'Operationa effectiveness test';
                                 } else {
                                     if ($test->type == 2) {
                                         $test_type = 'Compliance test';
                                     } else {
                                         if ($test->type == 3) {
                                             $test_type = 'Sustantive tests';
                                         } else {
                                             $test_type = 'Not defined';
                                         }
                                     }
                                 }
                             }
                             //resultado
                             if ($test->results == 0) {
                                 $results = 'Ineffective';
                             } else {
                                 if ($test->results == 1) {
                                     $results = 'Effective';
                                 } else {
                                     if ($test->results == 2) {
                                         $results = 'In process';
                                     }
                                 }
                             }
                             if ($type == 1) {
                                 $related = 'Risk: ' . $relacionado;
                             } else {
                                 if ($type == 2) {
                                     $related = 'Subprocess: ' . $relacionado;
                                 } else {
                                     if ($type == 3) {
                                         $related = 'Control: ' . $relacionado;
                                     }
                                 }
                             }
                             $audit_tests[$i] = ['Audit plan' => $audit_plan, 'Audit' => $test->audit_name, 'Program' => $test->audit_program_name, 'Test' => $test->name, 'Description' => $test->description, 'Kind' => $test_type, 'Results' => $results, 'Hours-man' => $test->hh, 'Responsable' => $resp, 'Related object' => $related];
                         }
                     }
                 }
             } else {
                 if ($kind == 1 && $test->status == 0) {
                     //tipo
                     if ($test->type == 0) {
                         $test_type = 'Prueba de diseño';
                     } else {
                         if ($test->type == 1) {
                             $test_type = 'Prueba de efectividad operativa';
                         } else {
                             if ($test->type == 2) {
                                 $test_type = 'Prueba de cumplimiento';
                             } else {
                                 if ($test->type == 3) {
                                     $test_type = 'Prueba sustantiva';
                                 } else {
                                     $test_type = 'No definido';
                                 }
                             }
                         }
                     }
                     //resultado
                     if ($test->results == 0) {
                         $results = 'Inefectiva';
                     } else {
                         if ($test->results == 1) {
                             $results = 'Efectiva';
                         } else {
                             if ($test->results == 2) {
                                 $results = 'En proceso';
                             }
                         }
                     }
                     if ($type == 1) {
                         $related = 'Riesgo: ' . $relacionado;
                     } else {
                         if ($type == 2) {
                             $related = 'Subproceso: ' . $relacionado;
                         } else {
                             if ($type == 3) {
                                 $related = 'Control: ' . $relacionado;
                             }
                         }
                     }
                     $audit_tests[$i] = ['Plan de auditoría' => $audit_plan, 'Auditoría' => $test->audit_name, 'Programa' => $test->audit_program_name, 'Prueba' => $test->name, 'Descripción' => $test->description, 'Tipo' => $test_type, 'Resultado' => $results, 'Horas-hombre' => $test->hh, 'Responsable' => $resp, 'Objeto relacionado' => $related];
                 } else {
                     if ($kind == 2 && $test->status == 1) {
                         //tipo
                         if ($test->type == 0) {
                             $test_type = 'Prueba de diseño';
                         } else {
                             if ($test->type == 1) {
                                 $test_type = 'Prueba de efectividad operativa';
                             } else {
                                 if ($test->type == 2) {
                                     $test_type = 'Prueba de cumplimiento';
                                 } else {
                                     if ($test->type == 3) {
                                         $test_type = 'Prueba sustantiva';
                                     } else {
                                         $test_type = 'No definido';
                                     }
                                 }
                             }
                         }
                         //resultado
                         if ($test->results == 0) {
                             $results = 'Inefectiva';
                         } else {
                             if ($test->results == 1) {
                                 $results = 'Efectiva';
                             } else {
                                 if ($test->results == 2) {
                                     $results = 'En proceso';
                                 }
                             }
                         }
                         if ($type == 1) {
                             $related = 'Riesgo: ' . $relacionado;
                         } else {
                             if ($type == 2) {
                                 $related = 'Subproceso: ' . $relacionado;
                             } else {
                                 if ($type == 3) {
                                     $related = 'Control: ' . $relacionado;
                                 }
                             }
                         }
                         $audit_tests[$i] = ['Plan de auditoría' => $audit_plan, 'Auditoría' => $test->audit_name, 'Programa' => $test->audit_program_name, 'Prueba' => $test->name, 'Descripción' => $test->description, 'Tipo' => $test_type, 'Resultado' => $results, 'Horas-hombre' => $test->hh, 'Responsable' => $resp, 'Objeto relacionado' => $related];
                     } else {
                         if ($kind == 3 && $test->status == 2) {
                             //tipo
                             if ($test->type == 0) {
                                 $test_type = 'Prueba de diseño';
                             } else {
                                 if ($test->type == 1) {
                                     $test_type = 'Prueba de efectividad operativa';
                                 } else {
                                     if ($test->type == 2) {
                                         $test_type = 'Prueba de cumplimiento';
                                     } else {
                                         if ($test->type == 3) {
                                             $test_type = 'Prueba sustantiva';
                                         } else {
                                             $test_type = 'No definido';
                                         }
                                     }
                                 }
                             }
                             //resultado
                             if ($test->results == 0) {
                                 $results = 'Inefectiva';
                             } else {
                                 if ($test->results == 1) {
                                     $results = 'Efectiva';
                                 } else {
                                     if ($test->results == 2) {
                                         $results = 'En proceso';
                                     }
                                 }
                             }
                             if ($type == 1) {
                                 $related = 'Riesgo: ' . $relacionado;
                             } else {
                                 if ($type == 2) {
                                     $related = 'Subproceso: ' . $relacionado;
                                 } else {
                                     if ($type == 3) {
                                         $related = 'Control: ' . $relacionado;
                                     }
                                 }
                             }
                             $audit_tests[$i] = ['Plan de auditoría' => $audit_plan, 'Auditoría' => $test->audit_name, 'Programa' => $test->audit_program_name, 'Prueba' => $test->name, 'Descripción' => $test->description, 'Tipo' => $test_type, 'Resultado' => $results, 'Horas-hombre' => $test->hh, 'Responsable' => $resp, 'Objeto relacionado' => $related];
                         }
                     }
                 }
             }
         } else {
             $audit_tests[$i] = ['audit_name' => $test->audit_name, 'audit_program_name' => $test->audit_program_name, 'name' => $test->name, 'description' => $test->description, 'type' => $test->type, 'status' => $test->status, 'results' => $test->results, 'hh' => $test->hh, 'stakeholder' => $resp, 'related' => $relacionado, 'related_type' => $type];
         }
         $i += 1;
     }
     if (strstr($_SERVER["REQUEST_URI"], 'genexcelgraficos')) {
         return $audit_tests;
     } else {
         return json_encode(['audit_plan' => $audit_plan, 'audit_tests' => $audit_tests, 'pruebas_abiertas' => $pruebas_abiertas, 'pruebas_ejec' => $pruebas_ejec, 'pruebas_cerradas' => $pruebas_cerradas]);
     }
 }