Merge branch 'develop'

This commit is contained in:
snipe 2017-11-03 14:59:38 -07:00
commit 877daba096
5 changed files with 18 additions and 12 deletions

View file

@ -108,11 +108,11 @@ class SettingsController extends Controller
if (!config('app.lock_passwords')) {
try {
Mail::send('emails.test', [], function ($m) {
$m->to(config('mail.from.address'), config('mail.from.name'));
$m->to(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->replyTo(config('mail.reply_to.address'), config('mail.reply_to.name'));
$m->subject(trans('mail.test_email'));
});
return response()->json(['message' => 'Mail sent to '.config('mail.from.address')], 200);
return response()->json(['message' => 'Mail sent to '.config('mail.reply_to.address')], 200);
} catch (Exception $e) {
return response()->json(['message' => $e->getMessage()], 500);
}

View file

@ -80,7 +80,7 @@ class UsersController extends Controller
}
if ($request->has('department_id')) {
$users = $users->where('department_id','=',$request->input('department_id'));
$users = $users->where('users.department_id','=',$request->input('department_id'));
}
$order = $request->input('order') === 'asc' ? 'asc' : 'desc';

View file

@ -441,8 +441,10 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
//Ugly, ugly code because Laravel sucks at self-joins
->orWhere(function ($query) use ($search) {
$query->whereRaw("users.manager_id IN (select id from users where first_name LIKE '%".$search."%' OR last_name LIKE '%".$search."%') ");
$query->whereRaw("users.manager_id IN (select id from users where first_name LIKE ? OR last_name LIKE ?)", ["%$search%", "%$search%"]);
});
});
}
@ -473,7 +475,7 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
public function scopeOrderManager($query, $order)
{
// Left join here, or it will only return results with parents
return $query->leftJoin('users as manager', 'users.manager_id', '=', 'manager.id')->orderBy('manager.first_name', $order)->orderBy('manager.last_name', $order);
return $query->leftJoin('users as users_manager', 'users.manager_id', '=', 'users_manager.id')->orderBy('users_manager.first_name', $order)->orderBy('users_manager.last_name', $order);
}
/**
@ -486,7 +488,7 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
*/
public function scopeOrderLocation($query, $order)
{
return $query->leftJoin('locations', 'users.location_id', '=', 'locations.id')->orderBy('locations.name', $order);
return $query->leftJoin('locations as locations_users', 'users.location_id', '=', 'locations_users.id')->orderBy('locations_users.name', $order);
}
@ -500,6 +502,6 @@ class User extends SnipeModel implements AuthenticatableContract, CanResetPasswo
*/
public function scopeOrderDepartment($query, $order)
{
return $query->leftJoin('departments', 'users.department_id', '=', 'departments.id')->orderBy('departments.name', $order);
return $query->leftJoin('departments as departments_users', 'users.department_id', '=', 'departments_users.id')->orderBy('departments_users.name', $order);
}
}

View file

@ -61,7 +61,11 @@ return [
|
*/
'from' => ['address' => env('MAIL_FROM_ADDR', null), 'name' => env('MAIL_FROM_NAME', null)],
'from' =>
[
'address' => env('MAIL_FROM_ADDR', null),
'name' => env('MAIL_FROM_NAME', null)
],
/*
@ -76,8 +80,8 @@ return [
*/
'reply_to' => [
'address' => env('MAIL_REPLYTO_ADDR', env('MAIL_FROM_ADDR', null)),
'name' => env('MAIL_REPLYTO_NAME', env('MAIL_FROM_NAME', null))
'address' => env('MAIL_REPLYTO_ADDR',null),
'name' => env('MAIL_REPLYTO_NAME', null)
],
/*

View file

@ -194,7 +194,7 @@
<div id="mailteststatus-error" class="text-danger"></div>
</div>
<div class="col-md-9 col-md-offset-3">
<p class="help-block">This will attempt to send a test mail to {{ config('mail.from.address') }}.</p>
<p class="help-block">This will attempt to send a test mail to {{ config('mail.reply_to.address') }}.</p>
</div>
</div>