mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-11 13:57:41 -08:00
Fixed some missing strings and checks
Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
parent
52af8afac2
commit
cff382605c
|
@ -539,31 +539,31 @@ class UsersController extends Controller
|
|||
|
||||
if ($user) {
|
||||
|
||||
if ($user->id === Auth::id()) {
|
||||
// Redirect to the user management page
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/users/message.error.cannot_delete_yourself')));
|
||||
}
|
||||
|
||||
if (($user->assets) && ($user->assets->count() > 0)) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/users/message.error.delete_has_assets')));
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans_choice('admin/users/message.error.delete_has_assets_var', $user->assets()->count(), ['count'=> $user->assets()->count()])));
|
||||
}
|
||||
|
||||
if (($user->licenses) && ($user->licenses->count() > 0)) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'This user still has ' . $user->licenses->count() . ' license(s) associated with them and cannot be deleted.'));
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans_choice('admin/users/message.error.delete_has_licenses_var', $user->licenses()->count(), ['count'=> $user->licenses()->count()])));
|
||||
}
|
||||
|
||||
if (($user->accessories) && ($user->accessories->count() > 0)) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'This user still has ' . $user->accessories->count() . ' accessories associated with them.'));
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans_choice('admin/users/message.error.delete_has_accessories_var', $user->accessories()->count(), ['count'=> $user->accessories()->count()])));
|
||||
}
|
||||
|
||||
if (($user->managedLocations()) && ($user->managedLocations()->count() > 0)) {
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'This user still has ' . $user->managedLocations()->count() . ' locations that they manage.'));
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans_choice('admin/users/message.error.delete_has_locations_var', $user->managedLocations()->count(), ['count'=> $user->managedLocations()->count()])));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (($user->managesUsers()) && ($user->managesUsers()->count() > 0)) {
|
||||
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, 'This user still has ' . $user->managesUsers()->count() . ' users that they manage.'));
|
||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans_choice('admin/users/message.error.delete_has_users_var', $user->managesUsers()->count(), ['count'=> $user->managesUsers()->count()])));
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ($user->delete()) {
|
||||
|
||||
// Remove the user's avatar if they have one
|
||||
|
|
|
@ -346,33 +346,35 @@ class UsersController extends Controller
|
|||
if ($user->id === Auth::id()) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', 'We would feel really bad if you deleted yourself, please reconsider.');
|
||||
->with('error', trans('admin/users/message.error.cannot_delete_yourself'));
|
||||
}
|
||||
|
||||
if (($user->assets()) && (($assetsCount = $user->assets()->count()) > 0)) {
|
||||
if (($user->assets()) && ($user->assets()->count() > 0)) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', 'This user still has '.$assetsCount.' assets associated with them.');
|
||||
->with('error', trans_choice('admin/users/message.error.delete_has_assets_var', $user->assets()->count(), ['count'=> $user->assets()->count()]));
|
||||
}
|
||||
|
||||
if (($user->licenses()) && (($licensesCount = $user->licenses()->count())) > 0) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', 'This user still has '.$licensesCount.' licenses associated with them.');
|
||||
if (($user->licenses()) && ($user->licenses()->count() > 0)) {
|
||||
return redirect()->route('users.index')->with('error', trans_choice('admin/users/message.error.delete_has_licenses_var', $user->licenses()->count(), ['count'=> $user->licenses()->count()]));
|
||||
}
|
||||
|
||||
if (($user->accessories()) && (($accessoriesCount = $user->accessories()->count()) > 0)) {
|
||||
if (($user->accessories()) && ($user->accessories()->count() > 0)) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', 'This user still has '.$accessoriesCount.' accessories associated with them.');
|
||||
return redirect()->route('users.index')->with('error', trans_choice('admin/users/message.error.delete_has_accessories_var', $user->accessories()->count(), ['count'=> $user->accessories()->count()]));
|
||||
}
|
||||
|
||||
if (($user->managedLocations()) && (($managedLocationsCount = $user->managedLocations()->count())) > 0) {
|
||||
if (($user->managedLocations()) && ($user->managedLocations()->count() > 0)) {
|
||||
// Redirect to the user management page
|
||||
return redirect()->route('users.index')
|
||||
->with('error', 'This user still has '.$managedLocationsCount.' locations that they manage.');
|
||||
->with('error', trans_choice('admin/users/message.error.delete_has_locations_var', $user->managedLocations()->count(), ['count'=> $user->managedLocations()->count()]));
|
||||
}
|
||||
|
||||
// if (($user->managesUsers()) && ($user->managesUsers()->count() > 0)) {
|
||||
// return redirect()->route('users.index')
|
||||
// ->with('error', trans_choice('admin/users/message.error.delete_has_users_var', $user->managesUsers()->count(), ['count'=> $user->managesUsers()->count()]));
|
||||
// }
|
||||
|
||||
// Delete the user
|
||||
$user->delete();
|
||||
return redirect()->route('users.index')->with('success', trans('admin/users/message.success.delete'));
|
||||
|
|
|
@ -37,10 +37,16 @@ return array(
|
|||
'update' => 'There was an issue updating the user. Please try again.',
|
||||
'delete' => 'There was an issue deleting the user. Please try again.',
|
||||
'delete_has_assets' => 'This user has items assigned and could not be deleted.',
|
||||
'delete_has_assets_var' => 'This user still has an asset assigned. Please check it in first.|This user still has :count assets assigned. Please check their assets in first.',
|
||||
'delete_has_licenses_var' => 'This user still has a license seats assigned. Please check it in first.|This user still has :count license seats assigned. Please check them in first.',
|
||||
'delete_has_accessories_var' => 'This user still has an accessory assigned. Please check it in first.|This user still has :count accessories assigned. Please check their assets in first.',
|
||||
'delete_has_locations_var' => 'This user still manages a location. Please select another manager first.|This user still manages :count locations. Please select another manager first.',
|
||||
'delete_has_users_var' => 'This user still manages another user. Please select another manager for that user first.|This user still manages :count users. Please select another manager for them first.',
|
||||
'unsuspend' => 'There was an issue unsuspending the user. Please try again.',
|
||||
'import' => 'There was an issue importing users. Please try again.',
|
||||
'asset_already_accepted' => 'This asset has already been accepted.',
|
||||
'accept_or_decline' => 'You must either accept or decline this asset.',
|
||||
'cannot_delete_yourself' => 'We would feel really bad if you deleted yourself, please reconsider.',
|
||||
'incorrect_user_accepted' => 'The asset you have attempted to accept was not checked out to you.',
|
||||
'ldap_could_not_connect' => 'Could not connect to the LDAP server. Please check your LDAP server configuration in the LDAP config file. <br>Error from LDAP Server:',
|
||||
'ldap_could_not_bind' => 'Could not bind to the LDAP server. Please check your LDAP server configuration in the LDAP config file. <br>Error from LDAP Server: ',
|
||||
|
|
Loading…
Reference in a new issue