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