diff --git a/scripts/bug_reminder_mail.php b/scripts/bug_reminder_mail.php
index 251af16..e99c3c2 100644
--- a/scripts/bug_reminder_mail.php
+++ b/scripts/bug_reminder_mail.php
@@ -56,10 +56,6 @@
$query .=" and due_date>1" ;
}
}
-// if ( $t_rem_project>0 ) {
-// $query .=" and project_id=$t_rem_project" ;
-// }
-
$t_rem_include = config_get( 'plugin_Reminder_reminder_include' );
$t_rem_projects = "(";
$t_rem_projects .= config_get('plugin_Reminder_reminder_project_id');
diff --git a/scripts/bug_reminder_mail_special.php b/scripts/bug_reminder_mail_special.php
new file mode 100644
index 0000000..d4a65eb
--- /dev/null
+++ b/scripts/bug_reminder_mail_special.php
@@ -0,0 +1,281 @@
+";
+
+if ( ON == $t_rem_handler ) {
+ echo 'Query-handler being executed' ;
+ echo '
';
+ $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 ";
+ if ( ON == $t_rem_ign_past ) {
+ $query .=" and due_date>=$basenow" ;
+ } else{
+ if ( ON == $t_rem_ignore ) {
+ $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 .= ")";
+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" ;
+ }else{
+ if ( ON == $t_rem_group2 ) {
+ $query .=" order by bugs.project_id,handler_id" ;
+ }
+ }
+ echo $query;
+ echo "
" ;
+ $results = db_query( $query );
+ $resnum=db_num_rows($results);
+ echo $resnum;
+ echo "
" ;
+ if ( OFF == $t_rem_group1 ) {
+ if ($results) {
+ while ($row1 = db_fetch_array($results)) {
+ $id = $row1['id'];
+ $handler = $row1['handler_id'];
+ echo $id;
+ echo '*';
+ echo $handler;
+ echo "
";
+ $list = string_get_bug_view_url_with_fqdn( $id, $handler2 );
+ $body = $t_rem_body1;
+ $body .= "
";
+ $body .= $list;
+ $body .= "
";
+ $body .= $t_rem_body2;
+ $result = email_group_reminder( $handler, $body );
+ # Add reminder as bugnote if store reminders option is ON.
+ if ( ON == $t_rem_store ) {
+ $t_attr = '|'.$handler2.'|';
+// bugnote_add( $id, $t_rem_body, 0, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr, NULL, FALSE );
+ }
+ }
+ } else {
+ echo 'Query-handler had no results'.$query ;
+ echo '
';
+ }
+ } else {
+ if ($results){
+ $start = true ;
+ $list= "";
+ // first group and store reminder per issue
+ while ($row1 = db_fetch_array($results)) {
+ $id = $row1['id'];
+ $handler = $row1['handler_id'];
+ $project = $row1['project_id'];
+ echo $id;
+ echo '*';
+ echo $handler;
+ echo '*';
+ echo $project;
+ echo "
";
+ if ($start){
+ $handler2 = $handler ;
+ $start = false ;
+ }
+ if ($handler==$handler2){
+ $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.'|';
+// bugnote_add( $id, $t_rem_body, 0, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr, NULL, FALSE );
+ }
+ } else {
+ // now send the grouped email
+ $body = $t_rem_body1;
+ $body .= "
";
+ $body .= $list;
+ $body .= "
";
+ $body .= $t_rem_body2;
+ $result = email_group_reminder( $handler2, $body);
+ $handler2 = $handler ;
+ $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.'|';
+// bugnote_add( $id, $t_rem_body, 0, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr, NULL, FALSE );
+ }
+ }
+ }
+ // handle last one
+ if ($resnum>0){
+ // now send the grouped email
+ $body = $t_rem_body1;
+ $body .= "
";
+ $body .= $list;
+ $body .= "
";
+ $body .= $t_rem_body2;
+ $result = email_group_reminder( $handler2, $body);
+
+ } else{
+ echo 'Query-Handler had no results '.$query ;
+ echo '
';
+ }
+ //
+ }else {
+ echo 'Query-handler had no results '.$query ;
+ echo '
';
+ }
+ }
+}
+
+if ( ON == $t_rem_manager ) {
+ echo 'Query-Manager being executed' ;
+ echo '
';
+ // select relevant issues in combination with an assigned manager to the project
+ $query = "select id,handler_id,user_id from {bug} bugs,{project_user_list} man where status in (".implode(",", $t_rem_status).") and due_date<=$baseline ";
+ if ( ON == $t_rem_ign_past ) {
+ $query .=" and due_date>=$basenow" ;
+ } else{
+ if ( ON == $t_rem_ignore ) {
+ $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 .= ")";
+if (ON==$t_rem_include){
+ if ($t_rem_projects <>"0") {
+ $query .= " and bugs.project_id IN ". $t_rem_projects;
+ }
+}else{
+ $query .= " and bugs.project_id NOT IN ".$t_rem_projects;
+}
+
+ $query .=" and bugs.project_id=man.project_id and man.access_level=70" ;
+ $query .=" order by man.project_id,man.user_id" ;
+
+
+
+ echo $query;
+ echo "
" ;
+ $results = db_query( $query );
+ $resnum=db_num_rows($results);
+ echo $resnum;
+ echo "
" ;
+ if ($results){
+ $start = true ;
+ $list= "";
+ // first group and store reminder per issue
+ while ($row1 = db_fetch_array($results)) {
+ $id = $row1['id'];
+ $handler = $row1['handler_id'];
+ $manager = $row1['user_id'];
+ echo $id;
+ echo '*';
+ echo $handler;
+ echo '*';
+ echo $manager;
+ echo "
";
+ if ($start){
+ $man2 = $manager ;
+ $start = false ;
+ }
+ if ($manager==$man2){
+ $list .=" \n\n";
+ $list .= string_get_bug_view_url_with_fqdn( $id, $man2 );
+ } else {
+ // now send the grouped email
+ $body = $t_rem_body1. " \n\n";
+ $body .= $list. " \n\n";
+ $body .= $t_rem_body2;
+ $result = email_group_reminder( $man2, $body);
+ $man2 = $manager ;
+ $list= string_get_bug_view_url_with_fqdn( $id, $man2 );
+ $list .= " \n\n";
+ }
+ }
+ // handle last one
+ if ($resnum>0){
+ // now send the grouped email
+ $body = $t_rem_body1. " \n\n";
+ $body .= $list. " \n\n";
+ $body .= $t_rem_body2;
+ $result = email_group_reminder( $man2, $body);
+
+ }else{
+ echo 'Query-Manager had no results '.$query ;
+ echo '
';
+ }
+ //
+ } else {
+ echo 'Query-Manager had no results '.$query ;
+ echo '
';
+ }
+}
+echo '
';
+echo 'Finished Reminder Test ';
+
+# Send Grouped reminder
+function email_group_reminder( $p_user_id, $issues ) {
+ $t_username = user_get_field( $p_user_id, 'username' );
+ $t_email = user_get_email( $p_user_id );
+ $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();
+ }
+ }
+}