From 629f2c959658c50ec2f4790b80bfe5ff30e3cd82 Mon Sep 17 00:00:00 2001 From: rojanu Date: Thu, 17 May 2012 01:22:41 +0200 Subject: Bug 728138: Custom fields should have a "Long Description" attribute to better understand what they are used for r/a=LpSolit --- Bugzilla/Field.pm | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'Bugzilla/Field.pm') diff --git a/Bugzilla/Field.pm b/Bugzilla/Field.pm index c244e66d9..250d7239e 100644 --- a/Bugzilla/Field.pm +++ b/Bugzilla/Field.pm @@ -80,6 +80,7 @@ use constant DB_COLUMNS => qw( id name description + long_desc type custom mailhead @@ -97,6 +98,7 @@ use constant DB_COLUMNS => qw( use constant VALIDATORS => { custom => \&_check_custom, description => \&_check_description, + long_desc => \&_check_long_desc, enter_bug => \&_check_enter_bug, buglist => \&Bugzilla::Object::check_boolean, mailhead => \&_check_mailhead, @@ -123,6 +125,7 @@ use constant VALIDATOR_DEPENDENCIES => { use constant UPDATE_COLUMNS => qw( description + long_desc mailhead sortkey obsolete @@ -279,6 +282,15 @@ sub _check_description { return $desc; } +sub _check_long_desc { + my ($invocant, $long_desc) = @_; + $long_desc = clean_text($long_desc || ''); + if (length($long_desc) > MAX_FIELD_LONG_DESC_LENGTH) { + ThrowUserError('field_long_desc_too_long'); + } + return $long_desc; +} + sub _check_enter_bug { return $_[1] ? 1 : 0; } sub _check_is_numeric { @@ -441,6 +453,17 @@ sub description { return $_[0]->{description} } =over +=item C + +A string providing detailed info about the field; + +=back +=cut + +sub long_desc { return $_[0]->{long_desc} } + +=over + =item C an integer specifying the kind of field this is; values correspond to @@ -824,6 +847,8 @@ They will throw an error if you try to set the values to something invalid. =item C +=item C + =item C =item C @@ -850,6 +875,7 @@ They will throw an error if you try to set the values to something invalid. =cut sub set_description { $_[0]->set('description', $_[1]); } +sub set_long_desc { $_[0]->set('long_desc', $_[1]); } sub set_enter_bug { $_[0]->set('enter_bug', $_[1]); } sub set_is_numeric { $_[0]->set('is_numeric', $_[1]); } sub set_obsolete { $_[0]->set('obsolete', $_[1]); } @@ -972,6 +998,8 @@ Just like L. Takes the following parameters: =item C B - The field label to display in the UI. +=item C - A longer description of the field. + =item C - boolean - Whether this field appears at the top of the bugmail for a newly-filed bug. Defaults to 0. -- cgit v1.2.3-24-g4f1b