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 @@ +
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
-
User | ++ |
---|---|
+ @if ($licensedto->assigned_to) + + {{ $licensedto->user->fullName() }} + + @endif + | ++ @if ($licensedto->assigned_to) + Checkin + @else + Checkout + @endif + | +
{{ $log->action_type }} | - @if (isset($log->checkedout_to->id)) + @if (isset($log->checkedout_to)) {{ $log->userlog->fullName() }} + @endif + | @endforeach @@ -122,48 +140,21 @@