mail message user/company switch
This commit is contained in:
parent
f453285de1
commit
6eadfb2c25
|
@ -1,6 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
App::uses('AppModel', 'Model');
|
App::uses('AppModel', 'Model');
|
||||||
App::uses('CakeEmail', 'Network/Email');
|
App::uses('CakeEmail', 'Network/Email');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MicDjJobsMsg Model
|
* MicDjJobsMsg Model
|
||||||
*
|
*
|
||||||
|
@ -48,6 +50,7 @@ class DreamjobJobMsg extends AppModel {
|
||||||
$Email->viewVars(array('id' => $id, 'data' => $data));
|
$Email->viewVars(array('id' => $id, 'data' => $data));
|
||||||
return $Email->send();
|
return $Email->send();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function sendMessage() {
|
public function sendMessage() {
|
||||||
$dataSource = $this->getDataSource();
|
$dataSource = $this->getDataSource();
|
||||||
$dataSource->begin();
|
$dataSource->begin();
|
||||||
|
@ -56,9 +59,9 @@ class DreamjobJobMsg extends AppModel {
|
||||||
$app = $this->DreamjobJobApplication->find('first', array('conditions' => array('DreamjobJobApplication.id' => $result["DreamjobJobMsg"]["application_id"])));
|
$app = $this->DreamjobJobApplication->find('first', array('conditions' => array('DreamjobJobApplication.id' => $result["DreamjobJobMsg"]["application_id"])));
|
||||||
|
|
||||||
if ($this->fromcompany)
|
if ($this->fromcompany)
|
||||||
$result = self::sendMail($app['User']['mail'],$this->application_id,array('DreamjobCompany'=>$app['DreamjobCompany']),true);
|
|
||||||
else
|
|
||||||
$result = self::sendMail($app['WorkerUser']['mail'], $this->application_id, array('User' => $app['WorkerUser'], 'AppUser' => $app['AppUserWorker']));
|
$result = self::sendMail($app['WorkerUser']['mail'], $this->application_id, array('User' => $app['WorkerUser'], 'AppUser' => $app['AppUserWorker']));
|
||||||
|
else
|
||||||
|
$result = self::sendMail($app['User']['mail'], $this->application_id, array('DreamjobCompany' => $app['DreamjobCompany']), true);
|
||||||
}
|
}
|
||||||
if ($result) {
|
if ($result) {
|
||||||
$dataSource->commit();
|
$dataSource->commit();
|
||||||
|
@ -68,6 +71,7 @@ class DreamjobJobMsg extends AppModel {
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public $validate = array(
|
public $validate = array(
|
||||||
'application_id' => array(
|
'application_id' => array(
|
||||||
'numeric' => array(
|
'numeric' => array(
|
||||||
|
@ -165,6 +169,6 @@ class DreamjobJobMsg extends AppModel {
|
||||||
'conditions' => array('Opening.company_id = AppUserCompany.id and Company.id = AppUserWorker.user_id'),
|
'conditions' => array('Opening.company_id = AppUserCompany.id and Company.id = AppUserWorker.user_id'),
|
||||||
'limit' => 1
|
'limit' => 1
|
||||||
),
|
),
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue