diff --git a/src/Controller/OrganisationController.php b/src/Controller/OrganisationController.php index c1e087b..a37305b 100644 --- a/src/Controller/OrganisationController.php +++ b/src/Controller/OrganisationController.php @@ -222,6 +222,11 @@ class OrganisationController extends SimpleController $transformer = new RequestDataTransformer($schema); $data = $transformer->transform($params); + $nameSet = isset($data['name']); + if (!$nameSet) { + $data['name'] = $organisation->name; + } + $error = false; // Validate request data @@ -234,7 +239,9 @@ class OrganisationController extends SimpleController // Determine targeted fields $fieldNames = []; foreach ($data as $name => $value) { - $fieldNames[] = $name; + if ($name == 'name' && $nameSet) { + $fieldNames[] = $name; + } } // Access-controlled resource - check that currentUser has permission to edit submitted fields for this organisation