From: Kohei Yoshino Date: Wed, 26 Jun 2019 17:32:04 +0000 (-0400) Subject: Bug 1560245 - Specify missing bug field types X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=11289b0b5baf0be88f54ae1797ba32848dac62ff;p=thirdparty%2Fbugzilla.git Bug 1560245 - Specify missing bug field types --- diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm index 45c84ace2..02d3e559a 100644 --- a/Bugzilla/Constants.pm +++ b/Bugzilla/Constants.pm @@ -117,6 +117,10 @@ use Memoize; FIELD_TYPE_BUG_URLS FIELD_TYPE_KEYWORDS FIELD_TYPE_INTEGER + FIELD_TYPE_BOOLEAN + FIELD_TYPE_USER + FIELD_TYPE_USERS + FIELD_TYPE_BUG_LIST FIELD_TYPE_EXTENSION FIELD_TYPE_HIGHEST_PLUS_ONE @@ -423,6 +427,10 @@ use constant FIELD_TYPE_BUG_URLS => 7; use constant FIELD_TYPE_KEYWORDS => 8; use constant FIELD_TYPE_DATE => 9; use constant FIELD_TYPE_INTEGER => 10; +use constant FIELD_TYPE_BOOLEAN => 11; +use constant FIELD_TYPE_USER => 20; +use constant FIELD_TYPE_USERS => 21; +use constant FIELD_TYPE_BUG_LIST => 22; use constant FIELD_TYPE_EXTENSION => 99; # Add new field types above this line, and change the below value in the diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm index 6aa6c71ad..5f581e377 100644 --- a/Bugzilla/Field.pm +++ b/Bugzilla/Field.pm @@ -271,16 +271,35 @@ use constant DEFAULT_FIELDS => ( }, { name => 'assigned_to', - desc => 'AssignedTo', + desc => 'Assignee', + type => FIELD_TYPE_USER, + in_new_bugmail => 1, + buglist => 1, + }, + { + name => 'reporter', + desc => 'Reporter', + type => FIELD_TYPE_USER, in_new_bugmail => 1, buglist => 1 }, - {name => 'reporter', desc => 'ReportedBy', in_new_bugmail => 1, buglist => 1}, - {name => 'qa_contact', desc => 'QAContact', in_new_bugmail => 1, buglist => 1}, - {name => 'cc', desc => 'CC', in_new_bugmail => 1}, + { + name => 'qa_contact', + desc => 'QA Contact', + type => FIELD_TYPE_USER, + in_new_bugmail => 1, + buglist => 1, + }, + { + name => 'cc', + desc => 'CC', + type => FIELD_TYPE_USERS, + in_new_bugmail => 1, + }, { name => 'dependson', desc => 'Depends on', + type => FIELD_TYPE_BUG_LIST, in_new_bugmail => 1, is_numeric => 1, buglist => 1 @@ -288,6 +307,7 @@ use constant DEFAULT_FIELDS => ( { name => 'blocked', desc => 'Blocks', + type => FIELD_TYPE_BUG_LIST, in_new_bugmail => 1, is_numeric => 1, buglist => 1 @@ -295,6 +315,7 @@ use constant DEFAULT_FIELDS => ( { name => 'regressed_by', desc => 'Regressed by', + type => FIELD_TYPE_BUG_LIST, in_new_bugmail => 1, is_numeric => 1, buglist => 1 @@ -302,6 +323,7 @@ use constant DEFAULT_FIELDS => ( { name => 'regresses', desc => 'Regressions', + type => FIELD_TYPE_BUG_LIST, in_new_bugmail => 1, is_numeric => 1, buglist => 1 @@ -310,44 +332,88 @@ use constant DEFAULT_FIELDS => ( { name => 'assignee_last_login', desc => 'Assignee Last Login Date', + type => FIELD_TYPE_DATE, buglist => 1 }, {name => 'attachments.description', desc => 'Attachment description'}, {name => 'attachments.filename', desc => 'Attachment filename'}, {name => 'attachments.mimetype', desc => 'Attachment mime type'}, - {name => 'attachments.ispatch', desc => 'Attachment is patch', is_numeric => 1}, + { + name => 'attachments.ispatch', + desc => 'Attachment is patch', + type => FIELD_TYPE_BOOLEAN, + is_numeric => 1, + }, { name => 'attachments.isobsolete', desc => 'Attachment is obsolete', + type => FIELD_TYPE_BOOLEAN, is_numeric => 1 }, { name => 'attachments.isprivate', desc => 'Attachment is private', + type => FIELD_TYPE_BOOLEAN, is_numeric => 1 }, - {name => 'attachments.submitter', desc => 'Attachment creator'}, + { + name => 'attachments.submitter', + desc => 'Attachment Creator', + type => FIELD_TYPE_USER, + }, {name => 'target_milestone', desc => 'Target Milestone', buglist => 1}, - {name => 'creation_ts', desc => 'Creation date', buglist => 1}, - {name => 'delta_ts', desc => 'Last changed date', buglist => 1}, + { + name => 'creation_ts', + desc => 'Opened', + type => FIELD_TYPE_DATETIME, + buglist => 1, + }, + { + name => 'delta_ts', + desc => 'Updated', + type => FIELD_TYPE_DATETIME, + buglist => 1, + }, {name => 'longdesc', desc => 'Comment'}, - {name => 'longdescs.isprivate', desc => 'Comment is private', is_numeric => 1}, + { + name => 'longdescs.isprivate', + desc => 'Comment is private', + type => FIELD_TYPE_BOOLEAN, + is_numeric => 1, + }, { name => 'longdescs.count', desc => 'Number of Comments', + type => FIELD_TYPE_INTEGER, buglist => 1, is_numeric => 1 }, {name => 'alias', desc => 'Alias', buglist => 1}, - {name => 'everconfirmed', desc => 'Ever Confirmed', is_numeric => 1}, - {name => 'reporter_accessible', desc => 'Reporter Accessible', is_numeric => 1}, - {name => 'cclist_accessible', desc => 'CC Accessible', is_numeric => 1}, + { + name => 'everconfirmed', + desc => 'Ever Confirmed', + type => FIELD_TYPE_BOOLEAN, + is_numeric => 1, + }, + { + name => 'reporter_accessible', + desc => 'Reporter Accessible', + type => FIELD_TYPE_BOOLEAN, + is_numeric => 1, + }, + { + name => 'cclist_accessible', + desc => 'CC Accessible', + type => FIELD_TYPE_BOOLEAN, + is_numeric => 1, + }, {name => 'bug_group', desc => 'Group', in_new_bugmail => 1}, { name => 'estimated_time', desc => 'Estimated Hours', + type => FIELD_TYPE_INTEGER, in_new_bugmail => 1, buglist => 1, is_numeric => 1 @@ -355,6 +421,7 @@ use constant DEFAULT_FIELDS => ( { name => 'remaining_time', desc => 'Remaining Hours', + type => FIELD_TYPE_INTEGER, buglist => 1, is_numeric => 1 }, @@ -365,14 +432,33 @@ use constant DEFAULT_FIELDS => ( in_new_bugmail => 1, buglist => 1 }, - {name => 'commenter', desc => 'Commenter'}, + { + name => 'commenter', + desc => 'Commenter', + type => FIELD_TYPE_USER, + }, {name => 'flagtypes.name', desc => 'Flags', buglist => 1}, - {name => 'requestees.login_name', desc => 'Flag Requestee'}, - {name => 'setters.login_name', desc => 'Flag Setter'}, - {name => 'work_time', desc => 'Hours Worked', buglist => 1, is_numeric => 1}, + { + name => 'requestees.login_name', + desc => 'Flag Requestee', + type => FIELD_TYPE_USER, + }, + { + name => 'setters.login_name', + desc => 'Flag Setter', + type => FIELD_TYPE_USER, + }, + { + name => 'work_time', + desc => 'Hours Worked', + type => FIELD_TYPE_INTEGER, + buglist => 1, + is_numeric => 1, + }, { name => 'percentage_complete', desc => 'Percentage Complete', + type => FIELD_TYPE_INTEGER, buglist => 1, is_numeric => 1 }, @@ -394,7 +480,12 @@ use constant DEFAULT_FIELDS => ( type => FIELD_TYPE_DATETIME }, {name => 'comment_tag', desc => 'Comment Tag'}, - {name => 'triage_owner', desc => 'Triage Owner', buglist => 1}, + { + name => 'triage_owner', + desc => 'Triage Owner', + type => FIELD_TYPE_USER, + buglist => 1, + }, ); ################ diff --git a/extensions/BugModal/template/en/default/hook/global/variables-end.none.tmpl b/extensions/BugModal/template/en/default/hook/global/variables-end.none.tmpl deleted file mode 100644 index acb6ab870..000000000 --- a/extensions/BugModal/template/en/default/hook/global/variables-end.none.tmpl +++ /dev/null @@ -1,13 +0,0 @@ -[%# This Source Code Form is subject to the terms of the Mozilla Public - # License, v. 2.0. If a copy of the MPL was not distributed with this - # file, You can obtain one at http://mozilla.org/MPL/2.0/. - # - # This Source Code Form is "Incompatible With Secondary Licenses", as - # defined by the Mozilla Public License, v. 2.0. - #%] - -[% - constants.FIELD_TYPE_USER = 20; - constants.FIELD_TYPE_USERS = 21; - constants.FIELD_TYPE_BUG_LIST = 22; -%] diff --git a/extensions/RestrictComments/Extension.pm b/extensions/RestrictComments/Extension.pm index 3f514d5a0..7bfada359 100644 --- a/extensions/RestrictComments/Extension.pm +++ b/extensions/RestrictComments/Extension.pm @@ -90,8 +90,11 @@ sub install_update_db { my $field = new Bugzilla::Field({name => 'restrict_comments'}); if (!$field) { - Bugzilla::Field->create( - {name => 'restrict_comments', description => 'Restrict Comments'}); + Bugzilla::Field->create({ + name => 'restrict_comments', + description => 'Restrict Comments', + type => FIELD_TYPE_BOOLEAN, + }); } $dbh->bz_add_column('bugs', 'restrict_comments', {TYPE => 'BOOLEAN'}); diff --git a/extensions/Review/Extension.pm b/extensions/Review/Extension.pm index 654063b9e..86977523f 100644 --- a/extensions/Review/Extension.pm +++ b/extensions/Review/Extension.pm @@ -936,7 +936,10 @@ sub install_update_db { my $field = Bugzilla::Field->new({name => 'bug_mentor'}); if (!$field) { Bugzilla::Field->create({ - name => 'bug_mentor', description => 'Mentor', mailhead => 1 + name => 'bug_mentor', + description => 'Mentors', + type => FIELD_TYPE_USERS, + mailhead => 1, }); } elsif (!$field->in_new_bugmail) { diff --git a/extensions/Voting/Extension.pm b/extensions/Voting/Extension.pm index df1500364..f3819a83a 100644 --- a/extensions/Voting/Extension.pm +++ b/extensions/Voting/Extension.pm @@ -84,8 +84,12 @@ sub install_update_db { my $field = new Bugzilla::Field({name => 'votes'}); if (!$field) { - Bugzilla::Field->create( - {name => 'votes', description => 'Votes', buglist => 1}); + Bugzilla::Field->create({ + name => 'votes', + description => 'Votes', + type => FIELD_TYPE_INTEGER, + buglist => 1, + }); } $dbh->bz_add_column('products', 'votesperuser', diff --git a/template/en/default/global/field-descs.none.tmpl b/template/en/default/global/field-descs.none.tmpl index e458c6e4a..4ee255e4c 100644 --- a/template/en/default/global/field-descs.none.tmpl +++ b/template/en/default/global/field-descs.none.tmpl @@ -64,13 +64,19 @@ $stash->set( field_types => { Bugzilla::Constants::FIELD_TYPE_UNKNOWN() => "Unknown Type", Bugzilla::Constants::FIELD_TYPE_FREETEXT() => "Free Text", - Bugzilla::Constants::FIELD_TYPE_INTEGER() => "Integer", Bugzilla::Constants::FIELD_TYPE_SINGLE_SELECT() => "Drop Down", Bugzilla::Constants::FIELD_TYPE_MULTI_SELECT() => "Multiple-Selection Box", Bugzilla::Constants::FIELD_TYPE_TEXTAREA() => "Large Text Box", Bugzilla::Constants::FIELD_TYPE_DATETIME() => "Date/Time", - Bugzilla::Constants::FIELD_TYPE_DATE() => "Date", Bugzilla::Constants::FIELD_TYPE_BUG_ID() => "$terms->{Bug} ID", + Bugzilla::Constants::FIELD_TYPE_BUG_URLS() => "$terms->{Bug} URL List", + Bugzilla::Constants::FIELD_TYPE_KEYWORDS() => "Keywords", + Bugzilla::Constants::FIELD_TYPE_DATE() => "Date", + Bugzilla::Constants::FIELD_TYPE_INTEGER() => "Integer", + Bugzilla::Constants::FIELD_TYPE_BOOLEAN() => "Boolean", + Bugzilla::Constants::FIELD_TYPE_USER() => "User", + Bugzilla::Constants::FIELD_TYPE_USERS() => "User List", + Bugzilla::Constants::FIELD_TYPE_BUG_LIST() => "$terms->{Bug} ID List", Bugzilla::Constants::FIELD_TYPE_EXTENSION() => "Extension", } );