From: dave%intrec.com <>
Date: Thu, 25 Jan 2001 06:24:06 +0000 (+0000)
Subject: Fix for bug 30694: adds title attributes to bug links with bug status and description...
X-Git-Tag: bugzilla-2.12~115
X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=144c47058535c630991b466ac80346a30852cb13;p=thirdparty%2Fbugzilla.git
Fix for bug 30694: adds title attributes to bug links with bug status and description. Patch by jake@acutex.net
---
diff --git a/bug_form.pl b/bug_form.pl
index 58f1b6cb2a..fcd33a7a17 100644
--- a/bug_form.pl
+++ b/bug_form.pl
@@ -321,24 +321,15 @@ sub EmitDependList {
my ($desc, $myfield, $targetfield) = (@_);
print "
$desc:
";
my @list;
- SendSQL("select dependencies.$targetfield, bugs.bug_status, short_desc
+ SendSQL("select dependencies.$targetfield
from dependencies, bugs
where dependencies.$myfield = $id
and bugs.bug_id = dependencies.$targetfield
order by dependencies.$targetfield");
while (MoreSQLData()) {
- my ($i, $stat, $dep_desc) = (FetchSQLData());
+ my ($i) = (FetchSQLData());
push(@list, $i);
- my $opened = ($stat eq "NEW" || $stat eq "ASSIGNED" ||
- $stat eq "REOPENED");
- if (!$opened) {
- print "";
- }
- $dep_desc = value_quote($dep_desc);
- print qq{$i};
- if (!$opened) {
- print "";
- }
+ print GetBugLink($i, $i);
print " ";
}
print "
$item};
+ $item = GetBugLink($num, $item);
$things[$count++] = $item;
}
while ($text =~ s/\*\*\* This bug has been marked as a duplicate of (\d+) \*\*\*/"##$count##"/ei) {
my $item = $&;
my $num = $1;
- SendSQL("select bugs.bug_status, short_desc
- from bugs where bugs.bug_id = $num");
- my ($stat, $dep_desc) = (FetchSQLData());
- $dep_desc = value_quote($dep_desc);
- $item =~ s@\d+@$num@;
+ my $bug_link;
+ $bug_link = GetBugLink($num, $num);
+ $item =~ s@\d+@$bug_link@;
$things[$count++] = $item;
}
while ($text =~ s/Created an attachment \(id=(\d+)\)/"##$count##"/e) {
@@ -755,10 +742,49 @@ sub quoteUrls {
# And undo the quoting of "#" characters.
$text =~ s/%#/#/g;
- # put back any query info in progress
+ return $text;
+}
+
+# This is a new subroutine written 12/20/00 for the purpose of processing a
+# link to a bug. It can be called using "GetBugLink (, );"
+# Where is the number of the bug and is what apprears
+# between '' and ''.
+
+sub GetBugLink {
+ my ($bug_num, $link_text) = (@_);
+ my ($link_return) = "";
+
+ # TODO - Add caching capabilites... possibly use a global variable in the form
+ # of $buglink{$bug_num} that contains the text returned by this sub. If that
+ # variable is defined, simply return it's value rather than running the SQL
+ # query. This would cut down on the number of SQL calls when the same bug is
+ # referenced multiple times.
+
+ # Make sure any unfetched data from a currently running query
+ # is saved off rather than overwritten
+ PushGlobalSQLState();
+
+ # Get this bug's info from the SQL Database
+ SendSQL("select bugs.bug_status, resolution, short_desc
+ from bugs where bugs.bug_id = $bug_num");
+ my ($bug_stat, $bug_res, $bug_desc) = (FetchSQLData());
+
+ # Format the retrieved information into a link
+ if ($bug_stat eq "UNCONFIRMED") { $link_return .= "" }
+ if ($bug_res ne "") { $link_return .= "" }
+ $bug_desc = value_quote($bug_desc);
+ $link_text = value_quote($link_text);
+ $link_return .= qq{$link_text};
+ if ($bug_res ne "") { $link_return .= "" }
+ if ($bug_stat eq "UNCONFIRMED") { $link_return .= ""}
+
+ # Put back any query in progress
PopGlobalSQLState();
- return $text;
+ return $link_return;
+
}
sub GetLongDescriptionAsText {