Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 298220 Details for
Bug 406111
3.1: Issue Tracker Integration
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
Issue tracker integration using custom fields (v3)
issuetracker.patch (text/plain), 17.64 KB, created by
David Lawrence
on 2008-03-16 21:34:35 UTC
(
hide
)
Description:
Issue tracker integration using custom fields (v3)
Filename:
MIME Type:
Creator:
David Lawrence
Created:
2008-03-16 21:34:35 UTC
Size:
17.64 KB
patch
obsolete
>? bugzilla-3.2rh-20080307.1.tar.gz >? bugzilla.spec >? localconfig >? patches >? tmp >? extensions/issuetracker >Index: colchange.cgi >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/colchange.cgi,v >retrieving revision 1.6 >diff -u -p -r1.6 colchange.cgi >--- colchange.cgi 5 Mar 2008 21:41:51 -0000 1.6 >+++ colchange.cgi 16 Mar 2008 21:30:46 -0000 >@@ -90,7 +90,8 @@ if (Bugzilla->params->{"useissuetracker" > > push(@masterlist, ("short_desc", "short_short_desc")); > >-my @custom_fields = grep { $_->type != FIELD_TYPE_MULTI_SELECT } >+my @custom_fields = grep { $_->type != FIELD_TYPE_MULTI_SELECT >+ && $_->type != FIELD_TYPE_FREETEXT_MULTI_INTEGER} > Bugzilla->active_custom_fields; > push(@masterlist, map { $_->name } @custom_fields); > >Index: config.cgi >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/config.cgi,v >retrieving revision 1.2 >diff -u -p -r1.2 config.cgi >--- config.cgi 27 Feb 2008 20:50:20 -0000 1.2 >+++ config.cgi 16 Mar 2008 21:30:46 -0000 >@@ -56,7 +56,9 @@ $vars->{'keyword'} = [map($_->name, B > $vars->{'resolution'} = get_legal_field_values('resolution'); > $vars->{'status'} = get_legal_field_values('bug_status'); > $vars->{'custom_fields'} = >- [ grep {$_->type == FIELD_TYPE_SINGLE_SELECT || $_->type == FIELD_TYPE_MULTI_SELECT} >+ [ grep {$_->type == FIELD_TYPE_SINGLE_SELECT >+ || $_->type == FIELD_TYPE_MULTI_SELECT >+ || $_->type == FIELD_TYPE_FREETEXT_MULTI_INTEGER} > Bugzilla->active_custom_fields ]; > > # Include a list of product objects. >Index: post_bug.cgi >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/post_bug.cgi,v >retrieving revision 1.8 >diff -u -p -r1.8 post_bug.cgi >--- post_bug.cgi 5 Mar 2008 21:41:51 -0000 1.8 >+++ post_bug.cgi 16 Mar 2008 21:30:46 -0000 >@@ -124,7 +124,9 @@ $template->process($format->{'template'} > || ThrowTemplateError($template->error()); > > # Include custom fields editable on bug creation. >-my @custom_bug_fields = grep {$_->type != FIELD_TYPE_MULTI_SELECT && $_->enter_bug} >+my @custom_bug_fields = grep {$_->type != FIELD_TYPE_MULTI_SELECT >+ && $_->type != FIELD_TYPE_FREETEXT_MULTI_INTEGER >+ && $_->enter_bug} > Bugzilla->active_custom_fields; > > # Undefined custom fields are ignored to ensure they will get their default >@@ -168,7 +170,9 @@ $bug_params{'cc'} = [$cgi->para > $bug_params{'groups'} = \@selected_groups; > $bug_params{'comment'} = $comment; > >-my @multi_selects = grep {$_->type == FIELD_TYPE_MULTI_SELECT && $_->enter_bug} >+my @multi_selects = grep {($_->type == FIELD_TYPE_MULTI_SELECT >+ || $_->type == FIELD_TYPE_FREETEXT_MULTI_INTEGER) >+ && $_->enter_bug} > Bugzilla->active_custom_fields; > > foreach my $field (@multi_selects) { >Index: Bugzilla/Bug.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Bug.pm,v >retrieving revision 1.28 >diff -u -p -r1.28 Bug.pm >--- Bugzilla/Bug.pm 10 Mar 2008 14:04:08 -0000 1.28 >+++ Bugzilla/Bug.pm 16 Mar 2008 21:30:50 -0000 >@@ -68,7 +68,8 @@ use constant LIST_ORDER => ID_FIELD; > # This is a sub because it needs to call other subroutines. > sub DB_COLUMNS { > my $dbh = Bugzilla->dbh; >- my @custom = grep {$_->type != FIELD_TYPE_MULTI_SELECT} >+ my @custom = grep {$_->type != FIELD_TYPE_MULTI_SELECT >+ && $_->type != FIELD_TYPE_FREETEXT_MULTI_INTEGER} > Bugzilla->active_custom_fields; > my @custom_names = map {$_->name} @custom; > return qw( >@@ -138,6 +139,9 @@ sub VALIDATORS { > elsif ($field->type == FIELD_TYPE_MULTI_SELECT) { > $validator = \&_check_multi_select_field; > } >+ elsif ($field->type == FIELD_TYPE_FREETEXT_MULTI_INTEGER) { >+ $validator = \&_check_freetext_multi_integer; >+ } > elsif ($field->type == FIELD_TYPE_DATETIME) { > $validator = \&_check_datetime_field; > } >@@ -166,7 +170,8 @@ use constant UPDATE_VALIDATORS => { > }; > > sub UPDATE_COLUMNS { >- my @custom = grep {$_->type != FIELD_TYPE_MULTI_SELECT} >+ my @custom = grep {$_->type != FIELD_TYPE_MULTI_SELECT >+ && $_->type != FIELD_TYPE_FREETEXT_MULTI_INTEGER} > Bugzilla->active_custom_fields; > my @custom_names = map {$_->name} @custom; > my @columns = qw( >@@ -711,7 +716,8 @@ sub update { > } > > # Insert the values into the multiselect value tables >- my @multi_selects = grep {$_->type == FIELD_TYPE_MULTI_SELECT} >+ my @multi_selects = grep {$_->type == FIELD_TYPE_MULTI_SELECT >+ || $_->type == FIELD_TYPE_FREETEXT_MULTI_INTEGER} > Bugzilla->active_custom_fields; > foreach my $field (@multi_selects) { > my $name = $field->name; >@@ -770,7 +776,8 @@ sub update { > sub _extract_multi_selects { > my ($invocant, $params) = @_; > >- my @multi_selects = grep {$_->type == FIELD_TYPE_MULTI_SELECT} >+ my @multi_selects = grep {$_->type == FIELD_TYPE_MULTI_SELECT >+ || $_->type == FIELD_TYPE_FREETEXT_MULTI_INTEGER} > Bugzilla->active_custom_fields; > my %ms_values; > foreach my $field (@multi_selects) { >@@ -1690,6 +1697,30 @@ sub _check_multi_select_field { > return $values; > } > >+sub _check_freetext_multi_integer { >+ my ($invocant, $value, $field) = @_; >+ my @value_list; >+ my %value_hash; >+ return [] if !$value; >+ foreach my $item (split(/[,\s]+/, $value)) { >+ $item = trim($item); >+ my $v = $item; >+ detaint_natural($item) >+ || ThrowUserError('field_invalid_value', >+ { value => $v, field => $field, type => 'integer' }); >+ $value_hash{$item} = 1; >+ } >+ >+ @value_list = sort keys %value_hash; >+ >+ # REDHAT EXTENSION START 406111 >+ Bugzilla::Hook::process('check_freetext_multi_integer', >+ { current => $invocant->$field, field => $field, values => \@value_list }); >+ # REDHAT EXTENSION END 406111 >+ >+ return \@value_list; >+} >+ > sub _check_select_field { > my ($invocant, $value, $field) = @_; > $value = trim($value); >@@ -3670,7 +3701,9 @@ sub AUTOLOAD { > > $self->{_multi_selects} ||= [Bugzilla->get_fields( > {custom => 1, type => FIELD_TYPE_MULTI_SELECT })]; >- if ( grep($_->name eq $attr, @{$self->{_multi_selects}}) ) { >+ $self->{_multi_freetext_integers} ||= [Bugzilla->get_fields( >+ {custom => 1, type => FIELD_TYPE_FREETEXT_MULTI_INTEGER })]; >+ if ( grep($_->name eq $attr, (@{$self->{_multi_selects}}, @{$self->{_multi_freetext_integers}})) ) { > $self->{$attr} ||= Bugzilla->dbh->selectcol_arrayref( > "SELECT value FROM bug_$attr WHERE bug_id = ? ORDER BY value", > undef, $self->id); >Index: Bugzilla/Constants.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Constants.pm,v >retrieving revision 1.7 >diff -u -p -r1.7 Constants.pm >--- Bugzilla/Constants.pm 4 Feb 2008 04:54:38 -0000 1.7 >+++ Bugzilla/Constants.pm 16 Mar 2008 21:30:50 -0000 >@@ -121,6 +121,7 @@ use File::Basename; > FIELD_TYPE_MULTI_SELECT > FIELD_TYPE_TEXTAREA > FIELD_TYPE_DATETIME >+ FIELD_TYPE_FREETEXT_MULTI_INTEGER > > USAGE_MODE_BROWSER > USAGE_MODE_CMDLINE >@@ -347,6 +348,7 @@ use constant FIELD_TYPE_SINGLE_SELECT => > use constant FIELD_TYPE_MULTI_SELECT => 3; > use constant FIELD_TYPE_TEXTAREA => 4; > use constant FIELD_TYPE_DATETIME => 5; >+use constant FIELD_TYPE_FREETEXT_MULTI_INTEGER => 6; > > # The maximum number of days a token will remain valid. > use constant MAX_TOKEN_AGE => 3; >Index: Bugzilla/DB.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/DB.pm,v >retrieving revision 1.8 >diff -u -p -r1.8 DB.pm >--- Bugzilla/DB.pm 11 Feb 2008 03:19:45 -0000 1.8 >+++ Bugzilla/DB.pm 16 Mar 2008 21:30:51 -0000 >@@ -677,14 +677,19 @@ sub _bz_add_field_table { > > sub bz_add_field_tables { > my ($self, $field) = @_; >- >- $self->_bz_add_field_table($field->name, >- $self->_bz_schema->FIELD_TABLE_SCHEMA); >+ >+ if ( $field->type != FIELD_TYPE_FREETEXT_MULTI_INTEGER ) { >+ $self->_bz_add_field_table($field->name, >+ $self->_bz_schema->FIELD_TABLE_SCHEMA); >+ } > if ( $field->type == FIELD_TYPE_MULTI_SELECT ) { > $self->_bz_add_field_table('bug_' . $field->name, > $self->_bz_schema->MULTI_SELECT_VALUE_TABLE); > } >- >+ if ( $field->type == FIELD_TYPE_FREETEXT_MULTI_INTEGER ) { >+ $self->_bz_add_field_table('bug_' . $field->name, >+ $self->_bz_schema->MULTI_SELECT_INTEGER_TABLE); >+ } > } > > sub bz_drop_field_tables { >Index: Bugzilla/Field.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Field.pm,v >retrieving revision 1.7 >diff -u -p -r1.7 Field.pm >--- Bugzilla/Field.pm 5 Mar 2008 21:41:51 -0000 1.7 >+++ Bugzilla/Field.pm 16 Mar 2008 21:30:53 -0000 >@@ -250,7 +250,7 @@ sub _check_type { > my $saved_type = $type; > # The constant here should be updated every time a new, > # higher field type is added. >- (detaint_natural($type) && $type <= FIELD_TYPE_DATETIME) >+ (detaint_natural($type) && $type <= FIELD_TYPE_FREETEXT_MULTI_INTEGER) > || ThrowCodeError('invalid_customfield_type', { type => $saved_type }); > return $type; > } >@@ -449,7 +449,8 @@ sub remove_from_db { > # Check to see if bugs table has records (slow) > my $bugs_query = ""; > >- if ($self->type == FIELD_TYPE_MULTI_SELECT) { >+ if ($self->type == FIELD_TYPE_MULTI_SELECT >+ || $self->type == FIELD_TYPE_FREETEXT_MULTI_INTEGER) { > $bugs_query = "SELECT COUNT(*) FROM bug_$name"; > } > else { >@@ -476,12 +477,14 @@ sub remove_from_db { > my $type = $self->type; > > # the values for multi-select are stored in a seperate table >- if ($type != FIELD_TYPE_MULTI_SELECT) { >+ if ($type != FIELD_TYPE_MULTI_SELECT >+ && $type != FIELD_TYPE_FREETEXT_MULTI_INTEGER) { > $dbh->bz_drop_column('bugs', $name); > } > > if ($type == FIELD_TYPE_SINGLE_SELECT >- || $type == FIELD_TYPE_MULTI_SELECT) >+ || $type == FIELD_TYPE_MULTI_SELECT >+ || $type == FIELD_TYPE_FREETEXT_MULTI_INTEGER) > { > # Delete the table that holds the legal values for this field. > $dbh->bz_drop_field_tables($self); >@@ -539,7 +542,8 @@ sub create { > } > > if ($type == FIELD_TYPE_SINGLE_SELECT >- || $type == FIELD_TYPE_MULTI_SELECT) >+ || $type == FIELD_TYPE_MULTI_SELECT >+ || $type == FIELD_TYPE_FREETEXT_MULTI_INTEGER) > { > # Create the table that holds the legal values for this field. > $dbh->bz_add_field_tables($field); >Index: Bugzilla/Search.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Search.pm,v >retrieving revision 1.18 >diff -u -p -r1.18 Search.pm >--- Bugzilla/Search.pm 12 Mar 2008 17:18:40 -0000 1.18 >+++ Bugzilla/Search.pm 16 Mar 2008 21:30:54 -0000 >@@ -127,6 +127,10 @@ sub init { > > my @multi_select_fields = Bugzilla->get_fields({ type => FIELD_TYPE_MULTI_SELECT, > obsolete => 0 }); >+ >+ my @multi_freetext_integer_fields = Bugzilla->get_fields({ type => FIELD_TYPE_FREETEXT_MULTI_INTEGER, >+ obsolete => 0 }); >+ > foreach my $field (@select_fields) { > my $name = $field->name; > $special_order{"bugs.$name"} = [ "$name.sortkey", "$name.value" ], >@@ -233,6 +237,7 @@ sub init { > # Include custom select fields. > push(@legal_fields, map { $_->name } @select_fields); > push(@legal_fields, map { $_->name } @multi_select_fields); >+ push(@legal_fields, map { $_->name } @multi_freetext_integer_fields); > > foreach my $field ($params->param()) { > if (lsearch(\@legal_fields, $field) != -1) { >@@ -416,7 +421,7 @@ sub init { > push(@specialchart, ['content', 'matches', $params->param('content')]); > } > >- my $multi_fields = join('|', map($_->name, @multi_select_fields)); >+ my $multi_fields = join('|', map($_->name, (@multi_select_fields, @multi_freetext_integer_fields))); > > my $chartid; > my $sequence = 0; >Index: Bugzilla/Template.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/Template.pm,v >retrieving revision 1.5 >diff -u -p -r1.5 Template.pm >--- Bugzilla/Template.pm 15 Feb 2008 05:24:14 -0000 1.5 >+++ Bugzilla/Template.pm 16 Mar 2008 21:30:55 -0000 >@@ -258,6 +258,11 @@ sub quoteUrls { > ~get_bug_link($1, $1) > ~egmx; > >+ # REDHAT EXTENSION START 406111 >+ Bugzilla::Hook::process('quote_urls', >+ { text => \$text, things => \@things, count => \$count }); >+ # REDHAT EXTENSION END 406111 >+ > # Now remove the encoding hacks > $text =~ s/\0\0(\d+)\0\0/$things[$1]/eg; > $text =~ s/$chr1\0/\0/g; >Index: Bugzilla/DB/Schema.pm >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/Bugzilla/DB/Schema.pm,v >retrieving revision 1.12 >diff -u -p -r1.12 Schema.pm >--- Bugzilla/DB/Schema.pm 15 Feb 2008 16:26:13 -0000 1.12 >+++ Bugzilla/DB/Schema.pm 16 Mar 2008 21:30:57 -0000 >@@ -1453,6 +1453,18 @@ use constant MULTI_SELECT_VALUE_TABLE => > ], > }; > >+use constant MULTI_SELECT_INTEGER_TABLE => { >+ FIELDS => [ >+ bug_id => {TYPE => 'INT3', NOTNULL => 1, >+ REFERENCES => {TABLE => 'bugs', >+ COLUMN => 'bug_id'}}, >+ value => {TYPE => 'INT3', NOTNULL => 1}, >+ ], >+ INDEXES => [ >+ bug_id_idx => {FIELDS => [qw( bug_id value)], TYPE => 'UNIQUE'}, >+ ], >+}; >+ > > #-------------------------------------------------------------------------- > >Index: template/en/default/bug/field.html.tmpl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/template/en/default/bug/field.html.tmpl,v >retrieving revision 1.3 >diff -u -p -r1.3 field.html.tmpl >--- template/en/default/bug/field.html.tmpl 14 Jan 2008 15:38:36 -0000 1.3 >+++ template/en/default/bug/field.html.tmpl 16 Mar 2008 21:30:59 -0000 >@@ -61,6 +61,12 @@ > <script type="text/javascript"> > createCalendar('[% field.name FILTER js %]') > </script> >+ [% CASE constants.FIELD_TYPE_FREETEXT_MULTI_INTEGER %] >+ <input id="[% field.name FILTER html %]" name="[% field.name FILTER html %]" >+ value="[% value.join(' ') FILTER html %]" size="60" >+ maxlength="[% constants.MAX_FREETEXT_LENGTH FILTER none %]"> >+ <br/> >+ [% Hook.process('links') %] > [% CASE [ constants.FIELD_TYPE_SINGLE_SELECT > constants.FIELD_TYPE_MULTI_SELECT ] %] > <select id="[% field.name FILTER html %]" >Index: template/en/default/global/field-descs.none.tmpl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/template/en/default/global/field-descs.none.tmpl,v >retrieving revision 1.4 >diff -u -p -r1.4 field-descs.none.tmpl >--- template/en/default/global/field-descs.none.tmpl 5 Mar 2008 21:41:51 -0000 1.4 >+++ template/en/default/global/field-descs.none.tmpl 16 Mar 2008 21:30:59 -0000 >@@ -78,12 +78,13 @@ > IF !field_descs.${bz_field.name}.defined %] > [% END %] > >-[% field_types = { ${constants.FIELD_TYPE_UNKNOWN} => "Unknown Type", >- ${constants.FIELD_TYPE_FREETEXT} => "Free Text", >- ${constants.FIELD_TYPE_SINGLE_SELECT} => "Drop Down", >- ${constants.FIELD_TYPE_MULTI_SELECT} => "Multiple-Selection Box", >- ${constants.FIELD_TYPE_TEXTAREA} => "Large Text Box", >- ${constants.FIELD_TYPE_DATETIME} => "Date/Time", >+[% field_types = { ${constants.FIELD_TYPE_UNKNOWN} => "Unknown Type", >+ ${constants.FIELD_TYPE_FREETEXT} => "Free Text", >+ ${constants.FIELD_TYPE_SINGLE_SELECT} => "Drop Down", >+ ${constants.FIELD_TYPE_MULTI_SELECT} => "Multiple-Selection Box", >+ ${constants.FIELD_TYPE_FREETEXT_MULTI_INTEGER} => "Multiple Value Text Box (Integer)", >+ ${constants.FIELD_TYPE_TEXTAREA} => "Large Text Box", >+ ${constants.FIELD_TYPE_DATETIME} => "Date/Time", > } %] > > [% status_descs = { "UNCONFIRMED" => "UNCONFIRMED", >Index: template/en/default/global/user-error.html.tmpl >=================================================================== >RCS file: /cvs/qa/rh_bugzilla_3/template/en/default/global/user-error.html.tmpl,v >retrieving revision 1.19 >diff -u -p -r1.19 user-error.html.tmpl >--- template/en/default/global/user-error.html.tmpl 11 Mar 2008 03:47:17 -0000 1.19 >+++ template/en/default/global/user-error.html.tmpl 16 Mar 2008 21:31:00 -0000 >@@ -406,6 +406,12 @@ > does not exist or you aren't authorized to > enter [% terms.abug %] into it. > >+ [% ELSIF error == "field_invalid_value" %] >+ [% title = "Invalid Field Value" %] >+ You entered an invalid value <em>[% value FILTER html %]</em> >+ for the [% field_descs.$field FILTER html %] field. Value must >+ be in form of [% type FILTER html %]. >+ > [% ELSIF error == "field_already_exists" %] > [% title = "Field Already Exists" %] > The field '[% field.name FILTER html %]'
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
kbaker
: review+
Actions:
View
|
Diff
Attachments on
bug 406111
:
295481
|
295565
|
295587
|
295999
|
297255
|
298010
| 298220