<h1><aclass='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><codeclass="code">Bugzilla::Field</code> is an implementation of <ahref="../Bugzilla/Object.html"class="podlinkpod"
>Bugzilla::Object</a>, and so provides all of the methods available in <ahref="../Bugzilla/Object.html"class="podlinkpod"
>Bugzilla::Object</a>, in addition to what is documented here.</p>
<h2><aclass='u'href='#___top'title='click to go to top of document'
name="Instance_Properties"
>Instance Properties</a></h2>
<dl>
<dt><aname="name"
><codeclass="code">name</code></a></dt>
<dd>
<p>the name of the field in the database; begins with "cf_" if field is a custom field, but test the value of the boolean "custom" property to determine if a given field is a custom field;</p>
<dt><aname="description"
><codeclass="code">description</code></a></dt>
<dd>
<p>a short string describing the field; displayed to Bugzilla users in several places within Bugzilla's UI, f.e. as the form field label on the "show bug" page;</p>
</dd>
</dl>
<dl>
<dt><aname="type"
><codeclass="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><aname="custom"
><codeclass="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 "cf_", but use this property to determine which fields are custom fields;</p>
</dd>
</dl>
<dl>
<dt><aname="in_new_bugmail"
><codeclass="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><aname="sortkey"
><codeclass="code">sortkey</code></a></dt>
<dd>
<p>an integer specifying the sortkey of the field.</p>
</dd>
</dl>
<dl>
<dt><aname="obsolete"
><codeclass="code">obsolete</code></a></dt>
<dd>
<p>a boolean specifying whether or not the field is obsolete;</p>
</dd>
</dl>
<dl>
<dt><aname="enter_bug"
><codeclass="code">enter_bug</code></a></dt>
<dd>
<p>A boolean specifying whether or not this field should appear on enter_bug.cgi</p>
<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><aname="is_select"
><codeclass="code">is_select</code></a></dt>
<dd>
<p>True if this is a <codeclass="code">FIELD_TYPE_SINGLE_SELECT</code> or <codeclass="code">FIELD_TYPE_MULTI_SELECT</code> field. It is only safe to call <ahref="#legal_values"class="podlinkpod"
<p>What field controls this field's visibility? Returns a <codeclass="code">Bugzilla::Field</code> object representing the field that controls this field's visibility.</p>
<p>Returns undef if there is no field that controls this field's visibility.</p>
<p>If we have a <ahref="#visibility_field"class="podlinkpod"
>"visibility_field"</a>, then what value does that field have to be set to in order to show this field? Returns a <ahref="../Bugzilla/Field/Choice.html"class="podlinkpod"
>Bugzilla::Field::Choice</a> or undef if there is no <codeclass="code">visibility_field</code> set.</p>
<h2><aclass='u'href='#___top'title='click to go to top of document'
name="Instance_Method"
>Instance Method</a></h2>
<dl>
<dt><aname="remove_from_db"
><codeclass="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><aclass='u'href='#___top'title='click to go to top of document'
name="Class_Methods"
>Class Methods</a></h2>
<dl>
<dt><aname="create"
><codeclass="code">create</code></a></dt>
<dd>
<p>Just like <ahref="../Bugzilla/Object.html#create"class="podlinkpod"
>"create" in Bugzilla::Object</a>. Takes the following parameters:</p>
><codeclass="code">mailhead</code> - boolean - Whether this field appears at the top of the bugmail for a newly-filed bug. Defaults to 0.
<dt><a
><codeclass="code">custom</code> - boolean - True if this is a Custom Field. The field will be added to the <codeclass="code">bugs</code> table if it does not exist. Defaults to 0.
<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: <codeclass="code">$field</code> - Name of the table where valid values are.</p>
<p>Returns: a reference to a list of valid values.</p>
<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 <codeclass="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>