Skip to content

Commit

Permalink
Select * because reasons
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Oct 22, 2015
1 parent 9c71d34 commit 1bdd588
Showing 1 changed file with 21 additions and 20 deletions.
41 changes: 21 additions & 20 deletions app/controllers/admin/AssetsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ public function getEdit($assetId = null)
$supplier_list = suppliersList();
$assigned_to = usersList();
$statuslabel_types = statusTypeList();

return View::make('backend/hardware/edit', compact('asset'))
->with('model_list',$model_list)
->with('supplier_list',$supplier_list)
Expand Down Expand Up @@ -1066,20 +1066,29 @@ public function postBulkSave($assets = null)
public function getDatatable($status = null)
{

if (Input::has('offset')) {
$offset = e(Input::get('offset'));
} else {
$offset = 0;
}

if (Input::has('limit')) {
$limit = e(Input::get('limit'));
} else {
$limit = 50;
}
$assets = Asset::with('model','assigneduser','assigneduser.userloc','assetstatus','defaultLoc','assetlog','model','model.category','assetstatus','assetloc')
->Hardware();

$assets = Asset::with('model','assigneduser','assigneduser.userloc','assetstatus','defaultLoc','assetlog','model','model.category','assetstatus','assetloc')->Hardware()->select(array('assets.id', 'assets.name','assets.model_id','assets.assigned_to','assets.asset_tag','assets.serial','assets.status_id','assets.purchase_date','assets.deleted_at','assets.rtd_location_id','assets.notes','assets.order_number'));
if (Input::has('search')) {
$assets = $assets->TextSearch(Input::get('search'));
}

if (Input::has('offset')) {
$offset = e(Input::get('offset'));
} else {
$offset = 0;
}

if (Input::has('limit')) {
$limit = e(Input::get('limit'));
} else {
$limit = 50;
}

if (Input::has('order_number')) {
$assets->where('order_number','=',e(Input::get('order_number')));
}

switch ($status) {
case 'Deleted':
Expand All @@ -1106,14 +1115,6 @@ public function getDatatable($status = null)

}

if (Input::has('order_number')) {
$assets->where('order_number','=',e(Input::get('order_number')));
}

if (Input::has('search')) {
$assets = $assets->TextSearch(Input::get('search'));
}

$allowed_columns = ['id','name','asset_tag','serial','model','checkout_date','category','notes'];
$order = Input::get('order') === 'asc' ? 'asc' : 'desc';
$sort = in_array(Input::get('sort'), $allowed_columns) ? Input::get('sort') : 'asset_tag';
Expand Down

0 comments on commit 1bdd588

Please sign in to comment.