From 152654312b8f500a0341e08bb88fa3854a6652a6 Mon Sep 17 00:00:00 2001 From: Vitaliy Filippov Date: Fri, 1 Aug 2014 21:13:45 +0400 Subject: [PATCH] Remove useXXX parameters and use $field->enabled instead; Make Bugzilla object always accessible in templates; Allow only specific tweaks for standard fields and show which ones are allowed in the UI. --- Bugzilla/Bug.pm | 27 +- Bugzilla/BugMail.pm | 2 +- Bugzilla/Component.pm | 2 +- Bugzilla/Config/BugChange.pm | 52 ++- Bugzilla/Config/BugFields.pm | 166 -------- Bugzilla/Field.pm | 34 ++ Bugzilla/Field/Choice.pm | 1 - Bugzilla/Install/DB.pm | 31 +- Bugzilla/Product.pm | 4 +- Bugzilla/Search.pm | 2 +- Bugzilla/Template.pm | 4 +- Bugzilla/User.pm | 4 +- Bugzilla/WebService/Bug.pm | 14 +- Bugzilla/WebService/Product.pm | 2 +- buglist.cgi | 2 +- config.cgi | 4 +- describecomponents.cgi | 2 +- editclassifications.cgi | 4 +- editfields.cgi | 47 ++- editproducts.cgi | 24 +- enter_bug.cgi | 10 +- importxls.cgi | 3 - importxml.pl | 4 +- post_bug.cgi | 4 +- process_bug.cgi | 2 +- qa/config/generate_test_data.pl | 15 +- query.cgi | 2 +- request.cgi | 2 +- .../account/auth/login-simple.html.tmpl | 2 - .../en/default/account/auth/login.html.tmpl | 4 +- .../en/default/account/prefs/email.html.tmpl | 4 +- template/en/default/admin/admin.html.tmpl | 5 +- .../admin/components/confirm-delete.html.tmpl | 6 +- .../default/admin/components/edit.html.tmpl | 2 +- .../default/admin/components/list.html.tmpl | 2 +- .../admin/custom_fields/edit.html.tmpl | 61 ++- .../admin/custom_fields/list.html.tmpl | 91 ++++- .../admin/fieldvalues/select-field.html.tmpl | 6 +- .../default/admin/milestones/list.html.tmpl | 3 - .../default/admin/params/bugchange.html.tmpl | 17 + .../default/admin/params/bugfields.html.tmpl | 39 -- .../admin/products/confirm-delete.html.tmpl | 6 +- .../admin/products/edit-common.html.tmpl | 10 +- .../en/default/admin/products/edit.html.tmpl | 4 +- .../default/admin/products/footer.html.tmpl | 6 +- .../admin/sanitycheck/messages.html.tmpl | 1 - template/en/default/admin/table.html.tmpl | 7 + .../attachment/cancel-create-dupe.html.tmpl | 2 - .../en/default/attachment/midair.html.tmpl | 1 - .../attachment/show-multiple-simple.html.tmpl | 2 - .../bug/create/comment-guided.txt.tmpl | 3 +- .../en/default/bug/create/comment.txt.tmpl | 1 - .../bug/create/confirm-create-dupe.html.tmpl | 2 - .../bug/create/create-guided.html.tmpl | 3 +- .../en/default/bug/create/create.html.tmpl | 27 +- template/en/default/bug/edit.html.tmpl | 25 +- template/en/default/bug/field.html.tmpl | 2 +- .../en/default/bug/process/results.html.tmpl | 2 - .../bug/process/verify-field-values.html.tmpl | 1 - .../bug/process/verify-flags.html.tmpl | 1 - template/en/default/bug/show-header.html.tmpl | 2 - .../en/default/bug/show-multiple.html.tmpl | 17 +- template/en/default/config.rdf.tmpl | 8 +- .../en/default/email/newchangedmail.txt.tmpl | 2 +- .../default/global/choose-product.html.tmpl | 4 +- .../default/global/code-error-page.html.tmpl | 1 - .../en/default/global/common-links.html.tmpl | 1 - .../global/confirm-user-match.html.tmpl | 2 - template/en/default/global/header.html.tmpl | 2 - template/en/default/global/help.html.tmpl | 5 +- .../en/default/global/hidden-fields.html.tmpl | 1 - .../default/global/site-navigation.html.tmpl | 1 - .../default/global/user-error-page.html.tmpl | 2 - .../en/default/global/user-error.html.tmpl | 4 +- .../en/default/list/edit-multiple.html.tmpl | 11 +- .../en/default/list/list-simple.html.tmpl | 1 - template/en/default/list/list.atom.tmpl | 2 +- template/en/default/list/table.html.tmpl | 1 - .../default/pages/attach-multiple.html.tmpl | 2 - template/en/default/pages/fields.html.tmpl | 6 +- .../en/default/pages/previewcomment.html.tmpl | 4 +- .../en/default/pages/quicksearch.html.tmpl | 10 +- .../default/pages/quicksearchhack.html.tmpl | 382 ------------------ .../en/default/reports/components.html.tmpl | 8 +- .../reports/duplicates-table.html.tmpl | 6 +- .../default/reports/report-simple.html.tmpl | 1 - template/en/default/request/email.txt.tmpl | 4 +- template/en/default/request/queue.html.tmpl | 4 +- template/en/default/search/form.html.tmpl | 18 +- .../default/search/search-advanced.html.tmpl | 5 +- .../en/default/search/search-help.html.tmpl | 130 +++--- .../default/search/search-specific.html.tmpl | 2 +- template/en/default/sidebar.xul.tmpl | 4 +- votes.cgi | 5 +- 94 files changed, 518 insertions(+), 958 deletions(-) delete mode 100644 Bugzilla/Config/BugFields.pm delete mode 100644 template/en/default/pages/quicksearchhack.html.tmpl diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index dabd63a73..f4458bc65 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -106,9 +106,8 @@ sub DB_COLUMNS version ); # FIXME kill op_sys and rep_platform completely, make them custom fields - # FIXME change useplatform/useopsys/useqacontact to "field(xxx).is_obsolete" - push @columns, 'op_sys' if Bugzilla->params->{useopsys}; - push @columns, 'rep_platform' if Bugzilla->params->{useplatform}; + push @columns, 'op_sys' if Bugzilla->get_field('op_sys')->enabled; + push @columns, 'rep_platform' if Bugzilla->get_field('rep_platform')->enabled; push @columns, map { $_->name } grep { $_->type != FIELD_TYPE_MULTI_SELECT && $_->type != FIELD_TYPE_BUG_ID_REV } Bugzilla->active_custom_fields; @@ -299,7 +298,7 @@ sub new if (!ref $param && $param !~ /^\d+$/) { # But only if aliases are enabled. - if (Bugzilla->params->{usebugaliases} && $param) + if (Bugzilla->get_field('alias')->enabled && $param) { $param = { name => $param }; } @@ -726,7 +725,7 @@ sub check_default_values for (qw(target_milestone version)) { my $f = Bugzilla->get_field($_); - $self->set($_, undef) if !$f->obsolete && (!$f->nullable && !$self->{$_} || !exists $self->{$_}); + $self->set($_, undef) if $f->enabled && (!$f->nullable && !$self->{$_} || !exists $self->{$_}); } # Remove NULLs for custom fields for my $field (Bugzilla->get_fields({ custom => 1, obsolete => 0 })) @@ -1042,7 +1041,7 @@ sub _check_bug_status # Check musthavemilestoneonaccept. if ($self->id && $new_status->is_assigned - && Bugzilla->params->{usetargetmilestone} + && Bugzilla->get_field('target_milestone')->enabled && Bugzilla->params->{musthavemilestoneonaccept} && !$self->target_milestone) { @@ -1729,7 +1728,7 @@ sub _set_alias { my ($self, $alias) = @_; $alias = trim($alias); - return undef if !Bugzilla->params->{usebugaliases}; + return undef if Bugzilla->get_field('alias')->enabled; return $self->{alias} = undef if !$alias; # Make sure the alias isn't too long. @@ -2168,8 +2167,8 @@ sub _set_qa_contact my $id; if (!$self->id) { - # Bugs get no QA Contact on creation if useqacontact is off. - return undef if !Bugzilla->params->{useqacontact}; + # Bugs get no QA Contact on creation if qa_contact is off. + return undef if !Bugzilla->get_field('qa_contact')->enabled; # Set the default QA Contact if one isn't specified or if the # user doesn't have editbugs. @@ -2252,7 +2251,7 @@ sub _set_status_whiteboard sub _set_target_milestone { my ($self, $target) = @_; - if (!Bugzilla->params->{usetargetmilestone}) + if (!Bugzilla->get_field('target_milestone')->enabled) { # Don't change value if the field is disabled return undef; @@ -3145,7 +3144,7 @@ sub qa_contact { my ($self) = @_; return $self->{qa_contact_obj} if exists $self->{qa_contact_obj} || !$self->{qa_contact}; - if (Bugzilla->params->{useqacontact} && $self->{qa_contact}) + if (Bugzilla->get_field('qa_contact')->enabled && $self->{qa_contact}) { $self->{qa_contact_obj} = new Bugzilla::User($self->{qa_contact}); } @@ -3251,7 +3250,7 @@ sub show_attachment_flags sub use_votes { my ($self) = @_; - return Bugzilla->params->{usevotes} && $self->product_obj->votes_per_user > 0; + return Bugzilla->get_field('votes')->enabled && $self->product_obj->votes_per_user > 0; } sub groups @@ -3334,7 +3333,7 @@ sub user my $unknown_privileges = $user->in_group('editbugs', $prod_id); my $canedit = $unknown_privileges || $user->id == $self->{assigned_to} - || (Bugzilla->params->{useqacontact} && $self->{qa_contact} && $user->id == $self->{qa_contact}); + || (Bugzilla->get_field('qa_contact')->enabled && $self->{qa_contact} && $user->id == $self->{qa_contact}); my $canconfirm = $unknown_privileges || $user->in_group('canconfirm', $prod_id); my $isreporter = $user->id && $user->id == $self->{reporter}; @@ -3967,7 +3966,7 @@ sub check_can_change_field } # Allow the QA contact to change anything else. - if (Bugzilla->params->{useqacontact} && + if (Bugzilla->get_field('qa_contact')->enabled && ($self->{qa_contact} && $self->{qa_contact} == $user->id || $self->{_old_self} && $self->{_old_self}->{qa_contact} == $user->id)) { diff --git a/Bugzilla/BugMail.pm b/Bugzilla/BugMail.pm index fcf228eb8..e929ba515 100644 --- a/Bugzilla/BugMail.pm +++ b/Bugzilla/BugMail.pm @@ -408,7 +408,7 @@ sub Send $recipients{$reporter}->{+REL_REPORTER} = BIT_DIRECT; # QA Contact - if (Bugzilla->params->{useqacontact}) + if (Bugzilla->get_field('qa_contact')->enabled) { foreach (@qa_contacts) { diff --git a/Bugzilla/Component.pm b/Bugzilla/Component.pm index 75db7e4e3..a2c5e2e17 100644 --- a/Bugzilla/Component.pm +++ b/Bugzilla/Component.pm @@ -283,7 +283,7 @@ sub _check_initialqacontact my ($invocant, $qa_contact) = @_; my $qa_contact_id; - if (Bugzilla->params->{useqacontact}) + if (Bugzilla->get_field('qa_contact')->enabled) { $qa_contact_id = Bugzilla::User->check($qa_contact)->id if $qa_contact; } diff --git a/Bugzilla/Config/BugChange.pm b/Bugzilla/Config/BugChange.pm index c68d040e5..ba23b8c1f 100644 --- a/Bugzilla/Config/BugChange.pm +++ b/Bugzilla/Config/BugChange.pm @@ -33,6 +33,8 @@ use strict; use Bugzilla::Status; +our $sortkey = 500; + sub check_bug_status { my $bug_status = shift; @@ -55,23 +57,24 @@ sub check_resolution return ""; } -our $sortkey = 500; - sub get_param_list { my $class = shift; - # Hardcoded bug statuses which existed before Bugzilla 3.1. - my @closed_bug_statuses = ('RESOLVED', 'VERIFIED', 'CLOSED'); + # Hardcoded bug statuses and resolutions which existed before Bugzilla 3.1. + my @closed_bug_statuses = qw(RESOLVED VERIFIED CLOSED); + my @resolutions = qw(FIXED INVALID WONTFIX LATER REMIND DUPLICATE WORKSFORME MOVED); # If we are upgrading from 3.0 or older, bug statuses are not customisable # and bug_status.is_open is not yet defined (hence the eval), so we use # the bug statuses above as they are still hardcoded. eval { - my @current_closed_states = map { $_->name } grep { !$_->is_open } Bugzilla::Status->get_all; - # If no closed state was found, use the default list above. - @closed_bug_statuses = @current_closed_states if scalar(@current_closed_states); + my @st = map { $_->name } grep { !$_->is_open } Bugzilla::Status->get_all; + my @res = map { $_->name } @{ Bugzilla->get_field('resolution')->legal_values }; + # If no closed states and resolutions were found was found, use the default list above. + @closed_bug_statuses = @st if @st; + @resolutions = @res if @res; }; my @param_list = ( @@ -85,7 +88,8 @@ sub get_param_list { name => 'duplicate_resolution', - type => 't', + type => 's', + choices => \@resolutions, default => 'DUPLICATE', checker => \&check_resolution, }, @@ -131,6 +135,38 @@ sub get_param_list type => 'b', default => 1, }, + + { + name => 'auto_add_flag_requestees_to_cc', + type => 'b', + default => 1, + }, + + { + name => 'clear_requests_on_close', + type => 'b', + default => 1, + }, + + { + name => 'unauth_bug_details', + type => 'b', + default => 0, + }, + + { + name => 'preview_comment_lines', + type => 't', + default => '30', + checker => \&check_numeric, + }, + + { + name => 'comment_line_length', + type => 't', + default => '80', + checker => \&check_numeric, + }, ); return @param_list; } diff --git a/Bugzilla/Config/BugFields.pm b/Bugzilla/Config/BugFields.pm deleted file mode 100644 index 8e1ce9f98..000000000 --- a/Bugzilla/Config/BugFields.pm +++ /dev/null @@ -1,166 +0,0 @@ -# -*- Mode: perl; indent-tabs-mode: nil -*- -# -# The contents of this file are subject to the Mozilla Public -# License Version 1.1 (the "License"); you may not use this file -# except in compliance with the License. You may obtain a copy of -# the License at http://www.mozilla.org/MPL/ -# -# Software distributed under the License is distributed on an "AS -# IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -# implied. See the License for the specific language governing -# rights and limitations under the License. -# -# The Original Code is the Bugzilla Bug Tracking System. -# -# The Initial Developer of the Original Code is Netscape Communications -# Corporation. Portions created by Netscape are -# Copyright (C) 1998 Netscape Communications Corporation. All -# Rights Reserved. -# -# Contributor(s): Terry Weissman -# Dawn Endico -# Dan Mosedale -# Joe Robins -# Jacob Steenhagen -# J. Paul Reed -# Bradley Baetz -# Joseph Heenan -# Erik Stambaugh -# Frédéric Buclin -# - -package Bugzilla::Config::BugFields; - -use strict; - -use Bugzilla::Config::Common; -use Bugzilla::Field; - -use constant USENAMES => { - useclassification => 'classification', - usetargetmilestone => 'target_milestone', - useqacontact => 'qa_contact', - usestatuswhiteboard => 'status_whiteboard', - usevotes => 'votes', - usebugaliases => 'alias', - use_see_also => 'see_also', - useplatform => 'rep_platform', - useopsys => 'op_sys', -}; - -our $sortkey = 600; - -# A bridge from products.classification_id to fielddefs.visibility_field -sub set_useclassification -{ - my ($value, $param) = @_; - $_[0] = $value ? 1 : 0; - my $f = Bugzilla->get_field('classification'); - $f->set_obsolete($value ? 0 : 1); - $f->update; - my $vf = $value ? $f->id : undef; - $f = Bugzilla->get_field('product'); - $f->set_value_field($vf); - $f->update; - return ''; -} - -# A bridge from useXXX to fielddefs.obsolete (FIXME: This should be removed at some point) -sub set_usefield -{ - my ($value, $param) = @_; - my $f = Bugzilla->get_field(USENAMES->{$param->{name}}); - $_[0] = $value ? 1 : 0; - $f->set_obsolete($value ? 0 : 1); - $f->update; - return ''; -} - -sub get_param_list -{ - return ( - { - name => 'useclassification', - type => 'b', - default => 0, - checker => \&set_useclassification, - }, - { - name => 'usetargetmilestone', - type => 'b', - default => 0, - checker => \&set_usefield, - }, - { - name => 'useqacontact', - type => 'b', - default => 0, - checker => \&set_usefield, - }, - { - name => 'usestatuswhiteboard', - type => 'b', - default => 0, - checker => \&set_usefield, - }, - { - name => 'usevotes', - type => 'b', - default => 0, - checker => \&set_usefield, - }, - { - name => 'usebugaliases', - type => 'b', - default => 0, - checker => \&set_usefield, - }, - { - name => 'use_see_also', - type => 'b', - default => 1, - checker => \&set_usefield, - }, - { - name => 'useplatform', - type => 'b', - default => 1, - checker => \&set_usefield, - }, - { - name => 'auto_add_flag_requestees_to_cc', - type => 'b', - default => 1, - }, - { - name => 'useopsys', - type => 'b', - default => 1, - checker => \&set_usefield, - }, - { - name => 'clear_requests_on_close', - type => 'b', - default => 1, - }, - { - name => 'unauth_bug_details', - type => 'b', - default => 0, - }, - { - name => 'comment_line_length', - type => 't', - default => '80', - checker => \&check_numeric, - }, - { - name => 'preview_comment_lines', - type => 't', - default => '30', - checker => \&check_numeric, - }, - ); -} - -1; diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm index 3a674132f..24f1b9dc8 100644 --- a/Bugzilla/Field.pm +++ b/Bugzilla/Field.pm @@ -203,6 +203,18 @@ use constant DEFAULT_FIELDS => (map { my $i = 0; $_ = { (map { (DEFAULT_FIELD_CO [ 'see_also', 'See Also', 0, 1, 0, FIELD_TYPE_BUG_URLS ], )); +# Tweaks allowed for standard field properties +use constant CAN_TWEAK => { + obsolete => { map { $_ => 1 } qw(alias classification op_sys qa_contact rep_platform see_also status_whiteboard target_milestone votes) }, + clone_bug => { map { $_ => 1 } qw(short_desc version rep_platform bug_file_loc op_sys status_whiteboard + keywords bug_severity priority component assigned_to votes qa_contact dependson blocked target_milestone estimated_time remaining_time see_also) }, + default_value => { map { $_ => 1 } qw(bug_severity deadline keywords op_sys priority rep_platform short_desc status_whiteboard target_milestone version) }, + nullable => { map { $_ => 1 } qw(alias bug_severity deadline keywords op_sys priority rep_platform status_whiteboard target_milestone version) }, + visibility_field_id => { map { $_ => 1 } qw(bug_severity op_sys priority rep_platform status_whiteboard target_milestone version) }, + value_field_id => { map { $_ => 1 } qw(bug_severity op_sys priority rep_platform) }, + default_field_id => { map { $_ => 1 } qw(bug_severity keywords op_sys priority component rep_platform status_whiteboard) }, +}; + ################ # Constructors # ################ @@ -466,6 +478,8 @@ a boolean specifying whether or not the field is obsolete sub obsolete { return $_[0]->{obsolete} } +sub enabled { return !$_[0]->{obsolete} } + =over =item C @@ -534,6 +548,20 @@ sub value_type return Bugzilla::Field::Choice->type($self); } +# Checks if a certain property can be changed for this field (either it is custom or standard) +sub can_tweak +{ + my $self = shift; + my ($prop) = @_; + return $self->name !~ /^attachments\./ && $self->name ne 'longdesc' if $prop eq 'mailhead'; + $prop = 'clone_bug' if $prop eq 'clone_field_id'; + $prop = 'nullable' if $prop eq 'null_field_id'; + return 0 if !$self->custom && !CAN_TWEAK->{$prop}->{$self->name}; + return $self->type && $self->type != FIELD_TYPE_BUG_ID_REV if $prop eq 'default_value' || $prop eq 'nullable'; + return $self->is_select if $prop eq 'value_field_id'; + return 1; +} + # Includes disabled values is $include_disabled = true sub legal_values { @@ -997,6 +1025,12 @@ sub update } my ($changes, $old_self) = $self->SUPER::update(@_); Bugzilla->refresh_cache_fields; + if ($self->{name} eq 'classification') + { + my $prod = Bugzilla->get_field('product'); + $prod->set_value_field($self->obsolete ? $self->id : undef); + $prod->update; + } return wantarray ? ($changes, $old_self) : $changes; } diff --git a/Bugzilla/Field/Choice.pm b/Bugzilla/Field/Choice.pm index 86a6be5c0..3fbb3f7ac 100644 --- a/Bugzilla/Field/Choice.pm +++ b/Bugzilla/Field/Choice.pm @@ -10,7 +10,6 @@ package Bugzilla::Field::Choice; use base qw(Bugzilla::Object); use Bugzilla::Config qw(SetParam write_params); -use Bugzilla::Config::BugFields; use Bugzilla::Constants; use Bugzilla::Error; use Bugzilla::Field; diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm index 528c27134..a2e37699d 100644 --- a/Bugzilla/Install/DB.pm +++ b/Bugzilla/Install/DB.pm @@ -4019,25 +4019,6 @@ sub _make_fieldvaluecontrol } } } - - # FIXME: Remove useXXX and defaultXXX parameters and make this migration only once - - # Copy useXXX parameter values to fielddefs.is_obsolete - if (Bugzilla->params->{useclassification}) - { - my ($cl_id) = $dbh->selectrow_array('SELECT id FROM fielddefs WHERE name=\'classification\''); - $dbh->do('UPDATE fielddefs SET value_field_id=? WHERE name=\'product\'', undef, $cl_id); - } - else - { - $dbh->do('UPDATE fielddefs SET value_field_id=NULL WHERE name=\'product\''); - } - require Bugzilla::Config::BugFields; - my $h = Bugzilla::Config::BugFields->USENAMES; - for (keys %$h) - { - $dbh->do('UPDATE fielddefs SET obsolete=? WHERE name=?', undef, Bugzilla->params->{$_} ? 0 : 1, $h->{$_}); - } } # Change all integer keys to INT4 @@ -4210,6 +4191,18 @@ sub _move_old_defaults } } } + my %old_use = qw(useclassification classification usetargetmilestone target_milestone + useqacontact qa_contact usestatuswhiteboard status_whiteboard usevotes votes + usebugaliases alias use_see_also see_also useplatform rep_platform useopsys op_sys); + while (my ($p, $f) = each %old_use) + { + if (exists $old_params->{$p} && ($f = Bugzilla->get_field($f))) + { + print (($old_params->{$p} ? "Enabling " : "Disabling ").$f->description."\n"); + $f->set_obsolete($old_params->{$p} ? 0 : 1); + $f->update; + } + } } 1; diff --git a/Bugzilla/Product.pm b/Bugzilla/Product.pm index 51901cd3e..b6c46046a 100644 --- a/Bugzilla/Product.pm +++ b/Bugzilla/Product.pm @@ -545,7 +545,7 @@ sub _check_classification_id my ($invocant, $classification_name) = @_; my $classification_id = 1; - if (Bugzilla->params->{useclassification}) + if (Bugzilla->get_field('classification')->enabled) { my $classification = ref $classification_name ? $classification_name @@ -612,7 +612,7 @@ sub _check_default_milestone return undef unless ref $invocant; # Do nothing if target milestones are not in use - return $invocant->default_milestone unless Bugzilla->params->{usetargetmilestone}; + return $invocant->default_milestone if !Bugzilla->get_field('target_milestone')->enabled; $milestone = trim($milestone) || undef; if ($milestone) diff --git a/Bugzilla/Search.pm b/Bugzilla/Search.pm index fd78246a1..bfc625e8a 100644 --- a/Bugzilla/Search.pm +++ b/Bugzilla/Search.pm @@ -1438,7 +1438,7 @@ sub init # does index merge on such conditions term => '(bugs.reporter_accessible = 1 AND bugs.reporter='.$user->id. ' OR bugs.assigned_to='.$user->id. - (Bugzilla->params->{useqacontact} ? ' OR bugs.qa_contact='.$user->id : '').')' + (Bugzilla->get_field('qa_contact')->enabled ? ' OR bugs.qa_contact='.$user->id : '').')' }) : ()) ] ]; } diff --git a/Bugzilla/Template.pm b/Bugzilla/Template.pm index 263d36a28..22051e7da 100644 --- a/Bugzilla/Template.pm +++ b/Bugzilla/Template.pm @@ -47,6 +47,7 @@ use Bugzilla::User; use Bugzilla::Error; use Bugzilla::Status; use Bugzilla::Token; +use Bugzilla::Template::Plugin::Bugzilla; use Cwd qw(abs_path); use MIME::Base64; @@ -466,7 +467,7 @@ sub get_bug_link if ($cansee) { $title .= '/' . $bug->component . ' - ' . $bug->short_desc; - if (Bugzilla->params->{usebugaliases} && $options->{use_alias} && $link_text =~ /^\d+$/ && $bug->alias) + if (!Bugzilla->get_field('alias')->obsolete && $options->{use_alias} && $link_text =~ /^\d+$/ && $bug->alias) { $link_text = $bug->alias; } @@ -883,6 +884,7 @@ sub create { terms => Bugzilla->messages->{terms}, field_descs => Bugzilla->messages->{field_descs}, lc_messages => Bugzilla->messages, + Bugzilla => Bugzilla::Template::Plugin::Bugzilla->new, # HTML [% END %] + [% IF !field.id || field.can_tweak('mailhead') %] - + + [% END %] - + [% IF !field.id || field.can_tweak('clone_bug') %] + [% END %] @@ -90,11 +121,13 @@ var constants = { - + [% IF !field.id || field.can_tweak('obsolete') %] + + [% END %] Type: @@ -113,7 +146,7 @@ var constants = { [% END %] - [% IF !field.id || field.type && field.type != constants.FIELD_TYPE_BUG_ID_REV %] + [% IF !field.id || field.can_tweak('default_value') %] Default value: [% IF field.is_select %] @@ -146,7 +179,7 @@ var constants = { [% ELSE %] [% END %] - [% IF !field.id || field.type && field.type != constants.FIELD_TYPE_BUG_ID_REV %] + [% IF !field.id || field.can_tweak('nullable') %] [% END %] - [% IF field.custom || !field.id %] + [% IF !field.id || field.can_tweak('visibility_field_id') %]