--- email_api.php 1.0.0rc1 +++ email_api.php 2005-07-25 17:40:54.455671200 +0200 @@ -154,9 +154,9 @@ # For example, you can get the value associated with notifying "admin" # on action "new", i.e. notify administrators on new bugs which can be # ON or OFF. - function email_notify_flag( $action, $flag ) { - $t_notify_flags = config_get( 'notify_flags' ); - $t_default_notify_flags = config_get( 'default_notify_flags' ); + function email_notify_flag( $action, $flag, $p_project = null ) { + $t_notify_flags = config_get( 'notify_flags', null, null, $p_project ); + $t_default_notify_flags = config_get( 'default_notify_flags', null, null, $p_project ); if ( isset ( $t_notify_flags[$action][$flag] ) ) { return $t_notify_flags[$action][$flag]; } elseif ( isset ( $t_default_notify_flags[$flag] ) ) { @@ -174,25 +174,25 @@ $t_recipients = array(); + $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); + # add Reporter - if ( ON == email_notify_flag( $p_notify_type, 'reporter' ) ) { + if ( ON == email_notify_flag( $p_notify_type, 'reporter', $t_project_id ) ) { $t_reporter_id = bug_get_field( $p_bug_id, 'reporter_id' ); $t_recipients[$t_reporter_id] = true; log_event( LOG_EMAIL_RECIPIENT, "bug= $p_bug_id, add reporter=$t_reporter_id" ); } # add Handler - if ( ON == email_notify_flag( $p_notify_type, 'handler' )) { + if ( ON == email_notify_flag( $p_notify_type, 'handler', $t_project_id )) { $t_handler_id = bug_get_field( $p_bug_id, 'handler_id' ); $t_recipients[$t_handler_id] = true; log_event( LOG_EMAIL_RECIPIENT, "bug= $p_bug_id, add handler=$t_handler_id" ); } - $t_project_id = bug_get_field( $p_bug_id, 'project_id' ); - # add users monitoring the bug $t_bug_monitor_table = config_get( 'mantis_bug_monitor_table' ); - if ( ON == email_notify_flag( $p_notify_type, 'monitor' ) ) { + if ( ON == email_notify_flag( $p_notify_type, 'monitor', $t_project_id ) ) { $query = "SELECT DISTINCT user_id FROM $t_bug_monitor_table WHERE bug_id=$c_bug_id"; @@ -213,7 +213,7 @@ $t_bug_date = bug_get_field( $p_bug_id, 'last_updated' ); $t_bugnote_table = config_get( 'mantis_bugnote_table' ); - if ( ON == email_notify_flag( $p_notify_type, 'bugnotes' ) ) { + if ( ON == email_notify_flag( $p_notify_type, 'bugnotes', $t_project_id ) ) { $query = "SELECT DISTINCT reporter_id FROM $t_bugnote_table WHERE bug_id = $c_bug_id"; @@ -229,8 +229,8 @@ # add project users who meet the thresholds $t_bug_is_private = bug_get_field( $p_bug_id, 'view_state' ) == VS_PRIVATE; - $t_threshold_min = email_notify_flag( $p_notify_type, 'threshold_min' ); - $t_threshold_max = email_notify_flag( $p_notify_type, 'threshold_max' ); + $t_threshold_min = email_notify_flag( $p_notify_type, 'threshold_min', $t_project_id ); + $t_threshold_max = email_notify_flag( $p_notify_type, 'threshold_max', $t_project_id ); $t_threshold_users = project_get_all_user_rows( $t_project_id, $t_threshold_min ); foreach( $t_threshold_users as $t_user ) { if ( $t_user['access_level'] <= $t_threshold_max ) {