summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSashi202019-05-21 12:52:06 +0530
committerGitHub2019-05-21 12:52:06 +0530
commited28a89b7b969686fefca6ed2714bfd9133734e8 (patch)
tree77f8fd31bda950b337a7336f932e0d3e81a5a332
parent7577967964c3194fb3b4107efa61a088c84c6eb4 (diff)
parent39195e8d05e2d8850a518b9995361c053fbbe87a (diff)
downloadopenmodelica_textbook_companion-ed28a89b7b969686fefca6ed2714bfd9133734e8.tar.gz
openmodelica_textbook_companion-ed28a89b7b969686fefca6ed2714bfd9133734e8.tar.bz2
openmodelica_textbook_companion-ed28a89b7b969686fefca6ed2714bfd9133734e8.zip
Merge pull request #8 from Sashi20/drupal_7.x
Modify email templates and email headers
-rwxr-xr-xmanage_proposal.inc16
-rwxr-xr-xtextbook_companion.module168
2 files changed, 108 insertions, 76 deletions
diff --git a/manage_proposal.inc b/manage_proposal.inc
index a4db4d8..210d329 100755
--- a/manage_proposal.inc
+++ b/manage_proposal.inc
@@ -806,13 +806,25 @@ function proposal_status_form_submit($form, &$form_state)
$query->fields(array(
'submited_all_examples_code' => 0
));
- $query->condition('id', $proposal_id);
+ $query->condition('proposal_id', $proposal_id);
$num_updated = $query->execute();
/* sending email */
$book_user = user_load($proposal_data->uid);
+ $email_to = $book_user->mail;
+ $from = variable_get('textbook_companion_from_email', '');
+ $bcc = variable_get('textbook_companion_emails', '');
+ $cc = variable_get('textbook_companion_cc_emails', '');
$params['all_code_submitted_status_changed']['proposal_id'] = $proposal_id;
$params['all_code_submitted_status_changed']['user_id'] = $proposal_data->uid;
- $email_to = $book_user->mail;
+ $params['all_code_submitted_status_changed']['headers'] = array(
+ 'From' => $from,
+ 'MIME-Version' => '1.0',
+ 'Content-Type' => 'text/plain; charset=UTF-8; format=flowed; delsp=yes',
+ 'Content-Transfer-Encoding' => '8Bit',
+ 'X-Mailer' => 'Drupal',
+ 'Cc' => $cc,
+ 'Bcc' => $bcc
+ );
if (!drupal_mail('textbook_companion', 'all_code_submitted_status_changed', $email_to, language_default(), $params, variable_get('textbook_companion_from_email', NULL), TRUE))
drupal_set_message('Error sending email message.', 'error');
drupal_set_message('User has been notified of that code submission interface is now available .', 'status');
diff --git a/textbook_companion.module b/textbook_companion.module
index aa5fbb5..9ca429b 100755
--- a/textbook_companion.module
+++ b/textbook_companion.module
@@ -2695,40 +2695,34 @@ function textbook_companion_mail($key, &$message, $params)
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
We have received your proposal for OpenModelica Textbook Companion with the following details:
-Full Name : ' . $proposal_data->full_name . '
-Email : ' . $user_data->mail . '
-Mobile : ' . $proposal_data->mobile . '
-Course : ' . $proposal_data->course . '
-Department/Branch : ' . $proposal_data->branch . '
+Full Name: ' . $proposal_data->full_name . '
+Email: ' . $user_data->mail . '
+Mobile: ' . $proposal_data->mobile . '
+Course: ' . $proposal_data->course . '
+Department/Branch: ' . $proposal_data->branch . '
University/Institute : ' . $proposal_data->university . '
-City : ' . $proposal_data->city . '
-State : ' . $proposal_data->state . '
-Expected date of completion : ' . date('d-m-Y', $proposal_data->completion_date) . '
-
-
-Your Book Preferences :
-
-Book Preference :-
-Title of the book : ' . $preference1_data->book . '
-Author name : ' . $preference1_data->author . '
-ISBN No. : ' . $preference1_data->isbn . '
-Publisher and Place : ' . $preference1_data->publisher . '
-Edition : ' . $preference1_data->edition . '
-Year of publication : ' . $preference1_data->year . '
-
-
+City: ' . $proposal_data->city . '
+State: ' . $proposal_data->state . '
+Expected date of completion: ' . date('d-m-Y', $proposal_data->completion_date) . '
+Book Preference:-
+Title of the book: ' . $preference1_data->book . '
+Author name: ' . $preference1_data->author . '
+ISBN No.: ' . $preference1_data->isbn . '
+Publisher and Place: ' . $preference1_data->publisher . '
+Edition: ' . $preference1_data->edition . '
+Year of publication: ' . $preference1_data->year . '
Your proposal is under review. You will soon receive an email when your proposal has been approved/ disapproved. Thank you for your submission.
Best Wishes,
-!site_name Team,
-FOSSEE,IIT Bombay', array(
+!site_name Team
+FOSSEE, IIT Bombay', array(
'!site_name' => variable_get('site_name', ''),
'!user_name' => $user_data->name
))
@@ -2762,36 +2756,32 @@ FOSSEE,IIT Bombay', array(
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
We regret to inform you that all the uploaded examples including the book
with following details have been deleted permanently.
-Full Name : ' . $proposal_data->full_name . '
-Email : ' . $user_data->mail . '
-Mobile : ' . $proposal_data->mobile . '
-Course : ' . $proposal_data->course . '
-Department/Branch : ' . $proposal_data->branch . '
-University/Institute : ' . $proposal_data->university . '
-City : ' . $proposal_data->city . '
-State : ' . $proposal_data->state . '
-
-Expected date of completion : ' . date('d-m-Y', $proposal_data->completion_date) . '
-
-Reason : ' . $proposal_data->reason . '
-
+Full Name: ' . $proposal_data->full_name . '
+Email: ' . $user_data->mail . '
+Mobile: ' . $proposal_data->mobile . '
+Course: ' . $proposal_data->course . '
+Department/Branch: ' . $proposal_data->branch . '
+University/Institute: ' . $proposal_data->university . '
+City: ' . $proposal_data->city . '
+State: ' . $proposal_data->state . '
-Reference : ' . $proposal_data->reference . '
+Expected date of completion: ' . date('d-m-Y', $proposal_data->completion_date) . '
-Your Book Preferences :
+Reason: ' . $proposal_data->reason . '
+Reference: ' . $proposal_data->reference . '
-Book Preference 1 :-
-Title of the book : ' . $preference1_data->book . '
-Author name : ' . $preference1_data->author . '
-ISBN No. : ' . $preference1_data->isbn . '
-Publisher and Place : ' . $preference1_data->publisher . '
-Edition : ' . $preference1_data->edition . '
-Year of publication : ' . $preference1_data->year . '
+Book Preference:-
+Title of the book: ' . $preference1_data->book . '
+Author name: ' . $preference1_data->author . '
+ISBN No.: ' . $preference1_data->isbn . '
+Publisher and Place: ' . $preference1_data->publisher . '
+Edition: ' . $preference1_data->edition . '
+Year of publication: ' . $preference1_data->year . '
Reason for disapproval: ' . $proposal_data->message . '
@@ -2799,8 +2789,8 @@ You are welcome to submit a new proposal.
Best Wishes,
-!site_name Team,
-FOSSEE,IIT Bombay', array(
+!site_name Team
+FOSSEE, IIT Bombay', array(
'!site_name' => variable_get('site_name', ''),
'!user_name' => $user_data->name
))
@@ -2832,7 +2822,7 @@ FOSSEE,IIT Bombay', array(
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
Congratulations! Your proposal for OpenModelica Textbook Companion with the following details is approved.
@@ -2864,8 +2854,8 @@ http://om.fossee.in/textbook-companion/guidelines-coding
Best Wishes,
-!site_name Team,
-FOSSEE,IIT Bombay', array(
+!site_name Team
+FOSSEE, IIT Bombay', array(
'!site_name' => variable_get('site_name', ''),
'!user_name' => $user_data->name
))
@@ -2897,7 +2887,7 @@ FOSSEE,IIT Bombay', array(
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
The textbook companion on the following book has been completed successfully by you:
@@ -2927,8 +2917,8 @@ Now you should be able to propose a new book.
Best Wishes,
-!site_name Team,
-FOSSEE,IIT Bombay', array(
+!site_name Team
+FOSSEE, IIT Bombay', array(
'!site_name' => variable_get('site_name', ''),
'!user_name' => $user_data->name
))
@@ -2960,7 +2950,7 @@ FOSSEE,IIT Bombay', array(
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
You have submitted codes for all examples:
@@ -2986,8 +2976,8 @@ You shall be notified after the code is reviewed.
Best Wishes,
-!site_name Team,
-FOSSEE,IIT Bombay', array(
+!site_name Team
+FOSSEE, IIT Bombay', array(
'!site_name' => variable_get('site_name', ''),
'!user_name' => $user_data->name
))
@@ -3019,7 +3009,7 @@ FOSSEE,IIT Bombay', array(
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
Your interface for code submission has been enabled by the reviewer, you can now able to send more code for this book.
@@ -3043,8 +3033,8 @@ Year of publication : ' . $approved_preference_data->year . '
Best Wishes,
-!site_name Team,
-FOSSEE,IIT Bombay', array(
+!site_name Team
+FOSSEE, IIT Bombay', array(
'!site_name' => variable_get('site_name', ''),
'!user_name' => $user_data->name
))
@@ -3073,6 +3063,12 @@ FOSSEE,IIT Bombay', array(
$query->range(0, 1);
$result = $query->execute();
$preference_data = $result->fetchObject();
+ $query = db_select('textbook_companion_proposal');
+ $query->fields('textbook_companion_proposal');
+ $query->condition('id', $preference_data->proposal_id);
+ $query->range(0, 1);
+ $result = $query->execute();
+ $proposal_data = $result->fetchObject();
$user_data = user_load($params['example_uploaded']['user_id']);
$message['headers'] = $params['example_uploaded']['headers'];
$message['subject'] = t('[!site_name] You have uploaded example for Textbook Companion', array(
@@ -3080,7 +3076,7 @@ FOSSEE,IIT Bombay', array(
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
You have uploaded the following solution :
@@ -3093,8 +3089,8 @@ You shall be notified after the solution is reviewed
Best Wishes,
-!site_name Team,
-FOSSEE,IIT Bombay', array(
+!site_name Team
+FOSSEE, IIT Bombay', array(
'!site_name' => variable_get('site_name', ''),
'!user_name' => $user_data->name
))
@@ -3121,6 +3117,12 @@ FOSSEE,IIT Bombay', array(
$query->range(0, 1);
$result = $query->execute();
$preference_data = $result->fetchObject();
+ $query = db_select('textbook_companion_proposal');
+ $query->fields('textbook_companion_proposal');
+ $query->condition('id', $preference_data->proposal_id);
+ $query->range(0, 1);
+ $result = $query->execute();
+ $proposal_data = $result->fetchObject();
$user_data = user_load($params['example_updated']['user_id']);
$message['headers'] = $params['example_updated']['headers'];
$message['subject'] = t('[!site_name] You have updated example for Textbook Companion', array(
@@ -3128,7 +3130,7 @@ FOSSEE,IIT Bombay', array(
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
You have updated the following example:
@@ -3169,6 +3171,12 @@ FOSSEE,IIT Bombay', array(
$query->range(0, 1);
$result = $query->execute();
$preference_data = $result->fetchObject();
+ $query = db_select('textbook_companion_proposal');
+ $query->fields('textbook_companion_proposal');
+ $query->condition('id', $preference_data->proposal_id);
+ $query->range(0, 1);
+ $result = $query->execute();
+ $proposal_data = $result->fetchObject();
$user_data = user_load($params['example_updated_admin']['user_id']);
$message['headers'] = $params['example_updated_admin']['headers'];
$message['subject'] = t('[!site_name] Reviewer have updated example for Textbook Companion ', array(
@@ -3176,7 +3184,7 @@ FOSSEE,IIT Bombay', array(
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
Reviewer have updated the following example:
@@ -3216,6 +3224,12 @@ FOSSEE,IIT Bombay', array(
$query->range(0, 1);
$result = $query->execute();
$preference_data = $result->fetchObject();
+ $query = db_select('textbook_companion_proposal');
+ $query->fields('textbook_companion_proposal');
+ $query->condition('id', $preference_data->proposal_id);
+ $query->range(0, 1);
+ $result = $query->execute();
+ $proposal_data = $result->fetchObject();
$user_data = user_load($params['example_approved']['user_id']);
$message['headers'] = $params['example_approved']['headers'];
$message['subject'] = t('[!site_name] Your uploaded example has been approved for Textbook Companion', array(
@@ -3223,7 +3237,7 @@ FOSSEE,IIT Bombay', array(
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
Your example for OpenModelica Textbook Companion with the following details is approved.
@@ -3258,13 +3272,19 @@ FOSSEE,IIT Bombay', array(
$query->range(0, 1);
$result = $query->execute();
$preference_data = $result->fetchObject();
+ $query = db_select('textbook_companion_proposal');
+ $query->fields('textbook_companion_proposal');
+ $query->condition('id', $preference_data->proposal_id);
+ $query->range(0, 1);
+ $result = $query->execute();
+ $proposal_data = $result->fetchObject();
$message['headers'] = $params['example_disapproved']['headers'];
$message['subject'] = t('[!site_name] Your uploaded example has been disapproved for Textbook Companion', array(
'!site_name' => variable_get('site_name', '')
));
$message['body'] = array(
'body' => t('
-Dear !user_name,
+Dear ' . $proposal_data->full_name . ',
Your following example has been disapproved:
@@ -3328,8 +3348,8 @@ You have uploaded following dependency files :
Best Wishes,
-!site_name Team,
-FOSSEE,IIT Bombay', array(
+!site_name Team
+FOSSEE, IIT Bombay', array(
'!site_name' => variable_get('site_name', ''),
'!user_name' => $user_data->name
))
@@ -3357,8 +3377,8 @@ Your feedback :
Best Wishes,
-!site_name Team,
-FOSSEE,IIT Bombay', array(
+!site_name Team
+FOSSEE, IIT Bombay', array(
'!site_name' => variable_get('site_name', ''),
'!user_name' => $user_data->name
))
@@ -3383,8 +3403,8 @@ Example No.: ' . $params['internshipform']['example_no'] . '
Best Wishes,
-!site_name Team,
-FOSSEE,IIT Bombay', array(
+!site_name Team
+FOSSEE, IIT Bombay', array(
'!site_name' => variable_get('site_name', ''),
'!user_name' => $user_data->name
))