示例#1
0
/**
 * Checks the presence of a custom field on the form.
 * @param integer $p_custom_field_id  The custom field id to check.
 * @return bool true when field is on form, false otherwise.
 */
function custom_field_is_present($p_custom_field_id)
{
    return gpc_isset(custom_field_presence_field_name($p_custom_field_id));
}
示例#2
0
foreach ($t_related_custom_field_ids as $t_id) {
    $t_def = custom_field_get_definition($t_id);
    # Only update the field if it would have been display for editing
    if (!(!$f_update_mode && $t_def['require_' . $t_custom_status_label] || !$f_update_mode && $t_def['display_' . $t_custom_status_label] && in_array($t_custom_status_label, array("resolved", "closed")) || $f_update_mode && $t_def['display_update'] || $f_update_mode && $t_def['require_update'])) {
        continue;
    }
    # Do not set custom field value if user has no write access.
    if (!custom_field_has_write_access($t_id, $f_bug_id)) {
        continue;
    }
    if ($t_def['require_' . $t_custom_status_label] && !gpc_isset("custom_field_{$t_id}")) {
        error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
        trigger_error(ERROR_EMPTY_FIELD, ERROR);
    }
    # Only update the field if it is posted
    if (!gpc_isset("custom_field_{$t_id}")) {
        continue;
    }
    if (!custom_field_set_value($t_id, $f_bug_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], null))) {
        error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
        trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
    }
}
$t_notify = true;
$t_bug_note_set = false;
if ($t_old_bug_status != $t_bug_data->status && FALSE == $f_update_mode) {
    # handle status transitions that come from pages other than bug_*update_page.php
    # this does the minimum to act on the bug and sends a specific message
    switch ($t_bug_data->status) {
        case $t_resolved:
            # bug_resolve updates the status, fixed_in_version, resolution, handler_id and bugnote and sends message
示例#3
0
/**
 * see if a custom field variable is set.  Uses gpc_isset().
 * @param string  $p_var_name          Variable name to retrieve.
 * @param integer $p_custom_field_type Custom field type.
 * @return boolean
 */
function gpc_isset_custom_field($p_var_name, $p_custom_field_type)
{
    $t_field_name = 'custom_field_' . $p_var_name;
    switch ($p_custom_field_type) {
        case CUSTOM_FIELD_TYPE_DATE:
            # date field is three dropdowns that default to 0
            # Dropdowns are always present, so check if they are set
            return gpc_isset($t_field_name . '_day') && gpc_get_int($t_field_name . '_day', 0) != 0 && gpc_isset($t_field_name . '_month') && gpc_get_int($t_field_name . '_month', 0) != 0 && gpc_isset($t_field_name . '_year') && gpc_get_int($t_field_name . '_year', 0) != 0;
        case CUSTOM_FIELD_TYPE_STRING:
        case CUSTOM_FIELD_TYPE_NUMERIC:
        case CUSTOM_FIELD_TYPE_FLOAT:
        case CUSTOM_FIELD_TYPE_ENUM:
        case CUSTOM_FIELD_TYPE_EMAIL:
            return gpc_isset($t_field_name) && !is_blank(gpc_get_string($t_field_name));
        default:
            return gpc_isset($t_field_name);
    }
}
示例#4
0
文件: board.php 项目: rombert/scrum
		{
			$categories[$category_name] = array($category_id);
		}
	}
}

# Get the selected category
$categories_by_project = array();
$token_categories_by_project = token_get_value(ScrumPlugin::TOKEN_SCRUM_CATEGORY);

if ( !is_null( $token_categories_by_project ) )
{
	$categories_by_project = unserialize( $token_categories_by_project );
}

if ( gpc_isset("category") )
{
	$category = gpc_get_string("category", "");
} else
{
	if ( array_key_exists( $current_project, $categories_by_project) )
	{
		$category = $categories_by_project[ $current_project ];
	}
}

if (isset($categories[$category]))
{
	$category_ids = $categories[$category];
}
示例#5
0
    if (is_blank($t_bug_data->platform)) {
        $t_bug_data->platform = $row['platform'];
    }
    if (is_blank($t_bug_data->os)) {
        $t_bug_data->os = $row['os'];
    }
    if (is_blank($t_bug_data->os_build)) {
        $t_bug_data->os_build = $row['os_build'];
    }
}
helper_call_custom_function('issue_create_validate', array($t_bug_data));
# Validate the custom fields before adding the bug.
$t_related_custom_field_ids = custom_field_get_linked_ids($t_bug_data->project_id);
foreach ($t_related_custom_field_ids as $t_id) {
    $t_def = custom_field_get_definition($t_id);
    if ($t_def['require_report'] && !gpc_isset("custom_field_{$t_id}")) {
        error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
        trigger_error(ERROR_EMPTY_FIELD, ERROR);
    }
    if (!custom_field_validate($t_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], $t_def['default_value']))) {
        error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
        trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
    }
}
# Create the bug
$t_bug_id = bug_create($t_bug_data);
# Handle the file upload
if (!is_blank($f_file['tmp_name']) && 0 < $f_file['size']) {
    $f_file_error = isset($f_file['error']) ? $f_file['error'] : 0;
    file_add($t_bug_id, $f_file['tmp_name'], $f_file['name'], $f_file['type'], 'bug', $f_file_error);
}
示例#6
0
<?php

/**************************************************************************
 MantisBT Seeder Plugin
 Copyright (c) MantisHub - Victor Boctor
 All rights reserved.
 MIT License
 **************************************************************************/
access_ensure_global_level(ADMINISTRATOR);
require_once dirname(dirname(__FILE__)) . '/core/Seeder.php';
html_page_top1();
html_meta_redirect(plugin_page('config_page'));
html_page_top2();
$f_create_issues = gpc_isset('create_issues');
$g_enable_email_notification = OFF;
$t_seeder = new Seeder();
if ($f_create_issues !== OFF) {
    $t_project_ids = $t_seeder->createProjects();
    $t_seeder->createIssues($t_project_ids);
}
echo '<div class="success-msg">';
echo lang_get('operation_successful');
echo '</div>';
html_page_bottom();
示例#7
0
    $category_id = $row['category_id'];
    $category_ids[] = $category_id;
    $category_name = category_full_name($category_id, false);
    if (isset($categories[$category_name])) {
        $categories[$category_name][] = $category_id;
    } else {
        $categories[$category_name] = array($category_id);
    }
}
# Get the selected category
$categories_by_project = array();
$token_categories_by_project = token_get_value(ScrumPlugin::TOKEN_SCRUM_CATEGORY);
if (!is_null($token_categories_by_project)) {
    $categories_by_project = unserialize($token_categories_by_project);
}
if (gpc_isset('category')) {
    $category = gpc_get_string('category', '');
} else {
    if (array_key_exists($current_project, $categories_by_project)) {
        $category = $categories_by_project[$current_project];
    }
}
if (isset($categories[$category])) {
    $category_ids = $categories[$category];
}
$columns = plugin_config_get('board_columns');
$sevcolors = plugin_config_get('board_severity_colors');
$rescolors = plugin_config_get('board_resolution_colors');
$sprint_length = plugin_config_get('sprint_length');
# Retrieve all statuses to display on the board
$statuses = array();