Skip to content

A free open source IT asset/license management system

renamed dead to unassigned, replaced 0 and 1 with true and flase

Godfrey Mf050864fb4cb
diff --git a/app/Helpers/Helper.php b/app/Helpers/Helper.php
index a980b0efac..0d7665f978 100644
--- a/app/Helpers/Helper.php
+++ b/app/Helpers/Helper.php
@@ -1535,7 +1535,7 @@ class Helper
{
if (!$license->reassignable) {
- $count = LicenseSeat::where('dead', '=', true)
+ $count = LicenseSeat::where('unassignable', '=', true)
->where('license_id', '=', $license->id)
->count();
return $count;
diff --git a/app/Http/Controllers/Api/LicenseSeatsController.php b/app/Http/Controllers/Api/LicenseSeatsController.php
index d9a34c32be..de1cc3b53c 100644
--- a/app/Http/Controllers/Api/LicenseSeatsController.php
+++ b/app/Http/Controllers/Api/LicenseSeatsController.php
@@ -119,7 +119,7 @@ class LicenseSeatsController extends Controller
// nothing to update
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
}
- if( $touched && $licenseSeat->dead) {
+ if( $touched && $licenseSeat->unassignable) {
return response()->json(Helper::formatStandardApiResponse('error', $licenseSeat, trans('admin/licenses/message.checkout.unavailable')));
}
// the logging functions expect only one "target". if both asset and user are present in the request,
@@ -140,7 +140,7 @@ class LicenseSeatsController extends Controller
if ($is_checkin) {
$licenseSeat->logCheckin($target, $request->input('note'));
if(!$licenseSeat->license->reassignable){
- $licenseSeat->dead = 1;
+ $licenseSeat->unassignable = true;
$licenseSeat->save();
}
diff --git a/app/Http/Controllers/Licenses/LicenseCheckinController.php b/app/Http/Controllers/Licenses/LicenseCheckinController.php
index 9d61b5e2f1..94cf55380a 100644
--- a/app/Http/Controllers/Licenses/LicenseCheckinController.php
+++ b/app/Http/Controllers/Licenses/LicenseCheckinController.php
@@ -96,7 +96,7 @@ class LicenseCheckinController extends Controller
$licenseSeat->asset_id = null;
$licenseSeat->notes = $request->input('notes');
if (! $licenseSeat->license->reassignable) {
- $licenseSeat->dead = 1;
+ $licenseSeat->unassignable = true;
$licenseSeat->notes .= "\n" . trans('admin/licenses/message.checkin.not_reassignable') . '.';
}
diff --git a/app/Http/Transformers/LicenseSeatsTransformer.php b/app/Http/Transformers/LicenseSeatsTransformer.php
index 55c95bb54b..f79be04d09 100644
--- a/app/Http/Transformers/LicenseSeatsTransformer.php
+++ b/app/Http/Transformers/LicenseSeatsTransformer.php
@@ -49,7 +49,7 @@ class LicenseSeatsTransformer
'reassignable' => (bool) $seat->license->reassignable,
'notes' => e($seat->notes),
'user_can_checkout' => (($seat->assigned_to == '') && ($seat->asset_id == '')),
- 'disabled' => $seat->dead,
+ 'disabled' => $seat->unassignable,
];
if ($seat_count != 0) {
diff --git a/app/Models/License.php b/app/Models/License.php
index f837fe2895..ac0e5a0049 100755
--- a/app/Models/License.php
+++ b/app/Models/License.php
@@ -653,7 +653,7 @@ class License extends Depreciable
{
return $this->licenseseats()
->whereNull('deleted_at')
- ->where('dead', '=', 0)
+ ->where('unassignable', '=', false)
->where(function ($query) {
$query->whereNull('assigned_to')
->whereNull('asset_id');
diff --git a/database/factories/LicenseSeatFactory.php b/database/factories/LicenseSeatFactory.php
index 34caeb3038..5fad52cbb3 100644
--- a/database/factories/LicenseSeatFactory.php
+++ b/database/factories/LicenseSeatFactory.php
@@ -14,7 +14,7 @@ class LicenseSeatFactory extends Factory
{
return [
'license_id' => License::factory(),
- 'dead' => 0,
+ 'dead' => false,
];
}
diff --git a/database/migrations/2025_01_15_190348_adds_unavailable_to_license_seats_tables.php b/database/migrations/2025_01_15_190348_adds_unavailable_to_license_seats_tables.php
index be123dc276..6d41b68b83 100644
--- a/database/migrations/2025_01_15_190348_adds_unavailable_to_license_seats_tables.php
+++ b/database/migrations/2025_01_15_190348_adds_unavailable_to_license_seats_tables.php
@@ -14,7 +14,7 @@ return new class extends Migration
public function up(): void
{
Schema::table('license_seats', function (Blueprint $table) {
- $table->addColumn('boolean', 'dead')->default(false)->after('assigned_to');
+ $table->addColumn('boolean', 'unassignable')->default(false)->after('assigned_to');
});
}
/**
@@ -23,7 +23,7 @@ return new class extends Migration
public function down(): void
{
Schema::table('license_seats', function (Blueprint $table) {
- $table->dropColumn('dead');
+ $table->dropColumn('unassignable');
});
}
};