]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 429847: config.cgi should include additional information about custom fields...
authorlpsolit%gmail.com <>
Sun, 20 Apr 2008 14:49:44 +0000 (14:49 +0000)
committerlpsolit%gmail.com <>
Sun, 20 Apr 2008 14:49:44 +0000 (14:49 +0000)
Bugzilla/DB.pm
config.cgi
template/en/default/config.js.tmpl
template/en/default/config.rdf.tmpl

index d74284b2766616db21d59eec8659dc13ac4f7fce..1617b7fc272d631e45726960b205cfe06d06ce99 100644 (file)
@@ -383,26 +383,6 @@ sub bz_last_key {
                                  $table, $column);
 }
 
-sub bz_get_field_defs {
-    my ($self) = @_;
-
-    my $extra = "";
-    if (!Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) {
-        $extra = "AND name NOT IN ('estimated_time', 'remaining_time', " .
-                 "'work_time', 'percentage_complete', 'deadline')";
-    }
-
-    my @fields;
-    my $sth = $self->prepare("SELECT name, description FROM fielddefs
-                              WHERE obsolete = 0 $extra
-                              ORDER BY sortkey");
-    $sth->execute();
-    while (my $field_ref = $sth->fetchrow_hashref()) {
-        push(@fields, $field_ref);
-    }
-    return(@fields);
-}
-
 #####################################################################
 # Database Setup
 #####################################################################
@@ -1273,9 +1253,6 @@ Bugzilla::DB - Database access routines, using L<DBI>
   my $column = $dbh->bz_column_info($table, $column);
   my $index  = $dbh->bz_index_info($table, $index);
 
-  # General Information
-  my @fields    = $dbh->bz_get_field_defs();
-
 =head1 DESCRIPTION
 
 Functions in this module allows creation of a database handle to connect
@@ -1949,23 +1926,6 @@ Last inserted ID (scalar)
 
 =back
 
-=item C<bz_get_field_defs>
-
-=over
-
-=item B<Description>
-
-Returns a list of all the "bug" fields in Bugzilla. The list
-contains hashes, with a C<name> key and a C<description> key.
-
-=item B<Params> (none)
-
-=item B<Returns>
-
-List of all the "bug" fields
-
-=back
-
 =back
 
 =head2 Database Setup Methods
index 026b070d616ef93bf977fc9d6fd48e87c57b9f4a..ebdf71241d9750c12fd11184918876f49324cf4f 100755 (executable)
@@ -87,7 +87,12 @@ $vars->{'open_status'} = \@open_status;
 $vars->{'closed_status'} = \@closed_status;
 
 # Generate a list of fields that can be queried.
-$vars->{'field'} = [Bugzilla->dbh->bz_get_field_defs()];
+my @fields = @{Bugzilla::Field->match({obsolete => 0})};
+# Exclude fields the user cannot query.
+if (!Bugzilla->user->in_group(Bugzilla->params->{'timetrackinggroup'})) {
+    @fields = grep { $_->name !~ /^(estimated_time|remaining_time|work_time|percentage_complete|deadline)$/ } @fields;
+}
+$vars->{'field'} = \@fields;
 
 display_data($vars);
 
index 628a918d0203be973522d08d8a1f687e9782d9ed..66617007dfbd0f25ac040f2f1d83445c2fd00181 100644 (file)
@@ -113,7 +113,14 @@ var component_exceptions = new Array(
 var field = [
 [% FOREACH x = field %]
   { name:        '[% x.name FILTER js %]', 
-    description: '[% (field_descs.${x.name} OR x.description) FILTER js %]' },
+    description: '[% (field_descs.${x.name} OR x.description) FILTER js %]',
+    [%-# These values are meaningful for custom fields only. %]
+    [% IF x.custom %]
+    type:        '[% x.type FILTER js %]',
+    type_desc:   '[% field_types.${x.type} FILTER js %]',
+    enter_bug:   '[% x.enter_bug FILTER js %]',
+    [% END %]
+  },
 [% END %]
 ];
 
index 99850fa712d5195fab0dbbfcc0a071ccab6e9674..8d2c5a282dc8a6037ab8e7ea73d2eec268e12539 100644 (file)
           <bz:field rdf:about="[% urlbase FILTER xml %]field.cgi?name=[% item.name FILTER url_quote %]">
             <bz:name>[% item.name FILTER html %]</bz:name>
             <bz:description>[% (field_descs.${item.name} OR item.description) FILTER html %]</bz:description>
+            [%-# These values are meaningful for custom fields only. %]
+            [% IF item.custom %]
+              <bz:type>[% item.type FILTER html %]</bz:type>
+              <bz:type_desc>[% field_types.${item.type} FILTER html %]</bz:type_desc>
+              <bz:enter_bug>[% item.enter_bug FILTER html %]</bz:enter_bug>
+            [% END %]
           </bz:field>
         </li>
       [% END %]