Ejemplo n.º 1
0
 public function getIssue($eval_id)
 {
     $issue = NULL;
     $eval = DB::table('control_evaluation')->where('id', '=', $eval_id)->where('status', '=', 1)->select('issue_id')->first();
     $evidence = getEvidences(3, $eval_id);
     if ($eval) {
         $issue = \Ermtool\Issue::find($eval->issue_id);
         $issue = ['issue' => $issue, 'evidence' => $evidence];
     }
     return json_encode($issue);
 }
Ejemplo n.º 2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit()
 {
     if (Auth::guest()) {
         return view('login');
     } else {
         if (isset($_GET['test_id'])) {
             $test_id = $_GET['test_id'];
             $eval_id = NULL;
         } else {
             if (isset($_GET['evaluation'])) {
                 $eval_id = $_GET['evaluation'];
                 $test_id = NULL;
             } else {
                 $test_id = NULL;
                 $eval_id = NULL;
             }
         }
         $org = \Ermtool\Organization::where('id', $_GET['org'])->value('name');
         $org_id = \Ermtool\Organization::where('id', $_GET['org'])->value('id');
         //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');
         $issue = \Ermtool\Issue::find($_GET['id']);
         //vemos si es que tiene plan de accion
         $action_plan = NULL;
         $action_plan = DB::table('action_plans')->where('issue_id', '=', $_GET['id'])->select('id', 'stakeholder_id', 'description', 'final_date', 'status')->first();
         //vemos si es hallazgo de proceso, organización, u otro
         if ($issue['process_id'] != NULL) {
             $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');
             $process_selected = $issue->process_id;
             if (Session::get('languaje') == 'en') {
                 return view('en.hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'processes' => $processes, 'process_selected' => $process_selected, 'action_plan' => $action_plan, 'test_id' => $test_id, 'kind' => $_GET['kind']]);
             } else {
                 return view('hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'processes' => $processes, 'process_selected' => $process_selected, 'action_plan' => $action_plan, 'test_id' => $test_id, 'kind' => $_GET['kind']]);
             }
         } else {
             if ($issue['organization_id'] != NULL) {
                 if (Session::get('languaje') == 'en') {
                     return view('en.hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'org_id' => $_GET['org'], 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => $_GET['kind']]);
                 } else {
                     return view('hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'org_id' => $_GET['org'], 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => $_GET['kind']]);
                 }
             } else {
                 if (!isset($_GET['kind'])) {
                     if (Session::get('languaje') == 'en') {
                         return view('en.hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => NULL]);
                     } else {
                         return view('hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => NULL]);
                     }
                 }
                 if (Session::get('languaje') == 'en') {
                     return view('en.hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => $_GET['kind']]);
                 } else {
                     return view('hallazgos.edit', ['org' => $org, 'org_id' => $org_id, 'issue' => $issue, 'stakeholders' => $stakes, 'action_plan' => $action_plan, 'test_id' => $test_id, 'eval_id' => $eval_id, 'kind' => $_GET['kind']]);
                 }
             }
         }
     }
 }