From b2940f9915d32e95b9af62b3d8d33e76b3d45783 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 16 Apr 2023 12:29:48 -0700 Subject: [PATCH 01/56] Added confirm modal Signed-off-by: snipe --- .../views/modals/confirm-action.blade.php | 31 +++++++++++++++++++ resources/views/modals/upload-file.blade.php | 2 +- routes/web/licenses.php | 11 +++++++ 3 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 resources/views/modals/confirm-action.blade.php diff --git a/resources/views/modals/confirm-action.blade.php b/resources/views/modals/confirm-action.blade.php new file mode 100644 index 000000000..2d1a7fcd3 --- /dev/null +++ b/resources/views/modals/confirm-action.blade.php @@ -0,0 +1,31 @@ + + diff --git a/resources/views/modals/upload-file.blade.php b/resources/views/modals/upload-file.blade.php index f87e3e496..09c53751c 100644 --- a/resources/views/modals/upload-file.blade.php +++ b/resources/views/modals/upload-file.blade.php @@ -4,7 +4,7 @@ + +@can('update', \App\Models\License::class) + @include ('modals.confirm-action', ['item_type' => 'user', 'item_id' => $user->id]) +@endcan + @can('update', \App\Models\License::class) @include ('modals.upload-file', ['item_type' => 'license', 'item_id' => $license->id]) @endcan From 8183b8deba55bda182296fd57e4270cc61c7fe28 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 16 Apr 2023 12:30:02 -0700 Subject: [PATCH 03/56] Added stub method Signed-off-by: snipe --- .../Licenses/LicenseCheckinController.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/Http/Controllers/Licenses/LicenseCheckinController.php b/app/Http/Controllers/Licenses/LicenseCheckinController.php index 257722b00..d1c760749 100644 --- a/app/Http/Controllers/Licenses/LicenseCheckinController.php +++ b/app/Http/Controllers/Licenses/LicenseCheckinController.php @@ -112,4 +112,19 @@ class LicenseCheckinController extends Controller // Redirect to the license page with error return redirect()->route('licenses.index')->with('error', trans('admin/licenses/message.checkin.error')); } + + /** + * Bulk checkin all license seats + * + * @author [A. Gianotto] [] + * @see LicenseCheckinController::create() method that provides the form view + * @since [v6.1.1] + * @return \Illuminate\Http\RedirectResponse + * @throws \Illuminate\Auth\Access\AuthorizationException + */ + + public function bulkCheckin() { + + } + } From 79ff6a8fc2f88bac72bbff799ec534dfbd317cc2 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 16 Apr 2023 12:30:23 -0700 Subject: [PATCH 04/56] Disallow deleting in the API view if there are things checked out Signed-off-by: snipe --- app/Http/Transformers/LicensesTransformer.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Transformers/LicensesTransformer.php b/app/Http/Transformers/LicensesTransformer.php index 3c389a1b1..8df6b89f1 100644 --- a/app/Http/Transformers/LicensesTransformer.php +++ b/app/Http/Transformers/LicensesTransformer.php @@ -56,7 +56,7 @@ class LicensesTransformer 'checkin' => Gate::allows('checkin', License::class), 'clone' => Gate::allows('create', License::class), 'update' => Gate::allows('update', License::class), - 'delete' => Gate::allows('delete', License::class), + 'delete' => (Gate::allows('delete', License::class) && ($license->seats == $license->availCount()->count())) ? true : false, ]; $array += $permissions_array; From 8e5042418a2d0b13e6c563100babb92433ac5b3a Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 16 Apr 2023 12:30:32 -0700 Subject: [PATCH 05/56] Added buttons Signed-off-by: snipe --- resources/views/licenses/view.blade.php | 40 +++++++++++++++++++++++-- 1 file changed, 37 insertions(+), 3 deletions(-) diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index 28fe510b7..d879f29d1 100755 --- a/resources/views/licenses/view.blade.php +++ b/resources/views/licenses/view.blade.php @@ -82,7 +82,7 @@
-
+
@if (!is_null($license->company)) @@ -378,8 +378,41 @@
-
-
+ +
+ + @can('update', $license) + {{ trans('admin/licenses/general.edit') }} + {{ trans('admin/licenses/general.clone') }} + @endcan + + @can('checkout', $license) + @if ($license->availCount()->count() > 0) + Checkout + Checkout Remaining to All Users + @else + Checkout + Checkout Remaining to All Users + @endif + @endcan + + @can('checkin', $license) + @if (($license->seats - $license->availCount()->count()) > 0 ) + Checkin All + @endif + @endcan + + @can('delete', $license) + + @if ($license->availCount()->count() == 0) + {{ trans('general.delete') }} + @else + {{ trans('general.delete') }} + @endif + @endcan +
+
+ @@ -555,6 +588,7 @@ + From 06d46a452300c8732c1787bf6d1eab90acf35067 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 16 Apr 2023 15:17:55 -0700 Subject: [PATCH 06/56] Indenting change for clarity Signed-off-by: snipe --- resources/views/users/view.blade.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index a130d1629..c7a07cbc1 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -122,7 +122,8 @@ @endcan @can('update', \App\Models\User::class) -
  • +
  • + From cf7f244942c4e1f43b9032b7fb8b1f812925ca9b Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 16 Apr 2023 15:19:37 -0700 Subject: [PATCH 07/56] Added (clarified?) edit autoassign_licenses in user edit Signed-off-by: snipe --- resources/views/users/edit.blade.php | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/resources/views/users/edit.blade.php b/resources/views/users/edit.blade.php index a94f0734b..34005e9bc 100755 --- a/resources/views/users/edit.blade.php +++ b/resources/views/users/edit.blade.php @@ -370,6 +370,20 @@ + + +
    +
    + + + +

    {{ trans('general.autoassign_licenses_help_long') }}

    +
    +
    +
    @@ -383,15 +397,6 @@
    - -
    -
    - -
    -
    @include ('partials.forms.edit.location-select', ['translated_name' => trans('general.location'), 'fieldname' => 'location_id']) @@ -444,8 +449,8 @@
    -
    - {!! Form::countries('country', old('country', $user->country), 'col-md-6 select2') !!} +
    + {!! Form::countries('country', old('country', $user->country), 'col-md-12 select2') !!} {!! $errors->first('country', '') !!}
    From 73188df0909882bea32bd263020567963510c941 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 16 Apr 2023 15:22:37 -0700 Subject: [PATCH 08/56] Added autoassign_licenses to bulk user edit Signed-off-by: snipe --- resources/views/users/bulk-edit.blade.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/resources/views/users/bulk-edit.blade.php b/resources/views/users/bulk-edit.blade.php index 10ae6261d..f1e84a0f8 100644 --- a/resources/views/users/bulk-edit.blade.php +++ b/resources/views/users/bulk-edit.blade.php @@ -119,6 +119,29 @@
    + +
    +
    + {{ trans('general.autoassign_licenses') }} +
    +
    + + + + + +
    +
    +
    From bc7c0aa80d7127380227bba0c6b757a1eb788781 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 16 Apr 2023 15:23:00 -0700 Subject: [PATCH 09/56] Fixed clone tooltip Signed-off-by: snipe --- resources/views/partials/bootstrap-table.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index 9c4932376..3697e7f72 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -261,7 +261,7 @@ } if ((row.available_actions) && (row.available_actions.clone === true)) { - actions += 'Clone '; + actions += 'Clone '; } if ((row.available_actions) && (row.available_actions.update === true)) { From ff9af7ea740b1148f266fbde3c6dd92d3723e9ae Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 16 Apr 2023 15:23:15 -0700 Subject: [PATCH 10/56] Added genetic modal partial Signed-off-by: snipe --- resources/views/modals/confirm-action.blade.php | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/resources/views/modals/confirm-action.blade.php b/resources/views/modals/confirm-action.blade.php index 2d1a7fcd3..14e97fdd4 100644 --- a/resources/views/modals/confirm-action.blade.php +++ b/resources/views/modals/confirm-action.blade.php @@ -1,31 +1,27 @@ -
  • - - - @can('update', $license) - - @endcan - + @can('update', \App\Models\License::class)
  • {{ trans('button.upload') }} @@ -392,7 +378,7 @@ {{ trans('general.checkout') }} - + {{ trans('admin/licenses/general.bulk.checkout_all.button') }} @@ -401,7 +387,7 @@ {{ trans('general.checkout') }} - + {{ trans('admin/licenses/general.bulk.checkout_all.button') }} @@ -411,12 +397,12 @@ @can('checkin', $license) @if (($license->seats - $license->availCount()->count()) > 0 ) - + {{ trans('admin/licenses/general.bulk.checkin_all.button') }} @else - + {{ trans('admin/licenses/general.bulk.checkin_all.button') }} From 8a41f37054ea633092c6ac994844d72d7b4abec3 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:00:06 -0700 Subject: [PATCH 36/56] Persists buttons through tabs Signed-off-by: snipe --- resources/views/licenses/view.blade.php | 111 +++++++++++++----------- 1 file changed, 58 insertions(+), 53 deletions(-) diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index a6b2b8e75..fdd24d437 100755 --- a/resources/views/licenses/view.blade.php +++ b/resources/views/licenses/view.blade.php @@ -10,7 +10,7 @@ {{-- Page content --}} @section('content')
    -
    +
    -
    - @can('update', $license) - {{ trans('admin/licenses/general.edit') }} - {{ trans('admin/licenses/general.clone') }} - @endcan - - @can('checkout', $license) - - @if ($license->availCount()->count() > 0) - - {{ trans('general.checkout') }} - - - {{ trans('admin/licenses/general.bulk.checkout_all.button') }} - - - @else - - {{ trans('general.checkout') }} - - - - {{ trans('admin/licenses/general.bulk.checkout_all.button') }} - - - @endif - @endcan - - @can('checkin', $license) - - @if (($license->seats - $license->availCount()->count()) > 0 ) - - {{ trans('admin/licenses/general.bulk.checkin_all.button') }} - - @else - - - {{ trans('admin/licenses/general.bulk.checkin_all.button') }} - - - @endif - @endcan - - @can('delete', $license) - - @if ($license->availCount()->count() == $license->seats) - {{ trans('general.delete') }} - @else - {{ trans('general.delete') }} - @endif - @endcan -
    @@ -590,11 +538,68 @@ + + + + +
    + + @can('update', $license) + {{ trans('admin/licenses/general.edit') }} + {{ trans('admin/licenses/general.clone') }} + @endcan + + @can('checkout', $license) + + @if ($license->availCount()->count() > 0) + + {{ trans('general.checkout') }} + + + {{ trans('admin/licenses/general.bulk.checkout_all.button') }} + + + @else + + {{ trans('general.checkout') }} + + + + {{ trans('admin/licenses/general.bulk.checkout_all.button') }} + + + @endif + @endcan + + @can('checkin', $license) + + @if (($license->seats - $license->availCount()->count()) > 0 ) + + {{ trans('admin/licenses/general.bulk.checkin_all.button') }} + + @else + + + {{ trans('admin/licenses/general.bulk.checkin_all.button') }} + + + @endif + @endcan + + @can('delete', $license) + + @if ($license->availCount()->count() == $license->seats) + {{ trans('general.delete') }} + @else + {{ trans('general.delete') }} + @endif + @endcan +
    From 3e53870b37df3fea4cf9b4bbcb1433fa2c55eb30 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:00:13 -0700 Subject: [PATCH 37/56] Updated language Signed-off-by: snipe --- resources/lang/en/admin/licenses/general.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/resources/lang/en/admin/licenses/general.php b/resources/lang/en/admin/licenses/general.php index c26ab05e7..98ed9f195 100644 --- a/resources/lang/en/admin/licenses/general.php +++ b/resources/lang/en/admin/licenses/general.php @@ -31,12 +31,13 @@ return array( 'checkout_all' => [ 'button' => 'Checkout All Seats', - 'modal' => 'This will action check in one seat to the first available user. | This action will checkout all :available_seats_count seats to the first available users. ', + 'modal' => 'This action will checkout one seat to the first available user. | This action will checkout all :available_seats_count seats to the first available users. ', 'enabled_tooltip' => 'Checkout ALL seats (or as many as are available) to ALL users', 'disabled_tooltip' => 'This is disabled because there are no seats currently available', 'success' => 'License successfully checked out! | :count licenses were successfully checked out!', 'error_no_seats' => 'There are no remaining seats left for this license.', 'warn_not_enough_seats' => ':count users were assigned this license, but we ran out of available license seats.', + 'warn_no_avail_users' => 'Nothing to do. There are no users who do not already have this license assigned to them.', 'log_msg' => 'Checked out via bulk license checkout in license GUI', From e84ba0c7a02909512c52b331eee6b6c66c82d8cb Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:06:32 -0700 Subject: [PATCH 38/56] Revert back to old method name Signed-off-by: snipe --- app/Models/License.php | 78 ++++++++++++++++++++++++++---------------- 1 file changed, 49 insertions(+), 29 deletions(-) diff --git a/app/Models/License.php b/app/Models/License.php index 4261b1fc4..2fc0aafe6 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -106,10 +106,10 @@ class License extends Depreciable * @var array */ protected $searchableRelations = [ - 'manufacturer' => ['name'], - 'company' => ['name'], - 'category' => ['name'], - 'depreciation' => ['name'], + 'manufacturer' => ['name'], + 'company' => ['name'], + 'category' => ['name'], + 'depreciation' => ['name'], ]; /** @@ -425,7 +425,7 @@ class License extends Depreciable public static function assetcount() { return LicenseSeat::whereNull('deleted_at') - ->count(); + ->count(); } @@ -441,8 +441,8 @@ class License extends Depreciable public function totalSeatsByLicenseID() { return LicenseSeat::where('license_id', '=', $this->id) - ->whereNull('deleted_at') - ->count(); + ->whereNull('deleted_at') + ->count(); } /** @@ -455,29 +455,49 @@ class License extends Depreciable * @since [v2.0] * @return \Illuminate\Database\Eloquent\Relations\Relation */ - public function seats() + public function licenseSeatsRelation() { return $this->hasMany(LicenseSeat::class)->whereNull('deleted_at')->selectRaw('license_id, count(*) as count')->groupBy('license_id'); } - /** - * Returns the number of total available seats for this license - * @todo - refactor all of these weird counters for licenses. The relationships are donked, yo. + * Sets the license seat count attribute * * @author A. Gianotto * @since [v2.0] * @return int */ - public function availableSeats() + public function getLicenseSeatsCountAttribute() + { + if ($this->licenseSeatsRelation->first()) { + return $this->licenseSeatsRelation->first()->count; + } + + return 0; + } + + /** + * Returns the number of total available seats across all licenses + * + * @author A. Gianotto + * @since [v2.0] + * @return int + */ + public static function availassetcount() { return LicenseSeat::whereNull('assigned_to') - ->where('license_id', '=', $this->id) ->whereNull('asset_id') ->whereNull('deleted_at') ->count(); } + public function availableSeats() + { + return LicenseSeat::whereNull('assigned_to') + ->whereNull('asset_id') + ->whereNull('deleted_at'); + } + /** * Returns the number of total available seats for this license * @@ -487,7 +507,7 @@ class License extends Depreciable */ public function availCount() { - return $this->seats() + return $this->licenseSeatsRelation() ->whereNull('asset_id') ->whereNull('assigned_to') ->whereNull('deleted_at'); @@ -518,9 +538,9 @@ class License extends Depreciable */ public function assignedCount() { - return $this->seats()->where(function ($query) { + return $this->licenseSeatsRelation()->where(function ($query) { $query->whereNotNull('assigned_to') - ->orWhereNotNull('asset_id'); + ->orWhereNotNull('asset_id'); }); } @@ -608,13 +628,13 @@ class License extends Depreciable public function freeSeat() { return $this->licenseseats() - ->whereNull('deleted_at') - ->where(function ($query) { - $query->whereNull('assigned_to') - ->whereNull('asset_id'); - }) - ->orderBy('id', 'asc') - ->first(); + ->whereNull('deleted_at') + ->where(function ($query) { + $query->whereNull('assigned_to') + ->whereNull('asset_id'); + }) + ->orderBy('id', 'asc') + ->first(); } @@ -644,11 +664,11 @@ class License extends Depreciable $days = (is_null($days)) ? 60 : $days; return self::whereNotNull('expiration_date') - ->whereNull('deleted_at') - ->whereRaw(DB::raw('DATE_SUB(`expiration_date`,INTERVAL '.$days.' DAY) <= DATE(NOW()) ')) - ->where('expiration_date', '>', date('Y-m-d')) - ->orderBy('expiration_date', 'ASC') - ->get(); + ->whereNull('deleted_at') + ->whereRaw(DB::raw('DATE_SUB(`expiration_date`,INTERVAL '.$days.' DAY) <= DATE(NOW()) ')) + ->where('expiration_date', '>', date('Y-m-d')) + ->orderBy('expiration_date', 'ASC') + ->get(); } /** @@ -692,4 +712,4 @@ class License extends Depreciable return $query->leftJoin('companies as companies', 'licenses.company_id', '=', 'companies.id')->select('licenses.*') ->orderBy('companies.name', $order); } -} +} \ No newline at end of file From a8a3ca3624e5d12a6b8179411e772dfa1c5df0d2 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:06:42 -0700 Subject: [PATCH 39/56] Use count on availSeats Signed-off-by: snipe --- app/Http/Controllers/Licenses/LicensesController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/Licenses/LicensesController.php b/app/Http/Controllers/Licenses/LicensesController.php index f298bec89..5113a42a6 100755 --- a/app/Http/Controllers/Licenses/LicensesController.php +++ b/app/Http/Controllers/Licenses/LicensesController.php @@ -236,7 +236,7 @@ class LicensesController extends Controller $license = License::with('assignedusers')->find($licenseId); $users_count = User::where('autoassign_licenses', '1')->count(); $total_seats_count = $license->totalSeatsByLicenseID(); - $available_seats_count = $license->availableSeats(); + $available_seats_count = $license->availableSeats()->count(); $checkedout_seats_count = ($total_seats_count - $available_seats_count); From dc6eb6f10454a1d8d7054d69e07f5965710d4001 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:07:17 -0700 Subject: [PATCH 40/56] Throw a warning if there were no users affected Signed-off-by: snipe --- app/Http/Controllers/Licenses/LicenseCheckoutController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/Http/Controllers/Licenses/LicenseCheckoutController.php b/app/Http/Controllers/Licenses/LicenseCheckoutController.php index 4eb108afc..a71049769 100644 --- a/app/Http/Controllers/Licenses/LicenseCheckoutController.php +++ b/app/Http/Controllers/Licenses/LicenseCheckoutController.php @@ -184,6 +184,10 @@ class LicenseCheckoutController extends Controller } } + if ($assigned_count == 0) { + return redirect()->back()->with('warning', trans('admin/licenses/general.bulk.checkout_all.warn_no_avail_users', ['count' => $assigned_count])); + } + return redirect()->back()->with('success', trans_choice('admin/licenses/general.bulk.checkout_all.success', 2, ['count' => $assigned_count] )); From 9da36833be771dc06444a7367125723dcd0eb1de Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:43:44 -0700 Subject: [PATCH 41/56] Removed unused method Signed-off-by: snipe --- app/Models/License.php | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/Models/License.php b/app/Models/License.php index 2fc0aafe6..162b3d662 100755 --- a/app/Models/License.php +++ b/app/Models/License.php @@ -491,12 +491,6 @@ class License extends Depreciable ->count(); } - public function availableSeats() - { - return LicenseSeat::whereNull('assigned_to') - ->whereNull('asset_id') - ->whereNull('deleted_at'); - } /** * Returns the number of total available seats for this license From 41490f1e3a2400260b14a2b72c7603d1d15dd623 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:43:59 -0700 Subject: [PATCH 42/56] =?UTF-8?q?Use=20=E2=80=9Cname=E2=80=9D=20instead=20?= =?UTF-8?q?of=20=E2=80=9Clicense=E2=80=9D=20for=20consistency?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: snipe --- app/Presenters/LicensePresenter.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Presenters/LicensePresenter.php b/app/Presenters/LicensePresenter.php index 1e8784f2f..5a44bf52a 100644 --- a/app/Presenters/LicensePresenter.php +++ b/app/Presenters/LicensePresenter.php @@ -33,7 +33,7 @@ class LicensePresenter extends Presenter 'field' => 'name', 'searchable' => true, 'sortable' => true, - 'title' => trans('admin/licenses/table.title'), + 'title' => trans('general.name'), 'formatter' => 'licensesLinkFormatter', ], [ 'field' => 'product_key', From beba31afbf5d6b21afda879fd08a851b7f409b72 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:44:09 -0700 Subject: [PATCH 43/56] Added tooltip for disabled delete buttons Signed-off-by: snipe --- resources/lang/en/admin/licenses/general.php | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lang/en/admin/licenses/general.php b/resources/lang/en/admin/licenses/general.php index 98ed9f195..4e0c8af5f 100644 --- a/resources/lang/en/admin/licenses/general.php +++ b/resources/lang/en/admin/licenses/general.php @@ -18,6 +18,7 @@ return array( 'software_licenses' => 'Software Licenses', 'user' => 'User', 'view' => 'View License', + 'delete_disabled' => 'This license cannot be deleted yet because some seats are still checked out.', 'bulk' => [ 'checkin_all' => [ From 4d09021e9c2243983b8e10c0c2052141c26c8164 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:44:19 -0700 Subject: [PATCH 44/56] Compact tooltip for un-deletable Signed-off-by: snipe --- resources/lang/en/general.php | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/lang/en/general.php b/resources/lang/en/general.php index 3133df222..1b9d9b623 100644 --- a/resources/lang/en/general.php +++ b/resources/lang/en/general.php @@ -445,5 +445,6 @@ return [ 'autoassign_licenses_help_long' => 'This allows a user to be have licenses assigned via the bulk-assign license UI or cli tools. (For example, you might not want contractors to be auto-assigned a license you would provide to only staff members. You can still individually assign licenses to those users, but they will not be included in the Checkout License to All Users functions.)', 'no_autoassign_licenses_help' => 'Do not include user for bulk-assigning through the license UI or cli tools.', 'modal_confirm_generic' => 'Are you sure?', + 'cannot_be_deleted' => 'This item cannot be deleted', ]; From 3a808aa8060ef3c2b610dc6063104a92efd2b522 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:44:33 -0700 Subject: [PATCH 45/56] Updated method for available seat count Signed-off-by: snipe --- app/Http/Controllers/Licenses/LicensesController.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Licenses/LicensesController.php b/app/Http/Controllers/Licenses/LicensesController.php index 5113a42a6..a3607c181 100755 --- a/app/Http/Controllers/Licenses/LicensesController.php +++ b/app/Http/Controllers/Licenses/LicensesController.php @@ -236,9 +236,14 @@ class LicensesController extends Controller $license = License::with('assignedusers')->find($licenseId); $users_count = User::where('autoassign_licenses', '1')->count(); $total_seats_count = $license->totalSeatsByLicenseID(); - $available_seats_count = $license->availableSeats()->count(); + $available_seats_count = $license->availCount()->count(); $checkedout_seats_count = ($total_seats_count - $available_seats_count); + \Log::debug('Total: '.$total_seats_count); + \Log::debug('Users: '.$users_count); + \Log::debug('Available: '.$available_seats_count); + \Log::debug('Checkedout: '.$checkedout_seats_count); + if ($license) { $this->authorize('view', $license); From 7aab4290c71053f37a1be17a86b369f852f7b7d9 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 02:44:50 -0700 Subject: [PATCH 46/56] Updated tooltips with data-tooltip=true from old method Signed-off-by: snipe --- resources/views/custom_fields/index.blade.php | 4 +-- resources/views/groups/edit.blade.php | 6 ++-- resources/views/hardware/view.blade.php | 2 +- resources/views/licenses/view.blade.php | 12 ++++--- .../views/models/custom_fields_form.blade.php | 2 +- .../views/partials/bootstrap-table.blade.php | 32 +++++++++---------- .../forms/edit/minimum_quantity.blade.php | 2 +- .../forms/edit/permissions-base.blade.php | 4 +-- 8 files changed, 33 insertions(+), 31 deletions(-) diff --git a/resources/views/custom_fields/index.blade.php b/resources/views/custom_fields/index.blade.php index d2435d7db..0ad851118 100644 --- a/resources/views/custom_fields/index.blade.php +++ b/resources/views/custom_fields/index.blade.php @@ -21,7 +21,7 @@

    {{ trans('admin/custom_fields/general.fieldsets') }}

    @@ -111,7 +111,7 @@

    {{ trans('admin/custom_fields/general.custom_fields') }}

    diff --git a/resources/views/groups/edit.blade.php b/resources/views/groups/edit.blade.php index f5948e484..cb95b3762 100755 --- a/resources/views/groups/edit.blade.php +++ b/resources/views/groups/edit.blade.php @@ -77,7 +77,7 @@ @unless (empty($localPermission['label'])) @@ -100,7 +100,7 @@

    {{ $area }}

    @@ -122,7 +122,7 @@ {{ $this_permission['label'] }} diff --git a/resources/views/hardware/view.blade.php b/resources/views/hardware/view.blade.php index e33f681f6..ccd3f8653 100755 --- a/resources/views/hardware/view.blade.php +++ b/resources/views/hardware/view.blade.php @@ -456,7 +456,7 @@
    @if ($field->field_encrypted=='1') - + @endif @if ($field->isFieldDecryptable($asset->{$field->db_column_name()} )) diff --git a/resources/views/licenses/view.blade.php b/resources/views/licenses/view.blade.php index fdd24d437..97265349e 100755 --- a/resources/views/licenses/view.blade.php +++ b/resources/views/licenses/view.blade.php @@ -584,10 +584,10 @@ @else - - {{ trans('admin/licenses/general.bulk.checkin_all.button') }} - - + + {{ trans('admin/licenses/general.bulk.checkin_all.button') }} + + @endif @endcan @@ -596,7 +596,9 @@ @if ($license->availCount()->count() == $license->seats) {{ trans('general.delete') }} @else - {{ trans('general.delete') }} + + {{ trans('general.delete') }} + @endif @endcan
    diff --git a/resources/views/models/custom_fields_form.blade.php b/resources/views/models/custom_fields_form.blade.php index 0f3ee9a3e..cbc6a731a 100644 --- a/resources/views/models/custom_fields_form.blade.php +++ b/resources/views/models/custom_fields_form.blade.php @@ -77,7 +77,7 @@ @if ($field->field_encrypted)
    - +
    @endif diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index ccb3963a6..1e1022083 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -215,7 +215,7 @@ text_help = ''; } - return ' ' + value.name + ' ' + text_help + ' '; + return ' ' + value.name + ' ' + text_help + ' '; } else if ((value) && (value.name)) { // Add some overrides for any funny urls we have @@ -261,7 +261,7 @@ } if ((row.available_actions) && (row.available_actions.clone === true)) { - actions += 'Clone '; + actions += 'Clone '; } if ((row.available_actions) && (row.available_actions.update === true)) { @@ -270,20 +270,20 @@ if ((row.available_actions) && (row.available_actions.delete === true)) { actions += '' + 'Delete '; } else { - actions += ' '; + actions += ' '; } if ((row.available_actions) && (row.available_actions.restore === true)) { actions += '
    '; actions += '@csrf'; - actions += ' '; + actions += ' '; } actions +=''; @@ -364,9 +364,9 @@ function licenseSeatInOutFormatter(value, row) { // The user is allowed to check the license seat out and it's available if ((row.available_actions.checkout == true) && (row.user_can_checkout == true) && ((!row.asset_id) && (!row.assigned_to))) { - return '{{ trans('general.checkout') }}'; + return '{{ trans('general.checkout') }}'; } else { - return '{{ trans('general.checkin') }}'; + return '{{ trans('general.checkin') }}'; } } @@ -376,18 +376,18 @@ // The user is allowed to check items out, AND the item is deployable if ((row.available_actions.checkout == true) && (row.user_can_checkout == true) && ((!row.asset_id) && (!row.assigned_to))) { - return '{{ trans('general.checkout') }}'; + return '{{ trans('general.checkout') }}'; // The user is allowed to check items out, but the item is not deployable } else if (((row.user_can_checkout == false)) && (row.available_actions.checkout == true) && (!row.assigned_to)) { - return ''; + return '{{ trans('general.checkout') }}'; // The user is allowed to check items in } else if (row.available_actions.checkin == true) { if (row.assigned_to) { - return '{{ trans('general.checkin') }}'; + return '{{ trans('general.checkin') }}'; } else if (row.assigned_pivot_id) { - return '{{ trans('general.checkin') }}'; + return '{{ trans('general.checkin') }}'; } } @@ -401,11 +401,11 @@ // This is only used by the requestable assets section function assetRequestActionsFormatter (row, value) { if (value.assigned_to_self == true){ - return ''; + return ''; } else if (value.available_actions.cancel == true) { - return '@csrf
    '; + return '
    @csrf
    '; } else if (value.available_actions.request == true) { - return '
    @csrf
    '; + return '
    @csrf
    '; } } @@ -537,7 +537,7 @@ if ((row) && (row!=undefined)) { return '' + row.name + ''; } else if (value.rtd_location) { - return '' + value.rtd_location.name + ''; + return '' + value.rtd_location.name + ''; } } @@ -779,7 +779,7 @@ // This is necessary to make the bootstrap tooltips work inside of the // wenzhixin/bootstrap-table formatters $('#table').on('post-body.bs.table', function () { - $('[data-toggle="tooltip"]').tooltip({ + $('[data-tooltip="true"]').tooltip({ container: 'body' }); diff --git a/resources/views/partials/forms/edit/minimum_quantity.blade.php b/resources/views/partials/forms/edit/minimum_quantity.blade.php index 83b15a124..1566ab2e9 100644 --- a/resources/views/partials/forms/edit/minimum_quantity.blade.php +++ b/resources/views/partials/forms/edit/minimum_quantity.blade.php @@ -6,7 +6,7 @@
    - + {{ trans('general.min_amt_help') }} diff --git a/resources/views/partials/forms/edit/permissions-base.blade.php b/resources/views/partials/forms/edit/permissions-base.blade.php index a702c619a..a6a6abf9e 100644 --- a/resources/views/partials/forms/edit/permissions-base.blade.php +++ b/resources/views/partials/forms/edit/permissions-base.blade.php @@ -4,7 +4,7 @@ @@ -76,7 +76,7 @@ @if ($permission['display']) From df7b19bc1ec31480875374a2a49b61b346099eb3 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 04:35:06 -0700 Subject: [PATCH 47/56] Removed unused validations Signed-off-by: snipe --- resources/lang/en/admin/licenses/general.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/resources/lang/en/admin/licenses/general.php b/resources/lang/en/admin/licenses/general.php index 4e0c8af5f..6d6d34581 100644 --- a/resources/lang/en/admin/licenses/general.php +++ b/resources/lang/en/admin/licenses/general.php @@ -43,8 +43,5 @@ return array( ], - - 'checkout' => 'The :attribute must be between :min - :max characters.', - 'array' => 'The :attribute must have between :min and :max items.', ], ); From 0eadc00f4d0315b9cf35b94b17939851482f121c Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 04:37:04 -0700 Subject: [PATCH 48/56] Removed unneeded css class Signed-off-by: snipe --- resources/views/modals/confirm-action.blade.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/views/modals/confirm-action.blade.php b/resources/views/modals/confirm-action.blade.php index 14e97fdd4..135a9799e 100644 --- a/resources/views/modals/confirm-action.blade.php +++ b/resources/views/modals/confirm-action.blade.php @@ -1,5 +1,5 @@ - From 031586495ad8e54736675a41e109114feb82e907 Mon Sep 17 00:00:00 2001 From: snipe Date: Tue, 18 Apr 2023 12:09:41 -0700 Subject: [PATCH 56/56] Small cosmetic tweaks to 2FA reset class, fixed weird layout on 2FA reset button Signed-off-by: snipe --- resources/views/users/view.blade.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/views/users/view.blade.php b/resources/views/users/view.blade.php index fdbd9cfb1..47d6dea32 100755 --- a/resources/views/users/view.blade.php +++ b/resources/views/users/view.blade.php @@ -602,11 +602,11 @@
    - +
    -
    +
    - + {{ trans('admin/settings/general.two_factor_reset') }} @@ -1043,9 +1043,9 @@ $(function () { dataType: 'json', success: function (data) { - $("#two_factor_reset_toggle").html('').html(' {{ trans('general.no') }}'); + $("#two_factor_reset_toggle").html('').html(' {{ trans('general.no') }}'); $("#two_factor_reseticon").html(''); - $("#two_factor_resetstatus").html('' + data.message); + $("#two_factor_resetstatus").html(' ' + data.message + ''); },