mirror of
https://github.com/snipe/snipe-it.git
synced 2025-03-05 20:52:15 -08:00
last rename
This commit is contained in:
parent
52bf0faaa5
commit
d217c2e295
|
@ -1535,7 +1535,7 @@ class Helper
|
||||||
{
|
{
|
||||||
|
|
||||||
if (!$license->reassignable) {
|
if (!$license->reassignable) {
|
||||||
$count = LicenseSeat::where('reassignable_seat', '=', true)
|
$count = LicenseSeat::where('unreassignable_seat', '=', true)
|
||||||
->where('license_id', '=', $license->id)
|
->where('license_id', '=', $license->id)
|
||||||
->count();
|
->count();
|
||||||
return $count;
|
return $count;
|
||||||
|
|
|
@ -119,7 +119,7 @@ class LicenseSeatsController extends Controller
|
||||||
// nothing to update
|
// nothing to update
|
||||||
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
|
return response()->json(Helper::formatStandardApiResponse('success', $licenseSeat, trans('admin/licenses/message.update.success')));
|
||||||
}
|
}
|
||||||
if( $touched && $licenseSeat->reassignable_seat) {
|
if( $touched && $licenseSeat->unreassignable_seat) {
|
||||||
return response()->json(Helper::formatStandardApiResponse('error', $licenseSeat, trans('admin/licenses/message.checkout.unavailable')));
|
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,
|
// 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) {
|
if ($is_checkin) {
|
||||||
$licenseSeat->logCheckin($target, $request->input('note'));
|
$licenseSeat->logCheckin($target, $request->input('note'));
|
||||||
if(!$licenseSeat->license->reassignable){
|
if(!$licenseSeat->license->reassignable){
|
||||||
$licenseSeat->reassignable_seat = true;
|
$licenseSeat->unreassignable_seat = true;
|
||||||
$licenseSeat->save();
|
$licenseSeat->save();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ class LicenseCheckinController extends Controller
|
||||||
$licenseSeat->asset_id = null;
|
$licenseSeat->asset_id = null;
|
||||||
$licenseSeat->notes = $request->input('notes');
|
$licenseSeat->notes = $request->input('notes');
|
||||||
if (! $licenseSeat->license->reassignable) {
|
if (! $licenseSeat->license->reassignable) {
|
||||||
$licenseSeat->reassignable_seat = true;
|
$licenseSeat->unreassignable_seat = true;
|
||||||
$licenseSeat->notes .= "\n" . trans('admin/licenses/message.checkin.not_reassignable') . '.';
|
$licenseSeat->notes .= "\n" . trans('admin/licenses/message.checkin.not_reassignable') . '.';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -251,7 +251,7 @@ class LicensesController extends Controller
|
||||||
$total_seats_count = (int) $license->totalSeatsByLicenseID();
|
$total_seats_count = (int) $license->totalSeatsByLicenseID();
|
||||||
$available_seats_count = $license->availCount()->count();
|
$available_seats_count = $license->availCount()->count();
|
||||||
$unreassignable_seats_count = Helper::unReassignableCount($license);
|
$unreassignable_seats_count = Helper::unReassignableCount($license);
|
||||||
if(!$license->reassignable){
|
if(!$license->unreassignable_seat){
|
||||||
$checkedout_seats_count = ($total_seats_count - $available_seats_count - $unreassignable_seats_count );
|
$checkedout_seats_count = ($total_seats_count - $available_seats_count - $unreassignable_seats_count );
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -49,7 +49,7 @@ class LicenseSeatsTransformer
|
||||||
'reassignable' => (bool) $seat->license->reassignable,
|
'reassignable' => (bool) $seat->license->reassignable,
|
||||||
'notes' => e($seat->notes),
|
'notes' => e($seat->notes),
|
||||||
'user_can_checkout' => (($seat->assigned_to == '') && ($seat->asset_id == '')),
|
'user_can_checkout' => (($seat->assigned_to == '') && ($seat->asset_id == '')),
|
||||||
'disabled' => $seat->reassignable_seat,
|
'disabled' => $seat->unreassignable_seat,
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($seat_count != 0) {
|
if ($seat_count != 0) {
|
||||||
|
|
|
@ -653,7 +653,7 @@ class License extends Depreciable
|
||||||
{
|
{
|
||||||
return $this->licenseseats()
|
return $this->licenseseats()
|
||||||
->whereNull('deleted_at')
|
->whereNull('deleted_at')
|
||||||
->where('reassignable_seat', '=', false)
|
->where('unreassignable_seat', '=', false)
|
||||||
->where(function ($query) {
|
->where(function ($query) {
|
||||||
$query->whereNull('assigned_to')
|
$query->whereNull('assigned_to')
|
||||||
->whereNull('asset_id');
|
->whereNull('asset_id');
|
||||||
|
|
|
@ -14,7 +14,7 @@ class LicenseSeatFactory extends Factory
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'license_id' => License::factory(),
|
'license_id' => License::factory(),
|
||||||
'reassignable_seat' => false,
|
'unreassignable_seat' => false,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@ return new class extends Migration
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
Schema::table('license_seats', function (Blueprint $table) {
|
Schema::table('license_seats', function (Blueprint $table) {
|
||||||
$table->addColumn('boolean', 'reassignable_seat')->default(false)->after('assigned_to');
|
$table->addColumn('boolean', 'unreassignable_seat')->default(false)->after('assigned_to');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
|
@ -23,7 +23,7 @@ return new class extends Migration
|
||||||
public function down(): void
|
public function down(): void
|
||||||
{
|
{
|
||||||
Schema::table('license_seats', function (Blueprint $table) {
|
Schema::table('license_seats', function (Blueprint $table) {
|
||||||
$table->dropColumn('reassignable_seat');
|
$table->dropColumn('unreassignable_seat');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,7 +32,7 @@ class LicenseCheckinTest extends TestCase
|
||||||
|
|
||||||
$licenseSeat->refresh();
|
$licenseSeat->refresh();
|
||||||
|
|
||||||
$this->assertEquals(1, $licenseSeat->reassignable_seat);
|
$this->assertEquals(1, $licenseSeat->unreassignable_seat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testCannotCheckinLicenseThatIsNotAssigned()
|
public function testCannotCheckinLicenseThatIsNotAssigned()
|
||||||
|
|
Loading…
Reference in a new issue