RSS

(root)/bugzilla/4.2 : 1760 : Bugzilla/Bug.pm

To get this branch, use:
bzr branch /bugzilla/4.2

« back to all changes in this revision

Viewing changes to Bugzilla/Bug.pm

bugreport%peshkin.net
2002-09-22 17:14:48
Revision ID: cvs-1:bugreportpeshkin.net-20020923001448-v33kod81tb8wd7nz
bug 157756 - Groups_20020716_Branch Tracking : > 55 groups now supported
r=bbaetz, gerv

Show diffs side-by-side

added added

removed removed

37
37
for my $key (qw (bug_id alias product version rep_platform op_sys bug_status 
38
38
                resolution priority bug_severity component assigned_to
39
39
                reporter bug_file_loc short_desc target_milestone 
40
 
                qa_contact status_whiteboard creation_ts groupset 
41
 
                delta_ts votes whoid usergroupset comment query error) ){
 
40
                qa_contact status_whiteboard creation_ts 
 
41
                delta_ts votes whoid comment query error) ){
42
42
    $ok_field{$key}++;
43
43
    }
44
44
 
105
105
 
106
106
 
107
107
  $self->{'whoid'} = $user_id;
108
 
  &::SendSQL("SELECT groupset FROM profiles WHERE userid=$self->{'whoid'}");
109
 
  my $usergroupset = &::FetchOneColumn();
110
 
  if (!$usergroupset) { $usergroupset = '0' }
111
 
  $self->{'usergroupset'} = $usergroupset;
112
108
 
113
109
  my $query = "
114
110
    select
116
112
      resolution, priority, bug_severity, components.name, assigned_to, reporter,
117
113
      bug_file_loc, short_desc, target_milestone, qa_contact,
118
114
      status_whiteboard, date_format(creation_ts,'%Y-%m-%d %H:%i'),
119
 
      groupset, delta_ts, sum(votes.count)
 
115
      delta_ts, sum(votes.count)
120
116
    from bugs left join votes using(bug_id),
121
117
      products, components
122
118
    where bugs.bug_id = $bug_id
124
120
      AND components.id = bugs.component_id
125
121
    group by bugs.bug_id";
126
122
 
127
 
  &::SendSQL(&::SelectVisible($query, $user_id, $usergroupset));
128
 
  my @row;
 
123
  &::SendSQL($query);
 
124
  my @row = ();
129
125
 
130
 
  if (@row = &::FetchSQLData()) {
 
126
  if ((@row = &::FetchSQLData()) && &::CanSeeBug($bug_id, $self->{'whoid'})) {
131
127
    my $count = 0;
132
128
    my %fields;
133
129
    foreach my $field ("bug_id", "alias", "product", "version", "rep_platform",
135
131
                       "bug_severity", "component", "assigned_to", "reporter",
136
132
                       "bug_file_loc", "short_desc", "target_milestone",
137
133
                       "qa_contact", "status_whiteboard", "creation_ts",
138
 
                       "groupset", "delta_ts", "votes") {
 
134
                       "delta_ts", "votes") {
139
135
        $fields{$field} = shift @row;
140
136
        if ($fields{$field}) {
141
137
            $self->{$field} = $fields{$field};
142
138
        }
143
139
        $count++;
144
140
    }
145
 
  } else {
146
 
    &::SendSQL("select groupset from bugs where bug_id = $bug_id");
147
 
    if (@row = &::FetchSQLData()) {
 
141
  } elsif (@row) {
148
142
      $self->{'bug_id'} = $bug_id;
149
143
      $self->{'error'} = "NotPermitted";
150
144
      return $self;
151
 
    } else {
 
145
  } else {
152
146
      $self->{'bug_id'} = $bug_id;
153
147
      $self->{'error'} = "NotFound";
154
148
      return $self;
155
 
    }
156
149
  }
157
150
 
158
151
  $self->{'assigned_to'} = &::DBID_to_name($self->{'assigned_to'});
356
349
  return ("</bugzilla>\n");
357
350
}
358
351
 
359
 
sub UserInGroup {
360
 
    my $self = shift();
361
 
    my ($groupname) = (@_);
362
 
    if ($self->{'usergroupset'} eq "0") {
363
 
        return 0;
364
 
    }
365
 
    &::ConnectToDatabase();
366
 
    &::SendSQL("select (bit & $self->{'usergroupset'}) != 0 from groups where name = " 
367
 
           . &::SqlQuote($groupname));
368
 
    my $bit = &::FetchOneColumn();
369
 
    if ($bit) {
370
 
        return 1;
371
 
    }
372
 
    return 0;
373
 
}
374
 
 
375
352
sub CanChangeField {
376
353
   my $self = shift();
377
354
   my ($f, $oldvalue, $newvalue) = (@_);

Loggerhead 1.18.1 is a web-based interface for Bazaar branches