Skip to content

A free open source IT asset/license management system

Ensure eula field enabled when not using default eula

Marcus Moore3fd0853fd05e
diff --git a/app/Http/Livewire/CategoryEditForm.php b/app/Http/Livewire/CategoryEditForm.php
index c42f04803d..21f0fa5c24 100644
--- a/app/Http/Livewire/CategoryEditForm.php
+++ b/app/Http/Livewire/CategoryEditForm.php
@@ -22,7 +22,7 @@ class CategoryEditForm extends Component
$this->originalSendCheckInEmailValue = $this->sendCheckInEmail;
if ($this->eulaText || $this->useDefaultEula) {
- $this->sendCheckInEmail = true;
+ $this->sendCheckInEmail = 1;
}
}
@@ -37,7 +37,7 @@ class CategoryEditForm extends Component
return;
}
- $this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula ? true : $this->originalSendCheckInEmailValue;
+ $this->sendCheckInEmail = $this->eulaText || $this->useDefaultEula ? 1 : $this->originalSendCheckInEmailValue;
}
public function getShouldDisplayEmailMessageProperty(): bool
@@ -56,7 +56,7 @@ class CategoryEditForm extends Component
public function getEulaTextDisabledProperty()
{
- return $this->useDefaultEula;
+ return (bool) $this->useDefaultEula;
}
public function getSendCheckInEmailDisabledProperty()
diff --git a/tests/Feature/Livewire/CategoryEditFormTest.php b/tests/Feature/Livewire/CategoryEditFormTest.php
index 270cd9efbe..26719e4041 100644
--- a/tests/Feature/Livewire/CategoryEditFormTest.php
+++ b/tests/Feature/Livewire/CategoryEditFormTest.php
@@ -93,4 +93,13 @@ class CategoryEditFormTest extends TestCase
->assertSet('sendCheckInEmail', true)
->assertSet('sendCheckInEmailDisabled', false);
}
+
+ public function testEulaFieldEnabledOnLoadWhenNotUsingDefaultEula()
+ {
+ Livewire::test(CategoryEditForm::class, [
+ 'sendCheckInEmail' => false,
+ 'eulaText' => '',
+ 'useDefaultEula' => false,
+ ])->assertSet('eulaTextDisabled', false);
+ }
}