]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 718289: The deadline field should be visible by non-members of the timetracking...
authorFrédéric Buclin <LpSolit@gmail.com>
Mon, 26 Nov 2012 19:20:29 +0000 (20:20 +0100)
committerFrédéric Buclin <LpSolit@gmail.com>
Mon, 26 Nov 2012 19:20:29 +0000 (20:20 +0100)
r=dkl a=LpSolit

13 files changed:
Bugzilla/Bug.pm
Bugzilla/Constants.pm
Bugzilla/Search.pm
Bugzilla/WebService/Bug.pm
buglist.cgi
colchange.cgi
config.cgi
docs/en/xml/using.xml
query.cgi
show_bug.cgi
template/en/default/bug/edit.html.tmpl
template/en/default/bug/show-multiple.html.tmpl
template/en/default/search/form.html.tmpl

index b72a8fcdbeb06187801aa6e7521491ddedd4483a..7a3ec4c8a1f5b7e1c08b6747cc3b509c5c9037e4 100644 (file)
@@ -3734,9 +3734,7 @@ sub editable_bug_fields {
         # Custom multi-select fields are not stored in the bugs table.
         splice(@fields, $location, 1) if ($location > -1);
     }
-    # Sorted because the old @::log_columns variable, which this replaces,
-    # was sorted.
-    return sort(@fields);
+    return @fields;
 }
 
 # XXX - When Bug::update() will be implemented, we should make this routine
@@ -4048,9 +4046,10 @@ sub check_can_change_field {
     # $PrivilegesRequired = PRIVILEGES_REQUIRED_REPORTER : the reporter, assignee or an empowered user;
     # $PrivilegesRequired = PRIVILEGES_REQUIRED_ASSIGNEE : the assignee or an empowered user;
     # $PrivilegesRequired = PRIVILEGES_REQUIRED_EMPOWERED : an empowered user.
-    
-    # Only users in the time-tracking group can change time-tracking fields.
-    if ( grep($_ eq $field, TIMETRACKING_FIELDS) ) {
+
+    # Only users in the time-tracking group can change time-tracking fields,
+    # including the deadline.
+    if (grep { $_ eq $field } (TIMETRACKING_FIELDS, 'deadline')) {
         if (!$user->is_timetracker) {
             $$PrivilegesRequired = PRIVILEGES_REQUIRED_EMPOWERED;
             return 0;
index 514c81143a7328ec41d0eae337311e6400260bf2..dbb1edf7454ce3310dfc789f1d104b61f44cdd41 100644 (file)
@@ -399,8 +399,7 @@ use constant ABNORMAL_SELECTS => {
 # The fields from fielddefs that are blocked from non-timetracking users.
 # work_time is sometimes called actual_time.
 use constant TIMETRACKING_FIELDS =>
-    qw(estimated_time remaining_time work_time actual_time
-       percentage_complete deadline);
+    qw(estimated_time remaining_time work_time actual_time percentage_complete);
 
 # The maximum number of days a token will remain valid.
 use constant MAX_TOKEN_AGE => 3;
index 3d09def653ca700971720bf9b358229a38e81aa8..401d2f2afd770a720f91cb8b305b1b21ba374244 100644 (file)
@@ -1475,9 +1475,8 @@ sub _special_parse_chfield {
 
 sub _special_parse_deadline {
     my ($self) = @_;
-    return if !$self->_user->is_timetracker;
     my $params = $self->_params;
-    
+
     my $clause = new Bugzilla::Search::Clause();
     if (my $from = $params->{'deadlinefrom'}) {
         $clause->add('deadline', 'greaterthaneq', $from);
index 7a29d325f1029df3a5fd92d077e42891f76fb693..f4cb53600c784a684073548fa2a00ef10648d190 100644 (file)
@@ -418,7 +418,7 @@ sub search {
     delete $params->{WHERE};
 
     unless (Bugzilla->user->is_timetracker) {
-        delete $params->{$_} foreach qw(estimated_time remaining_time deadline);
+        delete $params->{$_} foreach TIMETRACKING_FIELDS;
     }
 
     # Do special search types for certain fields.
@@ -851,6 +851,9 @@ sub _bug_to_hash {
         classification   => $self->type('string', $bug->classification),
         component        => $self->type('string', $bug->component),
         creation_time    => $self->type('dateTime', $bug->creation_ts),
+        # No need to format $bug->deadline specially, because Bugzilla::Bug
+        # already does it for us.
+        deadline         => $self->type('string', $bug->deadline),
         id               => $self->type('int', $bug->bug_id),
         is_confirmed     => $self->type('boolean', $bug->everconfirmed),
         last_change_time => $self->type('dateTime', $bug->delta_ts),
@@ -943,9 +946,6 @@ sub _bug_to_hash {
     if (Bugzilla->user->is_timetracker) {
         $item{'estimated_time'} = $self->type('double', $bug->estimated_time);
         $item{'remaining_time'} = $self->type('double', $bug->remaining_time);
-        # No need to format $bug->deadline specially, because Bugzilla::Bug
-        # already does it for us.
-        $item{'deadline'} = $self->type('string', $bug->deadline);
         $item{'actual_time'} = $self->type('double', $bug->actual_time);
     }
 
@@ -1782,9 +1782,6 @@ C<string> The login name of the person who filed this bug (the reporter).
 C<string> The day that this bug is due to be completed, in the format
 C<YYYY-MM-DD>.
 
-If you are not in the time-tracking group, this field will not be included
-in the return value.
-
 =item C<depends_on>
 
 C<array> of C<int>s. The ids of bugs that this bug "depends on".
index 5a8dcb6fd78a54488dcb80aa0475f758b9535c44..a59f0ee18ae98837a380eddd2846fef90ac04cf6 100755 (executable)
@@ -522,11 +522,9 @@ else {
 # Remove the timetracking columns if they are not a part of the group
 # (happens if a user had access to time tracking and it was revoked/disabled)
 if (!$user->is_timetracker) {
-   @displaycolumns = grep($_ ne 'estimated_time', @displaycolumns);
-   @displaycolumns = grep($_ ne 'remaining_time', @displaycolumns);
-   @displaycolumns = grep($_ ne 'actual_time', @displaycolumns);
-   @displaycolumns = grep($_ ne 'percentage_complete', @displaycolumns);
-   @displaycolumns = grep($_ ne 'deadline', @displaycolumns);
+   foreach my $tt_field (TIMETRACKING_FIELDS) {
+       @displaycolumns = grep($_ ne $tt_field, @displaycolumns);
+   }
 }
 
 # Remove the relevance column if the user is not doing a fulltext search.
index 0aa6c7cbafd980ecce13de1253c550d6cfe8f07e..66b661e5a915ccd751840ebc3653cb4594b7bdbe 100755 (executable)
@@ -26,6 +26,7 @@ use constant COLUMN_PARAMS => {
     'usetargetmilestone'  => ['target_milestone'],
     'useqacontact'        => ['qa_contact', 'qa_contact_realname'],
     'usestatuswhiteboard' => ['status_whiteboard'],
+    'timetrackinggroup'   => ['deadline'],
 };
 
 # We only show these columns if an object of this type exists in the
index c4f64a007ce4d376ff7579f4b2f936aea0ac0911..4c0881a11c522fcd522effe66219856bb58639a3 100755 (executable)
@@ -100,7 +100,9 @@ $vars->{'closed_status'} = \@closed_status;
 my @fields = @{Bugzilla::Field->match({obsolete => 0})};
 # Exclude fields the user cannot query.
 if (!$user->is_timetracker) {
-    @fields = grep { $_->name !~ /^(estimated_time|remaining_time|work_time|percentage_complete|deadline)$/ } @fields;
+    foreach my $tt_field (TIMETRACKING_FIELDS) {
+        @fields = grep { $_->name ne $tt_field } @fields;
+    }
 }
 
 my %FIELD_PARAMS = (
index 18d536bc964083fb6ff778ee073e01b859f658ea..88a87f0fcb5920ac3960e191981d6139d6f49463 100644 (file)
       Users who belong to the group specified by the <quote>timetrackinggroup</quote>
       parameter have access to time-related fields. Developers can see
       deadlines and estimated times to fix bugs, and can provide time spent
-      on these bugs.
+      on these bugs. Users who do not belong to this group can only see the deadline,
+      but not edit it. Other time-related fields remain invisible to them.
     </para>
 
     <para>
index 29e278c6d5ac6a42dee46daa33e4843226eda654..b62f77b531d2eed4deb048d08d991f09a634e38e 100755 (executable)
--- a/query.cgi
+++ b/query.cgi
@@ -190,9 +190,9 @@ foreach my $val (editable_bug_fields()) {
 if ($user->is_timetracker) {
     push @chfields, "work_time";
 } else {
-    @chfields = grep($_ ne "deadline", @chfields);
-    @chfields = grep($_ ne "estimated_time", @chfields);
-    @chfields = grep($_ ne "remaining_time", @chfields);
+    foreach my $tt_field (TIMETRACKING_FIELDS) {
+        @chfields = grep($_ ne $tt_field, @chfields);
+    }
 }
 @chfields = (sort(@chfields));
 $vars->{'chfield'} = \@chfields;
index f84bfc5310e974f42b00aec190b0c5e57e352701..7b915795903d11d3aa3cb530cadc519b49c65194 100755 (executable)
@@ -111,7 +111,7 @@ if ($cgi->param("field")) {
 }
 
 unless ($user->is_timetracker) {
-    @fieldlist = grep($_ !~ /(^deadline|_time)$/, @fieldlist);
+    @fieldlist = grep($_ !~ /_time$/, @fieldlist);
 }
 
 foreach (@fieldlist) {
index de9afb56cb0d28a5411b7e30f6ba06d9f989eb04..0eefc1b48f1b0ea595cb94e958f205c7ee31a336 100644 (file)
@@ -65,8 +65,8 @@
           
           [% PROCESS section_spacer %]
           
-          [%# *** severity, priority, version and milestone *** %]
-          [% PROCESS section_details2 %]            
+          [%# *** severity, priority, version, milestone, and deadline *** %]
+          [% PROCESS section_details2 %]
           
           [%# *** assigned to and qa contact *** %]
           [% PROCESS section_people %]
         [% PROCESS select selname = "target_milestone" %]
       </tr>
     [% END %]
-  
+
+    [% IF Param("timetrackinggroup") && bug.deadline %]
+      [% INCLUDE bug/field.html.tmpl field = bug_fields.deadline, value = bug.deadline, editable = 0 %]
+    [% END %]
 [% END %]
 
 [%############################################################################%]
index 7207e8cf9dde71bbaf52aa1e4af92c73ebcc4a0f..a20daedfaa97578c21f83c5c194138ee4babc8ef 100644 (file)
           </table>
         </td>
       </tr>
+    [% END %]
+    [% IF Param("timetrackinggroup") && bug.deadline %]
       [% PROCESS row cell="deadline" %]
     [% END %]
 
index 48980b633c5a68f93dc165f330b7569227511198..6ced462365e6c3a9a31e58c23ba3b8f99a617035 100644 (file)
@@ -114,7 +114,7 @@ TUI_hide_default('information_query');
     [%+ field_descs.longdesc FILTER html %]s, [%+ field_descs.bug_file_loc FILTER html %], 
     [% IF Param('usestatuswhiteboard') %] [%+ field_descs.status_whiteboard FILTER html %], [%+ END %]
     [% IF use_keywords %] [%+ field_descs.keywords FILTER html %], [%+ END %]
-    [% IF user.is_timetracker %] [%+ field_descs.deadline FILTER html %], [%+ END %]
+    [% IF Param('timetrackinggroup') %] [%+ field_descs.deadline FILTER html %], [%+ END %]
     [% terms.Bug %] Numbers, [%+ field_descs.version FILTER html %], 
     [% IF Param('usetargetmilestone') %] [%+ field_descs.target_milestone FILTER html %], [%+ END %]
     [% field_descs.bug_severity FILTER html %], [%+ field_descs.priority FILTER html %], [%+ field_descs.rep_platform FILTER html %], 
@@ -153,8 +153,7 @@ TUI_hide_default('information_query');
     </div>
   [% END %]
 
-  [%# Deadline %]
-  [% IF user.is_timetracker %]
+  [% IF Param('timetrackinggroup') %]
     <div class="search_field_row">
         [% INCLUDE "search/field.html.tmpl" 
                     field = bug_fields.deadline