#102 Beschränkung Stellen - richtiges Löschen deaktivieren
This commit is contained in:
parent
743fc3aed2
commit
f86695c9c3
|
@ -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"))
|
||||
));
|
||||
|
|
|
@ -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,14 +96,14 @@ 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'];
|
||||
$this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $cid;
|
||||
if ($this->DreamjobJobOpening->save($this->DreamjobJobOpening->data)) {
|
||||
$this->MiconwareSession->setFlash(__('dreamjob.opening.save.success'), 'flash', array('alert' => 'success'));
|
||||
if($this->request->data['DreamjobJobOpening']['active'] and $this->request->data['DreamjobJobOpening']['startdate'] <= date("Y-m-d") and $this->request->data['DreamjobJobOpening']['enddate'] >= date("Y-m-d", strtotime("+1 day") ) )
|
||||
if($this->request->data['DreamjobJobOpening']['active'] and $this->request->data['DreamjobJobOpening']['startdate'] <= date("Y-m-d") and $this->request->data['DreamjobJobOpening']['enddate'] >= date("Y-m-d", strtotime("+1 day") ))
|
||||
return $this->redirect(array('action' => 'openingGet','id'=>$this->request->params['id']));
|
||||
} else
|
||||
$this->MiconwareSession->setFlash(__('dreamjob.opening.save.error'), 'flash', array('alert' => 'danger'));
|
||||
|
|
Loading…
Reference in New Issue