Пример #1
0
	bug_ensure_exists( $t_bug_id );
	$t_bug = bug_get( $t_bug_id, true );

	if ( isset( $t_projects_bugs[$t_bug->project_id] ) ) {
	  $t_projects_bugs[$t_bug->project_id][] = $t_bug_id;
	} else {
	  $t_projects_bugs[$t_bug->project_id] = array( $t_bug_id );
	}
}

$t_failed_ids = array();

foreach( $t_projects_bugs as $t_project_id => $t_bugs ) {
	$g_project_override = $t_project_id;
	foreach( $t_bugs as $t_bug_id ) {
		$t_fail_reason = bug_group_action_validate( $f_action, $t_bug_id );
		if( $t_fail_reason !== null ) {
			$t_failed_ids[$t_bug_id] = $t_fail_reason;
		}
		if( !isset( $t_failed_ids[$t_bug_id] ) ) {
			$t_fail_reason = bug_group_action_process( $f_action, $t_bug_id );
			if( $t_fail_reason !== null ) {
				$t_failed_ids[$t_bug_id] = $t_fail_reason;
			}
		}
	}
}

$g_project_override = null;

form_security_purge( $t_form_name );
# group bugs by project
$t_projects_bugs = array();
foreach ($f_bug_arr as $t_bug_id) {
    bug_ensure_exists($t_bug_id);
    $t_bug = bug_get($t_bug_id, true);
    if (isset($t_projects_bugs[$t_bug->project_id])) {
        $t_projects_bugs[$t_bug->project_id][] = $t_bug_id;
    } else {
        $t_projects_bugs[$t_bug->project_id] = array($t_bug_id);
    }
}
$t_failed_ids = array();
foreach ($t_projects_bugs as $t_project_id => $t_bugs) {
    $g_project_override = $t_project_id;
    foreach ($t_bugs as $t_bug_id) {
        $t_result = bug_group_action_validate($f_action, $t_bug_id);
        if ($t_result !== true) {
            foreach ($t_result as $t_key => $t_value) {
                $t_failed_ids[$t_key] = $t_value;
            }
        }
        if (!isset($t_failed_ids[$t_bug_id])) {
            $t_result = bug_group_action_process($f_action, $t_bug_id);
            if ($t_result !== true) {
                $t_failed_ids[] = $t_result;
            }
        }
    }
}
$g_project_override = null;
form_security_purge($t_form_name);