summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpriyankabhagwat2015-05-13 11:50:29 +0530
committerpriyankabhagwat2015-05-13 11:50:29 +0530
commit8af46bf47d4e4b41f699ced5550a446a78d06ce0 (patch)
treec0b5136b933be3898f2ac718b5c121c3e30570b6
parent581b90225634aacd4c544680c10236776411e836 (diff)
downloadscilab-bulk-code-manages-8af46bf47d4e4b41f699ced5550a446a78d06ce0.tar.gz
scilab-bulk-code-manages-8af46bf47d4e4b41f699ced5550a446a78d06ce0.tar.bz2
scilab-bulk-code-manages-8af46bf47d4e4b41f699ced5550a446a78d06ce0.zip
Delete without folderHEADmaster
-rwxr-xr-xbulk_code.module34
1 files changed, 31 insertions, 3 deletions
diff --git a/bulk_code.module b/bulk_code.module
index 89ba381..010d02c 100755
--- a/bulk_code.module
+++ b/bulk_code.module
@@ -146,10 +146,38 @@ function bulk_code_all(){
exit();
}
} else {
- $data = "Book directory not present : " . $dir_path . ". Skipping deleting book directory.";
+ $data = "Book directory not present : " . $dir_path . ". Skip deleting book directory.";
echo $data;
- exit();
- }
+ $preference_q = db_query("SELECT * FROM {textbook_companion_preference} WHERE id = %d", $pref_id);
+ $preference_data = db_fetch_object($preference_q);
+ $proposal_id = $preference_data->proposal_id;
+ db_query("DELETE FROM {textbook_companion_preference} WHERE proposal_id = %d", $proposal_id);
+ db_query("DELETE FROM {textbook_companion_proposal} WHERE id = %d", $proposal_id);
+ $data .= 'Deleted Book Proposal.';
+ /* email */
+ $email_subject = t('Your uploaded examples including the book proposal have been deleted');
+ $email_body = t('Your all the uploaded examples including the book have been deleted permanently.
+
+Reason for deletion:
+
+' . $disapproval_reason);
+ if ($email_subject)
+ {
+ $email_to = $user->mail;
+ $param['standard']['subject'] = $email_subject;
+ $param['standard']['body'] = $email_body;
+ if (!drupal_mail('textbook_companion', 'standard', $email_to, language_default(), $param, variable_get('textbook_companion_from_email', NULL), TRUE))
+ $data .='Error sending email message.';
+ echo $data;
+ exit();
+ }
+
+ else {
+ $data .= "Error Dis-Approving and Deleting Entire Book.";
+ echo $data;
+ exit();
+ }
+ }
/* deleting preference and proposal */
$preference_q = db_query("SELECT * FROM {textbook_companion_preference} WHERE id = %d", $pref_id);
$preference_data = db_fetch_object($preference_q);