/** * check if there is a relationship between two bugs * return: * 0 if the relationship is not found * -1 if the relationship is found and it's of the same type $p_rel_type * id if the relationship is found and it's of a different time (this means it can be replaced with the new type $p_rel_type * @param integer $p_src_bug_id Source Bug Id. * @param integer $p_dest_bug_id Destination Bug Id. * @param integer $p_rel_type Relationship Type. * @return integer 0, -1 or id */ function relationship_same_type_exists($p_src_bug_id, $p_dest_bug_id, $p_rel_type) { # Check if there is already a relationship set between them $t_id_relationship = relationship_exists($p_src_bug_id, $p_dest_bug_id); if ($t_id_relationship > 0) { # if there is... # get all the relationship info $t_relationship = relationship_get($t_id_relationship); if ($t_relationship->src_bug_id == $p_src_bug_id && $t_relationship->dest_bug_id == $p_dest_bug_id) { if ($t_relationship->type == $p_rel_type) { $t_id_relationship = -1; } } else { if ($t_relationship->type == relationship_get_complementary_type($p_rel_type)) { $t_id_relationship = -1; } } } return $t_id_relationship; }
} # Remember the new custom field values so we can set them when updating # the bug (done after all data passed to this update page has been # validated). $t_custom_fields_to_set[] = array('id' => $t_cf_id, 'value' => $t_new_custom_field_value); } # Perform validation of the duplicate ID of the bug. if ($t_updated_bug->duplicate_id !== 0) { if ($t_updated_bug->duplicate_id === $f_bug_id) { trigger_error(ERROR_BUG_DUPLICATE_SELF, ERROR); } bug_ensure_exists($t_updated_bug->duplicate_id); if (!access_has_bug_level(config_get('update_bug_threshold'), $t_updated_bug->duplicate_id)) { trigger_error(ERROR_RELATIONSHIP_ACCESS_LEVEL_TO_DEST_BUG_TOO_LOW, ERROR); } if (relationship_exists($f_bug_id, $t_updated_bug->duplicate_id)) { trigger_error(ERROR_RELATIONSHIP_ALREADY_EXISTS, ERROR); } } # Validate the new bug note (if any is provided). if ($t_bug_note->note || config_get('time_tracking_enabled') && helper_duration_to_minutes($t_bug_note->time_tracking) > 0) { access_ensure_bug_level(config_get('add_bugnote_threshold'), $f_bug_id); if (!$t_bug_note->note && !config_get('time_tracking_without_note')) { error_parameters(lang_get('bugnote')); trigger_error(ERROR_EMPTY_FIELD, ERROR); } if ($t_bug_note->view_state !== config_get('default_bugnote_view_status')) { access_ensure_bug_level(config_get('set_view_status_threshold'), $f_bug_id); } } # Handle the reassign on feedback feature. Note that this feature generally