summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authorrojanu <aliustek@gmail.com>2012-05-17 01:22:41 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-05-17 01:22:41 +0200
commit629f2c959658c50ec2f4790b80bfe5ff30e3cd82 (patch)
treef7554f685112a8ae5a6fdeaddc328f2baec1ef0f /Bugzilla
parent82c52c304a6513c68735923f5ecb42c5137b9ed4 (diff)
downloadbugzilla-629f2c959658c50ec2f4790b80bfe5ff30e3cd82.tar.gz
bugzilla-629f2c959658c50ec2f4790b80bfe5ff30e3cd82.tar.xz
Bug 728138: Custom fields should have a "Long Description" attribute to better understand what they are used for
r/a=LpSolit
Diffstat (limited to 'Bugzilla')
-rw-r--r--Bugzilla/Constants.pm4
-rw-r--r--Bugzilla/DB/Schema.pm1
-rw-r--r--Bugzilla/Field.pm28
-rw-r--r--Bugzilla/Install/DB.pm6
4 files changed, 38 insertions, 1 deletions
diff --git a/Bugzilla/Constants.pm b/Bugzilla/Constants.pm
index 9ac54b917..b096cc3bb 100644
--- a/Bugzilla/Constants.pm
+++ b/Bugzilla/Constants.pm
@@ -156,6 +156,7 @@ use Memoize;
MAX_MILESTONE_SIZE
MAX_COMPONENT_SIZE
MAX_FIELD_VALUE_SIZE
+ MAX_FIELD_LONG_DESC_LENGTH
MAX_FREETEXT_LENGTH
MAX_BUG_URL_LENGTH
MAX_POSSIBLE_DUPLICATES
@@ -537,6 +538,9 @@ use constant MAX_COMPONENT_SIZE => 64;
# The maximum length for values of <select> fields.
use constant MAX_FIELD_VALUE_SIZE => 64;
+# The maximum length for the long description of fields.
+use constant MAX_FIELD_LONG_DESC_LENGTH => 255;
+
# Maximum length allowed for free text fields.
use constant MAX_FREETEXT_LENGTH => 255;
diff --git a/Bugzilla/DB/Schema.pm b/Bugzilla/DB/Schema.pm
index 707688473..11d88c8fc 100644
--- a/Bugzilla/DB/Schema.pm
+++ b/Bugzilla/DB/Schema.pm
@@ -670,6 +670,7 @@ use constant ABSTRACT_SCHEMA => {
custom => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'FALSE'},
description => {TYPE => 'TINYTEXT', NOTNULL => 1},
+ long_desc => {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"},
mailhead => {TYPE => 'BOOLEAN', NOTNULL => 1,
DEFAULT => 'FALSE'},
sortkey => {TYPE => 'INT2', NOTNULL => 1},
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<long_desc>
+
+A string providing detailed info about the field;
+
+=back
+=cut
+
+sub long_desc { return $_[0]->{long_desc} }
+
+=over
+
=item C<type>
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<set_description>
+=item C<set_long_desc>
+
=item C<set_enter_bug>
=item C<set_obsolete>
@@ -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<Bugzilla::Object/create>. Takes the following parameters:
=item C<description> B<Required> - The field label to display in the UI.
+=item C<long_desc> - A longer description of the field.
+
=item C<mailhead> - boolean - Whether this field appears at the
top of the bugmail for a newly-filed bug. Defaults to 0.
diff --git a/Bugzilla/Install/DB.pm b/Bugzilla/Install/DB.pm
index 59a2cdceb..372b010e8 100644
--- a/Bugzilla/Install/DB.pm
+++ b/Bugzilla/Install/DB.pm
@@ -114,7 +114,11 @@ sub update_fielddefs_definition {
{TYPE => 'BOOLEAN', NOTNULL => 1, DEFAULT => 'FALSE'});
$dbh->do('UPDATE fielddefs SET is_numeric = 1 WHERE type = '
. FIELD_TYPE_BUG_ID);
-
+
+ # 2012-04-12 aliustek@gmail.com - Bug 728138
+ $dbh->bz_add_column('fielddefs', 'long_desc',
+ {TYPE => 'varchar(255)', NOTNULL => 1, DEFAULT => "''"}, '');
+
Bugzilla::Hook::process('install_update_db_fielddefs');
# Remember, this is not the function for adding general table changes.