Fix Ticketmigration (#825)
This commit is contained in:
commit
b4b61bcc47
|
@ -8,13 +8,13 @@ class GeneralSettings extends Settings
|
||||||
{
|
{
|
||||||
public bool $store_enabled;
|
public bool $store_enabled;
|
||||||
public string $credits_display_name;
|
public string $credits_display_name;
|
||||||
public bool $recaptcha_enabled;
|
public ?bool $recaptcha_enabled;
|
||||||
public string $recaptcha_site_key;
|
public ?string $recaptcha_site_key;
|
||||||
public string $recaptcha_secret_key;
|
public ?string $recaptcha_secret_key;
|
||||||
public string $phpmyadmin_url;
|
public ?string $phpmyadmin_url;
|
||||||
public bool $alert_enabled;
|
public ?bool $alert_enabled;
|
||||||
public string $alert_type;
|
public string $alert_type;
|
||||||
public string $alert_message;
|
public ?string $alert_message;
|
||||||
public string $theme;
|
public string $theme;
|
||||||
|
|
||||||
//public int $initial_user_role; wait for Roles & Permissions PR.
|
//public int $initial_user_role; wait for Roles & Permissions PR.
|
||||||
|
@ -41,7 +41,7 @@ class GeneralSettings extends Settings
|
||||||
'phpmyadmin_url' => 'nullable|string',
|
'phpmyadmin_url' => 'nullable|string',
|
||||||
'alert_enabled' => 'nullable|boolean',
|
'alert_enabled' => 'nullable|boolean',
|
||||||
'alert_type' => 'required|in:primary,secondary,success,danger,warning,info',
|
'alert_type' => 'required|in:primary,secondary,success,danger,warning,info',
|
||||||
'alert_message' => 'required|string',
|
'alert_message' => 'nullable|string',
|
||||||
'theme' => 'required|in:default,BlueInfinity' // TODO: themes should be made/loaded dynamically
|
'theme' => 'required|in:default,BlueInfinity' // TODO: themes should be made/loaded dynamically
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,8 @@ class CreateTicketSettings extends SettingsMigration
|
||||||
$table_exists = DB::table('settings_old')->exists();
|
$table_exists = DB::table('settings_old')->exists();
|
||||||
|
|
||||||
// Get the user-set configuration values from the old table.
|
// Get the user-set configuration values from the old table.
|
||||||
$this->migrator->add('ticket.enabled', $table_exists ? $this->getOldValue('SETTINGS::TICKET:ENABLED') : 'all');
|
$this->migrator->add('ticket.enabled', $table_exists ? $this->getOldValue('SETTINGS::TICKET:ENABLED') : 'true');
|
||||||
|
$this->migrator->add('ticket.notify', $table_exists ? $this->getOldValue('SETTINGS::TICKET:NOTIFY') : 'all');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function down(): void
|
public function down(): void
|
||||||
|
@ -57,11 +58,16 @@ class CreateTicketSettings extends SettingsMigration
|
||||||
$old_value = DB::table('settings_old')->where('key', '=', $key)->get(['value', 'type'])->first();
|
$old_value = DB::table('settings_old')->where('key', '=', $key)->get(['value', 'type'])->first();
|
||||||
|
|
||||||
// Handle the old values to return without it being a string in all cases.
|
// Handle the old values to return without it being a string in all cases.
|
||||||
|
|
||||||
|
if (is_null($old_value)) {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
if ($old_value->type === "string" || $old_value->type === "text") {
|
if ($old_value->type === "string" || $old_value->type === "text") {
|
||||||
if (is_null($old_value->value)) {
|
if (is_null($old_value->value)) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Some values have the type string, but their values are boolean.
|
// Some values have the type string, but their values are boolean.
|
||||||
if ($old_value->value === "false" || $old_value->value === "true") {
|
if ($old_value->value === "false" || $old_value->value === "true") {
|
||||||
return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
|
return filter_var($old_value->value, FILTER_VALIDATE_BOOL);
|
||||||
|
|
|
@ -6,6 +6,7 @@ return new class extends SettingsMigration
|
||||||
{
|
{
|
||||||
public function up(): void
|
public function up(): void
|
||||||
{
|
{
|
||||||
|
$this->migrator->delete('ticket.notify');
|
||||||
$this->migrator->add('ticket.information', "Can't start your server? Need an additional port? Do you have any other questions? Let us know by opening a ticket.");
|
$this->migrator->add('ticket.information', "Can't start your server? Need an additional port? Do you have any other questions? Let us know by opening a ticket.");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -121,10 +121,11 @@
|
||||||
@case($value['type'] == 'select')
|
@case($value['type'] == 'select')
|
||||||
<select id="{{ $key }}"
|
<select id="{{ $key }}"
|
||||||
class="custom-select w-100" name="{{ $key }}">
|
class="custom-select w-100" name="{{ $key }}">
|
||||||
@foreach ($value['options'] as $option)
|
|
||||||
|
@foreach ($value['options'] as $option=>$display)
|
||||||
<option value="{{ $option }}"
|
<option value="{{ $option }}"
|
||||||
{{ $value['value'] == $option ? 'selected' : '' }}>
|
{{ $value['value'] == $option ? 'selected' : '' }}>
|
||||||
{{ __($option) }}
|
{{ __($display) }}
|
||||||
</option>
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
|
|
Loading…
Reference in a new issue