From 018937a24f2ea5c330ef864a6d9772421877212b Mon Sep 17 00:00:00 2001 From: CasN Date: Mon, 24 Jun 2024 09:55:59 +0200 Subject: [PATCH] Reviewed the script bug_reminder_mail2.php Reviewed the script bug_reminder_mail2.php --- scripts/bug_reminder_mail2.php | 64 +++++++++++----------------------- 1 file changed, 20 insertions(+), 44 deletions(-) diff --git a/scripts/bug_reminder_mail2.php b/scripts/bug_reminder_mail2.php index 5c2285a..6ddad16 100644 --- a/scripts/bug_reminder_mail2.php +++ b/scripts/bug_reminder_mail2.php @@ -1,6 +1,6 @@ "; - if ( ON == $t_rem_handler ) { - $query = "select id,handler_id,project_id from {bug} bugs where status in (".implode(",", $t_rem_status).") and due_date<=$baseline and handler_id>0 "; $query = "select bugs.id, bugs.handler_id, bugs.project_id, bugs.priority, bugs.category_id, bugs.status, bugs.severity, bugs.summary from {bug} bugs JOIN {bug_text} text ON (bugs.bug_text_id = text.id) where status in (".implode(",", $t_rem_status).") and due_date<=$baseline and handler_id<>0 "; - if ( ON == $t_rem_ign_past ) { $query .=" and due_date>=$basenow" ; } else{ @@ -57,15 +50,15 @@ $t_rem_projects = "("; $t_rem_projects .= config_get('plugin_Reminder_reminder_project_id'); $t_rem_projects .= ")"; -if ( ON==$t_rem_include ){ - if ( !empty( config_get( 'plugin_Reminder_reminder_project_id' ) ) ) { - $query .= " and bugs.project_id IN ". $t_rem_projects; - } -} else { - if (!empty( config_get( 'plugin_Reminder_reminder_project_id' ) )) { - $query .= " and bugs.project_id NOT IN ".$t_rem_projects; + if ( ON==$t_rem_include ){ + if ( !empty( config_get( 'plugin_Reminder_reminder_project_id' ) ) ) { + $query .= " and bugs.project_id IN ". $t_rem_projects; + } + } else { + if (!empty( config_get( 'plugin_Reminder_reminder_project_id' ) )) { + $query .= " and bugs.project_id NOT IN ".$t_rem_projects; + } } -} if ( ON == $t_rem_group1 ) { $query .=" order by handler_id" ; @@ -82,10 +75,8 @@ $id = $row1['id']; $handler = $row1['handler_id']; $list = string_get_bug_view_url_with_fqdn( $id, $handler2 ); - $body = $t_rem_body1; - $body .= "
"; - $body .= $list; - $body .= "
"; + $body = $t_rem_body1. " \n\n"; + $body .= $list. " \n\n"; $body .= $t_rem_body2; $result = email_group_reminder( $handler, $body ); # Add reminder as bugnote if store reminders option is ON. @@ -110,8 +101,6 @@ } if ($handler==$handler2){ $list .= formatBugEntry($row1); -// $list .="
"; -// $list .= string_get_bug_view_url_with_fqdn( $id, $handler2 ); # Add reminder as bugnote if store reminders option is ON. if ( ON == $t_rem_store ) { $t_attr = '|'.$handler2.'|'; @@ -119,16 +108,12 @@ } } else { // now send the grouped email - $body = $t_rem_body1; - $body .= "
"; - $body .= $list; - $body .= "
"; + $body = $t_rem_body1. " \n\n"; + $body .= $list. " \n\n"; $body .= $t_rem_body2; $result = email_group_reminder( $handler2, $body); $handler2 = $handler ; $list .= formatBugEntry($row1); -// $list ="
"; -// $list= string_get_bug_view_url_with_fqdn( $id, $handler2 ); # Add reminder as bugnote if store reminders option is ON. if ( ON == $t_rem_store ) { $t_attr = '|'.$handler2.'|'; @@ -139,10 +124,8 @@ // handle last one if ($resnum>0){ // now send the grouped email - $body = $t_rem_body1; - $body .= "
"; - $body .= $list; - $body .= "
"; + $body = $t_rem_body1. " \n\n";; + $body .= $list. " \n\n";; $body .= $t_rem_body2; $result = email_group_reminder( $handler2, $body); @@ -161,11 +144,10 @@ $query .=" and due_date>1" ; } } - -$t_rem_include = config_get('plugin_Reminder_reminder_include'); -$t_rem_projects = "("; -$t_rem_projects .= config_get('plugin_Reminder_reminder_project_id'); -$t_rem_projects .= ")"; + $t_rem_include = config_get('plugin_Reminder_reminder_include'); + $t_rem_projects = "("; + $t_rem_projects .= config_get('plugin_Reminder_reminder_project_id'); + $t_rem_projects .= ")"; if (ON==$t_rem_include){ if ($t_rem_projects <>"0") { $query .= " and bugs.project_id IN ". $t_rem_projects; @@ -223,12 +205,6 @@ function email_group_reminder( $p_user_id, $issues ) { $t_subject = config_get( 'plugin_Reminder_reminder_group_subject' ); $t_message = $issues ; if( !is_blank( $t_email ) ) { - echo $t_email; - echo '**'; - echo $t_subject; - echo '
'; - echo $t_message; - echo '
'; email_store( $t_email, $t_subject, $t_message ); if( OFF == config_get( 'email_send_using_cronjob' ) ) { email_send_all();