A free open source IT asset/license management system
Fixed tests again
snipea97530367d60
diff --git a/app/Http/Controllers/Assets/AssetsController.php b/app/Http/Controllers/Assets/AssetsController.phpindex 2bb248b993..5f944c386e 100755--- a/app/Http/Controllers/Assets/AssetsController.php+++ b/app/Http/Controllers/Assets/AssetsController.php@@ -331,14 +331,14 @@ class AssetsController extends Controller$asset->expected_checkin = $request->input('expected_checkin', null);// If the box isn't checked, it's not in the request at all.- $asset->requestable = $request->filled('requestable');+ $asset->requestable = $request->filled('requestable', 0);$asset->rtd_location_id = $request->input('rtd_location_id', null);$asset->byod = $request->input('byod', 0);- $status = Statuslabel::find($asset->status_id);+ $status = Statuslabel::find($request->input('status_id'));// This is a non-deployable status label - we should check the asset back in.- if (($status && $status->getStatuslabelType() != 'deployable') && (is_null($target = $asset->assignedTo))) {+ if (($status && $status->getStatuslabelType() != 'deployable') && ($target = $asset->assignedTo)) {$originalValues = $asset->getRawOriginal();$asset->assigned_to = null;diff --git a/resources/views/hardware/edit.blade.php b/resources/views/hardware/edit.blade.phpindex b756187fdd..4c14b2ea02 100755--- a/resources/views/hardware/edit.blade.php+++ b/resources/views/hardware/edit.blade.php@@ -263,7 +263,7 @@$("#assignto_selector").hide();$("#selected_status_status").removeClass('text-success');$("#selected_status_status").addClass('text-danger');- $("#selected_status_status").html('<x-icon type="warning" /> {{ (($item->assignedTo) && ($item->deleted_at == '')) ? trans('admin/hardware/form.asset_not_deployable_checkin') : trans('admin/hardware/form.asset_not_deployable') }} ');+ $("#selected_status_status").html('<x-icon type="warning" /> {{ (($item->assigned_to!='') && ($item->assigned_type!='') && ($item->deleted_at == '')) ? trans('admin/hardware/form.asset_not_deployable_checkin') : trans('admin/hardware/form.asset_not_deployable') }} ');}}});diff --git a/tests/Feature/Assets/Ui/EditAssetTest.php b/tests/Feature/Assets/Ui/EditAssetTest.phpindex c7aa85478c..27f00b5313 100644--- a/tests/Feature/Assets/Ui/EditAssetTest.php+++ b/tests/Feature/Assets/Ui/EditAssetTest.php@@ -81,16 +81,19 @@ class EditAssetTest extends TestCase$currentTimestamp = now();$this->actingAs(User::factory()->viewAssets()->editAssets()->create())- ->from(route('hardware.edit', $asset))- ->patch(route('hardware.update', $asset), [+ ->from(route('hardware.edit', $asset->id))+ ->put(route('hardware.update', $asset->id), ['status_id' => $achived_status->id,'model_id' => $asset->model_id,- 'asset_tag' => $asset->asset_tag,+ 'asset_tags' => $asset->asset_tag,],)->assertStatus(302);+ //->assertRedirect(route('hardware.show', ['hardware' => $asset->id]));;- $asset->refresh();+ // $asset->refresh();+ $asset = Asset::find($asset->id);+ $this->assertNull($asset->assigned_to);$this->assertNull($asset->assigned_type);$this->assertEquals($achived_status->id, $asset->status_id);