chg: [collection-elements:addElementToCollection] Redirect to collection creation if there no collections

notes
Sami Mokaddem 2024-02-06 14:25:54 +01:00
parent 3944d75f44
commit 6e41c956fa
No known key found for this signature in database
GPG Key ID: 164C473F627A06FA
1 changed files with 3 additions and 0 deletions

View File

@ -85,6 +85,9 @@ class CollectionElementsController extends AppController
'conditions' => ['Collection.orgc_id' => $this->Auth->user('org_id')]
]);
if (empty($validCollections)) {
if ($this->request->is('ajax')) {
return $this->redirect(['controller' => 'collections', 'action' => 'add']);
}
throw new NotFoundException(__('You don\'t have any collections yet. Make sure you create one first before you can start adding elements.'));
}
$dropdownData = [