diff --git a/app/Controller/JobController.php b/app/Controller/JobController.php
index b6cdd0d..3a99191 100644
--- a/app/Controller/JobController.php
+++ b/app/Controller/JobController.php
@@ -19,8 +19,11 @@ class JobController extends AppController {
* @throws NotFoundException When the view file could not be found
* or MissingViewException in debug mode.
*/
- private $OPENING_COUNT_GAP = 2;
+ private $OPENING_COUNT_GAP = 1;
+ private function allowOpening($c,$diff=0){
+ return ((count($c['DreamjobJobOpening'])+$diff) >= (($this->OPENING_COUNT_GAP < $c['Pro']['opening_count'])?$c['Pro']['opening_count']:$this->OPENING_COUNT_GAP));
+ }
public function openingList() {
$this->MiconwareSession->init($this);
@@ -60,7 +63,7 @@ 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)){
+ if(!$this->allowOpening($c)){
$this->DreamjobJobOpening->data['DreamjobJobOpening']['active'] = false;
}
if ($this->DreamjobJobOpening->save()) {
@@ -71,9 +74,7 @@ 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)
+ if(!$this->allowOpening($c,-1))
$this->MiconwareSession->setFlash(__('dreamjob.opening.count'), 'flash', array('alert' => 'danger'));
$this->request->data['DreamjobJobOpening']['active']=true;
}
@@ -111,11 +112,14 @@ 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)){
+ if(!$this->allowOpening($a)){
$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->allowOpening($a))
+ $this->MiconwareSession->setFlash(__('dreamjob.opening.save.count'), 'flash', array('alert' => 'info'));
+ else
+ $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") ))
return $this->redirect(array('action' => 'openingGet','id'=>$this->request->params['id']));
} else
diff --git a/app/Controller/UserController.php b/app/Controller/UserController.php
index 466710d..a712534 100755
--- a/app/Controller/UserController.php
+++ b/app/Controller/UserController.php
@@ -46,9 +46,7 @@ class UserController extends AppController {
$self = $this->MiconwareSession->getCompany();
$self_company = true;
- $_pro = decbin($self['DreamjobCompany']['pro_user']);
- $_pro_l = strlen($_pro);
- $self_company_pro = !empty($_pro[$_pro_l-1]);
+ $self_company_pro = $self['Pro']['worker_profil'];
}
//get Profil
diff --git a/app/Model/AppUser.php b/app/Model/AppUser.php
index ccdc641..097adb3 100755
--- a/app/Model/AppUser.php
+++ b/app/Model/AppUser.php
@@ -49,8 +49,6 @@ class AppUser extends AppModel {
$result = false;
} else {
$result = $this->saveField('avatar', str_replace(DS, "/", str_replace(WWW_ROOT.$this->uploadDir.DS, "", $filename) ));
- if($data["AppUser"]['take_systemwide'])
- $result = $this->User->saveField('avatar', str_replace(DS, "/", str_replace(WWW_ROOT.$this->uploadDir.DS, "", $filename) ));
}
if ($result) {
diff --git a/app/Model/DreamjobCompany.php b/app/Model/DreamjobCompany.php
index e2f388a..05f2eb8 100755
--- a/app/Model/DreamjobCompany.php
+++ b/app/Model/DreamjobCompany.php
@@ -4,7 +4,6 @@ App::uses('CakeEmail', 'Network/Email');
/**
* DreamjobCompany Model
*
- * TODO
*
* @property
*/
@@ -141,17 +140,7 @@ class DreamjobCompany extends AppModel {
if($result)
$result = $this->AppUser->saveField('take_systemwide',$data['AppUser']['take_systemwide']);
- if($result and $data['AppUser']['take_systemwide']){
- $result = $this->User->saveField('nickname',$data['AppUser']['nickname']);
- if($result)
- $result = $this->User->saveField('first_name',$data['AppUser']['first_name']);
- if($result)
- $result = $this->User->saveField('last_name',$data['AppUser']['last_name']);
- if($result)
- $result = $this->User->saveField('bday',$data['AppUser']['bday']);
- if($result)
- $result = $this->User->saveField('mannerofaddress_id',$data['AppUser']['mannerofaddress_id']);
- }
+
if ($result) {
$dataSource->commit();
@@ -215,16 +204,6 @@ class DreamjobCompany extends AppModel {
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
- 'pro_user' => array(
- 'numeric' => array(
- 'rule' => array('numeric'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
);
public $belongsTo = array(
'DreamjobListBranch' => array(
@@ -261,6 +240,11 @@ class DreamjobCompany extends AppModel {
'foreignKey' => false,
'conditions' => array('DreamjobCompany.djaccount_ptr_id=AppUser.id and User.id = AppUser.user_id'),
'limit' => 1
+ ),
+ 'Pro' => array(
+ 'className' => 'DreamjobCompanyPro',
+ 'foreignKey' => 'company_id',
+ 'limit' => 1
),
'DreamjobListCity' => array(
'className' => 'DreamjobListCity',
diff --git a/app/Model/DreamjobWorker.php b/app/Model/DreamjobWorker.php
index cff11b6..435497a 100755
--- a/app/Model/DreamjobWorker.php
+++ b/app/Model/DreamjobWorker.php
@@ -160,19 +160,6 @@ class DreamjobWorker extends AppModel {
if($result)
$result = $this->AppUser->saveField('take_systemwide',$data['AppUser']['take_systemwide']);
- if($result and $data['AppUser']['take_systemwide']){
- $result = $this->User->saveField('nickname',$data['AppUser']['nickname']);
- if($result)
- $result = $this->User->saveField('first_name',$data['AppUser']['first_name']);
- if($result)
- $result = $this->User->saveField('last_name',$data['AppUser']['last_name']);
- if($result)
- $result = $this->User->saveField('bday',$data['AppUser']['bday']);
- if($result)
- $result = $this->User->saveField('mannerofaddress_id',$data['AppUser']['mannerofaddress_id']);
- }
-
-
if ($result) {
$dataSource->commit();
diff --git a/app/Model/User.php b/app/Model/User.php
index bdb2fd2..e5526e9 100755
--- a/app/Model/User.php
+++ b/app/Model/User.php
@@ -149,36 +149,6 @@ class User extends AppModel {
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
- 'first_name' => array(
- 'notEmpty' => array(
- 'rule' => array('notEmpty'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
- 'last_name' => array(
- 'notEmpty' => array(
- 'rule' => array('notEmpty'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
- 'is_staff' => array(
- 'boolean' => array(
- 'rule' => array('boolean'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
'is_active' => array(
'boolean' => array(
'rule' => array('boolean'),
@@ -252,36 +222,6 @@ class User extends AppModel {
//'on' => 'create', // Limit validation to 'create' or 'update' operations
),
),
- 'avatar' => array(
- 'url' => array(
- 'rule' => array('url'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
- 'bday' => array(
- 'date' => array(
- 'rule' => array('date'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
- 'comment' => array(
- 'notEmpty' => array(
- 'rule' => array('notEmpty'),
- //'message' => 'Your custom message here',
- //'allowEmpty' => false,
- //'required' => false,
- //'last' => false, // Stop validation after this rule
- //'on' => 'create', // Limit validation to 'create' or 'update' operations
- ),
- ),
);
//The Associations below have been created with all possible keys, those that are not needed can be removed
@@ -291,15 +231,6 @@ class User extends AppModel {
*
* @var array
*/
- public $belongsTo = array(
- 'Mannerofaddress' => array(
- 'className' => 'Mannerofaddress',
- 'foreignKey' => 'mannerofaddress_id',
- 'conditions' => '',
- 'fields' => '',
- 'order' => ''
- ),
- );
public $hasMany = array(
'AppUser' => array(
'className' => 'AppUser',
diff --git a/app/View/Elements/job_company_item.ctp b/app/View/Elements/job_company_item.ctp
index d05e3c0..3bdb122 100644
--- a/app/View/Elements/job_company_item.ctp
+++ b/app/View/Elements/job_company_item.ctp
@@ -4,17 +4,11 @@
*/
$avatar = false;
$url = '';
-if($company['AppUser']['take_systemwide']){
- if($company['User']['avatar']){
- $url = $MEDIA.DS.$company['User']['avatar'];
- $avatar = true;
- }
-}else{
- if($company['AppUser']['avatar']){
- $url = $MEDIA.DS.$company['AppUser']['avatar'];
- $avatar = true;
- }
+if($company['AppUser']['avatar']){
+ $url = $MEDIA.DS.$company['AppUser']['avatar'];
+ $avatar = true;
}
+
?>
diff --git a/app/View/Elements/job_opening_item.ctp b/app/View/Elements/job_opening_item.ctp
index 0905f28..8ba7631 100644
--- a/app/View/Elements/job_opening_item.ctp
+++ b/app/View/Elements/job_opening_item.ctp
@@ -19,17 +19,11 @@
$avatar = false;
$url = '';
-if($opening['AppUser']['take_systemwide']){
- if($opening['User']['avatar']){
- $url = $MEDIA.DS.$opening['User']['avatar'];
- $avatar = true;
- }
-}else{
- if($opening['AppUser']['avatar']){
- $url = $MEDIA.DS.$opening['AppUser']['avatar'];
- $avatar = true;
- }
+if($opening['AppUser']['avatar']){
+ $url = $MEDIA.DS.$opening['AppUser']['avatar'];
+ $avatar = true;
}
+
?>
diff --git a/app/View/Elements/user_worker_cv.ctp b/app/View/Elements/user_worker_cv.ctp
index a5a2c43..d7a7ed2 100644
--- a/app/View/Elements/user_worker_cv.ctp
+++ b/app/View/Elements/user_worker_cv.ctp
@@ -22,14 +22,7 @@ if($edit){
=__("dreamjob.bday");?> |
-
- Time->format('d.m.Y', $profil['User']['bday']);
- else
- echo $this->Time->format('d.m.Y', $profil['AppUser']['bday']);
- ?>
- |
+ =$this->Time->format('d.m.Y', $profil['AppUser']['bday']);?> |
=__("dreamjob.workexperience");?> |
diff --git a/app/View/Elements/user_worker_cv_edit.ctp b/app/View/Elements/user_worker_cv_edit.ctp
index ee9a527..0a97622 100644
--- a/app/View/Elements/user_worker_cv_edit.ctp
+++ b/app/View/Elements/user_worker_cv_edit.ctp
@@ -25,14 +25,7 @@ echo $this->Html->link($text,array('controller'=>'user','action'=>'profil'),arra
=__("dreamjob.bday");?> |
-
- Time->format('d.m.Y', $profil['User']['bday']);
- else
- echo $this->Time->format('d.m.Y', $profil['AppUser']['bday']);
- ?>
- |
+ =$this->Time->format('d.m.Y', $profil['AppUser']['bday']);?> |
|
diff --git a/app/View/Elements/user_worker_cv_pdf.ctp b/app/View/Elements/user_worker_cv_pdf.ctp
index 9623c5f..08d85c7 100644
--- a/app/View/Elements/user_worker_cv_pdf.ctp
+++ b/app/View/Elements/user_worker_cv_pdf.ctp
@@ -26,14 +26,7 @@
=__("dreamjob.bday");?> |
-
- Time->format('d.m.Y', $profil['User']['bday']);
- else
- echo $this->Time->format('d.m.Y', $profil['AppUser']['bday']);
- ?>
- |
+ =$this->Time->format('d.m.Y', $profil['AppUser']['bday']);?> |
=__("dreamjob.workexperience");?> |
diff --git a/app/View/Elements/user_worker_header.ctp b/app/View/Elements/user_worker_header.ctp
index 5dd4f2f..d279f75 100644
--- a/app/View/Elements/user_worker_header.ctp
+++ b/app/View/Elements/user_worker_header.ctp
@@ -7,12 +7,8 @@
@@ -26,25 +22,14 @@
\ No newline at end of file
+
diff --git a/app/View/Pdf/application.ctp b/app/View/Pdf/application.ctp
index 3069122..ee7377c 100644
--- a/app/View/Pdf/application.ctp
+++ b/app/View/Pdf/application.ctp
@@ -23,12 +23,8 @@ $tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($tcpdf->font);
$url=WWW_ROOT.DS.'img'.DS.'icon_user.png';
-if($application['AppUserWorker']['take_systemwide']){
- if($application['WorkerUser']['avatar'])
- $url = WWW_ROOT.DS.'uploads'.DS.$application['WorkerUser']['avatar'];
-}else
- if($profil['AppUserWorker']['avatar'])
- $url = WWW_ROOT.DS.'uploads'.DS.$application['AppUserWorker']['avatar'];
+if($profil['AppUserWorker']['avatar'])
+ $url = WWW_ROOT.DS.'uploads'.DS.$application['AppUserWorker']['avatar'];
$tcpdf->Image($url,0,40,0,140,'','','','',300,'L');
$tcpdf->SetY(185);
diff --git a/app/View/Pdf/application_ext.ctp b/app/View/Pdf/application_ext.ctp
index cec7b63..866cfb4 100644
--- a/app/View/Pdf/application_ext.ctp
+++ b/app/View/Pdf/application_ext.ctp
@@ -24,12 +24,8 @@ $tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($tcpdf->font);
$url=WWW_ROOT.DS.'img'.DS.'icon_user.png';
-if($application['AppUserWorker']['take_systemwide']){
- if($application['WorkerUser']['avatar'])
- $url = WWW_ROOT.DS.'uploads'.DS.$application['WorkerUser']['avatar'];
-}else
- if($profil['AppUserWorker']['avatar'])
- $url = WWW_ROOT.DS.'uploads'.DS.$application['AppUserWorker']['avatar'];
+if($profil['AppUserWorker']['avatar'])
+ $url = WWW_ROOT.DS.'uploads'.DS.$application['AppUserWorker']['avatar'];
$tcpdf->Image($url,0,40,0,140,'','','','',300,'L');
$tcpdf->SetY(185);
diff --git a/app/View/Pdf/profil.ctp b/app/View/Pdf/profil.ctp
index ae8f5e2..df3f36b 100644
--- a/app/View/Pdf/profil.ctp
+++ b/app/View/Pdf/profil.ctp
@@ -24,12 +24,8 @@ $tcpdf->SetTextColor(0, 0, 0);
$tcpdf->SetFont($tcpdf->font);
$url=WWW_ROOT.DS.'img'.DS.'icon_user.png';
-if($WORKER['AppUser']['take_systemwide']){
- if($WORKER['User']['avatar'])
- $url = WWW_ROOT.DS.'uploads'.DS.$WORKER['User']['avatar'];
-}else
- if($profil['AppUser']['avatar'])
- $url = WWW_ROOT.DS.'uploads'.DS.$WORKER['AppUser']['avatar'];
+if($profil['AppUser']['avatar'])
+ $url = WWW_ROOT.DS.'uploads'.DS.$WORKER['AppUser']['avatar'];
$tcpdf->Image($url,0,40,0,140,'','','','',300,'L');
$tcpdf->SetY(185);
$tcpdf->SetFont($tcpdf->font,'B',$tcpdf->fontsize+4);
diff --git a/app/View/User/company.ctp b/app/View/User/company.ctp
index 06c66eb..5b173dc 100644
--- a/app/View/User/company.ctp
+++ b/app/View/User/company.ctp
@@ -3,25 +3,18 @@
*
*/
$avatar = false;
-if($profil['AppUser']['take_systemwide']){
- if($profil['User']['avatar'])
+ if($profil['AppUser']['avatar'])
$avatar = true;
-}else{
- if($profil['AppUser']['avatar'])
- $avatar = true;
-}
+
?>