Show names of non-functional Bug URLs and Keywords types
parent
1d333cc0eb
commit
b3d853917e
|
@ -302,15 +302,24 @@ sub _check_sortkey
|
|||
sub _check_type
|
||||
{
|
||||
my ($invocant, $type) = @_;
|
||||
if (ref $invocant)
|
||||
{
|
||||
# Do not allow to change type of an existing custom field
|
||||
return $invocant->type;
|
||||
}
|
||||
my $saved_type = $type;
|
||||
# The constant here should be updated every time a new,
|
||||
# higher field type is added.
|
||||
if (!detaint_natural($type) || $type < FIELD_TYPE_UNKNOWN ||
|
||||
if (!detaint_natural($type) || $type <= FIELD_TYPE_UNKNOWN ||
|
||||
$type > FIELD_TYPE_KEYWORDS && $type < FIELD_TYPE_NUMERIC ||
|
||||
$type > FIELD_TYPE_BUG_ID_REV)
|
||||
{
|
||||
ThrowCodeError('invalid_customfield_type', { type => $saved_type });
|
||||
}
|
||||
elsif ($type == FIELD_TYPE_BUG_URLS || $type == FIELD_TYPE_KEYWORDS)
|
||||
{
|
||||
ThrowUserError('useless_customfield_type', { type => $type });
|
||||
}
|
||||
return $type;
|
||||
}
|
||||
|
||||
|
|
|
@ -72,6 +72,8 @@ $Bugzilla::messages->{en} = {
|
|||
FIELD_TYPE_TEXTAREA() => 'Large Text Box',
|
||||
FIELD_TYPE_DATETIME() => 'Date/Time',
|
||||
FIELD_TYPE_BUG_ID() => $terms->{Bug}.' ID',
|
||||
FIELD_TYPE_BUG_URLS() => $terms->{Bug}.' URLs',
|
||||
FIELD_TYPE_KEYWORDS() => 'Keywords',
|
||||
FIELD_TYPE_NUMERIC() => 'Numeric',
|
||||
FIELD_TYPE_EXTURL() => 'External URL',
|
||||
FIELD_TYPE_BUG_ID_REV() => $terms->{Bug}.' ID reverse',
|
||||
|
|
|
@ -110,7 +110,10 @@ var constants = {
|
|||
[% ELSE %]
|
||||
<select id="type" name="type" onchange="onChangeType()">
|
||||
[% FOREACH type = field_types.sort %]
|
||||
[% NEXT IF type == constants.FIELD_TYPE_UNKNOWN %]
|
||||
[%# Types "Bug URLs" and "Keywords" are useless %]
|
||||
[% NEXT IF type == constants.FIELD_TYPE_UNKNOWN ||
|
||||
type == constants.FIELD_TYPE_BUG_URLS ||
|
||||
type == constants.FIELD_TYPE_KEYWORDS %]
|
||||
<option value="[% type | html %]">[% field_types.$type | html %]</option>
|
||||
[% END %]
|
||||
</select>
|
||||
|
|
|
@ -524,6 +524,12 @@
|
|||
Can't use [% field FILTER html %] as a field name.
|
||||
[% END %]
|
||||
|
||||
[% BLOCK error_useless_customfield_type %]
|
||||
[% title = "Can't create field of a useless type" %]
|
||||
It is impossible to create "[% lc_messages.field_types.$type %]" fields,
|
||||
because functionality of this type is hard-coded to a single builtin field.
|
||||
[% END %]
|
||||
|
||||
[% BLOCK error_field_already_exists %]
|
||||
[% title = "Field Already Exists" %]
|
||||
The field '[% field.name FILTER html %]'
|
||||
|
|
Loading…
Reference in New Issue