Commit 1d6499d6 authored by lpsolit%gmail.com's avatar lpsolit%gmail.com

Bug 340139: When adding a new attachment, data inserted in the bugs_activity…

Bug 340139: When adding a new attachment, data inserted in the bugs_activity table are quoted - Patch by Frédéric Buclin <LpSolit@gmail.com> r=bkor, r=ghendricks, r=vladd a=justdave
parent 623aee25
...@@ -1075,15 +1075,12 @@ sub insert ...@@ -1075,15 +1075,12 @@ sub insert
# Make sure the person we are taking the bug from gets mail. # Make sure the person we are taking the bug from gets mail.
$owner = $oldvalues[4]; $owner = $oldvalues[4];
@oldvalues = map($dbh->quote($_), @oldvalues);
@newvalues = map($dbh->quote($_), @newvalues);
# Update the bug record. Note that this doesn't involve login_name. # Update the bug record. Note that this doesn't involve login_name.
$dbh->do("UPDATE bugs SET delta_ts = ?, " . $dbh->do('UPDATE bugs SET delta_ts = ?, ' .
join(", ", map("$fields[$_] = $newvalues[$_]", (0..3))) . join(', ', map("$fields[$_] = ?", (0..3))) . ' WHERE bug_id = ?',
" WHERE bug_id = ?", undef, ($timestamp, $bugid)); undef, ($timestamp, map($newvalues[$_], (0..3)) , $bugid));
# If the bug was a dupe, we have to remove its entry from the # If the bug was a dupe, we have to remove its entry from the
# 'duplicates' table. # 'duplicates' table.
$dbh->do('DELETE FROM duplicates WHERE dupe = ?', undef, $bugid); $dbh->do('DELETE FROM duplicates WHERE dupe = ?', undef, $bugid);
...@@ -1091,17 +1088,11 @@ sub insert ...@@ -1091,17 +1088,11 @@ sub insert
# We store email addresses in the bugs_activity table rather than IDs. # We store email addresses in the bugs_activity table rather than IDs.
$oldvalues[0] = $oldvalues[4]; $oldvalues[0] = $oldvalues[4];
$newvalues[0] = $newvalues[4]; $newvalues[0] = $newvalues[4];
# Add the changes to the bugs_activity table
my $sth = $dbh->prepare("INSERT INTO bugs_activity
(bug_id, who, bug_when, fieldid, removed, added)
VALUES (?,?,?,?,?,?)");
for (my $i = 0; $i < 4; $i++) { for (my $i = 0; $i < 4; $i++) {
if ($oldvalues[$i] ne $newvalues[$i]) { if ($oldvalues[$i] ne $newvalues[$i]) {
my $fieldid = get_field_id($fields[$i]); LogActivityEntry($bugid, $fields[$i], $oldvalues[$i],
$sth->execute($bugid, $userid, $timestamp, $newvalues[$i], $userid, $timestamp);
$fieldid, $oldvalues[$i], $newvalues[$i]);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment