Ejemplo n.º 1
0
 function display_bug_id($p_event, $p_text)
 {
     $p_bug_id = (int) $p_text;
     if (!bug_exists($p_bug_id)) {
         return $p_text;
     }
     $bug = bug_get($p_bug_id);
     $project = $bug->__get("project_id");
     if ($project != plugin_config_get('project_id')) {
         return $p_text;
     }
     $p_field_id = plugin_config_get('field_id');
     $prefix = plugin_config_get('prefix');
     $has_parent = false;
     $t_bugs_ids = relationship_get_all_src($p_bug_id);
     foreach ($t_bugs_ids as $t_relaship) {
         if ($t_relaship->type == BUG_BLOCKS) {
             $has_parent = true;
             break;
         }
     }
     $t_bugs_ids = relationship_get_all_dest($p_bug_id);
     foreach ($t_bugs_ids as $t_relaship) {
         if ($t_relaship->type == BUG_DEPENDANT) {
             $has_parent = true;
             break;
         }
     }
     $prefix_two = plugin_config_get('prefix_two');
     if ($has_parent) {
         $prefix = $prefix_two;
     }
     $p_def = custom_field_get_definition($p_field_id);
     $t_custom_field_value = custom_field_get_value($p_field_id, $p_bug_id);
     global $g_custom_field_type_definition;
     if (isset($g_custom_field_type_definition[$p_def['type']]['#function_string_value'])) {
         return $prefix . call_user_func($g_custom_field_type_definition[$p_def['type']]['#function_string_value'], $t_custom_field_value);
     }
     return $prefix . $t_custom_field_value;
 }
Ejemplo n.º 2
0
/**
 * return false if there are child bugs not resolved/closed
 * N.B. we don't check if the parent bug is read-only. This is because the answer of this function is indepedent from
 * the state of the parent bug itself.
 * @param integer $p_bug_id A bug identifier.
 * @return boolean
 */
function relationship_can_resolve_bug($p_bug_id)
{
    # retrieve all the relationships in which the bug is the source bug
    $t_relationship = relationship_get_all_src($p_bug_id);
    $t_relationship_count = count($t_relationship);
    if ($t_relationship_count == 0) {
        return true;
    }
    for ($i = 0; $i < $t_relationship_count; $i++) {
        # verify if each bug in relation BUG_DEPENDANT is already marked as resolved
        if ($t_relationship[$i]->type == BUG_DEPENDANT) {
            $t_dest_bug_id = $t_relationship[$i]->dest_bug_id;
            $t_status = bug_get_field($t_dest_bug_id, 'status');
            if ($t_status < config_get('bug_resolved_status_threshold')) {
                # the bug is NOT marked as resolved/closed
                return false;
            }
        }
    }
    return true;
}
Ejemplo n.º 3
0
/**
 * Get the relationships of an issue.
 *
 * @param integer $p_issue_id The id of the issue to retrieve the relationships for.
 * @param integer $p_user_id  The user id of the user trying to access the information.
 * @return array that represents an RelationShipData structure
 */
function mci_issue_get_relationships($p_issue_id, $p_user_id)
{
    $t_relationships = array();
    $t_src_relationships = relationship_get_all_src($p_issue_id);
    foreach ($t_src_relationships as $t_relship_row) {
        if (access_has_bug_level(config_get('webservice_readonly_access_level_threshold'), $t_relship_row->dest_bug_id, $p_user_id)) {
            $t_relationship = array();
            $t_reltype = array();
            $t_relationship['id'] = $t_relship_row->id;
            $t_reltype['id'] = $t_relship_row->type;
            $t_reltype['name'] = relationship_get_description_src_side($t_relship_row->type);
            $t_relationship['type'] = $t_reltype;
            $t_relationship['target_id'] = $t_relship_row->dest_bug_id;
            $t_relationships[] = $t_relationship;
        }
    }
    $t_dest_relationships = relationship_get_all_dest($p_issue_id);
    foreach ($t_dest_relationships as $t_relship_row) {
        if (access_has_bug_level(config_get('webservice_readonly_access_level_threshold'), $t_relship_row->src_bug_id, $p_user_id)) {
            $t_relationship = array();
            $t_relationship['id'] = $t_relship_row->id;
            $t_reltype = array();
            $t_reltype['id'] = relationship_get_complementary_type($t_relship_row->type);
            $t_reltype['name'] = relationship_get_description_dest_side($t_relship_row->type);
            $t_relationship['type'] = $t_reltype;
            $t_relationship['target_id'] = $t_relship_row->src_bug_id;
            $t_relationships[] = $t_relationship;
        }
    }
    return count($t_relationships) == 0 ? null : $t_relationships;
}
/**
 * @param $unsolveld_bug_ids
 * @return mixed
 */
function calculate_rel_based_data($unsolveld_bug_ids)
{
    $specmanagement_database_api = new specmanagement_database_api();
    $rel_based_data = array();
    $add_rel_duration = 0;
    $add_rel_uncertainty_bug_ids = array();
    foreach ($unsolveld_bug_ids as $unsolveld_bug_id) {
        $bug_src_rels = relationship_get_all_src($unsolveld_bug_id);
        foreach ($bug_src_rels as $bug_src_rel) {
            if ($bug_src_rel->src_bug_id == $unsolveld_bug_id) {
                $blocking_bug_id = $bug_src_rel->dest_bug_id;
                $blocking_bug_status = bug_get_field($blocking_bug_id, 'status');
                $blocking_bug_duration = $specmanagement_database_api->get_bug_duration($blocking_bug_id);
                if (($blocking_bug_duration > 0 || !is_null($blocking_bug_duration)) && !($blocking_bug_status == 80 || $blocking_bug_status == 90)) {
                    array_push($add_rel_uncertainty_bug_ids, $blocking_bug_id);
                    $add_rel_duration += $blocking_bug_duration;
                }
            }
        }
    }
    $rel_based_data[0] = $add_rel_duration;
    $rel_based_data[1] = $add_rel_uncertainty_bug_ids;
    return $rel_based_data;
}
Ejemplo n.º 5
0
    ?>
<!-- Resolution -->
<tr <?php 
    echo helper_alternate_class();
    ?>
>
	<th class="category">
		<?php 
    echo lang_get('resolution');
    ?>
	</th>
	<td>
		<select name="resolution">
			<?php 
    $t_resolution = $t_bug_is_open ? config_get('bug_resolution_fixed_threshold') : $t_current_resolution;
    $t_relationships = relationship_get_all_src($f_bug_id);
    foreach ($t_relationships as $t_relationship) {
        if ($t_relationship->type == BUG_DUPLICATE) {
            $t_resolution = config_get('bug_duplicate_resolution');
            break;
        }
    }
    print_enum_string_option_list('resolution', $t_resolution);
    ?>
		</select>
	</td>
</tr>
<?php 
}
?>
function custom_function_override_print_bug_view_page_custom_buttons($p_bug_id)
{
    # Zuerst die lokalierten Buttontexte auslesen
    if (lang_get_current() === 'german') {
        $t_bfe_clone_issue_button = 'Klon in anderes Projekt...';
        $t_bfe_edit_failure_class_button = 'Fehlerklasse bearbeiten...';
    } else {
        $t_bfe_clone_issue_button = 'Clone To Other Project...';
        $t_bfe_edit_failure_class_button = 'Edit Failure Class...';
    }
    # Wenn Zugriff mindestens onsite developer, dann darf er Issues klonen
    if (access_has_project_level(50)) {
        echo '<td>';
        html_button_bug_clone_to_project($p_bug_id, $t_bfe_clone_issue_button);
        echo '</td>';
    }
    # Wenn Zugriff ändern von Fehlerklasse erlaubt, dann darf er sie ändern
    # Aber nur bis Status 'bestätigt' (40=confirmed)
    # Und nur für QS-Reporter (30) und ab Entwickler vor Ort (50) aufwärts
    if (custom_field_has_write_access(1, $p_bug_id)) {
        if (bug_get_field($p_bug_id, 'status') < 40) {
            if (access_compare_level(access_get_project_level(), array(30, 50, 55, 70, 90))) {
                echo '<td>';
                $t_bfe_bugs[] = $p_bug_id;
                $t_src = relationship_get_all_src($p_bug_id);
                $t_src_count = count($t_src);
                $t_dest = relationship_get_all_dest($p_bug_id);
                $t_dest_count = count($t_dest);
                if ($t_src_count || $t_dest_count) {
                    # Zunächst die Destination Bug IDs
                    for ($x = 0; $x < $t_src_count; $x++) {
                        $t_thisbugid = $t_src[$x]->dest_bug_id;
                        if (access_has_bug_level(50, $t_thisbugid)) {
                            $t_bfe_bugs[] = $t_thisbugid;
                        }
                    }
                    # und jetzt die Source Bug IDs
                    for ($y = 0; $y < $t_dest_count; $y++) {
                        $t_thisbugid = $t_dest[$y]->src_bug_id;
                        if (access_has_bug_level(50, $t_thisbugid)) {
                            $t_bfe_bugs[] = $t_thisbugid;
                        }
                    }
                }
                if (count($t_bfe_bugs) > 1) {
                    bfe_fehlerklasse_button('bug_actiongroup_page.php', $t_bfe_edit_failure_class_button, $t_bfe_bugs);
                } else {
                    html_button('bug_actiongroup_page.php', $t_bfe_edit_failure_class_button, array('bug_arr[]' => $p_bug_id, 'action' => 'custom_field_1'));
                }
                echo '</td>';
            }
        }
    }
}
Ejemplo n.º 7
0
function relgraph_add_child(&$p_bug_list, $p_bug_id)
{
    # Check if the issue is already in the issue list.
    if (isset($p_bug_list[$p_bug_id])) {
        # The issue is in the list, but we cannot discard it since it
        # may be a parent issue (whose children were not visited).
        if (!$p_bug_list[$p_bug_id]->is_descendant) {
            # Yes, we visited this issue as a parent... This is the case
            # where someone set up a cyclic relationship (I really hope
            # nobody ever do this, but should keep sanity) for this
            # issue. We just have to finish the job, visiting all issues
            # that were already listed by _add_parent().
            $p_bug_list[$p_bug_id]->is_descendant = true;
            foreach ($p_bug_list[$p_bug_id]->children as $t_child) {
                relgraph_add_child($p_bug_id, $t_child);
            }
        }
    } else {
        # The issue is not in the list, proceed as usual.
        # Check if the issue really exists and we have access to it.
        # If not, it is like it didn't exist.
        if (!bug_exists($p_bug_id)) {
            return false;
        }
        if (!access_has_bug_level(VIEWER, $p_bug_id)) {
            return false;
        }
        # Add the issue to the list.
        $p_bug_list[$p_bug_id] = bug_get($p_bug_id, false);
        $p_bug_list[$p_bug_id]->is_descendant = true;
        $p_bug_list[$p_bug_id]->parents = array();
        $p_bug_list[$p_bug_id]->children = array();
        # Add all parent issues to the list of parents. Do not visit them
        # for the same reason we didn't visit the children of all
        # ancestors.
        $t_relationships = relationship_get_all_dest($p_bug_id);
        foreach ($t_relationships as $t_relationship) {
            if ($t_relationship->type != BUG_DEPENDANT) {
                continue;
            }
            $p_bug_list[$p_bug_id]->parents[] = $t_relationship->src_bug_id;
        }
        # Add all child issues to the list of children and visit them
        # recursively.
        $t_relationships = relationship_get_all_src($p_bug_id);
        foreach ($t_relationships as $t_relationship) {
            if ($t_relationship->type != BUG_DEPENDANT) {
                continue;
            }
            $p_bug_list[$p_bug_id]->children[] = $t_relationship->dest_bug_id;
            relgraph_add_child($p_bug_list, $t_relationship->dest_bug_id);
        }
    }
    return true;
}
Ejemplo n.º 8
0
 function bfebugnote($t_event, $t_bug_id, $t_bugnote_id, $t_bugnote_is_private)
 {
     if ($t_bugnote_is_private) {
         # WK: zwei neue CSS-Klassen für unsere zusätzlichen Links
         $t_bugnote_bfe_css = 'bugnote-bfe-private';
         $t_spacer_bfe_css = 'spacer-bfe-private';
     } else {
         # WK: zwei weitere CSS-Klassen für unsere zusätzlichen Links
         $t_bugnote_bfe_css = 'bugnote-bfe-public';
         $t_spacer_bfe_css = 'spacer-bfe-public';
     }
     # Mod WK/BFE: Diese Links sind die neue BFE-Funktion Notiz klonen. Nur ab Recht 'Projekte bearbeiten' oder ab Rolle 'Entwickler vor Ort'
     if (!bug_is_readonly($t_bug_id)) {
         if (access_has_bug_level(config_get('manage_project_threshold'), $t_bug_id) || access_has_project_level(50)) {
             $t_src = relationship_get_all_src($t_bug_id);
             $t_src_count = count($t_src);
             $t_dest = relationship_get_all_dest($t_bug_id);
             $t_dest_count = count($t_dest);
             if ($t_src_count || $t_dest_count) {
                 echo '<tr class="row-1">';
                 echo '	<td class="' . $t_bugnote_bfe_css . '" colspan="2">';
                 # Zunächst die Destination Bug IDs
                 for ($z = 0; $z < $t_src_count; $z++) {
                     $t_thisbugid = $t_src[$z]->dest_bug_id;
                     $t_thisbugsumm = bug_get_field($t_thisbugid, 'summary');
                     $t_thisprojectid = bug_get_field($t_thisbugid, 'project_id');
                     echo '<a href="view.php?id=' . $t_thisbugid . '&bugnote_id=' . $t_bugnote_id . '#bugnotes">';
                     echo "Notiz klonen in Issue ";
                     echo bug_format_id($t_thisbugid) . ': ' . $t_thisbugsumm . ' [' . project_get_field($t_thisprojectid, 'name') . ']</a><br />';
                 }
                 # und jetzt die Source Bug IDs
                 for ($z = 0; $z < $t_dest_count; $z++) {
                     $t_thisbugid = $t_dest[$z]->src_bug_id;
                     $t_thisbugsumm = bug_get_field($t_thisbugid, 'summary');
                     $t_thisprojectid = bug_get_field($t_thisbugid, 'project_id');
                     echo '<a href="view.php?id=' . $t_thisbugid . '&bugnote_id=' . $t_bugnote_id . '#bugnotes">';
                     echo "Notiz klonen in Issue ";
                     echo bug_format_id($t_thisbugid) . ': ' . $t_thisbugsumm . ' [' . project_get_field($t_thisprojectid, 'name') . ']</a><br />';
                 }
                 echo '	</td>';
                 echo '</tr>';
             }
         }
     }
     echo '<tr class="' . $t_spacer_bfe_css . '" />';
 }