From 841e2ffe1224a890695aa4937aa715605bf82a83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20M=C3=BCller?= Date: Sun, 2 Mar 2014 12:29:41 +0100 Subject: [PATCH] jobController Test --- app/Controller/JobController.php | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php index 528f703..c250c6e 100644 --- a/app/Controller/JobController.php +++ b/app/Controller/JobController.php @@ -42,24 +42,23 @@ class JobController extends AppController { public function openingAdd() { $this->MiconwareSession->init($this); $this->MiconwareSession->initWeb($this); - /* - $this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list')); - $this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list')); - */ - if(empty($this->MiconwareSession->getCompany())){ - $this->set('error', 'dreamjob.error.noCompany'); - $this->render('/Home/error'); - }else{ + $c = $this->MiconwareSession->getCompany(); + if(!empty($c)){ if ($this->request->is('post')) { $this->DreamjobJobOpening->create($this->request->data); - $this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $this->MiconwareSession->getCompany()['AppUser']['id']; + $this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $c['AppUser']['id']; if ($this->DreamjobJobOpening->save()) { $this->MiconwareSession->setFlash('dreamjob.opening.save.add','flash',array('alert'=>'success')); }else{ $this->MiconwareSession->setFlash('dreamjob.opening.save.error','flash',array('alert'=>'danger')); } } + $this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list')); + $this->set('graducations', $this->DreamjobJobOpening->DreamjobListGraducation->find('list')); $this->render('/Job/opening_edit'); + }else{ + $this->set('error', 'dreamjob.error.noCompany'); + $this->render('/Home/error'); } } public function openingEdit() {