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

View File

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

View File

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