diff options
author | Byron Jones <glob@mozilla.com> | 2015-07-16 09:00:53 +0200 |
---|---|---|
committer | Byron Jones <glob@mozilla.com> | 2015-07-16 09:00:53 +0200 |
commit | cfaf0d051df5c567c02ec83813fb58514cbf7efd (patch) | |
tree | 27d5a4c79e98831b6c9ca90155fc76d687560b60 | |
parent | 3c7af66f8c8a2226d3a968df7fbcdeacb9fe669a (diff) | |
download | bugzilla-cfaf0d051df5c567c02ec83813fb58514cbf7efd.tar.gz bugzilla-cfaf0d051df5c567c02ec83813fb58514cbf7efd.tar.xz |
Bug 1184454 - unable to create new products
-rw-r--r-- | extensions/BMO/Extension.pm | 10 | ||||
-rw-r--r-- | extensions/BMO/template/en/default/hook/admin/products/edit-common-rows.html.tmpl | 15 |
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 { |