diff --git a/app/Calendar.php b/app/Calendar.php index 41c6c0f7..176824a5 100644 --- a/app/Calendar.php +++ b/app/Calendar.php @@ -92,7 +92,7 @@ public function __toString() foreach ($this->events as $event) { for ($d = 0; $d <= $event[2] - 1; $d++) { if (date('y-m-d', strtotime($this->active_year . '-' . $this->active_month . '-' . $i . ' -' . $d . ' day')) === date('y-m-d', strtotime($event[1]))) { - $html .= '
'; + $html .= '
'; $html .= $event[0]; $html .= '
'; } diff --git a/app/Console/Commands/GenerateTestData.php b/app/Console/Commands/GenerateTestData.php index 8e89e5a6..1878e76a 100644 --- a/app/Console/Commands/GenerateTestData.php +++ b/app/Console/Commands/GenerateTestData.php @@ -5,11 +5,10 @@ use App\Models\Control; use App\Models\Measure; use Carbon\Carbon; +use Faker; use Illuminate\Console\Command; use Illuminate\Support\Facades\DB; -use Faker; - class GenerateTestData extends Command { /** @@ -71,7 +70,6 @@ public function handle() // loop on measures $delta = $perPeriod - rand(-$perPeriod / 2, $perPeriod / 2); - $faker = Faker\Factory::create(); foreach ($measures as $measure) { diff --git a/app/Http/Controllers/ActionplanController.php b/app/Http/Controllers/ActionplanController.php index 573de514..713b98e3 100644 --- a/app/Http/Controllers/ActionplanController.php +++ b/app/Http/Controllers/ActionplanController.php @@ -15,6 +15,7 @@ class ActionplanController extends Controller */ public function index() { + // TODO : improve me $actions = DB::select(' select diff --git a/app/Http/Controllers/ControlController.php b/app/Http/Controllers/ControlController.php index 61e7ba72..819daf8a 100644 --- a/app/Http/Controllers/ControlController.php +++ b/app/Http/Controllers/ControlController.php @@ -40,7 +40,7 @@ public function index(Request $request) } } sort($attributes); - $attributes=array_unique($attributes); + $attributes = array_unique($attributes); // get domain base on his title $domain_title = $request->get('domain_title'); @@ -114,8 +114,9 @@ public function index(Request $request) } } else { $period = $request->session()->get('period'); - if ($period==null) + if ($period === null) { $request->session()->put('period', 99); + } } // Status filter @@ -124,8 +125,9 @@ public function index(Request $request) $request->session()->put('status', $status); } else { $status = $request->session()->get('status'); - if ($status==null) - $status="2"; + if ($status === null) { + $status = '2'; + } } // Late filter @@ -214,7 +216,7 @@ public function index(Request $request) public function create() { // does not exists in that way - return redirect('/control'); + return redirect('/bob/index'); } /** @@ -242,9 +244,7 @@ public function show(int $id) $control = Control::find($id); // Control not found - if ($control === null) { - abort(404); - } + abort_if($control === null, Response::HTTP_NOT_FOUND, '404 Not Found'); if ($control->next_id !== null) { $next_control = DB::table('controls') @@ -286,9 +286,7 @@ public function edit(int $id) $control = Control::find($id); // Control not found - if ($control === null) { - abort(404); - } + abort_if($control === null, Response::HTTP_NOT_FOUND, '404 Not Found'); $documents = DB::table('documents')->where('control_id', $id)->get(); @@ -323,7 +321,7 @@ public function edit(int $id) } } sort($values); - $values=array_unique($values); + $values = array_unique($values); return view('controls.edit') ->with('control', $control) @@ -349,9 +347,7 @@ public function destroy(int $id) $control = Control::find($id); // Control not found - if ($control === null) { - abort(404); - } + abort_if($control === null, Response::HTTP_NOT_FOUND, '404 Not Found'); // Delete files $documents = Document::select('id')->where('control_id', $id)->get(); @@ -369,7 +365,7 @@ public function destroy(int $id) // Then delete the control $control->delete(); - return redirect('/controls'); + return redirect('/bob/index'); } public function history() @@ -413,6 +409,7 @@ public function domains(Request $request) } // count control never made + // TODO : improve me $controls_never_made = DB::select( 'select domain_id from controls c1 @@ -424,6 +421,7 @@ public function domains(Request $request) ); // Last controls made by measures + // TODO : improve me $active_controls = DB::select(' select c2.id, @@ -442,7 +440,7 @@ public function domains(Request $request) order by domains.title;'); // return - return view('/radar/domains') + return view('radar.domains') ->with('domains', $domains) ->with('scopes', $scopes) ->with('active_controls', $active_controls) @@ -514,7 +512,7 @@ public function measures(Request $request) ->get(); // return - return view('radar.controls') + return view('/radar/controls') ->with('scopes', $scopes) ->with('controls', $controls) // ->with('cur_date', $cur_date) @@ -529,6 +527,7 @@ public function attributes(Request $request) ->get(); // Controls made + // TODO : improve me $controls = DB::select(' select c2.id, @@ -628,7 +627,7 @@ public function unplan(Request $request) $control->delete(); } - return redirect('/measures'); + return redirect('/alice/index'); } /** @@ -674,7 +673,7 @@ public function doPlan(Request $request) $control->owners()->sync($request->input('owners', [])); $control->save(); - return redirect('/controls/'.$request->id); + return redirect('/bob/show/'.$request->id); } public function make(Request $request) @@ -811,7 +810,7 @@ public function save(Request $request) $control->save(); - return redirect('/control/show/' . $request->id); + return redirect('/bob/show/' . $request->id); } /** @@ -835,7 +834,7 @@ public function draft(Request $request) $control->save(); - return redirect('/control/show/'.$id); + return redirect('/bob/show/'.$id); } public function export() diff --git a/app/Http/Controllers/MeasureController.php b/app/Http/Controllers/MeasureController.php index 803babea..598795f9 100644 --- a/app/Http/Controllers/MeasureController.php +++ b/app/Http/Controllers/MeasureController.php @@ -92,7 +92,7 @@ public function create() } } sort($values); - $values=array_unique($values); + $values = array_unique($values); } // store it in the response @@ -136,7 +136,7 @@ public function store(Request $request) $request->session()->put('domain', $measure->domain_id); - return redirect('/measures'); + return redirect('/alice/index'); } /** @@ -146,9 +146,11 @@ public function store(Request $request) * * @return \Illuminate\Http\Response */ - public function show(Measure $measure) + public function show(int $id) { - return view('measures.show', compact('measure')); + $measure = Measure::where('id', $id)->get()->first(); + return view('measures.show') + ->with('measure', $measure); } /** @@ -158,11 +160,16 @@ public function show(Measure $measure) * * @return \Illuminate\Http\Response */ - public function edit(Measure $measure) + public function edit(int $id) { // Not for Auditor abort_if(Auth::User()->role === 3, Response::HTTP_FORBIDDEN, '403 Forbidden'); + $measure = Measure::find($id); + + // not found + abort_if($measure === null, Response::HTTP_NOT_FOUND, '404 Not Found'); + // get the list of domains $domains = Domain::All(); @@ -179,7 +186,7 @@ public function edit(Measure $measure) } } sort($values); - $values=array_unique($values); + $values = array_unique($values); return view('measures.edit', compact('measure', 'values', 'domains'))->with('domains', $domains); } @@ -254,7 +261,7 @@ public function destroy(Measure $measure) $measure->delete(); - return redirect('/measures'); + return redirect('/alice/index'); } /** diff --git a/app/Http/Middleware/ForceXForwardedProto.php b/app/Http/Middleware/ForceXForwardedProto.php index 5ab2a53e..71d5aa7a 100644 --- a/app/Http/Middleware/ForceXForwardedProto.php +++ b/app/Http/Middleware/ForceXForwardedProto.php @@ -16,4 +16,4 @@ public function handle($request, Closure $next) return $next($request); } -} \ No newline at end of file +} diff --git a/app/Models/Control.php b/app/Models/Control.php index 26cdfc86..0f3d722f 100644 --- a/app/Models/Control.php +++ b/app/Models/Control.php @@ -15,7 +15,7 @@ class Control extends Model 'attributes', 'model', 'action_plan', - 'realisation_date' + 'realisation_date', ]; protected $dates = [ diff --git a/resources/views/actions/index.blade.php b/resources/views/actions/index.blade.php index e95b1ec3..6046e2af 100644 --- a/resources/views/actions/index.blade.php +++ b/resources/views/actions/index.blade.php @@ -29,7 +29,7 @@ @foreach($actions as $action) - + {{ $action->clause }} @@ -38,8 +38,8 @@
{{ $action->action_plan }}
{{ $action->scope }} - {{ $action->plan_date }} - {{ $action->next_date }} + {{ $action->plan_date }} + {{ $action->next_date }}
@if ($action->score==1) diff --git a/resources/views/controls/edit.blade.php b/resources/views/controls/edit.blade.php index 7494b2f2..6e55cee6 100644 --- a/resources/views/controls/edit.blade.php +++ b/resources/views/controls/edit.blade.php @@ -15,7 +15,7 @@
@endif -
+ @csrf @@ -98,8 +98,6 @@
{{ trans("cruds.control.fields.evidence") }} -
- {{ trans("cruds.control.fields.model") }}
@@ -187,7 +185,7 @@   -
+   -   -
+
@endif - + @csrf @@ -103,7 +103,7 @@   @endif @if (Auth::User()->role !== 3) - + @csrf
- {{ $control->clause }}   -   {{ $control->name }} + {{ $control->clause }}   -   {{ $control->name }}
{{ trans("cruds.control.fields.scope") }} @@ -80,7 +80,7 @@
@if ($prev_id!=null) - + {{ $prev_date }} @else @@ -88,7 +88,7 @@ @endif
@if ($next_id!=null) - + {{ $next_date }} @else @@ -214,7 +214,7 @@
@if ((Auth::User()->role==1)||(Auth::User()->role==2)) @if ($control->realisation_date==null) - +   -
+
  -
+
- - - @endsection diff --git a/resources/views/layout.blade.php b/resources/views/layout.blade.php index 46f960a6..7df8a038 100644 --- a/resources/views/layout.blade.php +++ b/resources/views/layout.blade.php @@ -40,7 +40,7 @@
  • - + {{ trans("menu.measures") }} @@ -48,7 +48,7 @@
  • - + {{ trans("menu.controls") }} @@ -63,7 +63,7 @@
  • - + {{ trans("menu.planning") }} @@ -76,13 +76,13 @@ {{ trans("menu.radar") }} @@ -130,7 +130,7 @@ {{ trans("menu.configuration.reports") }}
  • @if (Auth::User()->role==1) -
  • +
  • {{ trans("menu.configuration.import") }}
  • @@ -172,13 +172,13 @@ @endif - + @csrf
    @@ -118,7 +118,7 @@   -
    +
    @endif - + @method("PATCH") @csrf
    @@ -127,7 +127,7 @@   -
    +
    @endif -
    Current security Measures + Current security Measures
    @@ -24,7 +24,7 @@
    - + @csrf
    diff --git a/resources/views/measures/index.blade.php b/resources/views/measures/index.blade.php index 962645d6..d04851f7 100644 --- a/resources/views/measures/index.blade.php +++ b/resources/views/measures/index.blade.php @@ -20,7 +20,7 @@
    -
    @endif - + @csrf
    @@ -116,7 +116,7 @@ @endif   -
    +
    - {{ $measure->domain->title }} + {{ $measure->domain->title ?? ""}} - - {{ $measure->domain->description }} + {{ $measure->domain->description ?? "" }}
    @@ -91,7 +91,7 @@
    @if (Auth::User()->role !== 3) - +   -
    +
      -
    + {{ method_field('delete') }} @csrf