PMCORE-3232 Service /api/1.0/workflow/home/config/1/test return 400 if there is not this setting

This commit is contained in:
Roly Gutierrez
2021-08-20 08:06:13 -04:00
parent 7cbba5190c
commit 0c33badff7
2 changed files with 9 additions and 2 deletions

View File

@@ -34,10 +34,14 @@ class UserConfig extends Model
if (empty($userConfig)) {
return null;
}
$setting = json_decode($userConfig->USC_SETTING);
if (empty($setting)) {
$setting = new stdClass();
}
return [
"id" => $userConfig->USR_ID,
"name" => $userConfig->USC_NAME,
"setting" => json_decode($userConfig->USC_SETTING)
"setting" => $setting
];
}

View File

@@ -904,7 +904,10 @@ class Home extends Api
{
$setting = UserConfig::getSetting($id, $name);
if (is_null($setting)) {
throw new RestException(Api::STAT_APP_EXCEPTION, G::LoadTranslation('ID_DOES_NOT_EXIST'));
$setting = [
"status" => 404,
"message" => G::LoadTranslation('ID_DOES_NOT_EXIST')
];
}
return $setting;
}