summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorprashant2014-10-10 18:48:40 +0530
committerprashant2014-10-10 18:48:40 +0530
commit6356db73822485afaa781bc485e3b29e44b9c584 (patch)
treee8f29e6ec299c6a50a317458eaad7cfc768c8d69
parent436aece22dc72e74f75925d0b5109b257ca296c8 (diff)
downloadtbc-external-review-6356db73822485afaa781bc485e3b29e44b9c584.tar.gz
tbc-external-review-6356db73822485afaa781bc485e3b29e44b9c584.tar.bz2
tbc-external-review-6356db73822485afaa781bc485e3b29e44b9c584.zip
solved problem of automatic mail function
-rwxr-xr-xtbc_external_review.module171
1 files changed, 77 insertions, 94 deletions
diff --git a/tbc_external_review.module b/tbc_external_review.module
index 51b9035..0279c52 100755
--- a/tbc_external_review.module
+++ b/tbc_external_review.module
@@ -2406,54 +2406,48 @@
LEFT JOIN external_review_profile erp ON erp.uid = erd.uid
WHERE erd.status = 1 AND completed = 0 AND rol.rid = 9 AND id = {$id}
";
- $result = db_query($query);
- $num_rows = mysql_num_rows($result); //either 1 or 0
- if($num_rows){
+ $result = db_query($query);
$row = db_fetch_object($result);
$start_date = new DateTime($row->time);
$current_date = new DateTime();
$since_start = $start_date->diff($current_date);
$diff = ($since_start->format('%a'));
- if($diff % 15 == 0){
+ if($diff % 15 == 0){
- $query = "
- UPDATE external_review_details
- SET failed_reminder = failed_reminder + 1
- WHERE preference_id = {$id}
- ";
+ $query = "
+ UPDATE external_review_details
+ SET failed_reminder = failed_reminder + 1
+ WHERE preference_id = {$id}
+ ";
- /* sending mail */
- $to = $row->mail;
- $subject = "Reminder to complete review'";
- $body = "
- <p>
- Dear Reviewer,<br><br>
- This is to remind you that it has been 15 days since the book was allotted to you. You still have 15 days left from the provided 30 days to submit your review comments.<br>
- Please submit your review comments in the Scilab interface. If you fail to submit the comments on time, the textbook will be removed from your account.<br>
- Please note that extension of deadline is not possible on any account.<br><br>
- Regards,<br>
- Scilab Team
- </p>
- ";
- $message = array(
- "to" => $to,
- "subject" => $subject,
- "body" => $body,
- "headers" => array(
- "From" => "textbook@scilab.in",
- "Bcc" => "textbook@scilab.in, lavitha89@gmail.com, bhavani.jalkrish@gmail.com, rush2jrp@gmail.com, prashantsinalkar@gmail.com",
- "Content-Type" => "text/html; charset=UTF-8; format=flowed"
- )
- );
- drupal_mail_send($message);
- db_query($query);
- drupal_goto("tbc_external_review/reminder_all");
- } else
- {
-
- drupal_goto("tbc_external_review/reminder_all");
- }
- }
+ /* sending mail */
+ $to = $row->mail;
+ $subject = "Reminder to complete review";
+ $body = "
+ <p>
+ Dear Reviewer,<br><br>
+ {$row->first_name}<br>
+ This is to remind you that it has been 15 days since the book was allotted to you. You still have 15 days left from the provided 30 days to submit your review comments.
+ Please submit your review comments in the Scilab interface. If you fail to submit the comments on time, the textbook will be removed from your account.<br>
+ Please note that extension of deadline is not possible on any account.<br><br>
+ Regards,<br>
+ Scilab Team
+ </p>
+ ";
+ $message = array(
+ "to" => $to,
+ "subject" => $subject,
+ "body" => $body,
+ "headers" => array(
+ "From" => "textbook@scilab.in",
+ "Bcc" => "textbook@scilab.in, lavitha89@gmail.com, bhavani.jalkrish@gmail.com, rush2jrp@gmail.com, prashantsinalkar@gmail.com",
+ "Content-Type" => "text/html; charset=UTF-8; format=flowed"
+ )
+ );
+ drupal_mail_send($message);
+ db_query($query);
+ } else {
+ }
}
$page_content = "";
@@ -2501,57 +2495,47 @@
WHERE erd.status = 1 AND rol.rid = 9 AND erc.review = 0 AND erd.failed_review = 0 AND pre.id = {$id}
";
$result = db_query($query);
- $num_rows = mysql_num_rows($result); //either 1 or 0
- if($num_rows){
- $row = db_fetch_object($result);
- $start_date = new DateTime($row->time);
- $current_date = new DateTime();
- $since_start = $start_date->diff($current_date);
- $diff = ($since_start->format('%a'));
+ $row = db_fetch_object($result);
+ $start_date = new DateTime($row->time);
+ $current_date = new DateTime();
+ $since_start = $start_date->diff($current_date);
+ $diff = ($since_start->format('%a'));
if($diff % 15 == 0){
- /* increment failed_reminder */
- $query = "
- UPDATE external_review_details
- SET failed_review = failed_review + 1
- WHERE preference_id = {$id}
- ";
-
- /* sending mail */
-
- // $to = $row->mail;
- $subject = " External reviewers book delay";
- $body = "
- <p>
- Dear Scilab Team,<br><br>
- This is to inform you that <b>{$row->first_name} {$row->last_name}</b> has failed to review the Book: <b>{$row->book}</b>, Author: <b>{$row->author},
- Edition: <b>{$row->edition}</b> on time.<br><br><br>
-
- Regards,<br>
- TBC Reviewer
- </p>
- ";
- $message = array(
-
- "to" => "lavitha89@gmail.com, bhavani.jalkrish@gmail.com ",
- "subject" => $subject,
- "body" => $body,
- "headers" => array(
- "From" => "textbook@scilab.in",
- "Bcc" => "rush2jrp@gmail.com, prashantsinalkar@gmail.com",
- "Content-Type" => "text/html; charset=UTF-8; format=flowed"
- )
- );
- drupal_mail_send($message);
- db_query($query);
- drupal_goto("tbc_external_review/reminder_all/tbc_reviewer_all_reminder");
- } else
- {
-
- drupal_goto("tbc_external_review/reminder_all/tbc_reviewer_all_reminder");
+ /* increment failed to review */
+ $query = "
+ UPDATE external_review_details
+ SET failed_review = failed_review + 1
+ WHERE preference_id = {$id}
+ ";
+ /* sending mail */
+ $to = $row->mail;
+ $subject = " External reviewers book delay";
+ $body = "
+ <p>
+ Dear TBC Reviewers ,<br><br>
+ This is to inform you that <b>{$row->first_name} {$row->last_name}</b> has failed to review the Book: <b>{$row->book}</b>, Author: <b>{$row->author},
+ Edition: <b>{$row->edition}</b> on time.<br><br><br>
+ Regards,<br>
+ Scilab Team
+ </p>
+ ";
+ $message = array(
+ "to" => "lavitha89@gmail.com, bhavani.jalkrish@gmail.com ",
+ "subject" => $subject,
+ "body" => $body,
+ "headers" => array(
+ "From" => "textbook@scilab.in",
+ "Bcc" => "rush2jrp@gmail.com, prashantsinalkar@gmail.com",
+ "Content-Type" => "text/html; charset=UTF-8; format=flowed"
+ )
+ );
+ drupal_mail_send($message);
+ db_query($query);
+ } else{
}
- }
}
- $page_content = "";
+
+ $page_content = "";
$query = "
SELECT DISTINCT pre.id AS id, pre.book, pre.author, pre.edition, usr.uid, erd.failed_reminder,
erd.failed_review, erp.first_name, erp.last_name, usr.mail FROM textbook_companion_preference pre
@@ -2565,7 +2549,6 @@
$result = db_query($query);
$headers = array(
"Book", "Author", "Reviewer Name"
-
);
$rows = array();
while ($row = db_fetch_object($result)) {
@@ -2573,7 +2556,7 @@
$row->book,
$row->author,
$row->first_name ." ". $row->last_name,
- $row->failed_review,
+ // $row->failed_review,
_tbc_er_reminder_mail($row->id),
);
array_push($rows, $item);
@@ -2597,8 +2580,8 @@
$result = db_query($query);
$headers = array(
- "Book", "Author", "Reviewer Name",
- "Remainders"
+ "Book", "Author", "Reviewer Name",
+ "Remainders"
);
$rows = array();
while ($row = db_fetch_object($result)) {
@@ -2630,7 +2613,7 @@
";
$result = db_query($query);
$headers = array(
- "Book", "Author", "Reviewer Name"
+ "Book", "Author", "Reviewer Name"
);
$rows = array();
while ($row = db_fetch_object($result)) {