diff options
author | terry%mozilla.org <> | 2000-01-21 06:31:18 +0100 |
---|---|---|
committer | terry%mozilla.org <> | 2000-01-21 06:31:18 +0100 |
commit | 78865fda79e5b78288aafd75b531924c73b27883 (patch) | |
tree | 4a0ffbb8e9942e62d764975611e878b37e681c5e /globals.pl | |
parent | 84ca1e8656b35fafb90c223f6d5995db8927af5e (diff) | |
download | bugzilla-78865fda79e5b78288aafd75b531924c73b27883.tar.gz bugzilla-78865fda79e5b78288aafd75b531924c73b27883.tar.xz |
Moved all the long descriptions out of the bugs table, and into a new
table. There is now a separate entry for each new long description,
rather than appending them all together in one big field.
Diffstat (limited to 'globals.pl')
-rw-r--r-- | globals.pl | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/globals.pl b/globals.pl index 856048c4d..90d2513b7 100644 --- a/globals.pl +++ b/globals.pl @@ -51,6 +51,7 @@ sub globals_pl_sillyness { use Mysql; use Date::Format; # For time2str(). +use Date::Parse; # For str2time(). # use Carp; # for confess # Contains the version string for the current running Bugzilla. @@ -109,14 +110,11 @@ sub AppendComment { if ($comment =~ /^\s*$/) { # Nothin' but whitespace. return; } - SendSQL("select long_desc from bugs where bug_id = $bugid"); - - my $desc = FetchOneColumn(); - my $now = time2str("%Y-%m-%d %H:%M", time()); - $desc .= "\n\n------- Additional Comments From $who $now -------\n"; - $desc .= $comment; - SendSQL("update bugs set long_desc=" . SqlQuote($desc) . - " where bug_id=$bugid"); + + my $whoid = DBNameToIdAndCheck($who); + + SendSQL("INSERT INTO longdescs (bug_id, who, bug_when, thetext) " . + "VALUES($bugid, $whoid, now(), " . SqlQuote($comment) . ")"); } sub lsearch { @@ -464,8 +462,25 @@ sub DBNameToIdAndCheck { sub GetLongDescription { my ($id) = (@_); - SendSQL("select long_desc from bugs where bug_id = $id"); - return FetchOneColumn(); + my $result = ""; + SendSQL("SELECT profiles.login_name, longdescs.bug_when, " . + " longdescs.thetext " . + "FROM longdescs, profiles " . + "WHERE profiles.userid = longdescs.who " . + " AND longdescs.bug_id = $id " . + "ORDER BY longdescs.bug_when"); + my $count = 0; + while (MoreSQLData()) { + my ($who, $when, $text) = (FetchSQLData()); + if ($count) { + $result .= "\n\n------- Additional Comments From $who " . + time2str("%Y-%m-%d %H:%M", str2time($when)) . " -------\n"; + } + $result .= $text; + $count++; + } + + return $result; } |