Sophie

Sophie

distrib > Mageia > 7 > i586 > by-pkgid > 4e237fd705495e1e21ef20696443e053 > files > 1043

bugzilla-5.0.4-3.mga7.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>
Bugzilla::Field</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <link rel="stylesheet" title="style" type="text/css" href=".././../../../../style.css" media="all" >

</head>
  <body id="pod">
<p class="backlinktop"><b><a name="___top" href="../index.html" accesskey="1" title="All Documents">&lt;&lt;</a></b></p>
<h1>Bugzilla::Field</h1>
<div class='indexgroup'>
<ul   class='indexList indexList1'>
  <li class='indexItem indexItem1'><a href='#NAME'>NAME</a>
  <li class='indexItem indexItem1'><a href='#SYNOPSIS'>SYNOPSIS</a>
  <li class='indexItem indexItem1'><a href='#DESCRIPTION'>DESCRIPTION</a>
  <ul   class='indexList indexList2'>
    <li class='indexItem indexItem2'><a href='#Instance_Properties'>Instance Properties</a>
    <li class='indexItem indexItem2'><a href='#Instance_Mutators'>Instance Mutators</a>
    <li class='indexItem indexItem2'><a href='#Instance_Method'>Instance Method</a>
    <li class='indexItem indexItem2'><a href='#Class_Methods'>Class Methods</a>
    <li class='indexItem indexItem2'><a href='#Data_Validation'>Data Validation</a>
  </ul>
  <li class='indexItem indexItem1'><a href='#Methods_in_need_of_POD'>Methods in need of POD</a>
</ul>
</div>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="NAME"
>NAME</a></h1>

<p>Bugzilla::Field - a particular piece of information about bugs and useful routines for form field manipulation</p>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="SYNOPSIS"
>SYNOPSIS</a></h1>

<pre  class="code">  use Bugzilla;
  use Data::Dumper;

  # Display information about all fields.
  print Dumper(Bugzilla-&#62;fields());

  # Display information about non-obsolete custom fields.
  print Dumper(Bugzilla-&#62;active_custom_fields);

  use Bugzilla::Field;

  # Display information about non-obsolete custom fields.
  # Bugzilla-&#62;fields() is a wrapper around Bugzilla::Field-&#62;get_all(),
  # with arguments which filter the fields before returning them.
  print Dumper(Bugzilla-&#62;fields({ obsolete =&#62; 0, custom =&#62; 1 }));

  # Create or update a custom field or field definition.
  my $field = Bugzilla::Field-&#62;create(
    {name =&#62; &#39;cf_silly&#39;, description =&#62; &#39;Silly&#39;, custom =&#62; 1});

  # Instantiate a Field object for an existing field.
  my $field = new Bugzilla::Field({name =&#62; &#39;qacontact_accessible&#39;});
  if ($field-&#62;obsolete) {
      say $field-&#62;description . &#34; is obsolete&#34;;
  }

  # Validation Routines
  check_field($name, $value, \@legal_values, $no_warn);
  $fieldid = get_field_id($fieldname);</pre>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="DESCRIPTION"
>DESCRIPTION</a></h1>

<p>Field.pm defines field objects, which represent the particular pieces of information that Bugzilla stores about bugs.</p>

<p>This package also provides functions for dealing with CGI form fields.</p>

<p><code  class="code">Bugzilla::Field</code> is an implementation of <a href="../Bugzilla/Object.html" class="podlinkpod"
>Bugzilla::Object</a>, and so provides all of the methods available in <a href="../Bugzilla/Object.html" class="podlinkpod"
>Bugzilla::Object</a>, in addition to what is documented here.</p>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="Instance_Properties"
>Instance Properties</a></h2>

<dl>
<dt><a name="name"
><code  class="code">name</code></a></dt>

<dd>
<p>the name of the field in the database; begins with &#34;cf_&#34; if field is a custom field, but test the value of the boolean &#34;custom&#34; property to determine if a given field is a custom field;</p>

<dt><a name="description"
><code  class="code">description</code></a></dt>

<dd>
<p>a short string describing the field; displayed to Bugzilla users in several places within Bugzilla&#39;s UI, f.e. as the form field label on the &#34;show bug&#34; page;</p>
</dd>
</dl>

<dl>
<dt><a name="long_desc"
><code  class="code">long_desc</code></a></dt>

<dd>
<p>A string providing detailed info about the field;</p>
</dd>
</dl>

<dl>
<dt><a name="type"
><code  class="code">type</code></a></dt>

<dd>
<p>an integer specifying the kind of field this is; values correspond to the FIELD_TYPE_* constants in Constants.pm</p>
</dd>
</dl>

<dl>
<dt><a name="custom"
><code  class="code">custom</code></a></dt>

<dd>
<p>a boolean specifying whether or not the field is a custom field; if true, field name should start &#34;cf_&#34;, but use this property to determine which fields are custom fields;</p>
</dd>
</dl>

<dl>
<dt><a name="in_new_bugmail"
><code  class="code">in_new_bugmail</code></a></dt>

<dd>
<p>a boolean specifying whether or not the field is displayed in bugmail for newly-created bugs;</p>
</dd>
</dl>

<dl>
<dt><a name="sortkey"
><code  class="code">sortkey</code></a></dt>

<dd>
<p>an integer specifying the sortkey of the field.</p>
</dd>
</dl>

<dl>
<dt><a name="obsolete"
><code  class="code">obsolete</code></a></dt>

<dd>
<p>a boolean specifying whether or not the field is obsolete;</p>
</dd>
</dl>

<dl>
<dt><a name="enter_bug"
><code  class="code">enter_bug</code></a></dt>

<dd>
<p>A boolean specifying whether or not this field should appear on enter_bug.cgi</p>
</dd>
</dl>

<dl>
<dt><a name="buglist"
><code  class="code">buglist</code></a></dt>

<dd>
<p>A boolean specifying whether or not this field is selectable as a display or order column in buglist.cgi</p>
</dd>
</dl>

<dl>
<dt><a name="is_select"
><code  class="code">is_select</code></a></dt>

<dd>
<p>True if this is a <code  class="code">FIELD_TYPE_SINGLE_SELECT</code> or <code  class="code">FIELD_TYPE_MULTI_SELECT</code> field. It is only safe to call <a href="#legal_values" class="podlinkpod"
>&#34;legal_values&#34;</a> if this is true.</p>

<dt><a name="legal_values"
><code  class="code">legal_values</code></a></dt>

<dd>
<p>Valid values for this field, as an array of <a href="../Bugzilla/Field/Choice.html" class="podlinkpod"
>Bugzilla::Field::Choice</a> objects.</p>
</dd>
</dl>

<dl>
<dt><a name="is_abnormal"
><code  class="code">is_abnormal</code></a></dt>

<dd>
<p>Most fields that have a <code  class="code">SELECT</code> <a href="#type" class="podlinkpod"
>&#34;type&#34;</a> have a certain schema for the table that stores their values, the table has the same name as the field, and the field&#39;s legal values can be edited via <em  class="code">editvalues.cgi</em>.</p>

<p>However, some fields do not follow that pattern. Those fields are considered &#34;abnormal&#34;.</p>

<p>This method returns <code  class="code">1</code> if the field is &#34;abnormal&#34;, <code  class="code">0</code> otherwise.</p>
</dd>
</dl>

<dl>
<dt><a name="is_timetracking"
><code  class="code">is_timetracking</code></a></dt>

<dd>
<p>True if this is a time-tracking field that should only be shown to users in the <code  class="code">timetrackinggroup</code>.</p>
</dd>
</dl>

<dl>
<dt><a name="visibility_field"
><code  class="code">visibility_field</code></a></dt>

<dd>
<p>What field controls this field&#39;s visibility? Returns a <code  class="code">Bugzilla::Field</code> object representing the field that controls this field&#39;s visibility.</p>

<p>Returns undef if there is no field that controls this field&#39;s visibility.</p>
</dd>
</dl>

<dl>
<dt><a name="visibility_values"
><code  class="code">visibility_values</code></a></dt>

<dd>
<p>If we have a <a href="#visibility_field" class="podlinkpod"
>&#34;visibility_field&#34;</a>, then what values does that field have to be set to in order to show this field? Returns a <a href="../Bugzilla/Field/Choice.html" class="podlinkpod"
>Bugzilla::Field::Choice</a> or undef if there is no <code  class="code">visibility_field</code> set.</p>
</dd>
</dl>

<dl>
<dt><a name="controls_visibility_of"
><code  class="code">controls_visibility_of</code></a></dt>

<dd>
<p>An arrayref of <code  class="code">Bugzilla::Field</code> objects, representing fields that this field controls the visibility of.</p>
</dd>
</dl>

<dl>
<dt><a name="value_field"
><code  class="code">value_field</code></a></dt>

<dd>
<p>The Bugzilla::Field that controls the list of values for this field.</p>

<p>Returns undef if there is no field that controls this field&#39;s visibility.</p>
</dd>
</dl>

<dl>
<dt><a name="controls_values_of"
><code  class="code">controls_values_of</code></a></dt>

<dd>
<p>An arrayref of <code  class="code">Bugzilla::Field</code> objects, representing fields that this field controls the values of.</p>
</dd>
</dl>

<dl>
<dt><a name="is_visible_on_bug"
><code  class="code">is_visible_on_bug</code></a></dt>

<dd>
<p>See <a href="../Bugzilla/Field/ChoiceInterface.html" class="podlinkpod"
>Bugzilla::Field::ChoiceInterface</a>.</p>
</dd>
</dl>

<dl>
<dt><a name="is_relationship"
><code  class="code">is_relationship</code></a></dt>

<dd>
<p>Applies only to fields of type FIELD_TYPE_BUG_ID. Checks to see if a reverse relationship description has been set. This is the canonical condition to enable reverse link display, dependency tree display, and similar functionality.</p>
</dd>
</dl>

<dl>
<dt><a name="reverse_desc"
><code  class="code">reverse_desc</code></a></dt>

<dd>
<p>Applies only to fields of type FIELD_TYPE_BUG_ID. Describes the reverse relationship of this field. For example, if a BUG_ID field is called &#34;Is a duplicate of&#34;, the reverse description would be &#34;Duplicates of this bug&#34;.</p>
</dd>
</dl>

<dl>
<dt><a name="is_mandatory"
><code  class="code">is_mandatory</code></a></dt>

<dd>
<p>a boolean specifying whether or not the field is mandatory;</p>
</dd>
</dl>

<dl>
<dt><a name="is_numeric"
><code  class="code">is_numeric</code></a></dt>

<dd>
<p>A boolean specifying whether or not this field logically contains numeric (integer, decimal, or boolean) values. By &#34;logically contains&#34; we mean that the user inputs numbers into the value of the field in the UI. This is mostly used by <a href="../Bugzilla/Search.html" class="podlinkpod"
>Bugzilla::Search</a>.</p>
</dd>
</dl>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="Instance_Mutators"
>Instance Mutators</a></h2>

<p>These set the particular field that they are named after.</p>

<p>They take a single value--the new value for that field.</p>

<p>They will throw an error if you try to set the values to something invalid.</p>

<dl>
<dt><a name="set_description"
><code  class="code">set_description</code></a></dt>

<dd>
<dt><a name="set_long_desc"
><code  class="code">set_long_desc</code></a></dt>

<dd>
<dt><a name="set_enter_bug"
><code  class="code">set_enter_bug</code></a></dt>

<dd>
<dt><a name="set_obsolete"
><code  class="code">set_obsolete</code></a></dt>

<dd>
<dt><a name="set_sortkey"
><code  class="code">set_sortkey</code></a></dt>

<dd>
<dt><a name="set_in_new_bugmail"
><code  class="code">set_in_new_bugmail</code></a></dt>

<dd>
<dt><a name="set_buglist"
><code  class="code">set_buglist</code></a></dt>

<dd>
<dt><a name="set_reverse_desc"
><code  class="code">set_reverse_desc</code></a></dt>

<dd>
<dt><a name="set_visibility_field"
><code  class="code">set_visibility_field</code></a></dt>

<dd>
<dt><a name="set_visibility_values"
><code  class="code">set_visibility_values</code></a></dt>

<dd>
<dt><a name="set_value_field"
><code  class="code">set_value_field</code></a></dt>

<dd>
<dt><a name="set_is_mandatory"
><code  class="code">set_is_mandatory</code></a></dt>
</dl>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="Instance_Method"
>Instance Method</a></h2>

<dl>
<dt><a name="remove_from_db"
><code  class="code">remove_from_db</code></a></dt>

<dd>
<p>Attempts to remove the passed in field from the database. Deleting a field is only successful if the field is obsolete and there are no values specified (or EVER specified) for the field.</p>
</dd>
</dl>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="Class_Methods"
>Class Methods</a></h2>

<dl>
<dt><a name="create"
><code  class="code">create</code></a></dt>

<dd>
<p>Just like <a href="../Bugzilla/Object.html#create" class="podlinkpod"
>&#34;create&#34; in Bugzilla::Object</a>. Takes the following parameters:</p>

<dl>
<dt><a name="name_Required_-_The_name_of_the_field."
><code  class="code">name</code> <b>Required</b> - The name of the field.</a></dt>

<dd>
<dt><a name="description_Required_-_The_field_label_to_display_in_the_UI."
><code  class="code">description</code> <b>Required</b> - The field label to display in the UI.</a></dt>

<dd>
<dt><a name="long_desc_-_A_longer_description_of_the_field."
><code  class="code">long_desc</code> - A longer description of the field.</a></dt>

<dd>
<dt><a name="mailhead_-_boolean_-_Whether_this_field_appears_at_the_top_of_the_bugmail_for_a_newly-filed_bug._Defaults_to_0."
><code  class="code">mailhead</code> - boolean - Whether this field appears at the top of the bugmail for a newly-filed bug. Defaults to 0.</a></dt>

<dd>
<dt><a 
><code  class="code">custom</code> - boolean - True if this is a Custom Field. The field will be added to the <code  class="code">bugs</code> table if it does not exist. Defaults to 0.</a></dt>

<dd>
<dt><a name="sortkey_-_integer_-_The_sortkey_of_the_field._Defaults_to_0."
><code  class="code">sortkey</code> - integer - The sortkey of the field. Defaults to 0.</a></dt>

<dd>
<dt><a name="enter_bug_-_boolean_-_Whether_this_field_is_editable_on_the_bug_creation_form._Defaults_to_0."
><code  class="code">enter_bug</code> - boolean - Whether this field is editable on the bug creation form. Defaults to 0.</a></dt>

<dd>
<dt><a name="buglist_-_boolean_-_Whether_this_field_is_selectable_as_a_display_or_order_column_in_bug_lists._Defaults_to_0."
><code  class="code">buglist</code> - boolean - Whether this field is selectable as a display or order column in bug lists. Defaults to 0.</a></dt>

<dd>
<p><code  class="code">obsolete</code> - boolean - Whether this field is obsolete. Defaults to 0.</p>

<p><code  class="code">is_mandatory</code> - boolean - Whether this field is mandatory. Defaults to 0.</p>
</dd>
</dl>
</dd>
</dl>

<dl>
<dt><a name="get_legal_field_values($field)"
><code  class="code">get_legal_field_values($field)</code></a></dt>

<dd>
<p>Description: returns all the legal values for a field that has a list of legal values, like rep_platform or resolution. The table where these values are stored must at least have the following columns: value, isactive, sortkey.</p>

<p>Params: <code  class="code">$field</code> - Name of the table where valid values are.</p>

<p>Returns: a reference to a list of valid values.</p>
</dd>
</dl>

<dl>
<dt><a name="populate_field_definitions()"
><code  class="code">populate_field_definitions()</code></a></dt>

<dd>
<p>Description: Populates the fielddefs table during an installation or upgrade.</p>

<p>Params: none</p>

<p>Returns: nothing</p>
</dd>
</dl>

<h2><a class='u' href='#___top' title='click to go to top of document'
name="Data_Validation"
>Data Validation</a></h2>

<dl>
<dt><a name="check_field($name,_$value,_\@legal_values,_$no_warn)"
><code  class="code">check_field($name, $value, \@legal_values, $no_warn)</code></a></dt>

<dd>
<p>Description: Makes sure the field $name is defined and its $value is non empty. If @legal_values is defined, this routine checks whether its value is one of the legal values associated with this field, else it checks against the default valid values for this field obtained by <code  class="code">get_legal_field_values($name)</code>. If the test is successful, the function returns 1. If the test fails, an error is thrown (by default), unless $no_warn is true, in which case the function returns 0.</p>

<p>Params: $name - the field name $value - the field value @legal_values - (optional) list of legal values $no_warn - (optional) do not throw an error if true</p>

<p>Returns: 1 on success; 0 on failure if $no_warn is true (else an error is thrown).</p>
</dd>
</dl>

<dl>
<dt><a name="get_field_id($fieldname)"
><code  class="code">get_field_id($fieldname)</code></a></dt>

<dd>
<p>Description: Returns the ID of the specified field name and throws an error if this field does not exist.</p>

<p>Params: $fieldname - a field name</p>

<p>Returns: the corresponding field ID or an error if the field name does not exist.</p>
</dd>
</dl>

<h1><a class='u' href='#___top' title='click to go to top of document'
name="Methods_in_need_of_POD"
><b>Methods in need of POD</b></a></h1>

<dl>
<dt><a name="match"
>match</a></dt>

<dd>
<dt><a name="set_is_numeric"
>set_is_numeric</a></dt>

<dd>
<dt><a name="update"
>update</a></dt>
</dl>
<p class="backlinkbottom"><b><a name="___bottom" href="../index.html" title="All Documents">&lt;&lt;</a></b></p>

<!-- end doc -->

</body></html>