From a32c764ba4f84270e5730e643d099b46313e071a Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Wed, 11 May 2005 03:30:11 +0000 Subject: Bug 287487: User with no privs can not add comments to bugs that have a deadline field set - Patch by Frédéric Buclin r=mkanat a=myk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- process_bug.cgi | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'process_bug.cgi') diff --git a/process_bug.cgi b/process_bug.cgi index 05f4fec0d..451613e29 100755 --- a/process_bug.cgi +++ b/process_bug.cgi @@ -1185,7 +1185,13 @@ foreach my $id (@idlist) { my %formhash; foreach my $col (@::log_columns) { # Consider NULL db entries to be equivalent to the empty string - $oldvalues[$i] = '' unless defined $oldvalues[$i]; + $oldvalues[$i] = defined($oldvalues[$i]) ? $oldvalues[$i] : ''; + # Convert the deadline taken from the DB into the YYYY-MM-DD format + # for consistency with the deadline provided by the user, if any. + # Else CheckCanChangeField() would see them as different in all cases. + if ($col eq 'deadline') { + $oldvalues[$i] = format_time($oldvalues[$i], "%Y-%m-%d"); + } $oldhash{$col} = $oldvalues[$i]; $formhash{$col} = $cgi->param($col) if defined $cgi->param($col); $i++; @@ -1717,6 +1723,10 @@ foreach my $id (@idlist) { foreach my $col (@::log_columns) { # Consider NULL db entries to be equivalent to the empty string $newvalues[$i] ||= ''; + # Convert the deadline to the YYYY-MM-DD format. + if ($col eq 'deadline') { + $newvalues[$i] = format_time($newvalues[$i], "%Y-%m-%d"); + } $newhash{$col} = $newvalues[$i]; $i++; } @@ -1779,16 +1789,6 @@ foreach my $id (@idlist) { $check_dep_bugs = 1; } - # Convert deadlines to the YYYY-MM-DD format. We use an - # intermediate $xxxtime to prevent errors in the web - # server log file when str2time($xxx) is undefined. - if ($col eq 'deadline') { - my $oldtime = str2time($old); - $old = ($oldtime) ? time2str("%Y-%m-%d", $oldtime) : ''; - my $newtime = str2time($new); - $new = ($newtime) ? time2str("%Y-%m-%d", $newtime) : ''; - } - LogActivityEntry($id,$col,$old,$new,$whoid,$timestamp); $bug_changed = 1; } -- cgit v1.2.3-24-g4f1b