diff --git a/includes/mail.inc b/includes/mail.inc index 83be066..3d91df6 100644 --- a/includes/mail.inc +++ b/includes/mail.inc @@ -510,6 +510,7 @@ function _project_issue_mail($key, &$message, $params) { function project_issue_mail_generate_followup_mail_body($node, $history, $display_files, $recipient = NULL) { global $user; static $cache = array(); + $output = ''; $mail_body = $recipient->project_issue_notification['mail_body']; @@ -560,29 +561,33 @@ function project_issue_mail_generate_followup_mail_body($node, $history, $displa 'label' => $fields['updator'], ); - $summary = theme('project_issue_mail_summary', $entry, $node, $comment_changes, $display_files); + // Append the metadata which has changed. + $output .= theme('project_issue_mail_summary', $entry, $node, $comment_changes, $display_files, FALSE); // Create main body content project_issue_mail_output($content, 1, $entry->format); - $body = "$content\n$entry->name\n"; + $output .= $content . "\n" . $entry->name . "\n"; + + // Append all current metadata + $current = project_issue_metadata_changes($node, $new_data, $new_data); + $ouptut .= theme('project_issue_mail_summary', $entry, $node, $current, $display_files, TRUE); - // Append complete follow-up history if recient prefers that. + // Append complete follow-up history if recipient prefers that. if ($mail_body == PROJECT_ISSUE_MAIL_BODY_FULL_HISTORY) { $hr = str_repeat('-', 72); if (count($history)) { - $body .= "\n\n"; - $body .= t('Original issue:') ."\n"; - $body .= project_issue_mail_format_entry(array_shift($history), $display_files, TRUE); + $output .= "\n\n"; + $output .= t('Original issue:') ."\n"; + $output .= project_issue_mail_format_entry(array_shift($history), $display_files, TRUE); if (count($history)) { - $body .= "\n". t('Previous comments (!count):', array('!count' => count($history))) ."\n"; + $output .= "\n". t('Previous comments (!count):', array('!count' => count($history))) ."\n"; foreach ($history as $entry) { - $body .= project_issue_mail_format_entry($entry, $display_files); + $output .= project_issue_mail_format_entry($entry, $display_files); } } } } - $output = "$summary\n$body"; // Set cached output. $cache[$display_files][$mail_body] = $output; @@ -606,10 +611,12 @@ function project_issue_mail_generate_followup_mail_body($node, $history, $displa * is the output of the project_issue_metadata_changes() function. * @param $display_files * Boolean indicating if file attachments should be displayed. + * @param $show_unchanged + * Display metadata properties which did not change. * @return * A string containing the themed text of the issue metadata table. */ -function theme_project_issue_mail_summary($entry, $node, $changes, $display_files) { +function theme_project_issue_mail_summary($entry, $node, $changes, $display_files, $show_unchanged = TRUE) { // Mail summary (status values). $summary = ''; foreach ($changes as $field => $change) { @@ -630,10 +637,12 @@ function theme_project_issue_mail_summary($entry, $node, $changes, $display_file * @param $change * A nested array containing changes to project issue metadata * for the given issue or comment. + * @param $show_unchanged + * Display properties which did not change. * @return * A themed line or lines of text ready for inclusion into the email body. */ -function theme_project_issue_mail_summary_field($node, $field_name, $change) { +function theme_project_issue_mail_summary_field($node, $field_name, $change, $show_unchanged = TRUE) { // We need to run the label name through strip_tags here so that // the spacing isn't messed up if there are HTML tags in $change['label']. $text = str_pad(strip_tags($change['label']). ':', 14); @@ -684,7 +693,7 @@ function theme_project_issue_mail_summary_field($node, $field_name, $change) { // For example, the project, category, etc. are printed in each email // whether or not they have changed. // @TODO: Should we really assume the field in is $node->project_issue[]? - if (isset($node->project_issue[$field_name])) { + if ($show_unchanged && isset($node->project_issue[$field_name])) { $summary_row .= " $text". project_issue_change_summary($field_name, $node->project_issue[$field_name]) ."\n"; } } diff --git a/project_issue.module b/project_issue.module index b0e709a..0db47d7 100644 --- a/project_issue.module +++ b/project_issue.module @@ -400,6 +400,7 @@ function project_issue_theme() { 'node' => NULL, 'changes' => NULL, 'display_files' => NULL, + 'show_unchanged' => NULL, ), ), 'project_issue_mail_summary_field' => array(