Begrenzung stellenausschreibung + compareDate von < zu <=

This commit is contained in:
Martin Müller 2014-11-06 19:19:34 +01:00
parent a316c1298c
commit 1468103600
3 changed files with 17 additions and 3 deletions

View File

@ -19,6 +19,9 @@ class JobController extends AppController {
* @throws NotFoundException When the view file could not be found
* or MissingViewException in debug mode.
*/
private $OPENING_COUNT_GAP = 2;
public function openingList() {
$this->MiconwareSession->init($this);
@ -36,7 +39,7 @@ class JobController extends AppController {
$o = $this->DreamjobJobOpening->findById($this->request->query['del']);
if ($o['AppUser']['id'] == $self['AppUser']['id']) {
$o['DreamjobJobOpening']['delete']=true;
$o['DreamjobJobOpening']['active']=false;
$o['DreamjobJobOpening']['active']=true;
$this->DreamjobJobOpening->save($o);
$this->MiconwareSession->setFlash(__('dreamjob.opening.delete.success'), 'flash', array('alert' => 'success'));
} else {
@ -57,6 +60,9 @@ class JobController extends AppController {
if ($this->request->is('post')) {
$this->DreamjobJobOpening->create($this->request->data);
$this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $c['AppUser']['id'];
if(count($c['DreamjobJobOpening']) >= $this->OPENING_COUNT_GAP and !(strlen($c['DreamjobCompany']['bank_details'])>0)){
$this->DreamjobJobOpening->data['DreamjobJobOpening']['active'] = false;
}
if ($this->DreamjobJobOpening->save()) {
$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") ) )
@ -65,6 +71,10 @@ class JobController extends AppController {
$this->MiconwareSession->setFlash(__('dreamjob.opening.save.error'), 'flash', array('alert' => 'danger'));
}
}else{
if(strlen($c['DreamjobCompany']['bank_details']) > 0){
$this->MiconwareSession->setFlash(__('dreamjob.opening.count.thanks'), 'flash', array('alert' => 'success'));
}else if(count($c['DreamjobJobOpening']) >= $this->OPENING_COUNT_GAP)
$this->MiconwareSession->setFlash(__('dreamjob.opening.count'), 'flash', array('alert' => 'danger'));
$this->request->data['DreamjobJobOpening']['active']=true;
}
$this->set('kindofjobs', $this->DreamjobJobOpening->DreamjobListKindofjob->find('list'));
@ -101,6 +111,9 @@ class JobController extends AppController {
$this->DreamjobJobOpening->create($this->request->data);
$this->DreamjobJobOpening->data['DreamjobJobOpening']['id'] = $this->request->params['id'];
$this->DreamjobJobOpening->data['DreamjobJobOpening']['company_id'] = $cid;
if(count($a['DreamjobJobOpening']) > $this->OPENING_COUNT_GAP and !($this->DreamjobJobOpening->data['DreamjobJobOpening']['active']) or (strlen($a['DreamjobCompany']['bank_details']) > 0)){
$this->DreamjobJobOpening->data['DreamjobJobOpening']['active'] = false;
}
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") ))

View File

@ -124,7 +124,7 @@ class DreamjobCvEntry extends AppModel {
//The Associations below have been created with all possible keys, those that are not needed can be removed
public function compareDates()
{
return ($this->data[$this->alias]['startdate'] < $this->data[$this->alias]['enddate']) ? true : false;
return ($this->data[$this->alias]['startdate'] <= $this->data[$this->alias]['enddate']) ? true : false;
}
/**
* belongsTo associations

View File

@ -77,11 +77,13 @@ var global_load = null;
$("tbody tr.new", $(this)).remove();
i=0;
$("tbody tr", $(this)).each(function() {
if($(":input[name]", this).length > 0){
$(":input[name]", this).each(function() {
str = $(this).attr("name").replace(/data\[(.*?)\]\[.*?\]\[(.+)\]/g, 'data[$1][' + i + '][$2]');
$(this).attr("name", str);
});
i++;
}
});
}
$(":input[ name *= '_wysihtml5_mod' ]", this).remove();
@ -103,7 +105,6 @@ var global_load = null;
$(this).submit(function() {
//stopLoad(evt);
frame = $('#fileUpload').load(function() {
console.log("aha");
setContent($('#fileUpload').contents().find('html').html());
$('#fileUpload').unbind('load');
setTimeout(function() {