From 0665a74437c43e2a7805ba068b1a47ea59124787 Mon Sep 17 00:00:00 2001 From: "wicked%sci.fi" <> Date: Mon, 6 Apr 2009 20:57:13 +0000 Subject: Bug 302420: Allow whining messages to be sent even without any results - Patch by Micheal J. Tosh r=wicked a=mkanat --- editwhines.cgi | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) (limited to 'editwhines.cgi') diff --git a/editwhines.cgi b/editwhines.cgi index 06717fe2c..37f52349e 100755 --- a/editwhines.cgi +++ b/editwhines.cgi @@ -143,20 +143,22 @@ if ($cgi->param('update')) { $sth->execute($eventid, $userid); } else { - # check the subject and body for changes + # check the subject, body and mailifnobugs for changes my $subject = ($cgi->param("event_${eventid}_subject") or ''); my $body = ($cgi->param("event_${eventid}_body") or ''); + my $mailifnobugs = $cgi->param("event_${eventid}_mailifnobugs") ? 1 : 0; trick_taint($subject) if $subject; trick_taint($body) if $body; if ( ($subject ne $events->{$eventid}->{'subject'}) + || ($mailifnobugs != $events->{$eventid}->{'mailifnobugs'}) || ($body ne $events->{$eventid}->{'body'}) ) { $sth = $dbh->prepare("UPDATE whine_events " . - "SET subject=?, body=? " . + "SET subject=?, body=?, mailifnobugs=? " . "WHERE id=?"); - $sth->execute($subject, $body, $eventid); + $sth->execute($subject, $body, $mailifnobugs, $eventid); } # add a schedule @@ -438,14 +440,15 @@ sub get_events { my $dbh = Bugzilla->dbh; my $events = {}; - my $sth = $dbh->prepare("SELECT DISTINCT id, subject, body " . + my $sth = $dbh->prepare("SELECT DISTINCT id, subject, body, mailifnobugs " . "FROM whine_events " . "WHERE owner_userid=?"); $sth->execute($userid); - while (my ($ev, $sub, $bod) = $sth->fetchrow_array) { + while (my ($ev, $sub, $bod, $mno) = $sth->fetchrow_array) { $events->{$ev} = { 'subject' => $sub || '', 'body' => $bod || '', + 'mailifnobugs' => $mno || 0, }; } return $events; -- cgit v1.2.3-24-g4f1b