Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
1488a589
Commit
1488a589
authored
Sep 23, 2014
by
Frédéric Buclin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1065444: Several columns are not legal when displaying queries
r=dkl a=sgreen
parent
6b518aa3
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
39 deletions
+44
-39
Search.pm
Bugzilla/Search.pm
+10
-5
buglist.cgi
buglist.cgi
+34
-34
No files found.
Bugzilla/Search.pm
View file @
1488a589
...
...
@@ -647,7 +647,6 @@ sub COLUMNS {
foreach
my
$col
(
@id_fields
)
{
$special_sql
{
$col
}
=
"map_${col}.name"
;
$columns
{
"${col}_id"
}{
name
}
=
"bugs.${col}_id"
;
}
# Do the actual column-getting from fielddefs, now.
...
...
@@ -762,7 +761,7 @@ sub data {
my
@orig_fields
=
$self
->
_input_columns
;
my
$all_in_bugs_table
=
1
;
foreach
my
$field
(
@orig_fields
)
{
next
if
$self
->
COLUMNS
->
{
$field
}
->
{
name
}
=~
/^bugs\.\w+$/
;
next
if
(
$self
->
COLUMNS
->
{
$field
}
->
{
name
}
//
$field
)
=~
/^bugs\.\w+$/
;
$self
->
{
fields
}
=
[
'bug_id'
];
$all_in_bugs_table
=
0
;
last
;
...
...
@@ -1014,10 +1013,16 @@ sub _sql_select {
my
(
$self
)
=
@_
;
my
@sql_fields
;
foreach
my
$column
(
$self
->
_display_columns
)
{
my
$sql
=
$self
->
COLUMNS
->
{
$column
}
->
{
name
}
//
''
;
if
(
$sql
)
{
my
$alias
=
$column
;
# Aliases cannot contain dots in them. We convert them to underscores.
$alias
=~
s/\./_/g
;
my
$sql
=
$self
->
COLUMNS
->
{
$column
}
->
{
name
}
.
" AS $alias"
;
$alias
=~
tr
/./
_
/
;
$sql
.=
" AS $alias"
;
}
else
{
$sql
=
$column
;
}
push
(
@sql_fields
,
$sql
);
}
return
@sql_fields
;
...
...
@@ -1394,7 +1399,7 @@ sub _sql_group_by {
my
@extra_group_by
;
foreach
my
$column
(
$self
->
_select_columns
)
{
next
if
$self
->
_skip_group_by
->
{
$column
};
my
$sql
=
$self
->
COLUMNS
->
{
$column
}
->
{
name
};
my
$sql
=
$self
->
COLUMNS
->
{
$column
}
->
{
name
}
//
$column
;
push
(
@extra_group_by
,
$sql
);
}
...
...
buglist.cgi
View file @
1488a589
...
...
@@ -281,6 +281,38 @@ sub GetGroups {
return
[
values
%
legal_groups
];
}
sub
_get_common_flag_types
{
my
$component_ids
=
shift
;
# Get all the different components in the bug list
my
$components
=
Bugzilla::
Component
->
new_from_list
(
$component_ids
);
my
%
flag_types
;
my
@flag_types_ids
;
foreach
my
$component
(
@$components
)
{
foreach
my
$flag_type
(
@
{
$component
->
flag_types
->
{
'bug'
}})
{
push
@flag_types_ids
,
$flag_type
->
id
;
$flag_types
{
$flag_type
->
id
}
=
$flag_type
;
}
}
# We only want flags that appear in all components
my
%
common_flag_types
;
foreach
my
$id
(
keys
%
flag_types
)
{
my
$flag_type_count
=
scalar
grep
{
$_
==
$id
}
@flag_types_ids
;
$common_flag_types
{
$id
}
=
$flag_types
{
$id
}
if
$flag_type_count
==
scalar
@$components
;
}
# We only show flags that a user has request or set rights on
my
@show_flag_types
=
grep
{
$user
->
can_request_flag
(
$_
)
||
$user
->
can_set_flag
(
$_
)
}
values
%
common_flag_types
;
my
$any_flags_requesteeble
=
grep
(
$_
->
is_requesteeble
,
@show_flag_types
);
return
(
\
@show_flag_types
,
$any_flags_requesteeble
);
}
################################################################################
# Command Execution
################################################################################
...
...
@@ -510,38 +542,6 @@ if (grep('relevance', @displaycolumns) && !$fulltext) {
@displaycolumns
=
grep
(
$_
ne
'relevance'
,
@displaycolumns
);
}
sub
_get_common_flag_types
{
my
$component_ids
=
shift
;
# Get all the different components in the bug list
my
$components
=
Bugzilla::
Component
->
new_from_list
(
$component_ids
);
my
%
flag_types
;
my
@flag_types_ids
;
foreach
my
$component
(
@$components
)
{
foreach
my
$flag_type
(
@
{
$component
->
flag_types
->
{
'bug'
}})
{
push
@flag_types_ids
,
$flag_type
->
id
;
$flag_types
{
$flag_type
->
id
}
=
$flag_type
;
}
}
# We only want flags that appear in all components
my
%
common_flag_types
;
foreach
my
$id
(
keys
%
flag_types
)
{
my
$flag_type_count
=
scalar
grep
{
$_
==
$id
}
@flag_types_ids
;
$common_flag_types
{
$id
}
=
$flag_types
{
$id
}
if
$flag_type_count
==
scalar
@$components
;
}
# We only show flags that a user has request or set rights on
my
@show_flag_types
=
grep
{
$user
->
can_request_flag
(
$_
)
||
$user
->
can_set_flag
(
$_
)
}
values
%
common_flag_types
;
my
$any_flags_requesteeble
=
grep
(
$_
->
is_requesteeble
,
@show_flag_types
);
return
(
\
@show_flag_types
,
$any_flags_requesteeble
);
}
################################################################################
# Select Column Determination
################################################################################
...
...
@@ -582,7 +582,7 @@ foreach my $col (@displaycolumns) {
# has for modifying the bugs.
if
(
$dotweak
)
{
push
(
@selectcolumns
,
"bug_status"
)
if
!
grep
(
$_
eq
'bug_status'
,
@selectcolumns
);
push
(
@selectcolumns
,
"
component_id"
)
if
!
grep
(
$_
eq
'component_id'
,
@selectcolumns
);
push
(
@selectcolumns
,
"
bugs.component_id"
);
}
if
(
$format
->
{
'extension'
}
eq
'ics'
)
{
...
...
@@ -822,7 +822,7 @@ foreach my $row (@$data) {
# Record the assignee, product, and status in the big hashes of those things.
$bugowners
->
{
$bug
->
{
'assigned_to'
}}
=
1
if
$bug
->
{
'assigned_to'
};
$bugproducts
->
{
$bug
->
{
'product'
}}
=
1
if
$bug
->
{
'product'
};
$bugcomponentids
->
{
$bug
->
{
'
component_id'
}}
=
1
if
$bug
->
{
'
component_id'
};
$bugcomponentids
->
{
$bug
->
{
'
bugs.component_id'
}}
=
1
if
$bug
->
{
'bugs.
component_id'
};
$bugcomponents
->
{
$bug
->
{
'component'
}}
=
1
if
$bug
->
{
'component'
};
$bugstatuses
->
{
$bug
->
{
'bug_status'
}}
=
1
if
$bug
->
{
'bug_status'
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment