diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2013-04-19 00:55:59 +0200 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2013-04-19 00:55:59 +0200 |
commit | c69cbc8008696c82747b833bca5cfa2faf9c1594 (patch) | |
tree | 6611bbb98833e2081af78a454465424c1b035e05 /Bugzilla | |
parent | 01848b6f328992497d8b25b3057893c086de7751 (diff) | |
parent | 2aecaaf29af1866367a362bbd57c6b5258d6440e (diff) | |
download | bugzilla-c69cbc8008696c82747b833bca5cfa2faf9c1594.tar.gz bugzilla-c69cbc8008696c82747b833bca5cfa2faf9c1594.tar.xz |
merged with bugzilla/4.2
Diffstat (limited to 'Bugzilla')
-rw-r--r-- | Bugzilla/Bug.pm | 20 | ||||
-rw-r--r-- | Bugzilla/DB/Oracle.pm | 4 | ||||
-rw-r--r-- | Bugzilla/Field/ChoiceInterface.pm | 1 | ||||
-rw-r--r-- | Bugzilla/User.pm | 5 |
4 files changed, 19 insertions, 11 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index a873d63be..08c347abe 100644 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -745,6 +745,17 @@ sub run_create_validators { my $class = shift; my $params = $class->SUPER::run_create_validators(@_); + # Add classification for checking mandatory fields which depend on it + $params->{classification} = $params->{product}->classification->name; + + my @mandatory_fields = @{ Bugzilla->fields({ is_mandatory => 1, + enter_bug => 1, + obsolete => 0 }) }; + foreach my $field (@mandatory_fields) { + $class->_check_field_is_mandatory($params->{$field->name}, $field, + $params); + } + my $product = delete $params->{product}; $params->{product_id} = $product->id; my $component = delete $params->{component}; @@ -769,18 +780,11 @@ sub run_create_validators { delete $params->{resolution}; delete $params->{lastdiffed}; delete $params->{bug_id}; + delete $params->{classification}; Bugzilla::Hook::process('bug_end_of_create_validators', { params => $params }); - my @mandatory_fields = @{ Bugzilla->fields({ is_mandatory => 1, - enter_bug => 1, - obsolete => 0 }) }; - foreach my $field (@mandatory_fields) { - $class->_check_field_is_mandatory($params->{$field->name}, $field, - $params); - } - return $params; } diff --git a/Bugzilla/DB/Oracle.pm b/Bugzilla/DB/Oracle.pm index 7df2c09bb..644276898 100644 --- a/Bugzilla/DB/Oracle.pm +++ b/Bugzilla/DB/Oracle.pm @@ -550,7 +550,9 @@ sub bz_setup_database { . " RETURN NUMBER IS BEGIN RETURN LENGTH(COLUMN_NAME); END;"); # Create types for group_concat - $self->do("DROP TYPE T_GROUP_CONCAT"); + my $type_exists = $self->selectrow_array("SELECT 1 FROM user_types + WHERE type_name = 'T_GROUP_CONCAT'"); + $self->do("DROP TYPE T_GROUP_CONCAT") if $type_exists; $self->do("CREATE OR REPLACE TYPE T_CLOB_DELIM AS OBJECT " . "( p_CONTENT CLOB, p_DELIMITER VARCHAR2(256)" . ", MAP MEMBER FUNCTION T_CLOB_DELIM_ToVarchar return VARCHAR2" diff --git a/Bugzilla/Field/ChoiceInterface.pm b/Bugzilla/Field/ChoiceInterface.pm index 87354a103..3292536d3 100644 --- a/Bugzilla/Field/ChoiceInterface.pm +++ b/Bugzilla/Field/ChoiceInterface.pm @@ -183,6 +183,7 @@ sub is_set_on_bug { # This allows bug/create/create.html.tmpl to pass in a hashref that # looks like a bug object. my $value = blessed($bug) ? $bug->$field_name : $bug->{$field_name}; + $value = $value->name if blessed($value); return 0 if !defined $value; if ($self->field->type == FIELD_TYPE_BUG_URLS diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 2c11c2381..bd7c8123b 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -2493,7 +2493,8 @@ the database again. Used mostly by L<Bugzilla::Product>. =item C<can_enter_product($product_name, $warn)> - Description: Returns 1 if the user can enter bugs into the specified product. + Description: Returns a product object if the user can enter bugs into the + specified product. If the user cannot enter bugs into the product, the behavior of this method depends on the value of $warn: - if $warn is false (or not given), a 'false' value is returned; @@ -2504,7 +2505,7 @@ the database again. Used mostly by L<Bugzilla::Product>. must be thrown if the user cannot enter bugs into the specified product. - Returns: 1 if the user can enter bugs into the product, + Returns: A product object if the user can enter bugs into the product, 0 if the user cannot enter bugs into the product and if $warn is false (an error is thrown if $warn is true). |