From 745f7c974538df944cda447afc754b591edd91db Mon Sep 17 00:00:00 2001 From: Mathias Weitz Date: Mon, 11 May 2015 16:59:08 +0200 Subject: [PATCH] [Jobs] deny create a job if no company to select from is provided (#5806) --- module/Jobs/src/Jobs/Controller/ManageController.php | 4 ++++ module/Jobs/view/error/no-parent.phtml | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/module/Jobs/src/Jobs/Controller/ManageController.php b/module/Jobs/src/Jobs/Controller/ManageController.php index b800ebc2f..3f6eec5d4 100644 --- a/module/Jobs/src/Jobs/Controller/ManageController.php +++ b/module/Jobs/src/Jobs/Controller/ManageController.php @@ -96,6 +96,10 @@ protected function save($parameter = array()) if (empty($user->info->email)) { return $this->getErrorViewModel('no-parent', array('cause' => 'noEmail')); } + $userOrg = $user->getOrganization(); + if (!$userOrg->hasAssociation()) { + return $this->getErrorViewModel('no-parent', array('cause' => 'noCompany')); + } $translator = $serviceLocator->get('translator'); /** @var \Zend\Http\Request $request */ $request = $this->getRequest(); diff --git a/module/Jobs/view/error/no-parent.phtml b/module/Jobs/view/error/no-parent.phtml index e17e75147..da1e28447 100644 --- a/module/Jobs/view/error/no-parent.phtml +++ b/module/Jobs/view/error/no-parent.phtml @@ -17,7 +17,7 @@

cause == 'noEmail') { echo sprintf( - $this->translate('Before you are able to create jobs, you have to %screate an email%s first.'), + $this->translate('Before you are able to create jobs, you have to %screate a valid email%s first.'), '', '' );