Skip to content

Commit

Permalink
Stop asset acceptances from shown to user if full company support is …
Browse files Browse the repository at this point in the history
…enabled and companies not match
  • Loading branch information
inietov committed Aug 3, 2023
1 parent 924f528 commit 9ca163e
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion app/Http/Controllers/Account/AcceptanceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function create($id)
}

if (! Company::isCurrentUserHasAccess($acceptance->checkoutable)) {
return redirect()->route('account.accept')->with('error', trans('general.insufficient_permissions'));
return redirect()->route('account.accept')->with('error', trans('general.error_user_company'));
}

return view('account/accept.create', compact('acceptance'));
Expand Down
1 change: 1 addition & 0 deletions resources/lang/en/general.php
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@
'serial_number' => 'Serial Number',
'item_notes' => ':item Notes',
'item_name_var' => ':item Name',
'error_user_company' => 'User and Asset companies missmatch',
'importer' => [
'checked_out_to_fullname' => 'Checked Out to: Full Name',
'checked_out_to_first_name' => 'Checked Out to: First Name',
Expand Down
2 changes: 2 additions & 0 deletions resources/views/account/accept/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,11 @@ class="table table-striped snipe-table"
<tbody>
@foreach ($acceptances as $acceptance)
<tr>
@if ($acceptance->checkoutable)
<td>{{ ($acceptance->checkoutable) ? $acceptance->checkoutable->present()->name : '' }}</td>
<td><a href="{{ route('account.accept.item', $acceptance) }}" class="btn btn-default btn-sm">{{ trans('general.accept_decline') }}</a></td>
</tr>
@endif
@endforeach
</tbody>
</table>
Expand Down

0 comments on commit 9ca163e

Please sign in to comment.