Skip to content

A free open source IT asset/license management system

Merge branch 'develop' into checkin_non_reassignable_license

Godfrey Mdb9f85e9da60
diff --cc app/Http/Controllers/Licenses/LicenseCheckinController.php
index 4f7f7397ef,2a17c06d62..2bb2d5e68e
--- a/app/Http/Controllers/Licenses/LicenseCheckinController.php
+++ b/app/Http/Controllers/Licenses/LicenseCheckinController.php
@@@ -91,19 -98,19 +93,22 @@@ class LicenseCheckinController extends
$licenseSeat->assigned_to = null;
$licenseSeat->asset_id = null;
$licenseSeat->notes = $request->input('notes');
+ if (! $licenseSeat->license->reassignable) {
+ $licenseSeat->unreassignable_seat = true;
+ }
session()->put(['redirect_option' => $request->get('redirect_option')]);
-
+ if ($request->get('redirect_option') === 'target'){
+ session()->put(['checkout_to_type' => 'user']);
+ }
// Was the asset updated?
if ($licenseSeat->save()) {
- event(new CheckoutableCheckedIn($licenseSeat, $return_to, auth()->user(), $request->input('notes')));
+ event(new CheckoutableCheckedIn($licenseSeat, $return_to, auth()->user(), $licenseSeat->notes));
- return redirect()->to(Helper::getRedirectOption($request, $license->id, 'Licenses'))->with('success', trans('admin/licenses/message.checkin.success'));
+ return Helper::getRedirectOption($request, $license->id, 'Licenses')
+ ->with('success', trans('admin/licenses/message.checkin.success'));
}
// Redirect to the license page with error
diff --cc app/Http/Transformers/LicenseSeatsTransformer.php
index 9868876295,57f4087e9f..17025e7f9f
--- a/app/Http/Transformers/LicenseSeatsTransformer.php
+++ b/app/Http/Transformers/LicenseSeatsTransformer.php
@@@ -47,13 -52,8 +51,9 @@@ class LicenseSeatsTransforme
'reassignable' => (bool) $seat->license->reassignable,
'notes' => e($seat->notes),
'user_can_checkout' => (($seat->assigned_to == '') && ($seat->asset_id == '')),
+ 'disabled' => $seat->unreassignable_seat,
];
- if ($seat_count != 0) {
- $array['name'] = trans('admin/licenses/general.seat_count', ['count' => $seat_count]);
- }
-
$permissions_array['available_actions'] = [
'checkout' => Gate::allows('checkout', License::class),
'checkin' => Gate::allows('checkin', License::class),
diff --cc app/Models/License.php
index 490a8401a4,ddcac30d4c..ecd1b003e3
--- a/app/Models/License.php
+++ b/app/Models/License.php
@@@ -603,10 -590,10 +606,10 @@@ class License extends Depreciabl
* Calculates the number of remaining seats
*
* @author A. Gianotto <[email protected]>
- * @since [v1.0]
+ * @since [v1.0]
* @return int
*/
- public function remaincount()
+ public function remaincount() : int
{
$total = $this->licenseSeatsCount;
$taken = $this->assigned_seats_count;
diff --cc resources/views/licenses/view.blade.php
index 3100ee2cb3,8466aebb11..591870c544
--- a/resources/views/licenses/view.blade.php
+++ b/resources/views/licenses/view.blade.php
@@@ -573,24 -582,31 +582,24 @@@
{{ trans('admin/licenses/general.bulk.checkin_all.button') }}
</a>
</span>
- @elseif (! $license->reassignable)
- <span data-tooltip="true" title=" {{ trans('admin/licenses/general.bulk.checkin_all.disabled_tooltip_reassignable') }}">
- <a href="#" class="btn btn-primary bg-purple btn-sm btn-social btn-block hidden-print disabled" style="margin-bottom: 25px;">
- <x-icon type="checkin" />
- {{ trans('admin/licenses/general.bulk.checkin_all.button') }}
- </a>
- </span>
- @else
- <a href="#" class="btn btn-primary bg-purple btn-sm btn-social btn-block hidden-print" style="margin-bottom: 25px;" data-toggle="modal" data-tooltip="true" data-target="#checkinFromAllModal" data-content="{{ trans('general.sure_to_delete') }}" data-title="{{ trans('general.delete') }}" onClick="return false;">
- <x-icon type="checkin" />
- {{ trans('admin/licenses/general.bulk.checkin_all.button') }}
- </a>
- @endif
- @endcan
+ @else
+ <a href="#" class="btn btn-primary bg-purple btn-sm btn-social btn-block hidden-print" style="margin-bottom: 25px;" data-toggle="modal" data-tooltip="true" data-target="#checkinFromAllModal" data-content="{{ trans('general.sure_to_delete') }} data-title="{{ trans('general.delete') }}" onClick="return false;">
+ <x-icon type="checkin" />
+ {{ trans('admin/licenses/general.bulk.checkin_all.button') }}
+ </a>
+ @endif
+ @endcan
- @can('delete', $license)
+ @can('delete', $license)
- @if ($license->availCount()->count() == $license->seats)
- <button class="btn btn-block btn-danger btn-sm btn-social delete-license" data-toggle="modal" data-title="{{ trans('general.delete') }}" data-content="{{ trans('general.delete_confirm', ['item' => $license->name]) }}" data-target="#dataConfirmModal">
- <x-icon type="delete" />
- {{ trans('general.delete') }}
- </button>
- @else
+ @if ($license->availCount()->count() == $license->seats)
+ <a class="btn btn-block btn-danger btn-sm btn-social delete-asset" data-icon="fa fa trash" data-toggle="modal" data-title="{{ trans('general.delete') }}" data-content="{{ trans('general.delete_confirm', ['item' => $license->name]) }}" data-target="#dataConfirmModal" onClick="return false;">
+ <x-icon type="delete" />
+ {{ trans('general.delete') }}
+ </a>
+ @else
<span data-tooltip="true" title=" {{ trans('admin/licenses/general.delete_disabled') }}">
- <a href="#" class="btn btn-block btn-danger btn-sm btn-social delete-license disabled">
+ <a href="#" class="btn btn-block btn-danger btn-sm btn-social delete-asset disabled" onClick="return false;">
<x-icon type="delete" />
{{ trans('general.delete') }}
</a>