From 22bc088f6f9f91407cd74530ffed94b88d316c72 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 27 Aug 2024 07:21:19 +0100 Subject: [PATCH] Added start_date and end_date to user bulk edit Signed-off-by: snipe --- .../Controllers/Users/BulkUsersController.php | 13 ++++++- resources/lang/en-US/general.php | 2 +- resources/views/hardware/bulk.blade.php | 10 ++--- resources/views/users/bulk-edit.blade.php | 37 +++++++++++++++++++ 4 files changed, 54 insertions(+), 8 deletions(-) diff --git a/app/Http/Controllers/Users/BulkUsersController.php b/app/Http/Controllers/Users/BulkUsersController.php index 1a8f84b7a1..12dc14e29f 100644 --- a/app/Http/Controllers/Users/BulkUsersController.php +++ b/app/Http/Controllers/Users/BulkUsersController.php @@ -30,7 +30,7 @@ class BulkUsersController extends Controller * @author [A. Gianotto] [] * @since [v1.7] * @param Request $request - * @return \Illuminate\Contracts\View\View + * @return \Illuminate\Contracts\View\View | \Illuminate\Http\RedirectResponse * @throws \Illuminate\Auth\Access\AuthorizationException */ public function edit(Request $request) @@ -116,6 +116,8 @@ class BulkUsersController extends Controller ->conditionallyAddItem('remote') ->conditionallyAddItem('ldap_import') ->conditionallyAddItem('activated') + ->conditionallyAddItem('start_date') + ->conditionallyAddItem('end_date') ->conditionallyAddItem('autoassign_licenses'); @@ -146,7 +148,14 @@ class BulkUsersController extends Controller $this->update_array['company_id'] = null; } - + if ($request->input('null_start_date')=='1') { + $this->update_array['start_date'] = null; + } + + if ($request->input('null_end_date')=='1') { + $this->update_array['end_date'] = null; + } + if (! $manager_conflict) { $this->conditionallyAddItem('manager_id'); } diff --git a/resources/lang/en-US/general.php b/resources/lang/en-US/general.php index 4ebf1b8977..3092228674 100644 --- a/resources/lang/en-US/general.php +++ b/resources/lang/en-US/general.php @@ -419,7 +419,7 @@ return [ 'bulk_soft_delete' =>'Also soft-delete these users. Their asset history will remain intact unless/until you purge deleted records in the Admin Settings.', 'bulk_checkin_delete_success' => 'Your selected users have been deleted and their items have been checked in.', 'bulk_checkin_success' => 'The items for the selected users have been checked in.', - 'set_to_null' => 'Delete values for this asset|Delete values for all :asset_count assets ', + 'set_to_null' => 'Delete values for this selection|Delete values for all :selection_count selections ', 'set_users_field_to_null' => 'Delete :field values for this user|Delete :field values for all :user_count users ', 'na_no_purchase_date' => 'N/A - No purchase date provided', 'assets_by_status' => 'Assets by Status', diff --git a/resources/views/hardware/bulk.blade.php b/resources/views/hardware/bulk.blade.php index d36513e889..644637ff2d 100755 --- a/resources/views/hardware/bulk.blade.php +++ b/resources/views/hardware/bulk.blade.php @@ -48,7 +48,7 @@
@@ -67,11 +67,11 @@
- +
@@ -86,7 +86,7 @@
@@ -189,7 +189,7 @@
diff --git a/resources/views/users/bulk-edit.blade.php b/resources/views/users/bulk-edit.blade.php index e1d3b4201a..7235035760 100644 --- a/resources/views/users/bulk-edit.blade.php +++ b/resources/views/users/bulk-edit.blade.php @@ -218,6 +218,43 @@
@endif + + + + +
+ +
+
+ + +
+ {!! $errors->first('start_date', ' :message') !!} +
+
+ +
+
+ + +
+ +
+
+ + +
+ {!! $errors->first('end_date', ' :message') !!} +
+
+ +