Skip to content

Commit

Permalink
When field empty and default value exists, use that
Browse files Browse the repository at this point in the history
  • Loading branch information
zagganas committed May 25, 2022
1 parent 2bef973 commit 89ee2a5
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions models/Workflow.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,23 @@ public static function getParameters($fields,$fileStore='')
}
if ((!$field->optional) && ($field->value==''))
{
$errors=["A required field has an empty value."];
return [[],$errors];

if ($field->field_type=='boolean')
{
$params[$field->name]=$field->default_value ? true : false;
continue;
}

if (isset($field->default_value))
{
$params[$field->name]=$field->default_value;
}
else
{
$errors=["Required field '$field->name' has an empty value and no default value is specified."];
return [[],$errors];
}

}
if (!$field->is_array)
{
Expand Down

0 comments on commit 89ee2a5

Please sign in to comment.