Skip to content

Commit

Permalink
Possible fix for #518 - license count issue
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Feb 12, 2015
1 parent 58ff929 commit f57c61d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/admin/LicensesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,8 @@ public function getDelete($licenseId)

// Delete the license and the associated license seats
DB::table('license_seats')
->where('id', $asset->id)
->update(array('assigned_to' => NULL));
->where('id', $license->id)
->update(array('assigned_to' => NULL,'asset_id' => NULL));

$licenseseats = $license->licenseseats();
$licenseseats->delete();
Expand Down Expand Up @@ -578,7 +578,7 @@ public function postCheckin($seatId)
$logaction->checkedout_to = $licenseseat->assigned_to;

// Update the asset data
$licenseseat->assigned_to = '0';
$licenseseat->assigned_to = NULL;
$licenseseat->asset_id = NULL;

// Was the asset updated?
Expand Down
6 changes: 6 additions & 0 deletions app/models/Asset.php
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ public function eol_date()
public static function autoincrement_asset()
{
$settings = Setting::getSettings();

if (isset($asset_tag->id)) {
$asset_id = $asset_tag->id;
} else {
$asset_id = 1;
}
if ($settings->auto_increment_assets == '1') {
$asset_tag = DB::table('assets')
->where('physical', '=', '1')
Expand Down

0 comments on commit f57c61d

Please sign in to comment.