summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/FlagTypeComment/Extension.pm19
-rw-r--r--extensions/FlagTypeComment/template/en/default/hook/admin/flag-type/edit-rows.html.tmpl8
2 files changed, 17 insertions, 10 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);
diff --git a/extensions/FlagTypeComment/template/en/default/hook/admin/flag-type/edit-rows.html.tmpl b/extensions/FlagTypeComment/template/en/default/hook/admin/flag-type/edit-rows.html.tmpl
index 71aaad424..3ca5e8aa7 100644
--- a/extensions/FlagTypeComment/template/en/default/hook/admin/flag-type/edit-rows.html.tmpl
+++ b/extensions/FlagTypeComment/template/en/default/hook/admin/flag-type/edit-rows.html.tmpl
@@ -27,13 +27,17 @@
</tr>
[% FOREACH state = ftc_states %]
+ [% ftc_type_id = "ftc_${type.id}_$state" %]
+ [% IF action == 'insert' %]
+ [% ftc_type_id = "ftc_new_$state" %]
+ [% END %]
<tr>
<td>&nbsp;</td>
<td>
for [% state FILTER html %]<br>
<textarea
- id="ftc_[% type.id FILTER html %]_[% state FILTER html %]"
- name="ftc_[% type.id FILTER html %]_[% state FILTER html %]"
+ id="[% ftc_type_id FILTER html %]"
+ name="[% ftc_type_id FILTER html %]"
cols="50" rows="2">[% ftc_flags.${type.id}.$state FILTER html %]</textarea>
</td>
</tr>