diff --git a/app/controllers/admin/LicensesController.php b/app/controllers/admin/LicensesController.php index c9b983ca8c58..20f4560990d1 100644 --- a/app/controllers/admin/LicensesController.php +++ b/app/controllers/admin/LicensesController.php @@ -241,13 +241,13 @@ public function getCheckout($assetId) /** * Check out the asset to a person **/ - public function postCheckout($assetId) + public function postCheckout($seatId) { // Check if the asset exists - if (is_null($license = License::find($assetId))) + if (is_null($licenseseat = LicenseSeat::find($seatId))) { // Redirect to the asset management page with error - return Redirect::to('admin/licenses')->with('error', Lang::get('admin/assets/message.not_found')); + return Redirect::to('admin/licenses')->with('error', Lang::get('admin/licenses/message.not_found')); } $assigned_to = e(Input::get('assigned_to')); @@ -277,15 +277,15 @@ public function postCheckout($assetId) // Update the asset data - $license->assigned_to = e(Input::get('assigned_to')); + $licenseseat->assigned_to = e(Input::get('assigned_to')); // Was the asset updated? - if($license->save()) + if($licenseseat->save()) { $logaction = new Actionlog(); - $logaction->asset_id = $license->id; - $logaction->checkedout_to = $license->assigned_to; + $logaction->asset_id = $licenseseat->id; + $logaction->checkedout_to = $licenseseat->assigned_to; $logaction->location_id = $assigned_to->location_id; $logaction->asset_type = 'software'; $logaction->user_id = Sentry::getUser()->id; @@ -302,25 +302,25 @@ public function postCheckout($assetId) /** * Check in the item so that it can be checked out again to someone else **/ - public function postCheckin($assetId) + public function postCheckin($seatId) { // Check if the asset exists - if (is_null($license = License::find($assetId))) + if (is_null($licenseseat = LicenseSeat::find($seatId))) { // Redirect to the asset management page with error return Redirect::to('admin/licenses')->with('error', Lang::get('admin/assets/message.not_found')); } $logaction = new Actionlog(); - $logaction->checkedout_to = $license->assigned_to; + $logaction->checkedout_to = $licenseseat->assigned_to; // Update the asset data - $license->assigned_to = ''; + $licenseseat->assigned_to = ''; // Was the asset updated? - if($license->save()) + if($licenseseat->save()) { - $logaction->asset_id = $license->id; + $logaction->asset_id = $licenseseat->id; $logaction->location_id = NULL; $logaction->asset_type = 'software'; $logaction->user_id = Sentry::getUser()->id; diff --git a/app/models/Actionlog.php b/app/models/Actionlog.php index d7c44026970c..df38459fca74 100644 --- a/app/models/Actionlog.php +++ b/app/models/Actionlog.php @@ -7,7 +7,11 @@ class ActionLog extends Eloquent { public function assetlog() { - return $this->belongsTo('Asset','asset_id')->withTrashed(); + return $this->belongsTo('Asset','asset_id'); + } + + public function licenselog() { + return $this->belongsTo('License','asset_id'); } public function adminlog() { diff --git a/app/models/License.php b/app/models/License.php index 05e046a6e901..c258fe09ab34 100644 --- a/app/models/License.php +++ b/app/models/License.php @@ -38,7 +38,7 @@ public function assetloc() public function assetlog() { return $this->hasMany('Actionlog','asset_id') - ->where('checkedout_to', '=', '0') + ->where('asset_type', '=', 'software') ->orderBy('added_on', 'desc'); } diff --git a/app/views/backend/licenses/view.blade.php b/app/views/backend/licenses/view.blade.php index 57f6093c62ba..8ebe918996ed 100644 --- a/app/views/backend/licenses/view.blade.php +++ b/app/views/backend/licenses/view.blade.php @@ -30,37 +30,53 @@ +
+ +
+
+
+ -
-
-
- @if ($license->serial) -

Serial: {{ $license->serial }}
- @endif - @if ($license->license_name) - License Name: {{ $license->license_name }}
- @endif - @if ($license->license_email) - License Email: {{ $license->license_email }}
- @endif - @if ($license->purchase_date) - Purchase Date: {{ $license->purchase_date }}
- @endif -

-
-
+
License Seats
+ + + + + + + + + @if ($license->licenseseats) + @foreach ($license->licenseseats as $licensedto) + + + + + @endforeach + @endif -
- -
-
-
- + +
+
User
+ @if ($licensedto->assigned_to) + + {{ $licensedto->user->fullName() }} + + @endif + + @if ($licensedto->assigned_to) + Checkin + @else + Checkout + @endif +
+
+
Checkout History
@@ -90,11 +106,13 @@ @endforeach @@ -122,48 +140,21 @@
- - - - @if ((isset($license->assigned_to ) && ($license->assigned_to > 0))) -

Checked Out To:
+

License Info:
    - -


  • -
  • {{ $license->assigneduser->fullName() }}
  • - - - @if (isset($license->assetloc->address)) -
  • {{ $license->assetloc->address }} - @if (isset($license->assetloc->address2)) - {{ $license->assetloc->address2 }} - @endif -
  • - @if (isset($license->assetloc->city)) -
  • {{ $license->assetloc->city }}, {{ $license->assetloc->state }} {{ $license->assetloc->zip }}
  • - @endif - + @if ($license->serial) +
  • Serial: {{ $license->serial }}
  • @endif - - - - @if (isset($license->assigneduser->email)) -

  • {{ $license->assigneduser->email }}
  • + @if ($license->license_name) +
  • License Name: {{ $license->license_name }}
  • @endif - - @if (isset($license->assigneduser->phone)) -
  • {{ $license->assigneduser->phone }}
  • + @if ($license->license_email) +
  • License Email: {{ $license->license_email }}
  • + @endif + @if ($license->purchase_date) +
  • Purchase Date: {{ $license->purchase_date }}
  • @endif - -

  • Checkin Asset
  • -
- - @else -
    -


  • This asset is not currently assigned to anyone. You may check it into inventory - using the button below, or mark it as lost/stolen using the menu above.
  • -


  • Checkout Asset
- @endif +
@stop \ No newline at end of file
{{ $log->action_type }} - @if (isset($log->checkedout_to->id)) + @if (isset($log->checkedout_to)) {{ $log->userlog->fullName() }} + @endif +