mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -08:00
Merge branch 'develop' of github.com:snipe/snipe-it into develop
This commit is contained in:
commit
ad531d6d59
|
@ -549,7 +549,7 @@ class AccessoriesController extends Controller
|
|||
**/
|
||||
public function getDatatable(Request $request)
|
||||
{
|
||||
$accessories = Accessory::select('accessories.*')->with('category', 'company')
|
||||
$accessories = Company::scopeCompanyables(Accessory::select('accessories.*')->with('category', 'company'))
|
||||
->whereNull('accessories.deleted_at');
|
||||
|
||||
if (Input::has('search')) {
|
||||
|
|
|
@ -1408,7 +1408,7 @@ class AssetsController extends Controller
|
|||
{
|
||||
|
||||
|
||||
$assets = Asset::select('assets.*')->with('model', 'assigneduser', 'assigneduser.userloc', 'assetstatus', 'defaultLoc', 'assetlog', 'model', 'model.category', 'model.manufacturer', 'model.fieldset', 'assetstatus', 'assetloc', 'company')
|
||||
$assets = Company::scopeCompanyables(Asset::select('assets.*'))->with('model', 'assigneduser', 'assigneduser.userloc', 'assetstatus', 'defaultLoc', 'assetlog', 'model', 'model.category', 'model.manufacturer', 'model.fieldset', 'assetstatus', 'assetloc', 'company')
|
||||
->Hardware();
|
||||
|
||||
if (Input::has('search')) {
|
||||
|
|
|
@ -410,8 +410,8 @@ class ComponentsController extends Controller
|
|||
**/
|
||||
public function getDatatable()
|
||||
{
|
||||
$components = Component::select('components.*')->whereNull('components.deleted_at')
|
||||
->with('company', 'location', 'category');
|
||||
$components = Company::scopeCompanyables(Component::select('components.*')->whereNull('components.deleted_at')
|
||||
->with('company', 'location', 'category'));
|
||||
|
||||
if (Input::has('search')) {
|
||||
$components = $components->TextSearch(Input::get('search'));
|
||||
|
|
|
@ -397,8 +397,8 @@ class ConsumablesController extends Controller
|
|||
*/
|
||||
public function getDatatable()
|
||||
{
|
||||
$consumables = Consumable::select('consumables.*')->whereNull('consumables.deleted_at')
|
||||
->with('company', 'location', 'category', 'users');
|
||||
$consumables = Company::scopeCompanyables(Consumable::select('consumables.*')->whereNull('consumables.deleted_at')
|
||||
->with('company', 'location', 'category', 'users'));
|
||||
|
||||
if (Input::has('search')) {
|
||||
$consumables = $consumables->TextSearch(e(Input::get('search')));
|
||||
|
|
|
@ -965,7 +965,7 @@ class LicensesController extends Controller
|
|||
*/
|
||||
public function getDatatable()
|
||||
{
|
||||
$licenses = License::with('company');
|
||||
$licenses = Company::scopeCompanyables(License::with('company'));
|
||||
|
||||
if (Input::has('search')) {
|
||||
$licenses = $licenses->TextSearch(Input::get('search'));
|
||||
|
|
|
@ -328,7 +328,7 @@ class Asset extends Depreciable
|
|||
public static function assetcount()
|
||||
{
|
||||
|
||||
return Asset::where('physical', '=', '1')
|
||||
return Company::scopeCompanyables(Asset::where('physical', '=', '1'))
|
||||
->whereNull('deleted_at', 'and')
|
||||
->count();
|
||||
}
|
||||
|
|
|
@ -55,11 +55,7 @@ final class Company extends Model
|
|||
$company_id = null;
|
||||
}
|
||||
|
||||
if ($company_id == null) {
|
||||
return $query;
|
||||
} else {
|
||||
return $query->where($column, '=', $company_id);
|
||||
}
|
||||
return $query->where($column, '=', $company_id);
|
||||
}
|
||||
|
||||
public static function getSelectList()
|
||||
|
@ -141,7 +137,7 @@ final class Company extends Model
|
|||
{
|
||||
if (count($companyable_names) == 0) {
|
||||
throw new Exception('No Companyable Children to scope');
|
||||
} elseif (!static::isFullMultipleCompanySupportEnabled()) {
|
||||
} elseif (!static::isFullMultipleCompanySupportEnabled() || (Auth::check() && Auth::user()->isSuperUser())) {
|
||||
return $query;
|
||||
} else {
|
||||
$f = function ($q) {
|
||||
|
|
Loading…
Reference in a new issue