Fix for wrong math on remaining licenses when assigned to an asset
This commit is contained in:
+10
-7
@@ -112,12 +112,16 @@ class License extends Elegant
|
||||
*/
|
||||
public function assignedcount()
|
||||
{
|
||||
return DB::table('license_seats')
|
||||
->whereNotNull('assigned_to')
|
||||
->whereNotNull('asset_id')
|
||||
->where('license_id', '=', $this->id)
|
||||
->whereNull('deleted_at')
|
||||
->count();
|
||||
|
||||
return LicenseSeat::where('license_id', '=', $this->id)
|
||||
->where( function ( $query )
|
||||
{
|
||||
$query->whereNotNull('assigned_to')
|
||||
->orWhereNotNull('asset_id');
|
||||
})
|
||||
->count();
|
||||
|
||||
|
||||
}
|
||||
|
||||
public function remaincount()
|
||||
@@ -125,7 +129,6 @@ class License extends Elegant
|
||||
$total = $this->totalSeatsByLicenseID();
|
||||
$taken = $this->assignedcount();
|
||||
$diff = ($total - $taken);
|
||||
|
||||
return $diff;
|
||||
}
|
||||
|
||||
|
||||
@@ -143,9 +143,9 @@
|
||||
@endif
|
||||
</td>
|
||||
<td nowrap="nowrap">
|
||||
<a href="{{ route('update/hardware', $asset->id) }}" class="btn btn-warning"><i class="icon-pencil icon-white"></i></a>
|
||||
|
||||
@if ($asset->deleted_at=='')
|
||||
<a href="{{ route('update/hardware', $asset->id) }}" class="btn btn-warning"><i class="icon-pencil icon-white"></i></a>
|
||||
<a data-html="false" class="btn delete-asset btn-danger" data-toggle="modal" href="{{ route('delete/hardware', $asset->id) }}" data-content="@lang('admin/hardware/message.delete.confirm')"
|
||||
data-title="@lang('general.delete')
|
||||
{{ htmlspecialchars($asset->asset_tag) }}?" onClick="return false;"><i class="icon-trash icon-white"></i></a>
|
||||
|
||||
Reference in New Issue
Block a user