#102 Beschränkung Stellen - richtiges Löschen deaktivieren

This commit is contained in:
Martin Müller 2014-10-21 19:00:46 +02:00
parent 743fc3aed2
commit f86695c9c3
2 changed files with 7 additions and 4 deletions

View File

@ -115,6 +115,7 @@ class MiconwareSessionComponent extends Component {
public static function getOpeningCondition(){
return array('and'=>array(
'DreamjobJobOpening.active'=>true,
'DreamjobJobOpening.delete'=>false,
'DreamjobJobOpening.startdate <='=> date("Y-m-d"),
'DreamjobJobOpening.enddate >='=> date("Y-m-d", strtotime("+1 day"))
));

View File

@ -35,13 +35,15 @@ class JobController extends AppController {
if (!empty($this->request->query['del'])) {
$o = $this->DreamjobJobOpening->findById($this->request->query['del']);
if ($o['AppUser']['id'] == $self['AppUser']['id']) {
$this->DreamjobJobOpening->delete($this->request->query['del'], false);
$o['DreamjobJobOpening']['delete']=true;
$o['DreamjobJobOpening']['active']=false;
$this->DreamjobJobOpening->save($o);
$this->MiconwareSession->setFlash(__('dreamjob.opening.delete.success'), 'flash', array('alert' => 'success'));
} else {
$this->MiconwareSession->setFlash(__('dreamjob.opening.delete.error'), 'flash', array('alert' => 'danger'));
}
}
$openings = $this->DreamjobJobOpening->find('all', array('conditions' => array('DreamjobJobOpening.company_id' => $self['AppUser']['id'])));
$openings = $this->DreamjobJobOpening->find('all', array('conditions' => array('DreamjobJobOpening.company_id' => $self['AppUser']['id'],'DreamjobJobOpening.delete'=>false)));
$this->set('openings', $openings);
$this->render('/Job/opening_list');
}
@ -94,7 +96,7 @@ class JobController extends AppController {
if (!empty($this->request->params['id'])) {
$load = $this->DreamjobJobOpening->findById($this->request->params['id']);
$cid = $a['AppUser']['id'];
if (!empty($load) and $load['DreamjobJobOpening']['company_id'] == $cid) {
if (!empty($load) and $load['DreamjobJobOpening']['company_id'] == $cid and $load['DreamjobJobOpening']['delete']==false) {
if ($this->request->is(array('post', 'put'))) {
$this->DreamjobJobOpening->create($this->request->data);
$this->DreamjobJobOpening->data['DreamjobJobOpening']['id'] = $this->request->params['id'];