summaryrefslogtreecommitdiffstats
path: root/whine.pl
diff options
context:
space:
mode:
authorAlbert Ting <altlist@gmail.com>2012-10-13 14:38:55 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-10-13 14:38:55 +0200
commitfd004da7fb20f885eeec229877f4892f4e72c73b (patch)
treef95b4f79e6ae2ef41338d3bca30b1096f22c5257 /whine.pl
parentbfb66f198ca3e0dddcccaefc3d729f348a254056 (diff)
downloadbugzilla-fd004da7fb20f885eeec229877f4892f4e72c73b.tar.gz
bugzilla-fd004da7fb20f885eeec229877f4892f4e72c73b.tar.xz
Bug 245375: Scheduled whining needs custom columns
r/a=LpSolit
Diffstat (limited to 'whine.pl')
-rwxr-xr-xwhine.pl14
1 files changed, 13 insertions, 1 deletions
diff --git a/whine.pl b/whine.pl
index cb52029c0..481b47425 100755
--- a/whine.pl
+++ b/whine.pl
@@ -338,6 +338,7 @@ while (my $event = get_next_event) {
# - queries array of hashes containing:
# - bugs: array of hashes mapping fieldnames to values for this bug
# - title: text title given to this query in the whine event
+# - columnlist: array of fieldnames to display in the mail
# - name: text name of this query
# - schedule_id integer id of the schedule being run
# - subject Subject line for the message
@@ -408,6 +409,7 @@ sub run_queries {
'name' => $_->[0],
'title' => $_->[1],
'onemailperbug' => $_->[2],
+ 'columnlist' => [],
'bugs' => [],
}
);
@@ -434,7 +436,16 @@ sub run_queries {
# Bugzilla::Search to execute a saved query. It's exceedingly weird,
# but that's how it works.
my $searchparams = new Bugzilla::CGI($savedquery);
- my @orderstrings = split(/,\s*/, $searchparams->param('order'));
+
+ # Use the columnlist for the saved query, if it exists, and make
+ # sure bug_id is always in the list.
+ if (my $columnlist = $searchparams->param('columnlist')) {
+ @searchfields = split(/[\s,]+/, $columnlist);
+ unshift(@searchfields, 'bug_id') unless grep { $_ eq 'bug_id' } @searchfields;
+ }
+ push @{$thisquery->{'columnlist'}}, @searchfields;
+
+ my @orderstrings = split(/,\s*/, $searchparams->param('order') || '');
my $search = new Bugzilla::Search(
'fields' => \@searchfields,
'params' => scalar $searchparams->Vars,
@@ -466,6 +477,7 @@ sub run_queries {
{
'name' => $thisquery->{'name'},
'title' => $thisquery->{'title'},
+ 'columnlist' => $thisquery->{'columnlist'},
'bugs' => [ $bug ],
},
];