Skip to content

Commit b846bb2

Browse files
committed
Merge branch 'develop'
2 parents ceff6a9 + ab3f5f4 commit b846bb2

File tree

17 files changed

+184
-108
lines changed

17 files changed

+184
-108
lines changed

.env.example

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ LOGIN_LOCKOUT_DURATION=60
9797
# --------------------------------------------
9898
# OPTIONAL: MISC
9999
# --------------------------------------------
100-
APP_LOG=single
100+
APP_LOG=daily
101+
APP_LOG_MAX_FILES=10
101102
APP_LOCKED=false
102103
FILESYSTEM_DISK=local
103104
APP_TRUSTED_PROXIES=192.168.1.1,10.0.0.1

app/Http/Controllers/Api/AssetsController.php

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -146,39 +146,40 @@ public function index(Request $request)
146146
$assets->withTrashed()->Deleted();
147147
break;
148148
case 'Pending':
149-
$assets->join('status_labels',function ($join) {
150-
$join->on('status_labels.id', "=", "assets.status_id")
151-
->where('status_labels.deployable','=',0)
152-
->where('status_labels.pending','=',1)
153-
->where('status_labels.archived', '=', 0);
149+
$assets->join('status_labels AS status_alias',function ($join) {
150+
$join->on('status_alias.id', "=", "assets.status_id")
151+
->where('status_alias.deployable','=',0)
152+
->where('status_alias.pending','=',1)
153+
->where('status_alias.archived', '=', 0);
154154
});
155155
break;
156156
case 'RTD':
157-
$assets->join('status_labels',function ($join) {
158-
$join->on('status_labels.id', "=", "assets.status_id")
159-
->where('status_labels.deployable','=',1)
160-
->where('status_labels.pending','=',0)
161-
->where('status_labels.archived', '=', 0);
157+
$assets->whereNull('assets.assigned_to')
158+
->join('status_labels AS status_alias',function ($join) {
159+
$join->on('status_alias.id', "=", "assets.status_id")
160+
->where('status_alias.deployable','=',1)
161+
->where('status_alias.pending','=',0)
162+
->where('status_alias.archived', '=', 0);
162163
});
163164
break;
164165
case 'Undeployable':
165166
$assets->Undeployable();
166167
break;
167168
case 'Archived':
168-
$assets->join('status_labels',function ($join) {
169-
$join->on('status_labels.id', "=", "assets.status_id")
170-
->where('status_labels.deployable','=',0)
171-
->where('status_labels.pending','=',0)
172-
->where('status_labels.archived', '=', 1);
169+
$assets->join('status_labels AS status_alias',function ($join) {
170+
$join->on('status_alias.id', "=", "assets.status_id")
171+
->where('status_alias.deployable','=',0)
172+
->where('status_alias.pending','=',0)
173+
->where('status_alias.archived', '=', 1);
173174
});
174175
break;
175176
case 'Requestable':
176177
$assets->where('assets.requestable', '=', 1)
177-
->join('status_labels',function ($join) {
178-
$join->on('status_labels.id', "=", "assets.status_id")
179-
->where('status_labels.deployable','=',1)
180-
->where('status_labels.pending','=',0)
181-
->where('status_labels.archived', '=', 0);
178+
->join('status_labels AS status_alias',function ($join) {
179+
$join->on('status_alias.id', "=", "assets.status_id")
180+
->where('status_alias.deployable','=',1)
181+
->where('status_alias.pending','=',0)
182+
->where('status_alias.archived', '=', 0);
182183
});
183184

184185
break;
@@ -188,9 +189,9 @@ public function index(Request $request)
188189
break;
189190
default:
190191
// terrible workaround for complex-query Laravel bug in fulltext
191-
$assets->join('status_labels',function ($join) {
192-
$join->on('status_labels.id', "=", "assets.status_id")
193-
->where('status_labels.archived', '=', 0);
192+
$assets->join('status_labels AS status_alias',function ($join) {
193+
$join->on('status_alias.id', "=", "assets.status_id")
194+
->where('status_alias.archived', '=', 0);
194195
});
195196
}
196197

app/Http/Controllers/Api/UsersController.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,17 @@ public function index(Request $request)
5757
$users = $users->GetDeleted();
5858
}
5959

60-
6160
if ($request->has('company_id')) {
6261
$users = $users->where('company_id', '=', $request->input('company_id'));
6362
}
6463

6564
if ($request->has('location_id')) {
6665
$users = $users->where('location_id', '=', $request->input('location_id'));
6766
}
67+
68+
if ($request->has('group_id')) {
69+
$users = $users->ByGroup($request->has('group_id'));
70+
}
6871

6972
if ($request->has('department_id')) {
7073
$users = $users->where('department_id','=',$request->input('department_id'));

app/Http/Controllers/GroupsController.php

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,15 @@ public function store()
8787
public function edit($id = null)
8888
{
8989
$group = Group::find($id);
90-
$permissions = config('permissions');
91-
$groupPermissions = $group->decodePermissions();
92-
$selected_array = Helper::selectedPermissionsArray($permissions, $groupPermissions);
93-
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'));
90+
91+
if ($group) {
92+
$permissions = config('permissions');
93+
$groupPermissions = $group->decodePermissions();
94+
$selected_array = Helper::selectedPermissionsArray($permissions, $groupPermissions);
95+
return view('groups.edit', compact('group', 'permissions', 'selected_array', 'groupPermissions'));
96+
}
97+
98+
return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
9499
}
95100

96101
/**
@@ -142,4 +147,24 @@ public function destroy($id = null)
142147
return redirect()->route('groups.index')->with('error', trans('general.feature_disabled'));
143148
}
144149

150+
/**
151+
* Returns a view that invokes the ajax tables which actually contains
152+
* the content for the group detail page.
153+
*
154+
* @author [A. Gianotto] [<[email protected]>]
155+
* @param int $locationId
156+
* @since [v4.0.11]
157+
* @return \Illuminate\Contracts\View\View
158+
*/
159+
public function show($id)
160+
{
161+
$group = Group::find($id);
162+
163+
if ($group) {
164+
return view('groups/view', compact('group'));
165+
}
166+
167+
return redirect()->route('groups.index')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
168+
}
169+
145170
}

app/Models/Asset.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -781,14 +781,11 @@ public function scopeTextSearch($query, $search)
781781
$query->where('locations.name', 'LIKE', '%'.$search.'%');
782782
});
783783
})->orWhere(function ($query) use ($search) {
784-
785-
$query->whereHas('assignedTo', function ($query) use ($search) {
786784
$query->where('users.first_name', 'LIKE', '%'.$search.'%')
787785
->orWhere('users.last_name', 'LIKE', '%'.$search.'%')
788786
->orWhere('users.username', 'LIKE', '%'.$search.'%')
789787
->orWhere('locations.name', 'LIKE', '%'.$search.'%')
790788
->orWhere('assigned_assets.name', 'LIKE', '%'.$search.'%');
791-
});
792789
})->orWhere('assets.name', 'LIKE', '%'.$search.'%')
793790
->orWhere('assets.asset_tag', 'LIKE', '%'.$search.'%')
794791
->orWhere('assets.serial', 'LIKE', '%'.$search.'%')

app/Models/User.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,14 @@ public function decodePermissions()
378378
return json_decode($this->permissions, true);
379379
}
380380

381+
382+
public function scopeByGroup($query, $id) {
383+
return $query->whereHas('groups', function ($query) use ($id) {
384+
$query->where('id', '=', $id);
385+
});
386+
}
387+
388+
381389
/**
382390
* Query builder scope to search on text
383391
*

app/Providers/AppServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ public function register()
9898
if (config('app.debug')) {
9999
$log_level = 'debug';
100100
} else {
101-
if (config('log-level')) {
102-
$log_level = config('log-level');
101+
if (config('app.log_level')) {
102+
$log_level = config('app.log_level');
103103
} else {
104104
$log_level = 'error';
105105
}

config/app.php

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,8 +121,41 @@
121121
|
122122
*/
123123

124-
'log' => env('APP_LOG', 'single'),
125-
'log-level' => env('APP_LOG_LEVEL', 'error'),
124+
'log' => env('APP_LOG', 'daily'),
125+
126+
/*
127+
|--------------------------------------------------------------------------
128+
| Logging Max Files
129+
|--------------------------------------------------------------------------
130+
|
131+
| When using the daily log mode, Laravel will only retain 5
132+
| days of log files by default.
133+
|
134+
| To change this, set the APP_LOG_MAX_FILES option in your .env.
135+
|
136+
*/
137+
138+
'log_max_files' => env('APP_LOG_MAX_FILES', 5),
139+
140+
/*
141+
|--------------------------------------------------------------------------
142+
| Logging Detail
143+
|--------------------------------------------------------------------------
144+
|
145+
| By default, Laravel writes all log levels to storage. However, in your
146+
| production environment, you may wish to configure the minimum severity that
147+
| should be logged by editing your APP_LOG_LEVEL env config.
148+
|
149+
| Laravel will log all levels greater than or equal to the specified severity.
150+
| For example, a default log_level of error will log error, critical, alert,
151+
| and emergency messages.
152+
|
153+
| APP_LOG_LEVEL options are:
154+
| "debug", "info", "notice", "warning", "error", "critical", "alert", "emergency"
155+
|
156+
*/
157+
158+
'log_level' => env('APP_LOG_LEVEL', 'error'),
126159

127160

128161
/*

config/version.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
return array (
3-
'app_version' => 'v4.0.11',
4-
'build_version' => '264',
5-
'hash_version' => 'gc776fa4',
6-
'full_hash' => 'v4.0.11-264-gc776fa4',
3+
'app_version' => 'v4.0.12',
4+
'build_version' => '272',
5+
'hash_version' => 'gea63ced',
6+
'full_hash' => 'v4.0.12-272-gea63ced',
77
);

resources/views/account/requestable-assets.blade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@
6060
<td><a href="{{ $asset->present()->viewUrl() }}">{{ $asset->serial }}</a></td>
6161

6262
<td>
63-
{!! $asset->assetLoc->present()->nameUrl() !!}
63+
@if ($asset->assetloc)
64+
{!! $asset->assetloc->present()->nameUrl() !!}
65+
@endif
6466
</td>
6567
@if ($asset->assigned_to != '' && $asset->assigned_to > 0)
6668
<td>Checked out</td>

0 commit comments

Comments
 (0)