summaryrefslogtreecommitdiffstats
path: root/extensions/FlagTypeComment/Extension.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2012-10-05 23:35:22 +0200
committerDave Lawrence <dlawrence@mozilla.com>2012-10-05 23:35:22 +0200
commitaaedc17c5e2f7375195cb95dbd25fbc6c42febc0 (patch)
tree36cd46dccd1992109450cc3f400a99efcc42a13e /extensions/FlagTypeComment/Extension.pm
parentfe219884ea1149cdcd2e5a145720b642a1e99320 (diff)
downloadbugzilla-aaedc17c5e2f7375195cb95dbd25fbc6c42febc0.tar.gz
bugzilla-aaedc17c5e2f7375195cb95dbd25fbc6c42febc0.tar.xz
Fix attachment flag creation errors due to FlagTypeComment extension
Diffstat (limited to 'extensions/FlagTypeComment/Extension.pm')
-rw-r--r--extensions/FlagTypeComment/Extension.pm19
1 files changed, 11 insertions, 8 deletions
diff --git a/extensions/FlagTypeComment/Extension.pm b/extensions/FlagTypeComment/Extension.pm
index 2e3bba2ba..d9098a5db 100644
--- a/extensions/FlagTypeComment/Extension.pm
+++ b/extensions/FlagTypeComment/Extension.pm
@@ -97,13 +97,13 @@ sub _set_ftc_states {
} else {
return unless FLAGTYPE_COMMENT_ATTACHMENT_FLAGS;
}
- $db_result = $dbh->selectall_arrayref(
- "SELECT type_id AS flagtype, on_status AS state, comment AS text
- FROM flagtype_comments
- WHERE type_id = ?",
- { Slice => {} },
- $id);
-
+ if ($id) {
+ $db_result = $dbh->selectall_arrayref(
+ "SELECT type_id AS flagtype, on_status AS state, comment AS text
+ FROM flagtype_comments
+ WHERE type_id = ?",
+ { Slice => {} }, $id);
+ }
} else {
# creating/editing attachment / viewing bug
my $bug;
@@ -161,7 +161,10 @@ sub _set_flagtypes {
my $dbh = Bugzilla->dbh;
foreach my $state (FLAGTYPE_COMMENT_STATES) {
- my $text = $input->{"ftc_${flagtype_id}_$state"} || '';
+ next if (!defined $input->{"ftc_${flagtype_id}_$state"}
+ && !defined $input->{"ftc_new_$state"});
+
+ my $text = $input->{"ftc_${flagtype_id}_$state"} || $input->{"ftc_new_$state"} || '';
$text =~ s/\r\n/\n/g;
trick_taint($text);