summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--extensions/BMO/Extension.pm10
-rw-r--r--extensions/BMO/template/en/default/hook/admin/products/edit-common-rows.html.tmpl15
2 files changed, 11 insertions, 14 deletions
diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm
index 2e2a9c168..7d5bc42d1 100644
--- a/extensions/BMO/Extension.pm
+++ b/extensions/BMO/Extension.pm
@@ -162,10 +162,12 @@ sub template_before_process {
if ($file =~ /^admin\/products\/(create|edit)\./) {
my $product = $vars->{product};
my $security_groups = Bugzilla::Group->match({ isbuggroup => 1, isactive => 1 });
- # If set group is not active currently, we add it into the list
- if (!grep($_->name eq $product->default_security_group, @$security_groups)) {
- push(@$security_groups, $product->default_security_group_obj);
- @$security_groups = sort { $a->name cmp $b->name } @$security_groups;
+ if ($product) {
+ # If set group is not active currently, we add it into the list
+ if (!grep($_->name eq $product->default_security_group, @$security_groups)) {
+ push(@$security_groups, $product->default_security_group_obj);
+ @$security_groups = sort { $a->name cmp $b->name } @$security_groups;
+ }
}
$vars->{security_groups} = $security_groups;
}
diff --git a/extensions/BMO/template/en/default/hook/admin/products/edit-common-rows.html.tmpl b/extensions/BMO/template/en/default/hook/admin/products/edit-common-rows.html.tmpl
index f91e4052b..d2258eccb 100644
--- a/extensions/BMO/template/en/default/hook/admin/products/edit-common-rows.html.tmpl
+++ b/extensions/BMO/template/en/default/hook/admin/products/edit-common-rows.html.tmpl
@@ -9,12 +9,8 @@
[%
group_correct_visibility = {};
FOREACH g = product.group_controls.values;
- IF (g.membercontrol == constants.CONTROLMAPSHOWN)
- && (g.othercontrol == constants.CONTROLMAPSHOWN);
- group_correct_visibility.${g.name} = 1;
- ELSE;
- group_correct_visibility.${g.name} = 0;
- END;
+ group_correct_visibility.${g.name} =
+ (g.membercontrol == constants.CONTROLMAPNA) || (g.othercontrol == constants.CONTROLMAPNA) ? 0 : 1;
END;
%]
@@ -32,13 +28,12 @@
[% END %]
</select>
<span id="security_group_warning" style="color:red; display:none;">
- The chosen security group needs to be set to SHOWN/SHOWN for this product
+ This security group needs to be set to SHOWN/SHOWN
</span>
<script type="text/javascript">
var toggleGroupWarning = function() {
- var correct_shown = $('#security_group_id option:selected')
- .data('group-correct-visibility');
- if (correct_shown) {
+ var correct_shown = $('#security_group_id option:selected').data('group-correct-visibility');
+ if ($('#security_group_id').val() === '' || correct_shown) {
$('#security_group_warning').hide();
}
else {