This commit is contained in:
Martin Müller 2014-04-11 17:36:26 +02:00
parent 06113de208
commit c169fd9305
3 changed files with 6 additions and 8 deletions

View File

@ -13,11 +13,12 @@ class RegistrationController extends AppController {
public $componens = array('Email','MiconwareSession'); public $componens = array('Email','MiconwareSession');
public $uses = array('Mannerofaddress','DreamjobListGraducation','DreamjobListBranch','DreamjobWorker','DreamjobCompany','User'); public $uses = array('Mannerofaddress','DreamjobListGraducation','DreamjobListBranch','DreamjobWorker','DreamjobCompany','User');
private function registrationMail($data,$key){ public static function registrationMail($data){
$Email = new CakeEmail('dreamjobMain'); $Email = new CakeEmail('dreamjobMain');
$Email->to($data['User']['mail']); $Email->to($data['User']['mail']);
$Email->subject('Welcome to our really cool thing'); $Email->subject('Welcome to our really cool thing');
$Email->template('registration'); $Email->template('registration');
$key = substr($data['User']['code'],2);
$Email->viewVars(array('data'=>$data,'key'=>$key)); $Email->viewVars(array('data'=>$data,'key'=>$key));
return $Email->send(); return $Email->send();
} }
@ -61,12 +62,6 @@ class RegistrationController extends AppController {
$data['User']['is_active'] = false; $data['User']['is_active'] = false;
$result = $this->DreamjobCompany->registration($data); $result = $this->DreamjobCompany->registration($data);
if($result){
$result = $this->registrationMail($data,$key);
if($result){
$this->log("Registratrion Mail:"+$data['User']['mail']);
}
}
if ($result) { if ($result) {
$this->MiconwareSession->setFlash('dreamjob.registration.done','flash',array('alert'=>'success')); $this->MiconwareSession->setFlash('dreamjob.registration.done','flash',array('alert'=>'success'));
}else{ }else{

View File

@ -140,7 +140,8 @@ class DreamjobCompany extends AppModel {
$result = $this->User->saveField('mannerofaddress_id',$data['AppUser']['mannerofaddress_id']); $result = $this->User->saveField('mannerofaddress_id',$data['AppUser']['mannerofaddress_id']);
} }
if($result)
$result = RegistrationController::registrationMail($data);
if ($result) { if ($result) {
$dataSource->commit(); $dataSource->commit();

View File

@ -86,6 +86,8 @@ class DreamjobWorker extends AppModel {
$this->create(array('DreamjobWorker'=>$data['DreamjobWorker'])); $this->create(array('DreamjobWorker'=>$data['DreamjobWorker']));
$result=$this->save(); $result=$this->save();
} }
if($result)
$result = RegistrationController::registrationMail($data);
if ($result) { if ($result) {
$dataSource->commit(); $dataSource->commit();