1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2024-11-24 11:22:42 +01:00

Fix getOptions() default value

This commit is contained in:
FreeScout 2018-12-10 00:58:39 -08:00
parent 02bd76ac57
commit b9b829db7f

View File

@ -150,8 +150,10 @@ class Option extends Model
foreach ($options as $name) { foreach ($options as $name) {
if (isset(self::$cache[$name])) { if (isset(self::$cache[$name])) {
if (self::$cache[$name] == self::CACHE_DEFAULT_VALUE) { if (self::$cache[$name] == self::CACHE_DEFAULT_VALUE) {
if (empty($defaults[$name])) { if (!isset($defaults[$name])) {
$default = self::getDefault($name); $default = self::getDefault($name);
} else {
$default = $defaults[$name];
} }
$values[$name] = $default; $values[$name] = $default;
} else { } else {
@ -168,8 +170,10 @@ class Option extends Model
$db_options = self::whereIn('name', $options)->get(); $db_options = self::whereIn('name', $options)->get();
foreach ($options as $name) { foreach ($options as $name) {
// If not passed, get default value from config // If not passed, get default value from config
if (empty($defaults[$name])) { if (!isset($defaults[$name])) {
$default = self::getDefault($name); $default = self::getDefault($name);
} else {
$default = $defaults[$name];
} }
$db_option = $db_options->where('name', $name)->first(); $db_option = $db_options->where('name', $name)->first();
if ($db_option) { if ($db_option) {