diff options
author | prashant | 2015-11-04 18:10:42 +0530 |
---|---|---|
committer | prashant | 2015-11-04 18:10:42 +0530 |
commit | bd61ca0bae497fef876a3b8c716e70919e651474 (patch) | |
tree | ce2c3041afda690d0f7ea29af3e4ae9cd4925d2b /manage_solution_proposal.inc | |
parent | cf4aee0e5675851843062a070ed67b3194ddd7cf (diff) | |
download | DWSIM_lab_migration_module-bd61ca0bae497fef876a3b8c716e70919e651474.tar.gz DWSIM_lab_migration_module-bd61ca0bae497fef876a3b8c716e70919e651474.tar.bz2 DWSIM_lab_migration_module-bd61ca0bae497fef876a3b8c716e70919e651474.zip |
mail function modifed and formated the code
Diffstat (limited to 'manage_solution_proposal.inc')
-rwxr-xr-x | manage_solution_proposal.inc | 53 |
1 files changed, 35 insertions, 18 deletions
diff --git a/manage_solution_proposal.inc b/manage_solution_proposal.inc index 2bace0c..95a34e7 100755 --- a/manage_solution_proposal.inc +++ b/manage_solution_proposal.inc @@ -14,7 +14,7 @@ function lab_migration_solution_proposal_pending() $pending_q = $query->execute(); while ($pending_data = $pending_q->fetchObject()) { - $pending_rows[$pending_data->id] = array(l($pending_data->name, 'user/' . $pending_data->uid), $pending_data->lab_title, l('Approve', 'lab_migration/manage_proposal/solution_proposal_approve/' . $pending_data->id)); + $pending_rows[$pending_data->id] = array(l($pending_data->name, 'user/' . $pending_data->uid), $pending_data->lab_title, l('Approve', 'lab-migration/manage-proposal/solution-proposal-approve/' . $pending_data->id)); } /* check if there are any pending proposals */ @@ -51,12 +51,12 @@ function lab_migration_solution_proposal_approval_form($form_state) /* everything ok */ } else { drupal_set_message(t('Invalid proposal selected. Please try again.'), 'error'); - drupal_goto('lab_migration/manage_proposal/pending_solution_proposal'); + drupal_goto('lab-migration/manage-proposal/pending-solution-proposal'); return; } } else { drupal_set_message(t('Invalid proposal selected. Please try again.'), 'error'); - drupal_goto('lab_migration/manage_proposal/pending_solution_proposal'); + drupal_goto('lab-migration/manage-proposal/pending-solution-proposal'); return; } @@ -159,7 +159,7 @@ function lab_migration_solution_proposal_approval_form($form_state) $form['cancel'] = array( '#type' => 'markup', - '#value' => l(t('Cancel'), 'lab_migration/manage_proposal/pending_solution_proposal'), + '#value' => l(t('Cancel'), 'lab-migration/manage-proposal/pending-solution-proposal'), ); return $form; @@ -208,12 +208,12 @@ function lab_migration_solution_proposal_approval_form_submit($form, &$form_stat /* everything ok */ } else { drupal_set_message(t('Invalid proposal selected. Please try again.'), 'error'); - drupal_goto('lab_migration/manage_proposal/pending_solution_proposal'); + drupal_goto('lab-migration/manage-proposal/pending-solution-proposal'); return; } } else { drupal_set_message(t('Invalid proposal selected. Please try again.'), 'error'); - drupal_goto('lab_migration/manage_proposal/pending_solution_proposal'); + drupal_goto('lab-migration/manage-proposal/pending-solution-proposal'); return; } @@ -228,42 +228,59 @@ function lab_migration_solution_proposal_approval_form_submit($form, &$form_stat /* sending email */ $email_to = $user_data->mail; + + $from = variable_get('lab_migration_from_email', ''); + $bcc= $user->mail . ', ' .variable_get('lab_migration_emails', ''); + $cc=variable_get('lab_migration_cc_emails', ''); + $param['solution_proposal_approved']['proposal_id'] = $proposal_id; $param['solution_proposal_approved']['user_id'] = $proposal_data->solution_provider_uid; - if (!drupal_mail('lab_migration', 'solution_proposal_approved', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) + $param['solution_proposal_approved']['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('lab_migration', 'solution_proposal_approved', $email_to , language_default(), $param, $from, TRUE)) drupal_set_message('Error sending email message.', 'error'); - $email_to = $user->mail . ', ' . variable_get('lab_migration_emails', ''); + /*$email_to = $user->mail . ', ' . variable_get('lab_migration_emails', ''); if (!drupal_mail('lab_migration', 'solution_proposal_approved', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) - drupal_set_message('Error sending email message.', 'error'); + drupal_set_message('Error sending email message.', 'error');*/ drupal_set_message('Lab migration solution proposal approved. User has been notified of the approval.', 'status'); - drupal_goto('lab_migration/manage_proposal/pending_solution_proposal'); + drupal_goto('lab-migration/manage-proposal/pending-solution_proposal'); return; } else if ($form_state['values']['approval'] == 2) { $query = "UPDATE {lab_migration_proposal} SET solution_provider_uid = :solution_provider_uid, solution_status = :solution_status, solution_provider_name_title = '', solution_provider_name = '', solution_provider_contact_ph = '', solution_provider_department = '', solution_provider_university = '' WHERE id = :proposal_id"; $args = array( ":solution_provider_uid" => 0, - ":solution_status" => 0, + ":solution_status" => 0, ":proposal_id" => $proposal_id ); db_query($query, $args); - /* sending email */ + /* sending email */ $email_to = $user_data->mail; + + $from = variable_get('lab_migration_from_email', ''); + $bcc= $user->mail . ', ' .variable_get('lab_migration_emails', ''); + $cc=variable_get('lab_migration_cc_emails', ''); + $param['solution_proposal_disapproved']['proposal_id'] = $proposal_id; $param['solution_proposal_disapproved']['user_id'] = $proposal_data->solution_provider_uid; $param['solution_proposal_disapproved']['message'] = $form_state['values']['message']; - if (!drupal_mail('lab_migration', 'solution_proposal_disapproved', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) - drupal_set_message('Error sending email message.', 'error'); + $param['solution_proposal_disapproved']['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); - $email_to = $user->mail . ', ' . variable_get('lab_migration_emails', '');; - if (!drupal_mail('lab_migration', 'solution_proposal_disapproved', $email_to , language_default(), $param, variable_get('lab_migration_from_email', NULL), TRUE)) - drupal_set_message('Error sending email message.', 'error'); + if (!drupal_mail('lab_migration', 'solution_proposal_disapproved', $email_to , language_default(), $param, $from, TRUE)) + drupal_set_message('Error sending email message.', 'error'); drupal_set_message('Lab migration solution proposal dis-approved. User has been notified of the dis-approval.', 'status'); - drupal_goto('lab_migration/manage_proposal/pending_solution_proposal'); + drupal_goto('lab-migration/manage-proposal/pending-solution-proposal'); return; } } |