/** * 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]); } } } } } }
public function editEvaluacion($id) { if (Auth::guest()) { return view('login'); } else { $eval = \Ermtool\Control_evaluation::find($id); //responsables del plan de acción (si es que la prueba es inefectiva) $stakeholders = \Ermtool\Stakeholder::listStakeholders(NULL); $control = \Ermtool\Control::name($eval->control_id); if (Session::get('languaje') == 'en') { switch ($eval->kind) { case 0: $kind = 'Design test'; break; case 1: $kind = 'Operational effectiveness test'; break; case 2: $kind = 'Sustantive test'; break; case 3: $kind = 'Compliance test'; break; default: # code... break; } return view('en.controles.edit_evaluation', ['eval' => $eval, 'control' => $control, 'kind' => $kind, 'stakeholders' => $stakeholders, 'control_evaluation' => $eval->id, 'id' => $eval->control_id]); } else { switch ($eval->kind) { case 0: $kind = 'Prueba de diseño'; break; case 1: $kind = 'Prueba de efectividad operativa'; break; case 2: $kind = 'Prueba sustantiva'; break; case 3: $kind = 'Prueba de cumplimiento'; break; default: # code... break; } return view('controles.edit_evaluation', ['eval' => $eval, 'control' => $control, 'kind' => $kind, 'stakeholders' => $stakeholders, 'control_evaluation' => $eval->id, 'id' => $eval->control_id]); } } }
/** * Show the form for creating a new resource. * * @return \Illuminate\Http\Response */ public function create() { if (Auth::guest()) { return view('login'); } else { //categorias de riesgo $categorias = \Ermtool\Risk_category::where('status', 0)->lists('name', 'id'); //causas preingresadas $causas = \Ermtool\Cause::where('status', 0)->lists('name', 'id'); //efectos preingresados $efectos = \Ermtool\Effect::where('status', 0)->lists('name', 'id'); //riesgos tipo $riesgos_tipo = \Ermtool\Risk::where('status', 0)->where('type2', 0)->lists('name', 'id'); //obtenemos lista de stakeholders $stakeholders = \Ermtool\Stakeholder::listStakeholders($_GET['org']); if (isset($_GET['P'])) { //ACTUALIZACIÓN 26-07: SOLO MOSTRAMOS PROCESOS PERTENECIENTES A LA EMPRESA QUE SE ESTÁ CONSULTANDO //$subprocesos = \Ermtool\Subprocess::where('status',0)->lists('name','id'); $subprocesos = DB::table('subprocesses')->join('organization_subprocess', 'organization_subprocess.subprocess_id', '=', 'subprocesses.id')->where('organization_subprocess.organization_id', '=', $_GET['org'])->where('subprocesses.status', '=', 0)->lists('subprocesses.name', 'subprocesses.id'); if (Session::get('languaje') == 'en') { return view('en.riesgos.create', ['categorias' => $categorias, 'causas' => $causas, 'efectos' => $efectos, 'subprocesos' => $subprocesos, 'riesgos_tipo' => $riesgos_tipo, 'stakeholders' => $stakeholders, 'org_id' => $_GET['org']]); } else { return view('riesgos.create', ['categorias' => $categorias, 'causas' => $causas, 'efectos' => $efectos, 'subprocesos' => $subprocesos, 'riesgos_tipo' => $riesgos_tipo, 'stakeholders' => $stakeholders, 'org_id' => $_GET['org']]); } } else { if (isset($_GET['N'])) { $objectives = DB::table('objectives')->where('organization_id', '=', $_GET['org'])->where('status', '=', 0)->lists('name', 'id'); if (Session::get('languaje') == 'en') { return view('en.riesgos.create', ['categorias' => $categorias, 'causas' => $causas, 'efectos' => $efectos, 'objetivos' => $objectives, 'riesgos_tipo' => $riesgos_tipo, 'stakeholders' => $stakeholders, 'org_id' => $_GET['org']]); } else { return view('riesgos.create', ['categorias' => $categorias, 'causas' => $causas, 'efectos' => $efectos, 'objetivos' => $objectives, 'riesgos_tipo' => $riesgos_tipo, 'stakeholders' => $stakeholders, 'org_id' => $_GET['org']]); } } } } }