From 91b171e7584920d03abb9c45e779c84f3dee975c Mon Sep 17 00:00:00 2001 From: "myk%mozilla.org" <> Date: Sun, 29 Sep 2002 01:42:23 +0000 Subject: Fix for bug 98801: Implementation of the request tracker, a set of enhancements to attachment statuses. r=gerv,bbaetz --- globals.pl | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'globals.pl') diff --git a/globals.pl b/globals.pl index a6a751562..9a625a842 100644 --- a/globals.pl +++ b/globals.pl @@ -300,7 +300,12 @@ sub FetchOneColumn { "status", "resolution", "summary"); sub AppendComment { - my ($bugid,$who,$comment,$isprivate) = (@_); + my ($bugid, $who, $comment, $isprivate, $timestamp) = @_; + + # Use the date/time we were given if possible (allowing calling code + # to synchronize the comment's timestamp with those of other records). + $timestamp = ($timestamp ? SqlQuote($timestamp) : "NOW()"); + $comment =~ s/\r\n/\n/g; # Get rid of windows-style line endings. $comment =~ s/\r/\n/g; # Get rid of mac-style line endings. if ($comment =~ /^\s*$/) { # Nothin' but whitespace. @@ -310,7 +315,7 @@ sub AppendComment { my $whoid = DBNameToIdAndCheck($who); my $privacyval = $isprivate ? 1 : 0 ; SendSQL("INSERT INTO longdescs (bug_id, who, bug_when, thetext, isprivate) " . - "VALUES($bugid, $whoid, now(), " . SqlQuote($comment) . ", " . + "VALUES($bugid, $whoid, $timestamp, " . SqlQuote($comment) . ", " . $privacyval . ")"); SendSQL("UPDATE bugs SET delta_ts = now() WHERE bug_id = $bugid"); @@ -902,8 +907,7 @@ sub get_product_name { sub get_component_id { my ($prod_id, $comp) = @_; - die "non-numeric prod_id '$prod_id' passed to get_component_id" - unless ($prod_id =~ /^\d+$/); + return undef unless ($prod_id =~ /^\d+$/); PushGlobalSQLState(); SendSQL("SELECT id FROM components " . "WHERE product_id = $prod_id AND name = " . SqlQuote($comp)); -- cgit v1.2.3-24-g4f1b