Updated to use 5.2 trans() instead of Lang::get for localization

This commit is contained in:
snipe 2016-04-07 13:39:35 -07:00
parent a62859dc6d
commit bf728da39d
21 changed files with 501 additions and 449 deletions

View file

@ -101,7 +101,7 @@ class AccessoriesController extends Controller
// Was the accessory created?
if ($accessory->save()) {
// Redirect to the new accessory page
return Redirect::to("admin/accessories")->with('success', Lang::get('admin/accessories/message.create.success'));
return Redirect::to("admin/accessories")->with('success', trans('admin/accessories/message.create.success'));
}
@ -120,9 +120,9 @@ class AccessoriesController extends Controller
// Check if the accessory exists
if (is_null($accessory = Accessory::find($accessoryId))) {
// Redirect to the blogs management page
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.does_not_exist'));
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
}
$category_list = array('' => '') + DB::table('categories')->where('category_type', '=', 'accessory')->whereNull('deleted_at')->orderBy('name', 'ASC')->lists('name', 'id');
@ -148,9 +148,9 @@ class AccessoriesController extends Controller
// Check if the blog post exists
if (is_null($accessory = Accessory::find($accessoryId))) {
// Redirect to the blogs management page
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.does_not_exist'));
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
}
// Update the accessory data
@ -183,7 +183,7 @@ class AccessoriesController extends Controller
// Was the accessory created?
if ($accessory->save()) {
// Redirect to the new accessory page
return Redirect::to("admin/accessories")->with('success', Lang::get('admin/accessories/message.update.success'));
return Redirect::to("admin/accessories")->with('success', trans('admin/accessories/message.update.success'));
}
@ -203,19 +203,19 @@ class AccessoriesController extends Controller
// Check if the blog post exists
if (is_null($accessory = Accessory::find($accessoryId))) {
// Redirect to the blogs management page
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.not_found'));
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
}
if ($accessory->hasUsers() > 0) {
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.assoc_users', array('count'=> $accessory->hasUsers())));
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.assoc_users', array('count'=> $accessory->hasUsers())));
} else {
$accessory->delete();
// Redirect to the locations management page
return Redirect::to('admin/accessories')->with('success', Lang::get('admin/accessories/message.delete.success'));
return Redirect::to('admin/accessories')->with('success', trans('admin/accessories/message.delete.success'));
}
}
@ -239,13 +239,13 @@ class AccessoriesController extends Controller
if (isset($accessory->id)) {
if (!Company::isCurrentUserHasAccess($accessory)) {
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
} else {
return View::make('accessories/view', compact('accessory'));
}
} else {
// Prepare the error message
$error = Lang::get('admin/accessories/message.does_not_exist', compact('id'));
$error = trans('admin/accessories/message.does_not_exist', compact('id'));
// Redirect to the user management page
return Redirect::route('accessories')->with('error', $error);
@ -266,9 +266,9 @@ class AccessoriesController extends Controller
// Check if the accessory exists
if (is_null($accessory = Accessory::find($accessoryId))) {
// Redirect to the accessory management page with error
return Redirect::to('accessories')->with('error', Lang::get('admin/accessories/message.not_found'));
return Redirect::to('accessories')->with('error', trans('admin/accessories/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
}
// Get the dropdown of users and then pass it to the checkout view
@ -293,13 +293,13 @@ class AccessoriesController extends Controller
// Check if the accessory exists
if (is_null($accessory = Accessory::find($accessoryId))) {
// Redirect to the accessory management page with error
return Redirect::to('accessories')->with('error', Lang::get('admin/accessories/message.user_not_found'));
return Redirect::to('accessories')->with('error', trans('admin/accessories/message.user_not_found'));
} elseif (!Company::isCurrentUserHasAccess($accessory)) {
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
}
if (!$user = User::find(Input::get('assigned_to'))) {
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.not_found'));
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
}
// Update the accessory data
@ -380,7 +380,7 @@ class AccessoriesController extends Controller
}
// Redirect to the new accessory page
return Redirect::to("admin/accessories")->with('success', Lang::get('admin/accessories/message.checkout.success'));
return Redirect::to("admin/accessories")->with('success', trans('admin/accessories/message.checkout.success'));
@ -399,13 +399,13 @@ class AccessoriesController extends Controller
// Check if the accessory exists
if (is_null($accessory_user = DB::table('accessories_users')->find($accessoryUserId))) {
// Redirect to the accessory management page with error
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.not_found'));
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
}
$accessory = Accessory::find($accessory_user->accessory_id);
if (!Company::isCurrentUserHasAccess($accessory)) {
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
} else {
return View::make('accessories/checkin', compact('accessory'))->with('backto', $backto);
}
@ -425,14 +425,14 @@ class AccessoriesController extends Controller
// Check if the accessory exists
if (is_null($accessory_user = DB::table('accessories_users')->find($accessoryUserId))) {
// Redirect to the accessory management page with error
return Redirect::to('admin/accessories')->with('error', Lang::get('admin/accessories/message.not_found'));
return Redirect::to('admin/accessories')->with('error', trans('admin/accessories/message.not_found'));
}
$accessory = Accessory::find($accessory_user->accessory_id);
if (!Company::isCurrentUserHasAccess($accessory)) {
return Redirect::to('admin/accessories')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/accessories')->with('error', trans('general.insufficient_permissions'));
}
$logaction = new Actionlog();
@ -508,14 +508,14 @@ class AccessoriesController extends Controller
}
if ($backto=='user') {
return Redirect::to("admin/users/".$return_to.'/view')->with('success', Lang::get('admin/accessories/message.checkin.success'));
return Redirect::to("admin/users/".$return_to.'/view')->with('success', trans('admin/accessories/message.checkin.success'));
} else {
return Redirect::to("admin/accessories/".$accessory->id."/view")->with('success', Lang::get('admin/accessories/message.checkin.success'));
return Redirect::to("admin/accessories/".$accessory->id."/view")->with('success', trans('admin/accessories/message.checkin.success'));
}
}
// Redirect to the accessory management page with error
return Redirect::to("admin/accessories")->with('error', Lang::get('admin/accessories/message.checkin.error'));
return Redirect::to("admin/accessories")->with('error', trans('admin/accessories/message.checkin.error'));
}
/**
@ -589,7 +589,7 @@ class AccessoriesController extends Controller
$rows = array();
foreach ($accessories as $accessory) {
$actions = '<nobr><a href="'.route('checkout/accessory', $accessory->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($accessory->numRemaining() > 0 ) ? '' : ' disabled').'>'.Lang::get('general.checkout').'</a><a href="'.route('update/accessory', $accessory->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/accessory', $accessory->id).'" data-content="'.Lang::get('admin/accessories/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($accessory->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$actions = '<nobr><a href="'.route('checkout/accessory', $accessory->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($accessory->numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').'</a><a href="'.route('update/accessory', $accessory->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/accessory', $accessory->id).'" data-content="'.trans('admin/accessories/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($accessory->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$company = $accessory->company;
$rows[] = array(

View file

@ -42,7 +42,7 @@ class AssetMaintenancesController extends Controller
private static function getInsufficientPermissionsRedirect()
{
return redirect()->route('asset_maintenances')
->with('error', Lang::get('general.insufficient_permissions'));
->with('error', trans('general.insufficient_permissions'));
}
/**
@ -107,7 +107,7 @@ class AssetMaintenancesController extends Controller
foreach ($maintenances as $maintenance) {
$actions = '<nobr><a href="'.route('update/asset_maintenance', $maintenance->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/asset_maintenance', $maintenance->id).'" data-content="'.Lang::get('admin/asset_maintenances/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($maintenance->title).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$actions = '<nobr><a href="'.route('update/asset_maintenance', $maintenance->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/asset_maintenance', $maintenance->id).'" data-content="'.trans('admin/asset_maintenances/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($maintenance->title).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
if (($maintenance->cost) && ($maintenance->asset->assetloc) && ($maintenance->asset->assetloc->currency!='')) {
$maintenance_cost = $maintenance->asset->assetloc->currency.$maintenance->cost;
@ -273,7 +273,7 @@ class AssetMaintenancesController extends Controller
// Redirect to the new asset maintenance page
return Redirect::to("admin/asset_maintenances")
->with('success', Lang::get('admin/asset_maintenances/message.create.success'));
->with('success', trans('admin/asset_maintenances/message.create.success'));
}
return redirect()->back()->withInput()->withErrors($assetMaintenance->getErrors());
@ -299,7 +299,7 @@ class AssetMaintenancesController extends Controller
if (is_null($assetMaintenance = AssetMaintenance::find($assetMaintenanceId))) {
// Redirect to the improvement management page
return Redirect::to('admin/asset_maintenances')
->with('error', Lang::get('admin/asset_maintenances/message.not_found'));
->with('error', trans('admin/asset_maintenances/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($assetMaintenance->asset)) {
return static::getInsufficientPermissionsRedirect();
}
@ -382,7 +382,7 @@ class AssetMaintenancesController extends Controller
if (is_null($assetMaintenance = AssetMaintenance::find($assetMaintenanceId))) {
// Redirect to the asset maintenance management page
return Redirect::to('admin/asset_maintenances')
->with('error', Lang::get('admin/asset_maintenances/message.not_found'));
->with('error', trans('admin/asset_maintenances/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($assetMaintenance->asset)) {
return static::getInsufficientPermissionsRedirect();
}
@ -452,7 +452,7 @@ class AssetMaintenancesController extends Controller
// Redirect to the new asset maintenance page
return Redirect::to("admin/asset_maintenances")
->with('success', Lang::get('admin/asset_maintenances/message.create.success'));
->with('success', trans('admin/asset_maintenances/message.create.success'));
}
return Redirect::back() ->withInput()->withErrors($assetMaintenance->getErrors());
@ -474,7 +474,7 @@ class AssetMaintenancesController extends Controller
if (is_null($assetMaintenance = AssetMaintenance::find($assetMaintenanceId))) {
// Redirect to the asset maintenance management page
return Redirect::to('admin/asset_maintenances')
->with('error', Lang::get('admin/asset_maintenances/message.not_found'));
->with('error', trans('admin/asset_maintenances/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($assetMaintenance->asset)) {
return static::getInsufficientPermissionsRedirect();
}
@ -484,7 +484,7 @@ class AssetMaintenancesController extends Controller
// Redirect to the asset_maintenance management page
return Redirect::to('admin/asset_maintenances')
->with('success', Lang::get('admin/asset_maintenances/message.delete.success'));
->with('success', trans('admin/asset_maintenances/message.delete.success'));
}
/**
@ -502,7 +502,7 @@ class AssetMaintenancesController extends Controller
if (is_null($assetMaintenance = AssetMaintenance::find($assetMaintenanceId))) {
// Redirect to the asset maintenance management page
return Redirect::to('admin/asset_maintenances')
->with('error', Lang::get('admin/asset_maintenances/message.not_found'));
->with('error', trans('admin/asset_maintenances/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($assetMaintenance->asset)) {
return static::getInsufficientPermissionsRedirect();
}

View file

@ -120,7 +120,7 @@ class AssetModelsController extends Controller
// Was it created?
if ($model->save()) {
// Redirect to the new model page
return Redirect::to("hardware/models")->with('success', Lang::get('admin/models/message.create.success'));
return Redirect::to("hardware/models")->with('success', trans('admin/models/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($model->getErrors());
@ -174,7 +174,7 @@ class AssetModelsController extends Controller
// Check if the model exists
if (is_null($model = AssetModel::find($modelId))) {
// Redirect to the model management page
return Redirect::to('assets/models')->with('error', Lang::get('admin/models/message.does_not_exist'));
return Redirect::to('assets/models')->with('error', trans('admin/models/message.does_not_exist'));
}
$depreciation_list = \App\Helpers\Helper::depreciationList();
@ -202,7 +202,7 @@ class AssetModelsController extends Controller
// Check if the model exists
if (is_null($model = AssetModel::find($modelId))) {
// Redirect to the models management page
return Redirect::to('admin/models')->with('error', Lang::get('admin/models/message.does_not_exist'));
return Redirect::to('admin/models')->with('error', trans('admin/models/message.does_not_exist'));
}
@ -248,14 +248,14 @@ class AssetModelsController extends Controller
// Was it created?
if ($model->save()) {
// Redirect to the new model page
return Redirect::to("hardware/models")->with('success', Lang::get('admin/models/message.update.success'));
return Redirect::to("hardware/models")->with('success', trans('admin/models/message.update.success'));
} else {
return redirect()->back()->withInput()->withErrors($model->getErrors());
}
// Redirect to the model create page
return Redirect::to("hardware/models/$modelId/edit")->with('error', Lang::get('admin/models/message.update.error'));
return Redirect::to("hardware/models/$modelId/edit")->with('error', trans('admin/models/message.update.error'));
}
@ -273,19 +273,19 @@ class AssetModelsController extends Controller
// Check if the model exists
if (is_null($model = AssetModel::find($modelId))) {
// Redirect to the blogs management page
return Redirect::to('hardware/models')->with('error', Lang::get('admin/models/message.not_found'));
return Redirect::to('hardware/models')->with('error', trans('admin/models/message.not_found'));
}
if ($model->assets->count() > 0) {
// Throw an error that this model is associated with assets
return Redirect::to('hardware/models')->with('error', Lang::get('admin/models/message.assoc_users'));
return Redirect::to('hardware/models')->with('error', trans('admin/models/message.assoc_users'));
} else {
// Delete the model
$model->delete();
// Redirect to the models management page
return Redirect::to('hardware/models')->with('success', Lang::get('admin/models/message.delete.success'));
return Redirect::to('hardware/models')->with('success', trans('admin/models/message.delete.success'));
}
}
@ -310,13 +310,13 @@ class AssetModelsController extends Controller
$model->restore();
// Prepare the success message
$success = Lang::get('admin/models/message.restore.success');
$success = trans('admin/models/message.restore.success');
// Redirect back
return Redirect::back()->with('success', $success);
} else {
return Redirect::back()->with('error', Lang::get('admin/models/message.not_found'));
return Redirect::back()->with('error', trans('admin/models/message.not_found'));
}
}
@ -338,7 +338,7 @@ class AssetModelsController extends Controller
return View::make('models/view', compact('model'));
} else {
// Prepare the error message
$error = Lang::get('admin/models/message.does_not_exist', compact('id'));
$error = trans('admin/models/message.does_not_exist', compact('id'));
// Redirect to the user management page
return Redirect::route('models')->with('error', $error);
@ -360,7 +360,7 @@ class AssetModelsController extends Controller
// Check if the model exists
if (is_null($model_to_clone = AssetModel::find($modelId))) {
// Redirect to the model management page
return Redirect::to('assets/models')->with('error', Lang::get('admin/models/message.does_not_exist'));
return Redirect::to('assets/models')->with('error', trans('admin/models/message.does_not_exist'));
}
$model = clone $model_to_clone;
@ -448,7 +448,7 @@ class AssetModelsController extends Controller
foreach ($models as $model) {
if ($model->deleted_at == '') {
$actions = '<div style=" white-space: nowrap;"><a href="'.route('update/model', $model->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/model', $model->id).'" data-content="'.Lang::get('admin/models/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($model->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
$actions = '<div style=" white-space: nowrap;"><a href="'.route('update/model', $model->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/model', $model->id).'" data-content="'.trans('admin/models/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($model->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
} else {
$actions = '<a href="'.route('restore/model', $model->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
}
@ -460,9 +460,9 @@ class AssetModelsController extends Controller
'image' => ($model->image!='') ? '<img src="'.config('app.url').'/uploads/models/'.$model->image.'" height=50 width=50>' : '',
'modelnumber' => $model->modelno,
'numassets' => $model->assets->count(),
'depreciation' => (($model->depreciation)&&($model->depreciation->id > 0)) ? $model->depreciation->name.' ('.$model->depreciation->months.')' : Lang::get('general.no_depreciation'),
'depreciation' => (($model->depreciation)&&($model->depreciation->id > 0)) ? $model->depreciation->name.' ('.$model->depreciation->months.')' : trans('general.no_depreciation'),
'category' => ($model->category) ? $model->category->name : '',
'eol' => ($model->eol) ? $model->eol.' '.Lang::get('general.months') : '',
'eol' => ($model->eol) ? $model->eol.' '.trans('general.months') : '',
'note' => $model->getNote(),
'actions' => $actions
);
@ -521,9 +521,9 @@ class AssetModelsController extends Controller
if ($asset->assetstatus) {
if ($asset->assetstatus->deployable != 0) {
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
$actions = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.Lang::get('general.checkin').'</a>';
$actions = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
} else {
$actions = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.Lang::get('general.checkout').'</a>';
$actions = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
}
}
}

View file

@ -214,7 +214,7 @@ class AssetsController extends Controller
$log = $logaction->logaction('checkout');
}
// Redirect to the asset listing page
return Redirect::to("hardware")->with('success', Lang::get('admin/hardware/message.create.success'));
return Redirect::to("hardware")->with('success', trans('admin/hardware/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($asset->getErrors());
@ -234,9 +234,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
// Grab the dropdown lists
@ -276,9 +276,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page with error
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
// $input=Input::all();
@ -381,7 +381,7 @@ class AssetsController extends Controller
// Was the asset updated?
if ($asset->save()) {
// Redirect to the new asset page
return Redirect::to("hardware/$assetId/view")->with('success', Lang::get('admin/hardware/message.update.success'));
return Redirect::to("hardware/$assetId/view")->with('success', trans('admin/hardware/message.update.success'));
}
return Redirect::back()->withInput()->withErrors($asset->getErrors());
@ -401,9 +401,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page with error
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
DB::table('assets')
@ -414,7 +414,7 @@ class AssetsController extends Controller
$asset->delete();
// Redirect to the asset management page
return Redirect::to('hardware')->with('success', Lang::get('admin/hardware/message.delete.success'));
return Redirect::to('hardware')->with('success', trans('admin/hardware/message.delete.success'));
@ -435,9 +435,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset = Asset::find(e($assetId)))) {
// Redirect to the asset management page with error
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
// Get the dropdown of users and then pass it to the checkout view
@ -460,9 +460,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (!$asset = Asset::find($assetId)) {
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
$user = User::find(e(Input::get('assigned_to')));
@ -485,11 +485,11 @@ class AssetsController extends Controller
if ($asset->checkOutToUser($user, $admin, $checkout_at, $expected_checkin, e(Input::get('note')), e(Input::get('name')))) {
// Redirect to the new asset page
return Redirect::to("hardware")->with('success', Lang::get('admin/hardware/message.checkout.success'));
return Redirect::to("hardware")->with('success', trans('admin/hardware/message.checkout.success'));
}
// Redirect to the asset management page with error
return Redirect::to("hardware/$assetId/checkout")->with('error', Lang::get('admin/hardware/message.checkout.error'))->withErrors($asset->getErrors());
return Redirect::to("hardware/$assetId/checkout")->with('error', trans('admin/hardware/message.checkout.error'))->withErrors($asset->getErrors());
}
@ -507,9 +507,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page with error
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
$statusLabel_list = Helper::statusLabelList();
return View::make('hardware/checkin', compact('asset'))->with('statusLabel_list', $statusLabel_list)->with('backto', $backto);
@ -529,9 +529,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset = Asset::find($assetId))) {
// Redirect to the asset management page with error
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
// Check for a valid user to checkout fa-random
@ -539,7 +539,7 @@ class AssetsController extends Controller
if (!is_null($asset->assigned_to)) {
$user = User::find($asset->assigned_to);
} else {
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.checkin.already_checked_in'));
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.checkin.already_checked_in'));
}
// This is just used for the redirect
@ -626,15 +626,15 @@ class AssetsController extends Controller
}
if ($backto=='user') {
return Redirect::to("admin/users/".$return_to.'/view')->with('success', Lang::get('admin/hardware/message.checkin.success'));
return Redirect::to("admin/users/".$return_to.'/view')->with('success', trans('admin/hardware/message.checkin.success'));
} else {
return Redirect::to("hardware")->with('success', Lang::get('admin/hardware/message.checkin.success'));
return Redirect::to("hardware")->with('success', trans('admin/hardware/message.checkin.success'));
}
}
// Redirect to the asset management page with error
return Redirect::to("hardware")->with('error', Lang::get('admin/hardware/message.checkin.error'));
return Redirect::to("hardware")->with('error', trans('admin/hardware/message.checkin.error'));
}
@ -652,7 +652,7 @@ class AssetsController extends Controller
$settings = Setting::getSettings();
if (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
} elseif ($asset->userloc) {
$use_currency = $asset->userloc->currency;
} elseif ($asset->assetloc) {
@ -663,7 +663,7 @@ class AssetsController extends Controller
if ($settings->default_currency!='') {
$use_currency = $settings->default_currency;
} else {
$use_currency = Lang::get('general.currency');
$use_currency = trans('general.currency');
}
}
@ -680,7 +680,7 @@ class AssetsController extends Controller
return View::make('hardware/view', compact('asset', 'qr_code', 'settings'))->with('use_currency', $use_currency);
} else {
// Prepare the error message
$error = Lang::get('admin/hardware/message.does_not_exist', compact('id'));
$error = trans('admin/hardware/message.does_not_exist', compact('id'));
// Redirect to the user management page
return Redirect::route('hardware')->with('error', $error);
@ -705,7 +705,7 @@ class AssetsController extends Controller
$size = Helper::barcodeDimensions($settings->barcode_type);
if (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
if (isset($asset->id,$asset->asset_tag)) {
@ -733,7 +733,7 @@ class AssetsController extends Controller
$files = array();
if (!Company::isCurrentUserAuthorized()) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
if ($handle = opendir($path)) {
@ -770,7 +770,7 @@ class AssetsController extends Controller
{
if (!Company::isCurrentUserAuthorized()) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
} elseif (!config('app.lock_passwords')) {
@ -807,7 +807,7 @@ class AssetsController extends Controller
} else {
$results['error']=Lang::get('general.feature_disabled');
$results['error']=trans('general.feature_disabled');
return $results;
}
@ -829,7 +829,7 @@ class AssetsController extends Controller
// php artisan asset-import:csv path/to/your/file.csv --domain=yourdomain.com --email_format=firstname.lastname
if (!Company::isCurrentUserAuthorized()) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
$output = new BufferedOutput;
@ -856,9 +856,9 @@ class AssetsController extends Controller
// Check if the asset exists
if (is_null($asset_to_clone = Asset::find($assetId))) {
// Redirect to the asset management page
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($asset_to_clone)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
// Grab the dropdown lists
@ -908,20 +908,20 @@ class AssetsController extends Controller
$asset = Asset::withTrashed()->find($assetId);
if (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
} elseif (isset($asset->id)) {
// Restore the user
$asset->restore();
// Prepare the success message
$success = Lang::get('admin/hardware/message.restore.success');
$success = trans('admin/hardware/message.restore.success');
// Redirect to the user management page
return Redirect::route('hardware')->with('success', $success);
} else {
return Redirect::to('hardware')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('hardware')->with('error', trans('admin/hardware/message.does_not_exist'));
}
}
@ -947,7 +947,7 @@ class AssetsController extends Controller
if (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
if (Input::hasFile('assetfile')) {
@ -970,13 +970,13 @@ class AssetsController extends Controller
$log = $logaction->logaction('uploaded');
}
} else {
return Redirect::back()->with('error', Lang::get('admin/hardware/message.upload.nofiles'));
return Redirect::back()->with('error', trans('admin/hardware/message.upload.nofiles'));
}
if ($upload_success) {
return Redirect::back()->with('success', Lang::get('admin/hardware/message.upload.success'));
return Redirect::back()->with('success', trans('admin/hardware/message.upload.success'));
} else {
return Redirect::back()->with('error', Lang::get('admin/hardware/message.upload.error'));
return Redirect::back()->with('error', trans('admin/hardware/message.upload.error'));
}
@ -1002,7 +1002,7 @@ class AssetsController extends Controller
if (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
$log = Actionlog::find($fileId);
@ -1011,11 +1011,11 @@ class AssetsController extends Controller
unlink($destinationPath.'/'.$log->filename);
}
$log->delete();
return Redirect::back()->with('success', Lang::get('admin/hardware/message.deletefile.success'));
return Redirect::back()->with('success', trans('admin/hardware/message.deletefile.success'));
} else {
// Prepare the error message
$error = Lang::get('admin/hardware/message.does_not_exist', compact('id'));
$error = trans('admin/hardware/message.does_not_exist', compact('id'));
// Redirect to the hardware management page
return Redirect::route('hardware')->with('error', $error);
@ -1043,7 +1043,7 @@ class AssetsController extends Controller
if (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
}
$log = Actionlog::find($fileId);
@ -1060,7 +1060,7 @@ class AssetsController extends Controller
} else {
// Prepare the error message
$error = Lang::get('admin/hardware/message.does_not_exist', compact('id'));
$error = trans('admin/hardware/message.does_not_exist', compact('id'));
// Redirect to the hardware management page
return Redirect::route('hardware')->with('error', $error);
@ -1082,7 +1082,7 @@ class AssetsController extends Controller
{
if (!Company::isCurrentUserAuthorized()) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
} elseif (!Input::has('edit_asset')) {
return Redirect::back()->with('error', 'No assets selected');
@ -1131,7 +1131,7 @@ class AssetsController extends Controller
$statuslabel_list = Helper::statusLabelList();
$location_list = Helper::locationsList();
$models_list = Helper::modelList();
$companies_list = array('' => '') + array('clear' => Lang::get('general.remove_company')) + Helper::companyList();
$companies_list = array('' => '') + array('clear' => trans('general.remove_company')) + Helper::companyList();
return View::make('hardware/bulk')
->with('assets', $assets)
@ -1166,7 +1166,7 @@ class AssetsController extends Controller
{
if (!Company::isCurrentUserAuthorized()) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
} elseif (Input::has('bulk_edit')) {
@ -1243,11 +1243,11 @@ class AssetsController extends Controller
} // endforeach
return Redirect::to("hardware")->with('success', Lang::get('admin/hardware/message.update.success'));
return Redirect::to("hardware")->with('success', trans('admin/hardware/message.update.success'));
// no values given, nothing to update
} else {
return Redirect::to("hardware")->with('info', Lang::get('admin/hardware/message.update.nothing_updated'));
return Redirect::to("hardware")->with('info', trans('admin/hardware/message.update.nothing_updated'));
}
@ -1270,7 +1270,7 @@ class AssetsController extends Controller
{
if (!Company::isCurrentUserAuthorized()) {
return Redirect::to('hardware')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('hardware')->with('error', trans('general.insufficient_permissions'));
} elseif (Input::has('bulk_edit')) {
//$assets = Input::get('bulk_edit');
$assets = Asset::find(Input::get('bulk_edit'));
@ -1296,11 +1296,11 @@ class AssetsController extends Controller
}
} // endforeach
return Redirect::to("hardware")->with('success', Lang::get('admin/hardware/message.delete.success'));
return Redirect::to("hardware")->with('success', trans('admin/hardware/message.delete.success'));
// no values given, nothing to update
} else {
return Redirect::to("hardware")->with('info', Lang::get('admin/hardware/message.delete.nothing_updated'));
return Redirect::to("hardware")->with('info', trans('admin/hardware/message.delete.nothing_updated'));
}
@ -1431,7 +1431,7 @@ class AssetsController extends Controller
$inout = '';
$actions = '';
if ($asset->deleted_at=='') {
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset" data-toggle="tooltip"><i class="fa fa-clone"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm" title="Edit asset" data-toggle="tooltip"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.Lang::get('admin/hardware/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset" data-toggle="tooltip"><i class="fa fa-clone"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm" title="Edit asset" data-toggle="tooltip"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
} elseif ($asset->model->deleted_at=='') {
$actions = '<a href="'.route('restore/hardware', $asset->id).'" title="Restore asset" data-toggle="tooltip" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
}
@ -1439,9 +1439,9 @@ class AssetsController extends Controller
if ($asset->assetstatus) {
if ($asset->assetstatus->deployable != 0) {
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">'.Lang::get('general.checkin').'</a>';
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm" title="Checkin this asset" data-toggle="tooltip">'.trans('general.checkin').'</a>';
} else {
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">'.Lang::get('general.checkout').'</a>';
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Checkout this asset to a user" data-toggle="tooltip">'.trans('general.checkout').'</a>';
}
}
}

View file

@ -81,7 +81,7 @@ class CategoriesController extends Controller
if ($category->save()) {
// Redirect to the new category page
return Redirect::to("admin/settings/categories")->with('success', Lang::get('admin/categories/message.create.success'));
return Redirect::to("admin/settings/categories")->with('success', trans('admin/categories/message.create.success'));
} else {
// The given data did not pass validation
@ -90,7 +90,7 @@ class CategoriesController extends Controller
}
// Redirect to the category create page
return Redirect::to('admin/settings/categories/create')->with('error', Lang::get('admin/categories/message.create.error'));
return Redirect::to('admin/settings/categories/create')->with('error', trans('admin/categories/message.create.error'));
}
@ -109,7 +109,7 @@ class CategoriesController extends Controller
// Check if the category exists
if (is_null($category = Category::find($categoryId))) {
// Redirect to the blogs management page
return Redirect::to('admin/settings/categories')->with('error', Lang::get('admin/categories/message.does_not_exist'));
return Redirect::to('admin/settings/categories')->with('error', trans('admin/categories/message.does_not_exist'));
}
// Show the page
@ -138,7 +138,7 @@ class CategoriesController extends Controller
// Check if the blog post exists
if (is_null($category = Category::find($categoryId))) {
// Redirect to the blogs management page
return Redirect::to('admin/categories')->with('error', Lang::get('admin/categories/message.does_not_exist'));
return Redirect::to('admin/categories')->with('error', trans('admin/categories/message.does_not_exist'));
}
// Update the category data
@ -151,7 +151,7 @@ class CategoriesController extends Controller
if ($category->save()) {
// Redirect to the new category page
return Redirect::to("admin/settings/categories")->with('success', Lang::get('admin/categories/message.update.success'));
return Redirect::to("admin/settings/categories")->with('success', trans('admin/categories/message.update.success'));
} // attempt validation
else {
// The given data did not pass validation
@ -159,7 +159,7 @@ class CategoriesController extends Controller
}
// Redirect to the category management page
return Redirect::back()->with('error', Lang::get('admin/categories/message.update.error'));
return Redirect::back()->with('error', trans('admin/categories/message.update.error'));
}
@ -176,20 +176,20 @@ class CategoriesController extends Controller
// Check if the category exists
if (is_null($category = Category::find($categoryId))) {
// Redirect to the blogs management page
return Redirect::to('admin/settings/categories')->with('error', Lang::get('admin/categories/message.not_found'));
return Redirect::to('admin/settings/categories')->with('error', trans('admin/categories/message.not_found'));
}
if ($category->has_models() > 0) {
// Redirect to the asset management page
return Redirect::to('admin/settings/categories')->with('error', Lang::get('admin/categories/message.assoc_users'));
return Redirect::to('admin/settings/categories')->with('error', trans('admin/categories/message.assoc_users'));
} else {
$category->delete();
// Redirect to the locations management page
return Redirect::to('admin/settings/categories')->with('success', Lang::get('admin/categories/message.delete.success'));
return Redirect::to('admin/settings/categories')->with('success', trans('admin/categories/message.delete.success'));
}
@ -215,7 +215,7 @@ class CategoriesController extends Controller
return View::make('categories/view', compact('category'));
} else {
// Prepare the error message
$error = Lang::get('admin/categories/message.does_not_exist', compact('id'));
$error = trans('admin/categories/message.does_not_exist', compact('id'));
// Redirect to the user management page
return Redirect::route('categories')->with('error', $error);
@ -267,7 +267,7 @@ class CategoriesController extends Controller
$rows = array();
foreach ($categories as $category) {
$actions = '<a href="'.route('update/category', $category->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/category', $category->id).'" data-content="'.Lang::get('admin/categories/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($category->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$actions = '<a href="'.route('update/category', $category->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/category', $category->id).'" data-content="'.trans('admin/categories/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($category->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$rows[] = array(
'id' => $category->id,
'name' => (string)link_to('/admin/settings/categories/'.$category->id.'/view', $category->name) ,
@ -340,7 +340,7 @@ class CategoriesController extends Controller
$inout='';
if ($asset->deleted_at=='') {
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.Lang::get('admin/hardware/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
} elseif ($asset->deleted_at!='') {
$actions = '<a href="'.route('restore/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
}
@ -348,9 +348,9 @@ class CategoriesController extends Controller
if ($asset->assetstatus) {
if ($asset->assetstatus->deployable != 0) {
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.Lang::get('general.checkin').'</a>';
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
} else {
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.Lang::get('general.checkout').'</a>';
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
}
}
}

View file

@ -56,7 +56,7 @@ final class CompaniesController extends Controller
if ($company->save()) {
return Redirect::to('admin/settings/companies')
->with('success', Lang::get('admin/companies/message.create.success'));
->with('success', trans('admin/companies/message.create.success'));
} else {
return Redirect::back()->withInput()->withErrors($company->getErrors());
}
@ -76,7 +76,7 @@ final class CompaniesController extends Controller
{
if (is_null($company = Company::find($companyId))) {
return Redirect::to('admin/settings/companies')
->with('error', Lang::get('admin/companies/message.does_not_exist'));
->with('error', trans('admin/companies/message.does_not_exist'));
} else {
return View::make('companies/edit')->with('company', $company);
}
@ -93,7 +93,7 @@ final class CompaniesController extends Controller
public function postEdit($companyId)
{
if (is_null($company = Company::find($companyId))) {
return Redirect::to('admin/settings/companies')->with('error', Lang::get('admin/companies/message.does_not_exist'));
return Redirect::to('admin/settings/companies')->with('error', trans('admin/companies/message.does_not_exist'));
} else {
@ -101,10 +101,10 @@ final class CompaniesController extends Controller
if ($company->save()) {
return Redirect::to('admin/settings/companies')
->with('success', Lang::get('admin/companies/message.update.success'));
->with('success', trans('admin/companies/message.update.success'));
} else {
return Redirect::to("admin/settings/companies/$companyId/edit")
->with('error', Lang::get('admin/companies/message.update.error'));
->with('error', trans('admin/companies/message.update.error'));
}
}
@ -122,12 +122,12 @@ final class CompaniesController extends Controller
{
if (is_null($company = Company::find($companyId))) {
return Redirect::to('admin/settings/companies')
->with('error', Lang::get('admin/companies/message.not_found'));
->with('error', trans('admin/companies/message.not_found'));
} else {
try {
$company->delete();
return Redirect::to('admin/settings/companies')
->with('success', Lang::get('admin/companies/message.delete.success'));
->with('success', trans('admin/companies/message.delete.success'));
} catch (\Illuminate\Database\QueryException $exception) {
/*
* NOTE: This happens when there's a foreign key constraint violation
@ -135,7 +135,7 @@ final class CompaniesController extends Controller
*/
if ($exception->getCode() == 23000) {
return Redirect::to('admin/settings/companies')
->with('error', Lang::get('admin/companies/message.assoc_users'));
->with('error', trans('admin/companies/message.assoc_users'));
} else {
throw $exception;
}

View file

@ -106,7 +106,7 @@ class ComponentsController extends Controller
// Was the component created?
if ($component->save()) {
// Redirect to the new component page
return Redirect::to("admin/components")->with('success', Lang::get('admin/components/message.create.success'));
return Redirect::to("admin/components")->with('success', trans('admin/components/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($component->getErrors());
@ -128,9 +128,9 @@ class ComponentsController extends Controller
// Check if the component exists
if (is_null($component = Component::find($componentId))) {
// Redirect to the blogs management page
return Redirect::to('admin/components')->with('error', Lang::get('admin/components/message.does_not_exist'));
return Redirect::to('admin/components')->with('error', trans('admin/components/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($component)) {
return Redirect::to('admin/components')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
}
$category_list = Helper::categoryList();
@ -158,9 +158,9 @@ class ComponentsController extends Controller
// Check if the blog post exists
if (is_null($component = Component::find($componentId))) {
// Redirect to the blogs management page
return Redirect::to('admin/components')->with('error', Lang::get('admin/components/message.does_not_exist'));
return Redirect::to('admin/components')->with('error', trans('admin/components/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($component)) {
return Redirect::to('admin/components')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
}
@ -189,7 +189,7 @@ class ComponentsController extends Controller
// Was the component created?
if ($component->save()) {
// Redirect to the new component page
return Redirect::to("admin/components")->with('success', Lang::get('admin/components/message.update.success'));
return Redirect::to("admin/components")->with('success', trans('admin/components/message.update.success'));
}
return Redirect::back()->withInput()->withErrors($component->getErrors());
@ -212,15 +212,15 @@ class ComponentsController extends Controller
// Check if the blog post exists
if (is_null($component = Component::find($componentId))) {
// Redirect to the blogs management page
return Redirect::to('admin/components')->with('error', Lang::get('admin/components/message.not_found'));
return Redirect::to('admin/components')->with('error', trans('admin/components/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($component)) {
return Redirect::to('admin/components')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
}
$component->delete();
// Redirect to the locations management page
return Redirect::to('admin/components')->with('success', Lang::get('admin/components/message.delete.success'));
return Redirect::to('admin/components')->with('success', trans('admin/components/message.delete.success'));
}
@ -252,13 +252,13 @@ class ComponentsController extends Controller
if (!Company::isCurrentUserHasAccess($component)) {
return Redirect::to('admin/components')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
} else {
return View::make('components/view', compact('component'));
}
} else {
// Prepare the error message
$error = Lang::get('admin/components/message.does_not_exist', compact('id'));
$error = trans('admin/components/message.does_not_exist', compact('id'));
// Redirect to the user management page
return Redirect::route('components')->with('error', $error);
@ -281,9 +281,9 @@ class ComponentsController extends Controller
// Check if the component exists
if (is_null($component = Component::find($componentId))) {
// Redirect to the component management page with error
return Redirect::to('components')->with('error', Lang::get('admin/components/message.not_found'));
return Redirect::to('components')->with('error', trans('admin/components/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($component)) {
return Redirect::to('admin/components')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
}
// Get the dropdown of assets and then pass it to the checkout view
@ -307,9 +307,9 @@ class ComponentsController extends Controller
// Check if the component exists
if (is_null($component = Component::find($componentId))) {
// Redirect to the component management page with error
return Redirect::to('components')->with('error', Lang::get('admin/components/message.not_found'));
return Redirect::to('components')->with('error', trans('admin/components/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($component)) {
return Redirect::to('admin/components')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/components')->with('error', trans('general.insufficient_permissions'));
}
$admin_user = Auth::user();
@ -318,7 +318,7 @@ class ComponentsController extends Controller
// Check if the user exists
if (is_null($asset = Asset::find($asset_id))) {
// Redirect to the component management page with error
return Redirect::to('admin/components')->with('error', Lang::get('admin/components/message.asset_does_not_exist'));
return Redirect::to('admin/components')->with('error', trans('admin/components/message.asset_does_not_exist'));
}
// Update the component data
@ -375,7 +375,7 @@ class ComponentsController extends Controller
$log = $logaction->logaction('checkout');
// Redirect to the new component page
return Redirect::to("admin/components")->with('success', Lang::get('admin/components/message.checkout.success'));
return Redirect::to("admin/components")->with('success', trans('admin/components/message.checkout.success'));
@ -437,7 +437,7 @@ class ComponentsController extends Controller
$rows = array();
foreach ($components as $component) {
$actions = '<nobr><a href="'.route('checkout/component', $component->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($component->numRemaining() > 0 ) ? '' : ' disabled').'>'.Lang::get('general.checkout').'</a><a href="'.route('update/component', $component->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/component', $component->id).'" data-content="'.Lang::get('admin/components/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($component->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$actions = '<nobr><a href="'.route('checkout/component', $component->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($component->numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').'</a><a href="'.route('update/component', $component->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/component', $component->id).'" data-content="'.trans('admin/components/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($component->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$company = $component->company;
$rows[] = array(

View file

@ -100,7 +100,7 @@ class ConsumablesController extends Controller
// Was the consumable created?
if ($consumable->save()) {
// Redirect to the new consumable page
return Redirect::to("admin/consumables")->with('success', Lang::get('admin/consumables/message.create.success'));
return Redirect::to("admin/consumables")->with('success', trans('admin/consumables/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($consumable->getErrors());
@ -122,9 +122,9 @@ class ConsumablesController extends Controller
// Check if the consumable exists
if (is_null($consumable = Consumable::find($consumableId))) {
// Redirect to the blogs management page
return Redirect::to('admin/consumables')->with('error', Lang::get('admin/consumables/message.does_not_exist'));
return Redirect::to('admin/consumables')->with('error', trans('admin/consumables/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
}
$category_list = Helper::categoryList();
@ -150,9 +150,9 @@ class ConsumablesController extends Controller
public function postEdit($consumableId = null)
{
if (is_null($consumable = Consumable::find($consumableId))) {
return Redirect::to('admin/consumables')->with('error', Lang::get('admin/consumables/message.does_not_exist'));
return Redirect::to('admin/consumables')->with('error', trans('admin/consumables/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
}
$consumable->name = e(Input::get('name'));
@ -177,7 +177,7 @@ class ConsumablesController extends Controller
$consumable->qty = e(Input::get('qty'));
if ($consumable->save()) {
return Redirect::to("admin/consumables")->with('success', Lang::get('admin/consumables/message.update.success'));
return Redirect::to("admin/consumables")->with('success', trans('admin/consumables/message.update.success'));
}
return Redirect::back()->withInput()->withErrors($consumable->getErrors());
@ -197,15 +197,15 @@ class ConsumablesController extends Controller
// Check if the blog post exists
if (is_null($consumable = Consumable::find($consumableId))) {
// Redirect to the blogs management page
return Redirect::to('admin/consumables')->with('error', Lang::get('admin/consumables/message.not_found'));
return Redirect::to('admin/consumables')->with('error', trans('admin/consumables/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
}
$consumable->delete();
// Redirect to the locations management page
return Redirect::to('admin/consumables')->with('success', Lang::get('admin/consumables/message.delete.success'));
return Redirect::to('admin/consumables')->with('success', trans('admin/consumables/message.delete.success'));
}
@ -228,13 +228,13 @@ class ConsumablesController extends Controller
if (!Company::isCurrentUserHasAccess($consumable)) {
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
} else {
return View::make('consumables/view', compact('consumable'));
}
} else {
// Prepare the error message
$error = Lang::get('admin/consumables/message.does_not_exist', compact('id'));
$error = trans('admin/consumables/message.does_not_exist', compact('id'));
// Redirect to the user management page
return Redirect::route('consumables')->with('error', $error);
@ -257,9 +257,9 @@ class ConsumablesController extends Controller
// Check if the consumable exists
if (is_null($consumable = Consumable::find($consumableId))) {
// Redirect to the consumable management page with error
return Redirect::to('consumables')->with('error', Lang::get('admin/consumables/message.not_found'));
return Redirect::to('consumables')->with('error', trans('admin/consumables/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
}
// Get the dropdown of users and then pass it to the checkout view
@ -283,9 +283,9 @@ class ConsumablesController extends Controller
// Check if the consumable exists
if (is_null($consumable = Consumable::find($consumableId))) {
// Redirect to the consumable management page with error
return Redirect::to('consumables')->with('error', Lang::get('admin/consumables/message.not_found'));
return Redirect::to('consumables')->with('error', trans('admin/consumables/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($consumable)) {
return Redirect::to('admin/consumables')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/consumables')->with('error', trans('general.insufficient_permissions'));
}
$admin_user = Auth::user();
@ -294,7 +294,7 @@ class ConsumablesController extends Controller
// Check if the user exists
if (is_null($user = User::find($assigned_to))) {
// Redirect to the consumable management page with error
return Redirect::to('admin/consumables')->with('error', Lang::get('admin/consumables/message.user_does_not_exist'));
return Redirect::to('admin/consumables')->with('error', trans('admin/consumables/message.user_does_not_exist'));
}
// Update the consumable data
@ -370,7 +370,7 @@ class ConsumablesController extends Controller
}
// Redirect to the new consumable page
return Redirect::to("admin/consumables")->with('success', Lang::get('admin/consumables/message.checkout.success'));
return Redirect::to("admin/consumables")->with('success', trans('admin/consumables/message.checkout.success'));
@ -432,7 +432,7 @@ class ConsumablesController extends Controller
$rows = array();
foreach ($consumables as $consumable) {
$actions = '<nobr><a href="'.route('checkout/consumable', $consumable->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($consumable->numRemaining() > 0 ) ? '' : ' disabled').'>'.Lang::get('general.checkout').'</a><a href="'.route('update/consumable', $consumable->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/consumable', $consumable->id).'" data-content="'.Lang::get('admin/consumables/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($consumable->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$actions = '<nobr><a href="'.route('checkout/consumable', $consumable->id).'" style="margin-right:5px;" class="btn btn-info btn-sm" '.(($consumable->numRemaining() > 0 ) ? '' : ' disabled').'>'.trans('general.checkout').'</a><a href="'.route('update/consumable', $consumable->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/consumable', $consumable->id).'" data-content="'.trans('admin/consumables/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($consumable->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$company = $consumable->company;
$rows[] = array(

View file

@ -70,7 +70,7 @@ class CustomFieldsController extends Controller
$validator=Validator::make(Input::all(), $cfset->rules);
if ($validator->passes()) {
$cfset->save();
return Redirect::route("admin.custom_fields.show", [$cfset->id])->with('success', Lang::get('admin/custom_fields/message.fieldset.create.success'));
return Redirect::route("admin.custom_fields.show", [$cfset->id])->with('success', trans('admin/custom_fields/message.fieldset.create.success'));
} else {
return Redirect::back()->withInput()->withErrors($validator);
}
@ -90,13 +90,13 @@ class CustomFieldsController extends Controller
foreach ($set->fields as $field) {
if ($field->id == Input::get('field_id')) {
return Redirect::route("admin.custom_fields.show", [$id])->withInput()->withErrors(['field_id' => Lang::get('admin/custom_fields/message.field.already_added')]);
return Redirect::route("admin.custom_fields.show", [$id])->withInput()->withErrors(['field_id' => trans('admin/custom_fields/message.field.already_added')]);
}
}
$results=$set->fields()->attach(Input::get('field_id'), ["required" => (Input::get('required') == "on"),"order" => Input::get('order')]);
return Redirect::route("admin.custom_fields.show", [$id])->with("success", Lang::get('admin/custom_fields/message.field.create.assoc_success'));
return Redirect::route("admin.custom_fields.show", [$id])->with("success", trans('admin/custom_fields/message.field.create.assoc_success'));
}
@ -138,9 +138,9 @@ class CustomFieldsController extends Controller
$results=$field->save();
//return "postCreateField: $results";
if ($results) {
return Redirect::route("admin.custom_fields.index")->with("success", Lang::get('admin/custom_fields/message.field.create.success'));
return Redirect::route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.field.create.success'));
} else {
return Redirect::back()->withInput()->with('error', Lang::get('admin/custom_fields/message.field.create.error'));
return Redirect::back()->withInput()->with('error', trans('admin/custom_fields/message.field.create.error'));
}
} else {
return Redirect::back()->withInput()->withErrors($validator);
@ -162,7 +162,7 @@ class CustomFieldsController extends Controller
return Redirect::back()->withErrors(['message' => "Field is in-use"]);
} else {
$field->delete();
return Redirect::route("admin.custom_fields.index")->with("success", Lang::get('admin/custom_fields/message.field.delete.success'));
return Redirect::route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.field.delete.success'));
}
}
@ -245,9 +245,9 @@ class CustomFieldsController extends Controller
$models = AssetModel::where("fieldset_id", "=", $id);
if ($models->count()==0) {
$fieldset->delete();
return Redirect::route("admin.custom_fields.index")->with("success", Lang::get('admin/custom_fields/message.fieldset.delete.success'));
return Redirect::route("admin.custom_fields.index")->with("success", trans('admin/custom_fields/message.fieldset.delete.success'));
} else {
return Redirect::route("admin.custom_fields.index")->with("error", Lang::get('admin/custom_fields/message.fieldset.delete.in_use')); //->with("models",$models);
return Redirect::route("admin.custom_fields.index")->with("error", trans('admin/custom_fields/message.fieldset.delete.in_use')); //->with("models",$models);
}
}
}

View file

@ -76,7 +76,7 @@ class DepreciationsController extends Controller
// Was the asset created?
if ($depreciation->save()) {
// Redirect to the new depreciation page
return Redirect::to("admin/settings/depreciations")->with('success', Lang::get('admin/depreciations/message.create.success'));
return Redirect::to("admin/settings/depreciations")->with('success', trans('admin/depreciations/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($depreciation->getErrors());
@ -97,7 +97,7 @@ class DepreciationsController extends Controller
// Check if the depreciation exists
if (is_null($depreciation = Depreciation::find($depreciationId))) {
// Redirect to the blogs management page
return Redirect::to('admin/settings/depreciations')->with('error', Lang::get('admin/depreciations/message.does_not_exist'));
return Redirect::to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.does_not_exist'));
}
// Show the page
@ -122,7 +122,7 @@ class DepreciationsController extends Controller
// Check if the depreciation exists
if (is_null($depreciation = Depreciation::find($depreciationId))) {
// Redirect to the blogs management page
return Redirect::to('admin/settings/depreciations')->with('error', Lang::get('admin/depreciations/message.does_not_exist'));
return Redirect::to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.does_not_exist'));
}
// Depreciation data
@ -132,7 +132,7 @@ class DepreciationsController extends Controller
// Was the asset created?
if ($depreciation->save()) {
// Redirect to the depreciation page
return Redirect::to("admin/settings/depreciations/")->with('success', Lang::get('admin/depreciations/message.update.success'));
return Redirect::to("admin/settings/depreciations/")->with('success', trans('admin/depreciations/message.update.success'));
}
return Redirect::back()->withInput()->withErrors($depreciation->getErrors());
@ -154,19 +154,19 @@ class DepreciationsController extends Controller
// Check if the depreciation exists
if (is_null($depreciation = Depreciation::find($depreciationId))) {
// Redirect to the blogs management page
return Redirect::to('admin/settings/depreciations')->with('error', Lang::get('admin/depreciations/message.not_found'));
return Redirect::to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.not_found'));
}
if ($depreciation->has_models() > 0) {
// Redirect to the asset management page
return Redirect::to('admin/settings/depreciations')->with('error', Lang::get('admin/depreciations/message.assoc_users'));
return Redirect::to('admin/settings/depreciations')->with('error', trans('admin/depreciations/message.assoc_users'));
} else {
$depreciation->delete();
// Redirect to the depreciations management page
return Redirect::to('admin/settings/depreciations')->with('success', Lang::get('admin/depreciations/message.delete.success'));
return Redirect::to('admin/settings/depreciations')->with('success', trans('admin/depreciations/message.delete.success'));
}
}
@ -213,7 +213,7 @@ class DepreciationsController extends Controller
$rows = array();
foreach ($depreciations as $depreciation) {
$actions = '<a href="'.route('update/depreciations', $depreciation->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/depreciations', $depreciation->id).'" data-content="'.Lang::get('admin/depreciations/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($depreciation->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$actions = '<a href="'.route('update/depreciations', $depreciation->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/depreciations', $depreciation->id).'" data-content="'.trans('admin/depreciations/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($depreciation->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$rows[] = array(
'id' => $depreciation->id,

View file

@ -72,7 +72,7 @@ class GroupsController extends Controller
// Was the consumable created?
if ($group->save()) {
// Redirect to the new consumable page
return Redirect::to("admin/groups")->with('success', Lang::get('admin/groups/message.create.success'));
return Redirect::to("admin/groups")->with('success', trans('admin/groups/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($group->getErrors());
@ -113,7 +113,7 @@ class GroupsController extends Controller
{
if (!$group = Group::find($id)) {
return Redirect::route('groups')->with('error', Lang::get('admin/groups/message.group_not_found', compact('id')));
return Redirect::route('groups')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
}
$group->name = e(Input::get('name'));
@ -123,7 +123,7 @@ class GroupsController extends Controller
// Was the consumable created?
if ($group->save()) {
// Redirect to the new consumable page
return Redirect::to("admin/groups")->with('success', Lang::get('admin/groups/message.create.success'));
return Redirect::to("admin/groups")->with('success', trans('admin/groups/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($group->getErrors());
@ -153,13 +153,13 @@ class GroupsController extends Controller
$group->delete();
// Redirect to the group management page
return Redirect::route('groups')->with('success', Lang::get('admin/groups/message.success.delete'));
return Redirect::route('groups')->with('success', trans('admin/groups/message.success.delete'));
} catch (GroupNotFoundException $e) {
// Redirect to the group management page
return Redirect::route('groups')->with('error', Lang::get('admin/groups/message.group_not_found', compact('id')));
return Redirect::route('groups')->with('error', trans('admin/groups/message.group_not_found', compact('id')));
}
} else {
return Redirect::route('groups')->with('error', Lang::get('general.feature_disabled'));
return Redirect::route('groups')->with('error', trans('general.feature_disabled'));
}
}
@ -222,7 +222,7 @@ class GroupsController extends Controller
$actions .= '<a href="' . route('update/group', $group->id) . '" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> ';
if (!config('app.lock_passwords')) {
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/group', $group->id) . '" data-content="'.Lang::get('admin/groups/message.delete.confirm').'" data-title="Delete ' . htmlspecialchars($group->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
$actions .= '<a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="' . route('delete/group', $group->id) . '" data-content="'.trans('admin/groups/message.delete.confirm').'" data-title="Delete ' . htmlspecialchars($group->name) . '?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a> ';
} else {
$actions .= ' <span class="btn delete-asset btn-danger btn-sm disabled"><i class="fa fa-trash icon-white"></i></span>';
}

View file

@ -167,7 +167,7 @@ class LicensesController extends Controller
// Redirect to the new license page
return Redirect::to("admin/licenses")->with('success', Lang::get('admin/licenses/message.create.success'));
return Redirect::to("admin/licenses")->with('success', trans('admin/licenses/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($license->getErrors());
@ -188,9 +188,9 @@ class LicensesController extends Controller
// Check if the license exists
if (is_null($license = License::find($licenseId))) {
// Redirect to the blogs management page
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.does_not_exist'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
if ($license->purchase_date == "0000-00-00") {
@ -203,7 +203,7 @@ class LicensesController extends Controller
// Show the page
$license_options = array('' => 'Top Level') + DB::table('assets')->where('id', '!=', $licenseId)->pluck('name', 'id');
$depreciation_list = array('0' => Lang::get('admin/licenses/form.no_depreciation')) + Depreciation::pluck('name', 'id')->toArray();
$depreciation_list = array('0' => trans('admin/licenses/form.no_depreciation')) + Depreciation::pluck('name', 'id')->toArray();
$supplier_list = array('' => 'Select Supplier') + Supplier::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
$maintained_list = array('' => 'Maintained', '1' => 'Yes', '0' => 'No');
$company_list = Helper::companyList();
@ -232,9 +232,9 @@ class LicensesController extends Controller
// Check if the license exists
if (is_null($license = License::find($licenseId))) {
// Redirect to the blogs management page
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.does_not_exist'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
// Update the license data
@ -330,7 +330,7 @@ class LicensesController extends Controller
} else {
// Redirect to the license edit page
return Redirect::to("admin/licenses/$licenseId/edit")->with('error', Lang::get('admin/licenses/message.assoc_users'));
return Redirect::to("admin/licenses/$licenseId/edit")->with('error', trans('admin/licenses/message.assoc_users'));
}
} else {
@ -358,12 +358,12 @@ class LicensesController extends Controller
// Was the asset created?
if ($license->save()) {
// Redirect to the new license page
return Redirect::to("admin/licenses/$licenseId/view")->with('success', Lang::get('admin/licenses/message.update.success'));
return Redirect::to("admin/licenses/$licenseId/view")->with('success', trans('admin/licenses/message.update.success'));
}
// Redirect to the license edit page
return Redirect::to("admin/licenses/$licenseId/edit")->with('error', Lang::get('admin/licenses/message.update.error'));
return Redirect::to("admin/licenses/$licenseId/edit")->with('error', trans('admin/licenses/message.update.error'));
}
@ -381,15 +381,15 @@ class LicensesController extends Controller
// Check if the license exists
if (is_null($license = License::find($licenseId))) {
// Redirect to the license management page
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
if (($license->assignedcount()) && ($license->assignedcount() > 0)) {
// Redirect to the license management page
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.assoc_users'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.assoc_users'));
} else {
@ -406,7 +406,7 @@ class LicensesController extends Controller
// Redirect to the licenses management page
return Redirect::to('admin/licenses')->with('success', Lang::get('admin/licenses/message.delete.success'));
return Redirect::to('admin/licenses')->with('success', trans('admin/licenses/message.delete.success'));
}
@ -429,9 +429,9 @@ class LicensesController extends Controller
// Check if the license seat exists
if (is_null($licenseseat = LicenseSeat::find($seatId))) {
// Redirect to the asset management page with error
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($licenseseat->license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
// Get the dropdown of users and then pass it to the checkout view
@ -492,7 +492,7 @@ class LicensesController extends Controller
$user = Auth::user();
if (!Company::isCurrentUserHasAccess($licenseseat->license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
// Declare the rules for the form validation
@ -515,7 +515,7 @@ class LicensesController extends Controller
// Check if the user exists
if (is_null($is_assigned_to = User::find($assigned_to))) {
// Redirect to the asset management page with error
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.user_does_not_exist'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.user_does_not_exist'));
}
}
@ -523,12 +523,12 @@ class LicensesController extends Controller
if (is_null($is_asset_id = Asset::find($asset_id))) {
// Redirect to the asset management page with error
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.asset_does_not_exist'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.asset_does_not_exist'));
}
if (($is_asset_id->assigned_to!=$assigned_to) && ($assigned_to!='')) {
//echo 'asset assigned to: '.$is_asset_id->assigned_to.'<br>license assigned to: '.$assigned_to;
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.owner_doesnt_match_asset'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.owner_doesnt_match_asset'));
}
}
@ -538,7 +538,7 @@ class LicensesController extends Controller
// Check if the asset exists
if (is_null($licenseseat)) {
// Redirect to the asset management page with error
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
}
if (Input::get('asset_id') == '') {
@ -621,11 +621,11 @@ class LicensesController extends Controller
// Redirect to the new asset page
return Redirect::to("admin/licenses")->with('success', Lang::get('admin/licenses/message.checkout.success'));
return Redirect::to("admin/licenses")->with('success', trans('admin/licenses/message.checkout.success'));
}
// Redirect to the asset management page with error
return Redirect::to('admin/licenses/$assetId/checkout')->with('error', Lang::get('admin/licenses/message.create.error'))->with('license', new License);
return Redirect::to('admin/licenses/$assetId/checkout')->with('error', trans('admin/licenses/message.create.error'))->with('license', new License);
}
@ -643,9 +643,9 @@ class LicensesController extends Controller
// Check if the asset exists
if (is_null($licenseseat = LicenseSeat::find($seatId))) {
// Redirect to the asset management page with error
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
} elseif (!Company::isCurrentUserHasAccess($licenseseat->license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
return View::make('licenses/checkin', compact('licenseseat'))->with('backto', $backto);
@ -668,13 +668,13 @@ class LicensesController extends Controller
// Check if the asset exists
if (is_null($licenseseat = LicenseSeat::find($seatId))) {
// Redirect to the asset management page with error
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
}
$license = License::find($licenseseat->license_id);
if (!Company::isCurrentUserHasAccess($license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
if (!$license->reassignable) {
@ -756,15 +756,15 @@ class LicensesController extends Controller
if ($backto=='user') {
return Redirect::to("admin/users/".$return_to.'/view')->with('success', Lang::get('admin/licenses/message.checkin.success'));
return Redirect::to("admin/users/".$return_to.'/view')->with('success', trans('admin/licenses/message.checkin.success'));
} else {
return Redirect::to("admin/licenses/".$licenseseat->license_id."/view")->with('success', Lang::get('admin/licenses/message.checkin.success'));
return Redirect::to("admin/licenses/".$licenseseat->license_id."/view")->with('success', trans('admin/licenses/message.checkin.success'));
}
}
// Redirect to the license page with error
return Redirect::to("admin/licenses")->with('error', Lang::get('admin/licenses/message.checkin.error'));
return Redirect::to("admin/licenses")->with('error', trans('admin/licenses/message.checkin.error'));
}
/**
@ -783,13 +783,13 @@ class LicensesController extends Controller
if (isset($license->id)) {
if (!Company::isCurrentUserHasAccess($license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
return View::make('licenses/view', compact('license'));
} else {
// Prepare the error message
$error = Lang::get('admin/licenses/message.does_not_exist', compact('id'));
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
// Redirect to the user management page
return Redirect::route('licenses')->with('error', $error);
@ -801,9 +801,9 @@ class LicensesController extends Controller
// Check if the license exists
if (is_null($license_to_clone = License::find($licenseId))) {
// Redirect to the blogs management page
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.does_not_exist'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($license_to_clone)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
// Show the page
@ -849,7 +849,7 @@ class LicensesController extends Controller
if (!Company::isCurrentUserHasAccess($license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
if (Input::hasFile('licensefile')) {
@ -879,26 +879,26 @@ class LicensesController extends Controller
$logaction->filename = $filename;
$log = $logaction->logaction('uploaded');
} else {
return Redirect::back()->with('error', Lang::get('admin/licenses/message.upload.invalidfiles'));
return Redirect::back()->with('error', trans('admin/licenses/message.upload.invalidfiles'));
}
}
if ($upload_success) {
return Redirect::back()->with('success', Lang::get('admin/licenses/message.upload.success'));
return Redirect::back()->with('success', trans('admin/licenses/message.upload.success'));
} else {
return Redirect::back()->with('success', Lang::get('admin/licenses/message.upload.error'));
return Redirect::back()->with('success', trans('admin/licenses/message.upload.error'));
}
} else {
return Redirect::back()->with('error', Lang::get('admin/licenses/message.upload.nofiles'));
return Redirect::back()->with('error', trans('admin/licenses/message.upload.nofiles'));
}
} else {
// Prepare the error message
$error = Lang::get('admin/licenses/message.does_not_exist', compact('id'));
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
// Redirect to the licence management page
return Redirect::route('licenses')->with('error', $error);
@ -925,7 +925,7 @@ class LicensesController extends Controller
if (!Company::isCurrentUserHasAccess($license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
$log = Actionlog::find($fileId);
@ -934,11 +934,11 @@ class LicensesController extends Controller
unlink($destinationPath.'/'.$log->filename);
}
$log->delete();
return Redirect::back()->with('success', Lang::get('admin/licenses/message.deletefile.success'));
return Redirect::back()->with('success', trans('admin/licenses/message.deletefile.success'));
} else {
// Prepare the error message
$error = Lang::get('admin/licenses/message.does_not_exist', compact('id'));
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
// Redirect to the licence management page
return Redirect::route('licenses')->with('error', $error);
@ -965,7 +965,7 @@ class LicensesController extends Controller
if (isset($license->id)) {
if (!Company::isCurrentUserHasAccess($license)) {
return Redirect::to('admin/licenses')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::to('admin/licenses')->with('error', trans('general.insufficient_permissions'));
}
$log = Actionlog::find($fileId);
@ -973,7 +973,7 @@ class LicensesController extends Controller
return Response::download($file);
} else {
// Prepare the error message
$error = Lang::get('admin/licenses/message.does_not_exist', compact('id'));
$error = trans('admin/licenses/message.does_not_exist', compact('id'));
// Redirect to the licence management page
return Redirect::route('licenses')->with('error', $error);
@ -1009,7 +1009,7 @@ class LicensesController extends Controller
$rows = array();
foreach ($licenses as $license) {
$actions = '<span style="white-space: nowrap;"><a href="'.route('freecheckout/license', $license->id).'" class="btn btn-primary btn-sm" style="margin-right:5px;" '.(($license->remaincount() > 0) ? '' : 'disabled').'>'.Lang::get('general.checkout').'</a> <a href="'.route('clone/license', $license->id).'" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a><a href="'.route('update/license', $license->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/license', $license->id).'" data-content="'.Lang::get('admin/licenses/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($license->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></span>';
$actions = '<span style="white-space: nowrap;"><a href="'.route('freecheckout/license', $license->id).'" class="btn btn-primary btn-sm" style="margin-right:5px;" '.(($license->remaincount() > 0) ? '' : 'disabled').'>'.trans('general.checkout').'</a> <a href="'.route('clone/license', $license->id).'" class="btn btn-info btn-sm" style="margin-right:5px;" title="Clone asset"><i class="fa fa-files-o"></i></a><a href="'.route('update/license', $license->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/license', $license->id).'" data-content="'.trans('admin/licenses/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($license->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></span>';
$rows[] = array(
'id' => $license->id,
@ -1053,7 +1053,7 @@ class LicensesController extends Controller
// Check if the asset exists
if (is_null($license = License::find($licenseId))) {
// Redirect to the asset management page with error
return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found'));
return Redirect::to('admin/licenses')->with('error', trans('admin/licenses/message.not_found'));
}
$seatId = $license->freeSeat($licenseId);
return Redirect::to('admin/licenses/'.$seatId.'/checkout');

View file

@ -97,7 +97,7 @@ class LocationsController extends Controller
if ($location->save()) {
// Redirect to the new location page
return Redirect::to("admin/settings/locations")->with('success', Lang::get('admin/locations/message.create.success'));
return Redirect::to("admin/settings/locations")->with('success', trans('admin/locations/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($location->getErrors());
@ -158,7 +158,7 @@ class LocationsController extends Controller
{
// Check if the location exists
if (is_null($location = Location::find($locationId))) {
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.does_not_exist'));
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
}
// Show the page
@ -185,7 +185,7 @@ class LocationsController extends Controller
// Check if the location exists
if (is_null($location = Location::find($locationId))) {
// Redirect to the blogs management page
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.does_not_exist'));
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.does_not_exist'));
}
// Update the location data
@ -206,7 +206,7 @@ class LocationsController extends Controller
// Was the asset created?
if ($location->save()) {
// Redirect to the saved location page
return Redirect::to("admin/settings/locations/")->with('success', Lang::get('admin/locations/message.update.success'));
return Redirect::to("admin/settings/locations/")->with('success', trans('admin/locations/message.update.success'));
}
// Redirect to the location management page
@ -227,21 +227,21 @@ class LocationsController extends Controller
// Check if the location exists
if (is_null($location = Location::find($locationId))) {
// Redirect to the blogs management page
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.not_found'));
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.not_found'));
}
if ($location->users->count() > 0) {
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.assoc_users'));
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_users'));
} elseif ($location->childLocations->count() > 0) {
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.assoc_child_loc'));
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_child_loc'));
} elseif ($location->assets->count() > 0) {
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.assoc_assets'));
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_assets'));
} elseif ($location->assignedassets->count() > 0) {
return Redirect::to('admin/settings/locations')->with('error', Lang::get('admin/locations/message.assoc_assets'));
return Redirect::to('admin/settings/locations')->with('error', trans('admin/locations/message.assoc_assets'));
} else {
$location->delete();
return Redirect::to('admin/settings/locations')->with('success', Lang::get('admin/locations/message.delete.success'));
return Redirect::to('admin/settings/locations')->with('success', trans('admin/locations/message.delete.success'));
}
@ -268,7 +268,7 @@ class LocationsController extends Controller
return View::make('locations/view', compact('location'));
} else {
// Prepare the error message
$error = Lang::get('admin/locations/message.does_not_exist', compact('id'));
$error = trans('admin/locations/message.does_not_exist', compact('id'));
// Redirect to the user management page
return Redirect::route('locations')->with('error', $error);
@ -330,7 +330,7 @@ class LocationsController extends Controller
$rows = array();
foreach ($locations as $location) {
$actions = '<nobr><a href="'.route('update/location', $location->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/location', $location->id).'" data-content="'.Lang::get('admin/locations/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($location->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$actions = '<nobr><a href="'.route('update/location', $location->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/location', $location->id).'" data-content="'.trans('admin/locations/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($location->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></nobr>';
$rows[] = array(
'id' => $location->id,

View file

@ -20,8 +20,12 @@ use Auth;
class ManufacturersController extends Controller
{
/**
* Show a list of all manufacturers
* Returns a view that invokes the ajax tables which actually contains
* the content for the manufacturers listing, which is generated in getDatatable.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ManufacturersController::getDatatable() method that generates the JSON response
* @since [v1.0]
* @return View
*/
public function getIndex()
@ -32,8 +36,11 @@ class ManufacturersController extends Controller
/**
* Manufacturer create.
* Returns a view that displays a form to create a new manufacturer.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ManufacturersController::postCreate()
* @since [v1.0]
* @return View
*/
public function getCreate()
@ -43,21 +50,21 @@ class ManufacturersController extends Controller
/**
* Manufacturer create form processing.
* Validates and stores the data for a new manufacturer.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ManufacturersController::postCreate()
* @since [v1.0]
* @return Redirect
*/
public function postCreate()
{
// Create a new manufacturer
$manufacturer = new Manufacturer;
$manufacturer->name = e(Input::get('name'));
$manufacturer->user_id = Auth::user()->id;
// Was it created?
if ($manufacturer->save()) {
return Redirect::to("admin/settings/manufacturers")->with('success', Lang::get('admin/manufacturers/message.create.success'));
return Redirect::to("admin/settings/manufacturers")->with('success', trans('admin/manufacturers/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($manufacturer->getErrors());
@ -65,9 +72,12 @@ class ManufacturersController extends Controller
}
/**
* Manufacturer update.
* Returns a view that displays a form to edit a manufacturer.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ManufacturersController::postEdit()
* @param int $manufacturerId
* @since [v1.0]
* @return View
*/
public function getEdit($manufacturerId = null)
@ -75,7 +85,7 @@ class ManufacturersController extends Controller
// Check if the manufacturer exists
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
// Redirect to the manufacturer page
return Redirect::to('admin/settings/manufacturers')->with('error', Lang::get('admin/manufacturers/message.does_not_exist'));
return Redirect::to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.does_not_exist'));
}
// Show the page
@ -84,17 +94,20 @@ class ManufacturersController extends Controller
/**
* Manufacturer update form processing page.
* Validates and stores the updated manufacturer data.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ManufacturersController::getEdit()
* @param int $manufacturerId
* @return Redirect
* @since [v1.0]
* @return View
*/
public function postEdit($manufacturerId = null)
{
// Check if the manufacturer exists
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
// Redirect to the manufacturer page
return Redirect::to('admin/settings/manufacturers')->with('error', Lang::get('admin/manufacturers/message.does_not_exist'));
return Redirect::to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.does_not_exist'));
}
// Save the data
@ -103,7 +116,7 @@ class ManufacturersController extends Controller
// Was it created?
if ($manufacturer->save()) {
// Redirect to the new manufacturer page
return Redirect::to("admin/settings/manufacturers")->with('success', Lang::get('admin/manufacturers/message.update.success'));
return Redirect::to("admin/settings/manufacturers")->with('success', trans('admin/manufacturers/message.update.success'));
}
return Redirect::back()->withInput()->withErrors($manufacturer->getErrors());
@ -112,30 +125,32 @@ class ManufacturersController extends Controller
}
/**
* Delete the given manufacturer.
* Deletes a manufacturer.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @param int $manufacturerId
* @return Redirect
* @since [v1.0]
* @return View
*/
public function getDelete($manufacturerId)
{
// Check if the manufacturer exists
if (is_null($manufacturer = Manufacturer::find($manufacturerId))) {
// Redirect to the manufacturers page
return Redirect::to('admin/settings/manufacturers')->with('error', Lang::get('admin/manufacturers/message.not_found'));
return Redirect::to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.not_found'));
}
if ($manufacturer->has_models() > 0) {
// Redirect to the asset management page
return Redirect::to('admin/settings/manufacturers')->with('error', Lang::get('admin/manufacturers/message.assoc_users'));
return Redirect::to('admin/settings/manufacturers')->with('error', trans('admin/manufacturers/message.assoc_users'));
} else {
// Delete the manufacturer
$manufacturer->delete();
// Redirect to the manufacturers management page
return Redirect::to('admin/settings/manufacturers')->with('success', Lang::get('admin/manufacturers/message.delete.success'));
return Redirect::to('admin/settings/manufacturers')->with('success', trans('admin/manufacturers/message.delete.success'));
}
}
@ -143,20 +158,25 @@ class ManufacturersController extends Controller
/**
* Get the asset information to present to the category view page
* Returns a view that invokes the ajax tables which actually contains
* the content for the manufacturers detail listing, which is generated in getDatatable.
* This data contains a listing of all assets that belong to that manufacturer.
*
* @param int $assetId
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ManufacturersController::getDataView()
* @param int $manufacturerId
* @since [v1.0]
* @return View
**/
public function getView($manufacturerID = null)
*/
public function getView($manufacturerId = null)
{
$manufacturer = Manufacturer::find($manufacturerID);
$manufacturer = Manufacturer::find($manufacturerId);
if (isset($manufacturer->id)) {
return View::make('manufacturers/view', compact('manufacturer'));
} else {
// Prepare the error message
$error = Lang::get('admin/manufacturers/message.does_not_exist', compact('id'));
$error = trans('admin/manufacturers/message.does_not_exist', compact('id'));
// Redirect to the user management page
return Redirect::route('manufacturers')->with('error', $error);
@ -165,6 +185,14 @@ class ManufacturersController extends Controller
}
/**
* Generates the JSON used to display the manufacturer listings.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ManufacturersController::getIndex()
* @since [v1.0]
* @return String JSON
*/
public function getDatatable()
{
$manufacturers = Manufacturer::select(array('id','name'))->with('assets')
@ -198,7 +226,7 @@ class ManufacturersController extends Controller
$rows = array();
foreach ($manufacturers as $manufacturer) {
$actions = '<a href="'.route('update/manufacturer', $manufacturer->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/manufacturer', $manufacturer->id).'" data-content="'.Lang::get('admin/manufacturers/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($manufacturer->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$actions = '<a href="'.route('update/manufacturer', $manufacturer->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/manufacturer', $manufacturer->id).'" data-content="'.trans('admin/manufacturers/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($manufacturer->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$rows[] = array(
'id' => $manufacturer->id,
@ -215,11 +243,21 @@ class ManufacturersController extends Controller
}
public function getDataView($manufacturerID)
/**
* Generates the JSON used to display the manufacturer detail.
* This JSON returns data on all of the assets with the specified
* manufacturer ID number.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ManufacturersController::getView()
* @param int $manufacturerId
* @since [v1.0]
* @return String JSON
*/
public function getDataView($manufacturerId)
{
$manufacturer = Manufacturer::with('assets.company')->find($manufacturerID);
$manufacturer = Manufacturer::with('assets.company')->find($manufacturerId);
$manufacturer_assets = $manufacturer->assets;
if (Input::has('search')) {
@ -250,7 +288,7 @@ class ManufacturersController extends Controller
$actions = '';
if ($asset->deleted_at=='') {
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.Lang::get('admin/hardware/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
$actions = '<div style=" white-space: nowrap;"><a href="'.route('clone/hardware', $asset->id).'" class="btn btn-info btn-sm" title="Clone asset"><i class="fa fa-files-o"></i></a> <a href="'.route('update/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-pencil icon-white"></i></a> <a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/hardware', $asset->id).'" data-content="'.trans('admin/hardware/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($asset->asset_tag).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a></div>';
} elseif ($asset->deleted_at!='') {
$actions = '<a href="'.route('restore/hardware', $asset->id).'" class="btn btn-warning btn-sm"><i class="fa fa-recycle icon-white"></i></a>';
}
@ -258,9 +296,9 @@ class ManufacturersController extends Controller
if ($asset->assetstatus) {
if ($asset->assetstatus->deployable != 0) {
if (($asset->assigned_to !='') && ($asset->assigned_to > 0)) {
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.Lang::get('general.checkin').'</a>';
$inout = '<a href="'.route('checkin/hardware', $asset->id).'" class="btn btn-primary btn-sm">'.trans('general.checkin').'</a>';
} else {
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.Lang::get('general.checkout').'</a>';
$inout = '<a href="'.route('checkout/hardware', $asset->id).'" class="btn btn-info btn-sm">'.trans('general.checkout').'</a>';
}
}
}

View file

@ -18,8 +18,10 @@ use App\Helpers\Helper;
class ProfileController extends Controller
{
/**
* User profile page.
* Returns a view with the user's profile form for editing
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0]
* @return View
*/
public function getIndex()
@ -31,8 +33,10 @@ class ProfileController extends Controller
}
/**
* User profile form processing page.
* Validates and stores the user's update data.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0]
* @return Redirect
*/
public function postIndex()

View file

@ -31,8 +31,10 @@ class ReportsController extends Controller
{
/**
* Show Report for Accessories
* Returns a view that displaysthe accessories report.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0]
* @return View
*/
public function getAccessoryReport()
@ -43,8 +45,12 @@ class ReportsController extends Controller
}
/**
* Export Accessories Report as CSV
* Exports the accessories to CSV
*
* @deprecated Server-side exports have been replaced by datatables export since v2.
* @author [A. Gianotto] [<snipe@snipe.net>]
* @see ManufacturersController::getDatatable() method that generates the JSON response
* @since [v1.0]
* @return file download
*/
public function exportAccessoryReport()
@ -53,10 +59,10 @@ class ReportsController extends Controller
$rows = array();
$header = array(
Lang::get('admin/accessories/table.title'),
Lang::get('admin/accessories/general.accessory_category'),
Lang::get('admin/accessories/general.total'),
Lang::get('admin/accessories/general.remaining')
trans('admin/accessories/table.title'),
trans('admin/accessories/general.accessory_category'),
trans('admin/accessories/general.total'),
trans('admin/accessories/general.remaining')
);
$header = array_map('trim', $header);
$rows[] = implode($header, ', ');
@ -81,8 +87,10 @@ class ReportsController extends Controller
}
/**
* Show Asset Report
* Display asset report.
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0]
* @return View
*/
public function getAssetsReport()
@ -105,8 +113,10 @@ class ReportsController extends Controller
}
/**
* Export Asset Report as CSV
* Exports the assets to CSV
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v1.0]
* @return file download
*/
public function exportAssetReport()
@ -118,20 +128,20 @@ class ReportsController extends Controller
// Create the header row
$header = [
Lang::get('admin/hardware/table.asset_tag'),
Lang::get('admin/hardware/form.manufacturer'),
Lang::get('admin/hardware/form.model'),
Lang::get('general.model_no'),
Lang::get('general.name'),
Lang::get('admin/hardware/table.serial'),
Lang::get('general.status'),
Lang::get('admin/hardware/table.purchase_date'),
Lang::get('admin/hardware/table.purchase_cost'),
Lang::get('admin/hardware/form.order'),
Lang::get('admin/hardware/form.supplier'),
Lang::get('admin/hardware/table.checkoutto'),
Lang::get('admin/hardware/table.location'),
Lang::get('general.notes'),
trans('admin/hardware/table.asset_tag'),
trans('admin/hardware/form.manufacturer'),
trans('admin/hardware/form.model'),
trans('general.model_no'),
trans('general.name'),
trans('admin/hardware/table.serial'),
trans('general.status'),
trans('admin/hardware/table.purchase_date'),
trans('admin/hardware/table.purchase_cost'),
trans('admin/hardware/form.order'),
trans('admin/hardware/form.supplier'),
trans('admin/hardware/table.checkoutto'),
trans('admin/hardware/table.location'),
trans('general.notes'),
];
$header = array_map('trim', $header);
$rows[] = implode($header, ',');
@ -244,15 +254,15 @@ class ReportsController extends Controller
// Create the header row
$header = [
Lang::get('admin/hardware/table.asset_tag'),
Lang::get('admin/hardware/table.title'),
Lang::get('admin/hardware/table.serial'),
Lang::get('admin/hardware/table.checkoutto'),
Lang::get('admin/hardware/table.location'),
Lang::get('admin/hardware/table.purchase_date'),
Lang::get('admin/hardware/table.purchase_cost'),
Lang::get('admin/hardware/table.book_value'),
Lang::get('admin/hardware/table.diff')
trans('admin/hardware/table.asset_tag'),
trans('admin/hardware/table.title'),
trans('admin/hardware/table.serial'),
trans('admin/hardware/table.checkoutto'),
trans('admin/hardware/table.location'),
trans('admin/hardware/table.purchase_date'),
trans('admin/hardware/table.purchase_cost'),
trans('admin/hardware/table.book_value'),
trans('admin/hardware/table.diff')
];
//we insert the CSV header
@ -348,13 +358,13 @@ class ReportsController extends Controller
$rows = [ ];
$header = [
Lang::get('admin/licenses/table.title'),
Lang::get('admin/licenses/table.serial'),
Lang::get('admin/licenses/form.seats'),
Lang::get('admin/licenses/form.remaining_seats'),
Lang::get('admin/licenses/form.expiration'),
Lang::get('admin/licenses/form.date'),
Lang::get('admin/licenses/form.cost')
trans('admin/licenses/table.title'),
trans('admin/licenses/table.serial'),
trans('admin/licenses/form.seats'),
trans('admin/licenses/form.remaining_seats'),
trans('admin/licenses/form.expiration'),
trans('admin/licenses/form.date'),
trans('admin/licenses/form.cost')
];
$header = array_map('trim', $header);
@ -525,9 +535,9 @@ class ReportsController extends Controller
}
if (e(Input::get('status')) == '1') {
if (( $asset->status_id == '0' ) && ( $asset->assigned_to == '0' )) {
$row[] = Lang::get('general.ready_to_deploy');
$row[] = trans('general.ready_to_deploy');
} elseif (( $asset->status_id == '' ) && ( $asset->assigned_to == '0' )) {
$row[] = Lang::get('general.pending');
$row[] = trans('general.pending');
} elseif ($asset->assetstatus) {
$row[] = '"' .e($asset->assetstatus->name). '"';
} else {
@ -562,7 +572,7 @@ class ReportsController extends Controller
return $response;
} else {
return Redirect::to("reports/custom")
->with('error', Lang::get('admin/reports/message.error'));
->with('error', trans('admin/reports/message.error'));
}
}
@ -601,14 +611,14 @@ class ReportsController extends Controller
$rows = [ ];
$header = [
Lang::get('admin/asset_maintenances/table.asset_name'),
Lang::get('admin/asset_maintenances/table.supplier_name'),
Lang::get('admin/asset_maintenances/form.asset_maintenance_type'),
Lang::get('admin/asset_maintenances/form.title'),
Lang::get('admin/asset_maintenances/form.start_date'),
Lang::get('admin/asset_maintenances/form.completion_date'),
Lang::get('admin/asset_maintenances/form.asset_maintenance_time'),
Lang::get('admin/asset_maintenances/form.cost')
trans('admin/asset_maintenances/table.asset_name'),
trans('admin/asset_maintenances/table.supplier_name'),
trans('admin/asset_maintenances/form.asset_maintenance_type'),
trans('admin/asset_maintenances/form.title'),
trans('admin/asset_maintenances/form.start_date'),
trans('admin/asset_maintenances/form.completion_date'),
trans('admin/asset_maintenances/form.asset_maintenance_time'),
trans('admin/asset_maintenances/form.cost')
];
$header = array_map('trim', $header);
@ -629,7 +639,7 @@ class ReportsController extends Controller
$improvementTime = intval($assetMaintenance->asset_maintenance_time);
}
$row[] = $improvementTime;
$row[] = Lang::get('general.currency') . number_format($assetMaintenance->cost, 2);
$row[] = trans('general.currency') . number_format($assetMaintenance->cost, 2);
$rows[] = implode($row, ',');
}
@ -673,11 +683,11 @@ class ReportsController extends Controller
$rows = [ ];
$header = [
Lang::get('general.category'),
Lang::get('admin/hardware/form.model'),
Lang::get('admin/hardware/form.name'),
Lang::get('admin/hardware/table.asset_tag'),
Lang::get('admin/hardware/table.checkoutto'),
trans('general.category'),
trans('admin/hardware/form.model'),
trans('admin/hardware/form.name'),
trans('admin/hardware/table.asset_tag'),
trans('admin/hardware/table.checkoutto'),
];
$header = array_map('trim', $header);

View file

@ -291,7 +291,7 @@ class SettingsController extends Controller
// Check if the asset exists
if (is_null($setting = Setting::find(1))) {
// Redirect to the asset management page with error
return Redirect::to('admin')->with('error', Lang::get('admin/settings/message.update.error'));
return Redirect::to('admin')->with('error', trans('admin/settings/message.update.error'));
}
if (Input::get('clear_logo')=='1') {
@ -393,7 +393,7 @@ class SettingsController extends Controller
// If validation fails, we'll exit the operation now.
if ($setting->save()) {
return Redirect::to("admin/settings/app")->with('success', Lang::get('admin/settings/message.update.success'));
return Redirect::to("admin/settings/app")->with('success', trans('admin/settings/message.update.success'));
} else {
return Redirect::back()->withInput()->withErrors($setting->getErrors());
@ -401,7 +401,7 @@ class SettingsController extends Controller
// Redirect to the setting management page
return Redirect::to("admin/settings/app/edit")->with('error', Lang::get('admin/settings/message.update.error'));
return Redirect::to("admin/settings/app/edit")->with('error', trans('admin/settings/message.update.error'));
}
@ -455,10 +455,10 @@ class SettingsController extends Controller
{
if (!config('app.lock_passwords')) {
Artisan::call('backup:run');
return Redirect::to("admin/settings/backups")->with('success', Lang::get('admin/settings/message.backup.generated'));
return Redirect::to("admin/settings/backups")->with('success', trans('admin/settings/message.backup.generated'));
} else {
return Redirect::to("admin/settings/backups")->with('error', Lang::get('general.feature_disabled'));
return Redirect::to("admin/settings/backups")->with('error', trans('general.feature_disabled'));
}
@ -482,11 +482,11 @@ class SettingsController extends Controller
} else {
// Redirect to the backup page
return Redirect::route('settings/backups')->with('error', Lang::get('admin/settings/message.backup.file_not_found'));
return Redirect::route('settings/backups')->with('error', trans('admin/settings/message.backup.file_not_found'));
}
} else {
// Redirect to the backup page
return Redirect::route('settings/backups')->with('error', Lang::get('general.feature_disabled'));
return Redirect::route('settings/backups')->with('error', trans('general.feature_disabled'));
}
@ -507,12 +507,12 @@ class SettingsController extends Controller
$file = config('backup::path').'/'.$filename;
if (file_exists($file)) {
unlink($file);
return Redirect::route('settings/backups')->with('success', Lang::get('admin/settings/message.backup.file_deleted'));
return Redirect::route('settings/backups')->with('success', trans('admin/settings/message.backup.file_deleted'));
} else {
return Redirect::route('settings/backups')->with('error', Lang::get('admin/settings/message.backup.file_not_found'));
return Redirect::route('settings/backups')->with('error', trans('admin/settings/message.backup.file_not_found'));
}
} else {
return Redirect::route('settings/backups')->with('error', Lang::get('general.feature_disabled'));
return Redirect::route('settings/backups')->with('error', trans('general.feature_disabled'));
}
}

View file

@ -75,7 +75,7 @@ class StatuslabelsController extends Controller
// Was the asset created?
if ($statuslabel->save()) {
// Redirect to the new Statuslabel page
return Redirect::to("admin/settings/statuslabels")->with('success', Lang::get('admin/statuslabels/message.create.success'));
return Redirect::to("admin/settings/statuslabels")->with('success', trans('admin/statuslabels/message.create.success'));
}
return Redirect::back()->withInput()->withErrors($statuslabel->getErrors());
@ -126,12 +126,12 @@ class StatuslabelsController extends Controller
// Check if the Statuslabel exists
if (is_null($statuslabel = Statuslabel::find($statuslabelId))) {
// Redirect to the blogs management page
return Redirect::to('admin/settings/statuslabels')->with('error', Lang::get('admin/statuslabels/message.does_not_exist'));
return Redirect::to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.does_not_exist'));
}
$use_statuslabel_type = $statuslabel->getStatuslabelType();
$statuslabel_types = array('' => Lang::get('admin/hardware/form.select_statustype')) + array('undeployable' => Lang::get('admin/hardware/general.undeployable')) + array('pending' => Lang::get('admin/hardware/general.pending')) + array('archived' => Lang::get('admin/hardware/general.archived')) + array('deployable' => Lang::get('admin/hardware/general.deployable'));
$statuslabel_types = array('' => trans('admin/hardware/form.select_statustype')) + array('undeployable' => trans('admin/hardware/general.undeployable')) + array('pending' => trans('admin/hardware/general.pending')) + array('archived' => trans('admin/hardware/general.archived')) + array('deployable' => trans('admin/hardware/general.deployable'));
return View::make('statuslabels/edit', compact('statuslabel', 'statuslabel_types'))->with('use_statuslabel_type', $use_statuslabel_type);
}
@ -148,7 +148,7 @@ class StatuslabelsController extends Controller
// Check if the Statuslabel exists
if (is_null($statuslabel = Statuslabel::find($statuslabelId))) {
// Redirect to the blogs management page
return Redirect::to('admin/settings/statuslabels')->with('error', Lang::get('admin/statuslabels/message.does_not_exist'));
return Redirect::to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.does_not_exist'));
}
@ -164,14 +164,14 @@ class StatuslabelsController extends Controller
// Was the asset created?
if ($statuslabel->save()) {
// Redirect to the saved Statuslabel page
return Redirect::to("admin/settings/statuslabels/")->with('success', Lang::get('admin/statuslabels/message.update.success'));
return Redirect::to("admin/settings/statuslabels/")->with('success', trans('admin/statuslabels/message.update.success'));
} else {
return Redirect::back()->withInput()->withErrors($statuslabel->getErrors());
}
// Redirect to the Statuslabel management page
return Redirect::to("admin/settings/statuslabels/$statuslabelId/edit")->with('error', Lang::get('admin/statuslabels/message.update.error'));
return Redirect::to("admin/settings/statuslabels/$statuslabelId/edit")->with('error', trans('admin/statuslabels/message.update.error'));
}
@ -186,20 +186,20 @@ class StatuslabelsController extends Controller
// Check if the Statuslabel exists
if (is_null($statuslabel = Statuslabel::find($statuslabelId))) {
// Redirect to the blogs management page
return Redirect::to('admin/settings/statuslabels')->with('error', Lang::get('admin/statuslabels/message.not_found'));
return Redirect::to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.not_found'));
}
if ($statuslabel->has_assets() > 0) {
// Redirect to the asset management page
return Redirect::to('admin/settings/statuslabels')->with('error', Lang::get('admin/statuslabels/message.assoc_users'));
return Redirect::to('admin/settings/statuslabels')->with('error', trans('admin/statuslabels/message.assoc_users'));
} else {
$statuslabel->delete();
// Redirect to the statuslabels management page
return Redirect::to('admin/settings/statuslabels')->with('success', Lang::get('admin/statuslabels/message.delete.success'));
return Redirect::to('admin/settings/statuslabels')->with('success', trans('admin/statuslabels/message.delete.success'));
}
@ -242,16 +242,16 @@ class StatuslabelsController extends Controller
foreach ($statuslabels as $statuslabel) {
if ($statuslabel->deployable == 1) {
$label_type = Lang::get('admin/statuslabels/table.deployable');
$label_type = trans('admin/statuslabels/table.deployable');
} elseif ($statuslabel->pending == 1) {
$label_type = Lang::get('admin/statuslabels/table.pending');
$label_type = trans('admin/statuslabels/table.pending');
} elseif ($statuslabel->archived == 1) {
$label_type = Lang::get('admin/statuslabels/table.archived');
$label_type = trans('admin/statuslabels/table.archived');
} else {
$label_type = Lang::get('admin/statuslabels/table.undeployable');
$label_type = trans('admin/statuslabels/table.undeployable');
}
$actions = '<a href="'.route('update/statuslabel', $statuslabel->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/statuslabel', $statuslabel->id).'" data-content="'.Lang::get('admin/statuslabels/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($statuslabel->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$actions = '<a href="'.route('update/statuslabel', $statuslabel->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/statuslabel', $statuslabel->id).'" data-content="'.trans('admin/statuslabels/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($statuslabel->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$rows[] = array(
'id' => e($statuslabel->id),

View file

@ -94,7 +94,7 @@ class SuppliersController extends Controller
// Was it created?
if ($supplier->save()) {
// Redirect to the new supplier page
return Redirect::to("admin/settings/suppliers")->with('success', Lang::get('admin/suppliers/message.create.success'));
return Redirect::to("admin/settings/suppliers")->with('success', trans('admin/suppliers/message.create.success'));
}
@ -126,7 +126,7 @@ class SuppliersController extends Controller
// Check if the supplier exists
if (is_null($supplier = Supplier::find($supplierId))) {
// Redirect to the supplier page
return Redirect::to('admin/settings/suppliers')->with('error', Lang::get('admin/suppliers/message.does_not_exist'));
return Redirect::to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.does_not_exist'));
}
// Show the page
@ -145,7 +145,7 @@ class SuppliersController extends Controller
// Check if the supplier exists
if (is_null($supplier = Supplier::find($supplierId))) {
// Redirect to the supplier page
return Redirect::to('admin/settings/suppliers')->with('error', Lang::get('admin/suppliers/message.does_not_exist'));
return Redirect::to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.does_not_exist'));
}
// Save the data
@ -179,7 +179,7 @@ class SuppliersController extends Controller
}
if ($supplier->save()) {
return Redirect::to("admin/settings/suppliers")->with('success', Lang::get('admin/suppliers/message.update.success'));
return Redirect::to("admin/settings/suppliers")->with('success', trans('admin/suppliers/message.update.success'));
}
return Redirect::back()->withInput()->withErrors($supplier->getErrors());
@ -197,20 +197,20 @@ class SuppliersController extends Controller
// Check if the supplier exists
if (is_null($supplier = Supplier::find($supplierId))) {
// Redirect to the suppliers page
return Redirect::to('admin/settings/suppliers')->with('error', Lang::get('admin/suppliers/message.not_found'));
return Redirect::to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.not_found'));
}
if ($supplier->num_assets() > 0) {
// Redirect to the asset management page
return Redirect::to('admin/settings/suppliers')->with('error', Lang::get('admin/suppliers/message.assoc_users'));
return Redirect::to('admin/settings/suppliers')->with('error', trans('admin/suppliers/message.assoc_users'));
} else {
// Delete the supplier
$supplier->delete();
// Redirect to the suppliers management page
return Redirect::to('admin/settings/suppliers')->with('success', Lang::get('admin/suppliers/message.delete.success'));
return Redirect::to('admin/settings/suppliers')->with('success', trans('admin/suppliers/message.delete.success'));
}
}
@ -230,7 +230,7 @@ class SuppliersController extends Controller
return View::make('suppliers/view', compact('supplier'));
} else {
// Prepare the error message
$error = Lang::get('admin/suppliers/message.does_not_exist', compact('id'));
$error = trans('admin/suppliers/message.does_not_exist', compact('id'));
// Redirect to the user management page
return Redirect::route('suppliers')->with('error', $error);
@ -272,7 +272,7 @@ class SuppliersController extends Controller
$rows = array();
foreach ($suppliers as $supplier) {
$actions = '<a href="'.route('update/supplier', $supplier->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/supplier', $supplier->id).'" data-content="'.Lang::get('admin/suppliers/message.delete.confirm').'" data-title="'.Lang::get('general.delete').' '.htmlspecialchars($supplier->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$actions = '<a href="'.route('update/supplier', $supplier->id).'" class="btn btn-warning btn-sm" style="margin-right:5px;"><i class="fa fa-pencil icon-white"></i></a><a data-html="false" class="btn delete-asset btn-danger btn-sm" data-toggle="modal" href="'.route('delete/supplier', $supplier->id).'" data-content="'.trans('admin/suppliers/message.delete.confirm').'" data-title="'.trans('general.delete').' '.htmlspecialchars($supplier->name).'?" onClick="return false;"><i class="fa fa-trash icon-white"></i></a>';
$rows[] = array(
'id' => $supplier->id,

View file

@ -187,7 +187,7 @@ class UsersController extends Controller
$user = User::find($id);
if (!Company::isCurrentUserHasAccess($user)) {
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
}
// Get this user groups
@ -216,7 +216,7 @@ class UsersController extends Controller
->lists('full_name', 'id');
} catch (UserNotFoundException $e) {
// Prepare the error message
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
$error = trans('admin/users/message.user_not_found', compact('id'));
// Redirect to the user management page
return Redirect::route('users')->with('error', $error);
@ -255,11 +255,11 @@ class UsersController extends Controller
$user = User::find($id);
if (!Company::isCurrentUserHasAccess($user)) {
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
}
} catch (UserNotFoundException $e) {
// Prepare the error message
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
$error = trans('admin/users/message.user_not_found', compact('id'));
// Redirect to the user management page
return Redirect::route('users')->with('error', $error);
@ -308,7 +308,7 @@ class UsersController extends Controller
// Was the user updated?
if ($user->save()) {
// Prepare the success message
$success = Lang::get('admin/users/message.success.update');
$success = trans('admin/users/message.success.update');
// Redirect to the user page
return Redirect::route('users')->with('success', $success);
@ -335,7 +335,7 @@ class UsersController extends Controller
// Check if we are not trying to delete ourselves
if ($user->id === Auth::user()->id) {
// Prepare the error message
$error = Lang::get('admin/users/message.error.delete');
$error = trans('admin/users/message.error.delete');
// Redirect to the user management page
return Redirect::route('users')->with('error', $error);
@ -364,13 +364,13 @@ class UsersController extends Controller
$user->delete();
// Prepare the success message
$success = Lang::get('admin/users/message.success.delete');
$success = trans('admin/users/message.success.delete');
// Redirect to the user management page
return Redirect::route('users')->with('success', $success);
} catch (UserNotFoundException $e) {
// Prepare the error message
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
$error = trans('admin/users/message.user_not_found', compact('id'));
// Redirect to the user management page
return Redirect::route('users')->with('error', $error);
@ -424,7 +424,7 @@ class UsersController extends Controller
}
if (!Auth::user()->isSuperUser()) {
return Redirect::route('users')->with('error', Lang::get('admin/users/message.insufficient_permissions'));
return Redirect::route('users')->with('error', trans('admin/users/message.insufficient_permissions'));
}
if (!config('app.lock_passwords')) {
@ -500,20 +500,20 @@ class UsersController extends Controller
//$user = Sentry::getUserProvider()->createModel()->withTrashed()->find($id);
if (!Company::isCurrentUserHasAccess($user)) {
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
} else {
// Restore the user
$user->restore();
// Prepare the success message
$success = Lang::get('admin/users/message.success.restored');
$success = trans('admin/users/message.success.restored');
// Redirect to the user management page
return Redirect::route('users')->with('success', $success);
}
} catch (UserNotFoundException $e) {
// Prepare the error message
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
$error = trans('admin/users/message.user_not_found', compact('id'));
// Redirect to the user management page
return Redirect::route('users')->with('error', $error);
@ -539,13 +539,13 @@ class UsersController extends Controller
if (isset($user->id)) {
if (!Company::isCurrentUserHasAccess($user)) {
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
} else {
return View::make('users/view', compact('user', 'userlog'));
}
} else {
// Prepare the error message
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
$error = trans('admin/users/message.user_not_found', compact('id'));
// Redirect to the user management page
return Redirect::route('users')->with('error', $error);
@ -569,7 +569,7 @@ class UsersController extends Controller
// Check if we are not trying to unsuspend ourselves
if ($user->id === Auth::user()->id) {
// Prepare the error message
$error = Lang::get('admin/users/message.error.unsuspend');
$error = trans('admin/users/message.error.unsuspend');
// Redirect to the user management page
return Redirect::route('users')->with('error', $error);
@ -582,13 +582,13 @@ class UsersController extends Controller
}
// Prepare the success message
$success = Lang::get('admin/users/message.success.unsuspend');
$success = trans('admin/users/message.success.unsuspend');
// Redirect to the user management page
return Redirect::route('users')->with('success', $success);
} catch (UserNotFoundException $e) {
// Prepare the error message
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
$error = trans('admin/users/message.user_not_found', compact('id'));
// Redirect to the user management page
return Redirect::route('users')->with('error', $error);
@ -657,7 +657,7 @@ class UsersController extends Controller
->with('clone_user', $user_to_clone);
} catch (UserNotFoundException $e) {
// Prepare the error message
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
$error = trans('admin/users/message.user_not_found', compact('id'));
// Redirect to the user management page
return Redirect::route('users')->with('error', $error);
@ -937,7 +937,7 @@ class UsersController extends Controller
if (isset($user->id)) {
if (!Company::isCurrentUserHasAccess($user)) {
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
}
foreach (Input::file('file') as $file) {
@ -986,7 +986,7 @@ class UsersController extends Controller
if (isset($user->id)) {
if (!Company::isCurrentUserHasAccess($user)) {
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
} else {
$log = Actionlog::find($fileId);
$full_filename = $destinationPath . '/' . $log->filename;
@ -994,11 +994,11 @@ class UsersController extends Controller
unlink($destinationPath . '/' . $log->filename);
}
$log->delete();
return Redirect::back()->with('success', Lang::get('admin/users/message.deletefile.success'));
return Redirect::back()->with('success', trans('admin/users/message.deletefile.success'));
}
} else {
// Prepare the error message
$error = Lang::get('admin/users/message.does_not_exist', compact('id'));
$error = trans('admin/users/message.does_not_exist', compact('id'));
// Redirect to the licence management page
return Redirect::route('users')->with('error', $error);
@ -1022,7 +1022,7 @@ class UsersController extends Controller
// the license is valid
if (isset($user->id)) {
if (!Company::isCurrentUserHasAccess($user)) {
return Redirect::route('users')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::route('users')->with('error', trans('general.insufficient_permissions'));
} else {
$log = Actionlog::find($fileId);
$file = $log->get_src();
@ -1030,7 +1030,7 @@ class UsersController extends Controller
}
} else {
// Prepare the error message
$error = Lang::get('admin/users/message.does_not_exist', compact('id'));
$error = trans('admin/users/message.does_not_exist', compact('id'));
// Redirect to the licence management page
return Redirect::route('users')->with('error', $error);
@ -1126,13 +1126,13 @@ class UsersController extends Controller
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
if (!$ldapconn) {
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_connect'));
return Redirect::route('users')->with('error', trans('admin/users/message.error.ldap_could_not_connect'));
}
// Set options
$ldapopt = @ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, $ldap_version);
if (!$ldapopt) {
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_connect'));
return Redirect::route('users')->with('error', trans('admin/users/message.error.ldap_could_not_connect'));
}
// Binding to ldap server
@ -1140,7 +1140,7 @@ class UsersController extends Controller
Log::error(ldap_errno($ldapconn));
if (!$ldapbind) {
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_bind').ldap_error($ldapconn));
return Redirect::route('users')->with('error', trans('admin/users/message.error.ldap_could_not_bind').ldap_error($ldapconn));
}
// Set up LDAP pagination for very large databases
@ -1158,13 +1158,13 @@ class UsersController extends Controller
$search_results = ldap_search($ldapconn, $base_dn, '('.$filter.')');
if (!$search_results) {
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_search').ldap_error($ldapconn));
return Redirect::route('users')->with('error', trans('admin/users/message.error.ldap_could_not_search').ldap_error($ldapconn));
}
// Get results from page
$results = ldap_get_entries($ldapconn, $search_results);
if (!$results) {
return Redirect::route('users')->with('error', Lang::get('admin/users/message.error.ldap_could_not_get_entries').ldap_error($ldapconn));
return Redirect::route('users')->with('error', trans('admin/users/message.error.ldap_could_not_get_entries').ldap_error($ldapconn));
}
// Add results to result set

View file

@ -46,7 +46,7 @@ class ViewAssetsController extends Controller
return View::make('account/view-assets', compact('user', 'userlog'));
} else {
// Prepare the error message
$error = Lang::get('admin/users/message.user_not_found', compact('id'));
$error = trans('admin/users/message.user_not_found', compact('id'));
// Redirect to the user management page
return Redirect::route('users')->with('error', $error);
@ -72,9 +72,9 @@ class ViewAssetsController extends Controller
// Check if the asset exists and is requestable
if (is_null($asset = Asset::RequestableAssets()->find($assetId))) {
// Redirect to the asset management page
return Redirect::route('requestable-assets')->with('error', Lang::get('admin/hardware/message.does_not_exist_or_not_requestable'));
return Redirect::route('requestable-assets')->with('error', trans('admin/hardware/message.does_not_exist_or_not_requestable'));
} elseif (!Company::isCurrentUserHasAccess($asset)) {
return Redirect::route('requestable-assets')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
} else {
$logaction = new Actionlog();
@ -130,7 +130,7 @@ class ViewAssetsController extends Controller
}
return Redirect::route('requestable-assets')->with('success')->with('success', Lang::get('admin/hardware/message.requests.success'));
return Redirect::route('requestable-assets')->with('success')->with('success', trans('admin/hardware/message.requests.success'));
}
@ -144,13 +144,13 @@ class ViewAssetsController extends Controller
if (is_null($findlog = Actionlog::find($logID))) {
// Redirect to the asset management page
return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('account')->with('error', trans('admin/hardware/message.does_not_exist'));
}
$user = Auth::user();
if ($user->id != $findlog->checkedout_to) {
return Redirect::to('account/view-assets')->with('error', Lang::get('admin/users/message.error.incorrect_user_accepted'));
return Redirect::to('account/view-assets')->with('error', trans('admin/users/message.error.incorrect_user_accepted'));
}
// Asset
@ -168,9 +168,9 @@ class ViewAssetsController extends Controller
// Check if the asset exists
if (is_null($item)) {
// Redirect to the asset management page
return Redirect::to('account')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('account')->with('error', trans('admin/hardware/message.does_not_exist'));
} elseif (!Company::isCurrentUserHasAccess($item)) {
return Redirect::route('requestable-assets')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
} else {
return View::make('account/accept-asset', compact('item'))->with('findlog', $findlog);
}
@ -183,28 +183,28 @@ class ViewAssetsController extends Controller
// Check if the asset exists
if (is_null($findlog = Actionlog::find($logID))) {
// Redirect to the asset management page
return Redirect::to('account/view-assets')->with('error', Lang::get('admin/hardware/message.does_not_exist'));
return Redirect::to('account/view-assets')->with('error', trans('admin/hardware/message.does_not_exist'));
}
// NOTE: make sure the global scope is applied
$is_unauthorized = is_null(Actionlog::where('id', '=', $logID)->first());
if ($is_unauthorized) {
return Redirect::route('requestable-assets')->with('error', Lang::get('general.insufficient_permissions'));
return Redirect::route('requestable-assets')->with('error', trans('general.insufficient_permissions'));
}
if ($findlog->accepted_id!='') {
// Redirect to the asset management page
return Redirect::to('account/view-assets')->with('error', Lang::get('admin/users/message.error.asset_already_accepted'));
return Redirect::to('account/view-assets')->with('error', trans('admin/users/message.error.asset_already_accepted'));
}
if (!Input::has('asset_acceptance')) {
return Redirect::to('account/view-assets')->with('error', Lang::get('admin/users/message.error.accept_or_decline'));
return Redirect::to('account/view-assets')->with('error', trans('admin/users/message.error.accept_or_decline'));
}
$user = Auth::user();
if ($user->id != $findlog->checkedout_to) {
return Redirect::to('account/view-assets')->with('error', Lang::get('admin/users/message.error.incorrect_user_accepted'));
return Redirect::to('account/view-assets')->with('error', trans('admin/users/message.error.incorrect_user_accepted'));
}
$logaction = new Actionlog();
@ -212,11 +212,11 @@ class ViewAssetsController extends Controller
if (Input::get('asset_acceptance')=='accepted') {
$logaction_msg = 'accepted';
$accepted="accepted";
$return_msg = Lang::get('admin/users/message.accepted');
$return_msg = trans('admin/users/message.accepted');
} else {
$logaction_msg = 'declined';
$accepted="rejected";
$return_msg = Lang::get('admin/users/message.declined');
$return_msg = trans('admin/users/message.declined');
}
// Asset