Skip to content

Commit

Permalink
Fix flash error construction.name type_id field is required
Browse files Browse the repository at this point in the history
  • Loading branch information
Ioannis committed Nov 15, 2024
1 parent 5ce3f4a commit b444d89
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
16 changes: 11 additions & 5 deletions app/src/Controller/StandardController.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,17 @@ public function add() {
$errors = $obj->getErrors();

if(!empty($errors)) {
$this->Flash->error(__d('error', 'fields', [ implode(',',
array_map(function($v) use ($errors) {
return __d('error', 'flash', [$v, implode(',', array_values($errors[$v]))]);
},
array_keys($errors))) ]));
$errorlist = [];
foreach ($errors as $model => $fails) {
foreach ($fails as $issues) {
foreach ($issues as $column => $issue) {
$error_descriptions = array_values($issue);
$col_issues = implode(',', $error_descriptions);
$errorlist[] = __d('error', 'flash', [$column, $col_issues]);
}
}
}
$this->Flash->error(__d('error', 'fields', $errorlist));
} else {
$this->Flash->error(__d('error', 'save', [$modelsName]));
}
Expand Down
3 changes: 2 additions & 1 deletion app/templates/People/fields.inc
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ if($vv_action == 'add') {
'arguments' => [
'fieldName' => 'names.0.type_id',
'fieldOptions' => [
'default' => $vv_default_name_type
'default' => $vv_default_name_type,
'required' => true
],
'fieldType' => 'string'
]]);
Expand Down

0 comments on commit b444d89

Please sign in to comment.