Fix handling of existing organisation name/slug clashes
This commit is contained in:
@@ -87,12 +87,12 @@ class OrganisationController extends SimpleController
|
|||||||
$classMapper = $this->ci->classMapper;
|
$classMapper = $this->ci->classMapper;
|
||||||
|
|
||||||
// Check if name or slug already exists
|
// Check if name or slug already exists
|
||||||
if ($classMapper->getClassMapping('organisation')::where('name', $data['name'])->first()) {
|
if ($classMapper->getClassMapping('organisation')::findUnique($data['name'], 'name')) {
|
||||||
$ms->addMessageTranslated('danger', 'ORGANISATION.NAME.IN_USE', $data);
|
$ms->addMessageTranslated('danger', 'ORGANISATION.NAME.IN_USE', $data);
|
||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($classMapper->getClassMapping('organisation')::where('slug', $data['slug'])->first()) {
|
if ($classMapper->getClassMapping('organisation')::findUnique($data['slug'], 'slug')) {
|
||||||
$ms->addMessageTranslated('danger', 'ORGANISATION.SLUG.IN_USE', $data);
|
$ms->addMessageTranslated('danger', 'ORGANISATION.SLUG.IN_USE', $data);
|
||||||
$error = true;
|
$error = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user