Skip to content

Commit

Permalink
[spalenque] - #13742 * send email to alison when survey is submitted
Browse files Browse the repository at this point in the history
  • Loading branch information
santipalenque committed Feb 8, 2018
1 parent e84524e commit cbd0c83
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
2 changes: 2 additions & 0 deletions sample._ss_environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
define('MARKETPLACE_ADMIN_UPDATE_EMAIL_TO','');

define('DEPLOYMENT_SURVEY_THANK_U_FROM_EMAIL','');

define('SURVEY_COMPLETE_EMAIL_TO','');
//used on openstack/code/FeedbackForm.php (submitFeedback - ln 46)
define('FEEDBACK_FORM_FROM_EMAIL','');
define('FEEDBACK_FORM_TO_EMAIL','');
Expand Down
18 changes: 18 additions & 0 deletions survey_builder/code/model/SurveyManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,24 @@ public function sendFinalStepEmail(IMessageSenderService $sender_service, ISurve
{
return $this->tx_manager->transaction(function() use($sender_service, $survey){
$survey->sentEmail($sender_service);

// send email to admin
$survey_url = Director::absoluteBaseUrl().'sangria/SurveyDetails/'.$survey->ID;
$body = 'Respondent: '.$survey->CreatedBy()->getName().'<br/>';
$body .= 'Template: '.$survey->Template()->Title.'<br/>';
$body .= 'State: '.$survey->State.'<br/>';
$body .= 'Lang: '.$survey->Lang.'<br/>';
$body .= '<a href="'.$survey_url.'">Review</a>';
$email = EmailFactory::getInstance()->buildEmail
(
"noreply@openstack.org",
SURVEY_COMPLETE_EMAIL_TO,
"New Survey Submitted",
$body
);

$email->send();

});
}

Expand Down
1 change: 1 addition & 0 deletions survey_builder/code/ui/frontend/SurveyPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ public function NextStep($data, $form)
if ($current_survey->isLastStep() && $current_step->template()->getType() == 'SurveyReviewStepTemplate') {
if(!$current_survey->isEmailSent())
$this->survey_manager->sendFinalStepEmail(new SurveyThankYouEmailSenderService, $current_survey);

$this->survey_manager->completeSurvey($current_step);
$form->sessionMessage(GetTextTemplateHelpers::_t("survey_ui", "Thank you for your submission !!!"), 'good');
}
Expand Down

0 comments on commit cbd0c83

Please sign in to comment.