From ba5fc44f12b4421649055459f9c20f001929d60e Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Tue, 18 Apr 2017 14:13:54 -0500 Subject: [PATCH] Fix message with survey invitations sent - refs BT#12554 --- main/survey/surveyUtil.class.php | 20 +++++++++++++------- main/survey/survey_invite.php | 19 ++++++++++++------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/main/survey/surveyUtil.class.php b/main/survey/surveyUtil.class.php index fd65605df8..5aa478dd59 100755 --- a/main/survey/surveyUtil.class.php +++ b/main/survey/surveyUtil.class.php @@ -2054,22 +2054,28 @@ class SurveyUtil * This function saves all the invitations of course users and additional users in the database * and sends the invitations by email * - * @param array Users array can be both a list of course uids AND a list of additional emailaddresses - * @param string Title of the invitation, used as the title of the mail - * @param string Text of the invitation, used as the text of the mail. - * The text has to contain a **link** string or this will automatically be added to the end + * @param $users_array Users $array array can be both a list of course uids AND a list of additional emailaddresses + * @param $invitation_title Title $string of the invitation, used as the title of the mail + * @param $invitation_text Text $string of the invitation, used as the text of the mail. + * The text has to contain a **link** string or this will automatically be added to the end + * @param int $reminder + * @param bool $sendmail + * @param int $remindUnAnswered * @return int + * @internal param + * @internal param + * @internal param + * The text has to contain a **link** string or this will automatically be added to the end * @author Patrick Cool , Ghent University * @author Julio Montoya - Adding auto-generated link support * @version January 2007 - * */ public static function saveInvitations( $users_array, $invitation_title, $invitation_text, $reminder = 0, - $sendmail = 0, + $sendmail = false, $remindUnAnswered = 0 ) { if (!is_array($users_array)) { @@ -2163,7 +2169,7 @@ class SurveyUtil } // Send the email if checkboxed - if (($new_user || $reminder == 1) && $sendmail != 0) { + if (($new_user || $reminder == 1) && $sendmail) { // Make a change for absolute url if (isset($invitation_text)) { $invitation_text = api_html_entity_decode($invitation_text, ENT_QUOTES); diff --git a/main/survey/survey_invite.php b/main/survey/survey_invite.php index 1f4b0a81f9..7f9a2e3ecf 100755 --- a/main/survey/survey_invite.php +++ b/main/survey/survey_invite.php @@ -171,7 +171,12 @@ $form->addElement('label', null, $auto_survey_link); if ($form->validate()) { $values = $form->exportValues(); - if (isset($values['send_mail']) && $values['send_mail'] == 1) { + + $resendAll = isset($values['resend_to_all']) ? $values['resend_to_all'] : ''; + $sendMail = isset($values['send_mail']) ? $values['send_mail'] : ''; + $remindUnAnswered = isset($values['remindUnAnswered']) ? $values['remindUnAnswered'] : ''; + + if ($sendMail) { if (empty($values['mail_title']) || empty($values['mail_text'])) { Display :: display_error_message(get_lang('FormHasErrorsPleaseComplete')); // Getting the invited users @@ -197,10 +202,6 @@ if ($form->validate()) { !empty($survey_data['invite_mail']) ); - $resendAll = isset($values['resend_to_all']) ? $values['resend_to_all'] : ''; - $sendMail = isset($values['send_mail']) ? $values['send_mail'] : ''; - $remindUnAnswered = isset($values['remindUnAnswered']) ? $values['remindUnAnswered'] : ''; - // Saving the invitations for the course users $count_course_users = SurveyUtil::saveInvitations( $values['users'], @@ -248,8 +249,12 @@ if ($form->validate()) { $message .= ''. $total_invited.' '; $message .= get_lang('WereInvited'); - Display::display_normal_message($message, false); - Display::display_confirmation_message($total_count.' '.get_lang('InvitationsSend')); + + echo Display::return_message($message, 'normal', false); + + if ($sendMail) { + echo Display::return_message($total_count.' '.get_lang('InvitationsSend'), 'success', false); + } } } else { // Getting the invited users