View Issue Details

IDProjectCategoryView StatusLast Update
0006626mantisbtcustom fieldspublic2016-11-09 08:44
ReporterLeonard Assigned Todaryn  
PrioritynormalSeverityfeatureReproducibilityN/A
Status closedResolutionfixed 
Product Version1.0.0rc5 
Target Version1.3.0-beta.1Fixed in Version1.3.0-beta.1 
Summary0006626: Support "Memo" custom field type
Description

I added a new custom field type memo. The data is stored in a text field in the database. The patch requires a new table mantis_custom_field_text_table with the following structure:
CREATE TABLE mantis_custom_field_text_table (
field_id int(11) NOT NULL default '0',
bug_id int(11) NOT NULL default '0',
value text collate latin1_general_ci,
PRIMARY KEY (field_id,bug_id),
KEY idx_custom_field_bug (bug_id)
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;

Additional Information

The patch is created for version 1.0.0rc5.

Tagspatch
Attached Files
memo_cf_1d43887af615582304a66d6eca0c9a6cb613e5b5.diff (16,166 bytes)   
diff -x config_inc.php -N -a --unified -r mantisbt/admin/schema.php mantisbt-diff/admin/schema.php
--- mantisbt/admin/schema.php	2008-12-02 14:59:34.000000000 -0500
+++ mantisbt-diff/admin/schema.php	2008-12-02 16:06:10.964976800 -0500
@@ -405,3 +405,9 @@
 $upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_custom_field_table' ), "
   filter_by 		L 		NOTNULL DEFAULT \" '1' \"" ) );
 
+$upgrade[] = Array('CreateTableSQL',Array(db_get_table('mantis_custom_field_text_table'),"
+	field_id I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
+	bug_id I  UNSIGNED NOTNULL PRIMARY DEFAULT '0',
+	value XL NOTNULL DEFAULT \" '' \"
+	", Array('mysql' => 'TYPE=MyISAM', 'pgsql' => 'WITHOUT OIDS')));
+$upgrade[] = Array('CreateIndexSQL',Array('idx_custom_field_bug',db_get_table('mantis_custom_field_text_table'),'bug_id'));
diff -x config_inc.php -N -a --unified -r mantisbt/bug_view_advanced_page.php mantisbt-diff/bug_view_advanced_page.php
--- mantisbt/bug_view_advanced_page.php	2008-12-02 14:59:34.000000000 -0500
+++ mantisbt-diff/bug_view_advanced_page.php	2008-12-02 16:16:03.055870400 -0500
@@ -528,6 +528,8 @@
 <!-- Custom Fields -->
 <?php
 	$t_custom_fields_found = false;
+	$t_custom_fields_column = 0;
+	$t_custom_fields_text = Array();
 	$t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug->project_id );
 	foreach( $t_related_custom_field_ids as $t_id ) {
 		if ( !custom_field_has_read_access( $t_id, $f_bug_id ) ) {
@@ -536,17 +538,49 @@
 
 		$t_custom_fields_found = true;
 		$t_def = custom_field_get_definition( $t_id );
+		
+		if($t_def['type'] == CUSTOM_FIELD_TYPE_TEXT) {
+			$t_custom_fields_text[] = $t_def;
+			continue; // Push all text custom field to their own line.
+		}
+		
+		if($t_custom_fields_column == 0) {
 ?>
 	<tr <?php echo helper_alternate_class() ?>>
+<?php	} ?>
 		<td class="category">
 			<?php echo string_display( lang_get_defaulted( $t_def['name'] ) ) ?>
 		</td>
-		<td colspan="5">
+		<td>
 		<?php print_custom_field_value( $t_def, $t_id, $f_bug_id ); ?>
 		</td>
+<?php	if($t_custom_fields_column == 2) { ?>
 	</tr>
-<?php
+<?php	}
+		$t_custom_fields_column++;
+		if( $t_custom_fields_column > 2 )
+			$t_custom_fields_column = 0;
 	} # foreach
+	
+	if( $t_custom_fields_column == 1 ) {
+		echo '<td colspan="4"></td></tr>';
+	} else if( $t_custom_fields_column == 2 ) {
+		echo '<td colspan="2"></td></tr>';
+	}
+	
+	foreach( $t_custom_fields_text as $t_def )
+	{
+?>
+	<tr <?php echo helper_alternate_class() ?>>
+		<td class="category">
+		<?php echo string_display( lang_get_defaulted( $t_def['name'] ) ) ?>
+		</td>
+		<td colspan="5">
+			<?php print_custom_field_value( $t_def, $t_id, $f_bug_id ); ?>
+		</td>
+	</tr>
+<?php
+	}
 ?>
 
 <?php if ( $t_custom_fields_found ) { ?>
diff -x config_inc.php -N -a --unified -r mantisbt/bug_view_page.php mantisbt-diff/bug_view_page.php
--- mantisbt/bug_view_page.php	2008-12-02 14:59:34.000000000 -0500
+++ mantisbt-diff/bug_view_page.php	2008-12-02 16:08:35.550398200 -0500
@@ -383,23 +383,59 @@
 <!-- Custom Fields -->
 <?php
 	$t_custom_fields_found = false;
+	$t_custom_fields_column = 0;
+	$t_custom_fields_text = Array();
 	$t_related_custom_field_ids = custom_field_get_linked_ids( $t_bug->project_id );
 	foreach( $t_related_custom_field_ids as $t_id ) {
+		if( $t_def['advanced'] || !custom_field_has_read_access( $t_id, $f_bug_id ) ) {
+			continue;
+		}
+		
+		$t_custom_fields_found = true;
 		$t_def = custom_field_get_definition( $t_id );
-		if( !$t_def['advanced'] && custom_field_has_read_access( $t_id, $f_bug_id ) ) {
-			$t_custom_fields_found = true;
+		
+		if($t_def['type'] == CUSTOM_FIELD_TYPE_TEXT) {
+			$t_custom_fields_text[] = $t_def;
+			continue; // Push all text custom field to their own line.
+		}
+
+		if($t_custom_fields_column == 0) {
 ?>
 	<tr <?php echo helper_alternate_class() ?>>
+<?php	} ?>
 		<td class="category">
 			<?php echo string_display( lang_get_defaulted( $t_def['name'] ) ) ?>
 		</td>
+		<td>
+			<?php print_custom_field_value( $t_def, $t_id, $f_bug_id ); ?>
+		</td>
+<?php	if($t_custom_fields_column == 2) { ?>
+	</tr>
+<?php	}
+		$t_custom_fields_column++;
+		if( $t_custom_fields_column > 2 )
+			$t_custom_fields_column = 0;
+	} # foreach
+	
+	if( $t_custom_fields_column == 1 ) {
+		echo '<td colspan="4"></td></tr>';
+	} else if( $t_custom_fields_column == 2 ) {
+		echo '<td colspan="2"></td></tr>';
+	}
+	
+	foreach( $t_custom_fields_text as $t_def )
+	{
+?>
+	<tr <?php echo helper_alternate_class() ?>>
+		<td class="category">
+		<?php echo string_display( lang_get_defaulted( $t_def['name'] ) ) ?>
+		</td>
 		<td colspan="5">
 			<?php print_custom_field_value( $t_def, $t_id, $f_bug_id ); ?>
 		</td>
 	</tr>
 <?php
-		} # !$t_def['advanced'] && has read access
-	} # foreach
+	}
 ?>
 
 
diff -x config_inc.php -N -a --unified -r mantisbt/config_defaults_inc.php mantisbt-diff/config_defaults_inc.php
--- mantisbt/config_defaults_inc.php	2008-12-02 14:59:34.000000000 -0500
+++ mantisbt-diff/config_defaults_inc.php	2008-12-02 16:09:28.453600800 -0500
@@ -1478,6 +1478,7 @@
 	$g_db_table['mantis_custom_field_project_table']	= '%db_table_prefix%_custom_field_project%db_table_suffix%';
 	$g_db_table['mantis_custom_field_table']      	    = '%db_table_prefix%_custom_field%db_table_suffix%';
 	$g_db_table['mantis_custom_field_string_table']    = '%db_table_prefix%_custom_field_string%db_table_suffix%';
+	$g_db_table['mantis_custom_field_text_table']		= '%db_table_prefix%_custom_field_text%db_table_suffix%';
 	$g_db_table['mantis_upgrade_table']					= '%db_table_prefix%_upgrade%db_table_suffix%';
 	$g_db_table['mantis_filters_table']					= '%db_table_prefix%_filters%db_table_suffix%';
 	$g_db_table['mantis_sponsorship_table']				= '%db_table_prefix%_sponsorship%db_table_suffix%';
@@ -1512,7 +1513,7 @@
 	$g_eta_enum_string					= '10:none,20:< 1 day,30:2-3 days,40:< 1 week,50:< 1 month,60:> 1 month';
 	$g_sponsorship_enum_string          = '0:Unpaid,1:Requested,2:Paid';
 
-	$g_custom_field_type_enum_string    = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio';
+	$g_custom_field_type_enum_string    = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio,10:text';
 
 	#############################
 	# MantisBT Javascript Variables
diff -x config_inc.php -N -a --unified -r mantisbt/core/cfdefs/cfdef_standard.php mantisbt-diff/core/cfdefs/cfdef_standard.php
--- mantisbt/core/cfdefs/cfdef_standard.php	2008-12-02 14:59:34.000000000 -0500
+++ mantisbt-diff/core/cfdefs/cfdef_standard.php	2008-12-02 16:09:58.608113800 -0500
@@ -162,6 +162,20 @@
 	'#function_string_value_for_email' => 'cfdef_prepare_date_value_for_email',
 );
 
+$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_TEXT ] = array ( 
+	'#display_possible_values' => FALSE,
+	'#display_valid_regexp' => TRUE,
+	'#display_length_min' => FALSE,
+	'#display_length_max' => FALSE,
+	'#display_default_value' => TRUE,
+	'#function_return_distinct_values' => null,
+	'#function_value_to_database' => null,
+	'#function_database_to_value' => null,
+	'#function_print_input' => 'cfdef_input_textarea',
+	'#function_string_value' => null,
+	'#function_string_value_for_email' => null,
+);
+
 function cfdef_prepare_list_database_to_value($p_value) {
 	return str_replace( '||', '', '|' . $p_value . '|' );
 }
@@ -296,6 +310,12 @@
 	echo ' value="' . $t_custom_field_value .'"></input>';
 }
 
+function cfdef_input_textarea($p_field_def, $t_custom_field_value) {
+	echo '<textarea ', helper_get_tab_index(), ' name="custom_field_' . $p_field_def['id'] . '" cols="80" rows="10">';
+	echo $t_custom_field_value;
+	echo '</textarea>';
+}
+
 /**
  * Prints the controls for the date selector.
  *
diff -x config_inc.php -N -a --unified -r mantisbt/core/constant_inc.php mantisbt-diff/core/constant_inc.php
--- mantisbt/core/constant_inc.php	2008-12-02 14:59:34.000000000 -0500
+++ mantisbt-diff/core/constant_inc.php	2008-12-02 16:10:21.684909500 -0500
@@ -373,6 +373,7 @@
 define( 'CUSTOM_FIELD_TYPE_MULTILIST', 7 );
 define( 'CUSTOM_FIELD_TYPE_DATE', 8 );
 define( 'CUSTOM_FIELD_TYPE_RADIO', 9 );
+define( 'CUSTOM_FIELD_TYPE_TEXT', 10 );
 
 # Meta filter values
 define( 'META_FILTER_MYSELF', -1 );
diff -x config_inc.php -N -a --unified -r mantisbt/core/custom_field_api.php mantisbt-diff/core/custom_field_api.php
--- mantisbt/core/custom_field_api.php	2008-12-02 14:59:34.000000000 -0500
+++ mantisbt-diff/core/custom_field_api.php	2008-12-02 16:12:24.084108900 -0500
@@ -55,6 +55,7 @@
 $g_custom_field_types[CUSTOM_FIELD_TYPE_LIST] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_MULTILIST] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_DATE] = 'standard';
+$g_custom_field_types[CUSTOM_FIELD_TYPE_TEXT] = 'standard';
 
 foreach( $g_custom_field_types as $type ) {
 	require_once( $t_core_dir . 'cfdefs' . DIRECTORY_SEPARATOR . 'cfdef_' . $type . '.php' );
@@ -709,6 +710,12 @@
 				  WHERE field_id=" . db_param();
 	db_query_bound( $query, Array( $c_field_id ) );
 
+	#delete all text values
+ 	$t_custom_field_text_table = db_get_table( 'mantis_custom_field_text_table' );
+	$query = "DELETE FROM $t_custom_field_text_table
+			  WHERE field_id=" . db_param();
+	db_query_bound( $query, Array( $c_field_id ) );
+	
 	# delete all project associations
 	$t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' );
 	$query = "DELETE FROM $t_custom_field_project_table
@@ -767,6 +774,11 @@
 				  WHERE bug_id='$c_bug_id'";
 	db_query( $query );
 
+	$t_custom_field_text_table = db_get_table( 'mantis_custom_field_text_table' );
+	$query = "DELETE FROM $t_custom_field_text_table
+				  WHERE bug_id='$c_bug_id'";
+	db_query( $query );
+	
 	# db_query errors on failure so:
 	return true;
 }
@@ -1000,14 +1012,19 @@
 
 	$t_access_level_r = $row['access_level_r'];
 	$t_default_value = $row['default_value'];
+	$t_type = $row['type'];
 
 	if( !custom_field_has_read_access( $p_field_id, $p_bug_id, auth_get_current_user_id() ) ) {
 		return false;
 	}
 
-	$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
+	if( $t_type == CUSTOM_FIELD_TYPE_TEXT ) {
+		$t_custom_field_value_table = db_get_table( 'mantis_custom_field_text_table' );
+	} else {
+		$t_custom_field_value_table = db_get_table( 'mantis_custom_field_string_table' );
+	}
 	$query = "SELECT value
-				  FROM $t_custom_field_string_table
+				  FROM $t_custom_field_value_table
 				  WHERE bug_id=" . db_param() . " AND
 				  		field_id=" . db_param();
 	$result = db_query_bound( $query, Array( $c_bug_id, $c_field_id ) );
@@ -1064,12 +1081,16 @@
 		$t_custom_field_project_table = db_get_table( 'mantis_custom_field_project_table' );
 		$t_custom_field_table = db_get_table( 'mantis_custom_field_table' );
 		$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
-
-		$query = "SELECT f.name, f.type, f.access_level_r, f.default_value, f.type, s.value
+		$t_custom_field_text_table    = db_get_table( 'mantis_custom_field_text_table' );
+		$t_custom_field_type_text	  = CUSTOM_FIELD_TYPE_TEXT;
+		
+		$query = "SELECT f.name, f.type, f.access_level_r, f.default_value, f.type, COALESCE(t.value, s.value) value
 					FROM $t_custom_field_project_table p INNER JOIN $t_custom_field_table f
 						ON p.field_id = f.id
 					LEFT JOIN $t_custom_field_string_table s
 						ON  p.field_id=s.field_id AND s.bug_id='$c_bug_id'
+					LEFT JOIN $t_custom_field_text_table t
+						ON  p.field_id=t.field_id AND t.bug_id='$c_bug_id'
 					WHERE   p.project_id = '$c_project_id'
 					ORDER BY p.sequence ASC, f.name ASC";
 
@@ -1321,7 +1342,7 @@
 	$t_length_max = $row['length_max'];
 	$t_default_value = $row['default_value'];
 
-	$c_value = db_prepare_string( custom_field_value_to_database( $p_value, $t_type ) );
+	$c_value = custom_field_value_to_database( $p_value, $t_type );
 
 	# check for valid value
 	if( !is_blank( $t_valid_regexp ) ) {
@@ -1344,19 +1365,25 @@
 
 	$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
 
+	if( $t_type == CUSTOM_FIELD_TYPE_TEXT ) {
+		$t_custom_field_value_table = db_get_table( 'mantis_custom_field_text_table' );
+	} else {
+		$t_custom_field_value_table = db_get_table( 'mantis_custom_field_string_table' );
+	}
+	
 	# do I need to update or insert this value?
 	$query = "SELECT value
-				  FROM $t_custom_field_string_table
-				  WHERE field_id='$c_field_id' AND
-				  		bug_id='$c_bug_id'";
-	$result = db_query( $query );
-
+				  FROM $t_custom_field_value_table
+				  WHERE field_id=" . db_param() . " AND
+				  		bug_id=" . db_param();
+	$result = db_query_bound( $query, Array( $c_field_id, $c_bug_id ) );
+	
 	if( db_num_rows( $result ) > 0 ) {
-		$query = "UPDATE $t_custom_field_string_table
-					  SET value='$c_value'
-					  WHERE field_id='$c_field_id' AND
-					  		bug_id='$c_bug_id'";
-		db_query( $query );
+		$query = "UPDATE $t_custom_field_value_table
+					  SET value=" . db_param() . "
+					  WHERE field_id=" . db_param() . " AND
+					  		bug_id=" . db_param();
+		db_query_bound( $query, Array( $c_value, $c_field_id, $c_bug_id ) );
 
 		$row = db_fetch_array( $result );
 		history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row['value'], $t_type ), $p_value );
@@ -1364,11 +1391,11 @@
 		# Always store the value, even if it's the dafault value
 		# This is important, as the definitions might change but the
 		#  values stored with a bug must not change
-		$query = "INSERT INTO $t_custom_field_string_table
+		$query = "INSERT INTO $t_custom_field_value_table
 						( field_id, bug_id, value )
 					  VALUES
-						( '$c_field_id', '$c_bug_id', '$c_value' )";
-		db_query( $query );
+						( " . db_param() . ", " . db_param() . ", " . db_param() . " )";
+		db_query_bound( $query, Array( $c_field_id, $c_bug_id, $c_value ) );
 		history_log_event_direct( $c_bug_id, $t_name, '', $p_value );
 	}
 
diff -x config_inc.php -N -a --unified -r mantisbt/core/filter_api.php mantisbt-diff/core/filter_api.php
--- mantisbt/core/filter_api.php	2008-12-02 14:59:34.000000000 -0500
+++ mantisbt-diff/core/filter_api.php	2008-12-02 16:13:27.283593400 -0500
@@ -1726,7 +1726,7 @@
 
 		foreach( $t_custom_fields as $t_cfid ) {
 			$t_field_info = custom_field_cache_row( $t_cfid, true );
-			if( !$t_field_info['filter_by'] ) {
+			if( !$t_field_info['filter_by'] || $t_def['type'] == CUSTOM_FIELD_TYPE_TEXT ) {
 				continue;
 
 				# skip this custom field it shouldn't be filterable
@@ -1979,6 +1979,13 @@
 
 			foreach( $t_custom_fields as $t_cfid ) {
 				$t_field_info = custom_field_cache_row( $t_cfid, true );
+				
+				if( !$t_field_info['filter_by'] || $t_def['type'] == CUSTOM_FIELD_TYPE_TEXT ) {
+					continue;
+
+					# skip this custom field it shouldn't be filterable
+				}
+
 				if( $t_field_info['access_level_r'] <= $t_current_user_access_level && $t_field_info['filter_by'] ) {
 					$t_accessible_custom_fields_ids[] = $t_cfid;
 					$t_accessible_custom_fields_names[] = $t_field_info['name'];
diff -x config_inc.php -N -a --unified -r mantisbt/lang/strings_english.txt mantisbt-diff/lang/strings_english.txt
--- mantisbt/lang/strings_english.txt	2008-12-02 14:59:34.000000000 -0500
+++ mantisbt-diff/lang/strings_english.txt	2008-12-02 16:13:57.969325800 -0500
@@ -1298,7 +1298,7 @@
 $s_linked_projects = 'Linked Projects';
 
 $s_custom_field_sequence = 'Sequence';
-$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio';
+$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio,10:Text';
 
 $s_confirm_used_custom_field_deletion = 'This field is currently linked to at least one project.  If you continue all values for this field will be permanently deleted.  This action cannot be undone.  If you do not want to delete this field, hit the Back button in your browser.  To proceed, click the button below';
 $s_confirm_custom_field_deletion = 'Are you sure you want to delete this custom field and all associated values?';
custom_field_api_1.1.6.php.patch (316 bytes)   
1251a1252,1258
> 		  # START MX: treat maxLength > 255 as textarea
> 			if( 255 < $p_field_def['length_max'] ) {
> 				echo '<textarea cols="80" rows="10" name="custom_field_' . $t_id . '">';
> 				echo '' . $t_custom_field_value .'';
>         echo '</textarea>';
> 			} else {
> 		  # END MX
1258a1266
> 			} # MX
mantis-1.2.3-patch-textarea.patch (11,009 bytes)   
diff -u -r mantisbt-1.2.3/admin/schema.php mantisbt-1.2.3-patch-textarea/admin/schema.php
--- mantisbt-1.2.3/admin/schema.php	2010-10-22 09:57:01.000000000 +0200
+++ mantisbt-1.2.3-patch-textarea/admin/schema.php	2010-10-22 09:37:17.000000000 +0200
@@ -609,4 +609,6 @@
 $upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_email_id', db_get_table( 'mantis_email_table' ), 'email_id', array( 'DROP' ) ), Array( 'db_index_exists', Array( db_get_table( 'mantis_email_table' ), 'idx_email_id') ) );
 $upgrade[] = Array( 'UpdateFunction', 'correct_multiselect_custom_fields_db_format' );
 
-ALTER TABLE `mantis_custom_field_string_table` ADD `text` LONGTEXT NULL DEFAULT NULL 
+/* Patch to add textareas as custom fields */
+$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'custom_field_string' ), "
+	text		XL  			NULL DEFAULT NULL " ) );
Seulement dans mantisbt-1.2.3/admin: schema.php~
diff -u -r mantisbt-1.2.3/config_defaults_inc.php mantisbt-1.2.3-patch-textarea/config_defaults_inc.php
--- mantisbt-1.2.3/config_defaults_inc.php	2010-09-14 20:40:10.000000000 +0200
+++ mantisbt-1.2.3-patch-textarea/config_defaults_inc.php	2010-10-22 09:38:19.000000000 +0200
@@ -2981,7 +2981,7 @@
 	 *
 	 * @global string $g_custom_field_type_enum_string
 	 */
-	$g_custom_field_type_enum_string    = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio';
+  $g_custom_field_type_enum_string    = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio,10:textarea';
 
 	/*********************************
 	 * MantisBT Javascript Variables *
diff -u -r mantisbt-1.2.3/core/cfdefs/cfdef_standard.php mantisbt-1.2.3-patch-textarea/core/cfdefs/cfdef_standard.php
--- mantisbt-1.2.3/core/cfdefs/cfdef_standard.php	2010-09-14 20:40:10.000000000 +0200
+++ mantisbt-1.2.3-patch-textarea/core/cfdefs/cfdef_standard.php	2010-10-22 09:25:13.000000000 +0200
@@ -31,6 +31,20 @@
 	'#function_string_value_for_email' => null,
 );
 
+$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_TEXTAREA] = array (
+	'#display_possible_values' => TRUE,
+	'#display_valid_regexp' => TRUE,
+	'#display_length_min' => TRUE,
+	'#display_length_max' => TRUE,
+	'#display_default_value' => TRUE,
+	'#function_return_distinct_values' => null,
+	'#function_value_to_database' => null,
+	'#function_database_to_value' => null,
+	'#function_print_input' => 'cfdef_input_textarea',
+	'#function_string_value' => null,
+	'#function_string_value_for_email' => null,
+);
+
 $g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_NUMERIC ] = array (
 	'#display_possible_values' => TRUE,
 	'#display_valid_regexp' => TRUE,
@@ -300,6 +314,16 @@
 	echo ' value="' . string_attribute( $t_custom_field_value ) .'"></input>';
 }
 
+function cfdef_input_textarea($p_field_def, $t_custom_field_value) {
+	echo '<textarea ', helper_get_tab_index(), ' name="custom_field_' . $p_field_def['id'] . '"';
+	if( 0 < $p_field_def['length_max'] ) {
+		echo ' maxlength="' . $p_field_def['length_max'] . '"';
+	} else {
+		echo ' maxlength="255"';
+	}
+	echo 'cols="70" rows="8">' . $t_custom_field_value .'</textarea>';
+}
+
 /**
  * Prints the controls for the date selector.
  *
diff -u -r mantisbt-1.2.3/core/constant_inc.php mantisbt-1.2.3-patch-textarea/core/constant_inc.php
--- mantisbt-1.2.3/core/constant_inc.php	2010-09-14 20:40:10.000000000 +0200
+++ mantisbt-1.2.3-patch-textarea/core/constant_inc.php	2010-10-22 09:25:13.000000000 +0200
@@ -414,6 +414,7 @@
 define( 'CUSTOM_FIELD_TYPE_MULTILIST', 7 );
 define( 'CUSTOM_FIELD_TYPE_DATE', 8 );
 define( 'CUSTOM_FIELD_TYPE_RADIO', 9 );
+define( 'CUSTOM_FIELD_TYPE_TEXTAREA', 10 );
 
 # Meta filter values
 define( 'META_FILTER_MYSELF', -1 );
diff -u -r mantisbt-1.2.3/core/custom_field_api.php mantisbt-1.2.3-patch-textarea/core/custom_field_api.php
--- mantisbt-1.2.3/core/custom_field_api.php	2010-09-14 20:40:10.000000000 +0200
+++ mantisbt-1.2.3-patch-textarea/core/custom_field_api.php	2010-10-22 09:41:27.000000000 +0200
@@ -45,6 +45,7 @@
 # *******************************************
 
 $g_custom_field_types[CUSTOM_FIELD_TYPE_STRING] = 'standard';
+$g_custom_field_types[CUSTOM_FIELD_TYPE_TEXTAREA] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_NUMERIC] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_FLOAT] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_ENUM] = 'standard';
@@ -991,8 +992,10 @@
 		return false;
 	}
 
+  $t_value_field = ( $row['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
 	$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
-	$query = "SELECT value
+
+	$query = "SELECT $t_value_field
 				  FROM $t_custom_field_string_table
 				  WHERE bug_id=" . db_param() . " AND
 				  		field_id=" . db_param();
@@ -1334,8 +1337,10 @@
 	$t_type = custom_field_get_field( $p_field_id, 'type' );
 	$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
 
+	$t_value_field = ( $t_type == CUSTOM_FIELD_TYPE_TEXTAREA ) ? 'text' : 'value';
+
 	# Determine whether an existing value needs to be updated or a new value inserted
-	$query = "SELECT value
+	$query = "SELECT $t_value_field
 				  FROM $t_custom_field_string_table
 				  WHERE field_id=" . db_param() . " AND
 				  		bug_id=" . db_param();
@@ -1343,16 +1348,16 @@
 
 	if( db_num_rows( $result ) > 0 ) {
 		$query = "UPDATE $t_custom_field_string_table
-					  SET value=" . db_param() . "
+					  SET $t_value_field=" . db_param() . "
 					  WHERE field_id=" . db_param() . " AND
 					  		bug_id=" . db_param();
 		db_query_bound( $query, Array( custom_field_value_to_database( $p_value, $t_type ), $c_field_id, $c_bug_id ) );
 
 		$row = db_fetch_array( $result );
-		history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row['value'], $t_type ), $p_value );
+		history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row[$t_value_field], $t_type ), $p_value );
 	} else {
 		$query = "INSERT INTO $t_custom_field_string_table
-						( field_id, bug_id, value )
+						( field_id, bug_id, $t_value_field )
 					  VALUES
 						( " . db_param() . ', ' . db_param() . ', ' . db_param() . ')';
 		db_query_bound( $query, Array( $c_field_id, $c_bug_id, custom_field_value_to_database( $p_value, $t_type ) ) );
diff -u -r mantisbt-1.2.3/core/filter_api.php mantisbt-1.2.3-patch-textarea/core/filter_api.php
--- mantisbt-1.2.3/core/filter_api.php	2010-09-14 20:40:10.000000000 +0200
+++ mantisbt-1.2.3-patch-textarea/core/filter_api.php	2010-10-22 09:25:13.000000000 +0200
@@ -916,10 +916,11 @@
 			if( strpos( $c_sort, 'custom_' ) === 0 ) {
 				$t_custom_field = utf8_substr( $c_sort, utf8_strlen( 'custom_' ) );
 				$t_custom_field_id = custom_field_get_id_from_name( $t_custom_field );
-
+				$t_def = custom_field_get_definition( $t_custom_field_id );
+				$t_value_field = ( $t_def['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
 				$c_cf_alias = str_replace( ' ', '_', $t_custom_field );
 				$t_cf_table_alias = $t_custom_field_string_table . '_' . $t_custom_field_id;
-				$t_cf_select = "$t_cf_table_alias.value $c_cf_alias";
+				$t_cf_select = "$t_cf_table_alias.$t_value_field $c_cf_alias";
 
 				# check to be sure this field wasn't already added to the query.
 				if( !in_array( $t_cf_select, $p_query_clauses['select'] ) ) {
@@ -1902,6 +1903,10 @@
 								$t_where_params[] = '%|' . $t_filter_member . '|%';
 								array_push( $t_filter_array, db_helper_like( "$t_table_name.value" ) );
 								break;
+							case CUSTOM_FIELD_TYPE_TEXTAREA:
+								$t_where_params[] = '%' . $t_filter_member . '%';
+								array_push( $t_filter_array, db_helper_like( "$t_table_name.text" ) );
+								break;
 							default:
 								array_push( $t_filter_array, "$t_table_name.value = '" . db_prepare_string( $t_filter_member ) . "'" );
 						}
@@ -4014,6 +4019,8 @@
 	} else if( isset( $t_accessible_custom_fields_names[$j] ) ) {
 		if( $t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_DATE ) {
 			print_filter_custom_field_date( $j, $p_field_id );
+		} else if( $t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_TEXTAREA ) {
+			echo '<input type="text" name="custom_field_', $p_field_id, '" size="10" value="" />';
 		} else {
 			echo '<select ' . $t_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
 			echo '<option value="' . META_FILTER_ANY . '" ';
diff -u -r mantisbt-1.2.3/lang/strings_english.txt mantisbt-1.2.3-patch-textarea/lang/strings_english.txt
--- mantisbt-1.2.3/lang/strings_english.txt	2010-09-14 20:40:10.000000000 +0200
+++ mantisbt-1.2.3-patch-textarea/lang/strings_english.txt	2010-10-22 09:42:47.000000000 +0200
@@ -1300,7 +1300,7 @@
 $s_linked_projects = 'Linked Projects';
 
 $s_custom_field_sequence = 'Sequence';
-$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio';
+$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio,10:Textarea';
 
 $s_confirm_used_custom_field_deletion = 'This field is currently linked to at least one project. If you continue all values for this field will be permanently deleted. This action cannot be undone. If you do not want to delete this field, hit the Back button in your browser. To proceed, click the button below';
 $s_confirm_custom_field_deletion = 'Are you sure you want to delete this custom field and all associated values?';
diff -u -r mantisbt-1.2.3/lang/strings_french.txt mantisbt-1.2.3-patch-textarea/lang/strings_french.txt
--- mantisbt-1.2.3/lang/strings_french.txt	2010-10-22 09:58:02.000000000 +0200
+++ mantisbt-1.2.3-patch-textarea/lang/strings_french.txt	2010-09-14 20:40:10.000000000 +0200
@@ -1017,7 +1017,7 @@
 $s_link_custom_field_to_project_button = 'Lier champ personnalisé';
 $s_linked_projects = 'Projets liés';
 $s_custom_field_sequence = 'Suite';
-$s_custom_field_type_enum_string = '0:Chaîne de caractères,1:Nombre entier,2:Nombre réel,3:Énumération,4:Courriel,5:Case à cocher,6:Liste,7:Liste à sélection multiple,8:Date,9:Bouton radio,10:Zone de texte';
+$s_custom_field_type_enum_string = '0:Chaîne de caractères,1:Nombre entier,2:Nombre réel,3:Énumération,4:Courriel,5:Case à cocher,6:Liste,7:Liste à sélection multiple,8:Date,9:Bouton radio';
 $s_confirm_used_custom_field_deletion = 'Ce champ est actuellement lié à au moins un projet.  Si vous continuez, toutes les valeurs de ce champ seront supprimées.  Cette action ne peut être annulée.  Si vous ne voulez pas supprimer ce champ, cliquer sur le bouton Retour de votre navigateur.  Sinon pour supprimer ce champ, cliquer sur le bouton ci dessous';
 $s_confirm_custom_field_deletion = 'Êtes vous sûr de vouloir supprimer ce champ personnalisé et toutes les valeurs associées ?';
 $s_field_delete_button = 'Supprimer le champ';
Seulement dans mantisbt-1.2.3/lang: strings_french.txt~
mantis-1.2.4-patch-textarea.patch (10,769 bytes)   
diff -ur mantisbt-1.2.4-orig/admin/schema.php mantisbt-1.2.4/admin/schema.php
--- mantisbt-1.2.4-orig/admin/schema.php	2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/admin/schema.php	2010-12-15 17:22:24.000000000 +0100
@@ -608,3 +608,7 @@
 $upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_tag_tag_id', db_get_table( 'mantis_bug_tag_table' ), 'tag_id' ) );
 $upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_email_id', db_get_table( 'mantis_email_table' ), 'email_id', array( 'DROP' ) ), Array( 'db_index_exists', Array( db_get_table( 'mantis_email_table' ), 'idx_email_id') ) );
 $upgrade[] = Array( 'UpdateFunction', 'correct_multiselect_custom_fields_db_format' );
+
++ /* Patch to add textareas as custom fields */
++ $upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'custom_field_string' ), "
++ 	text		XL  			NULL DEFAULT NULL " ) );
diff -ur mantisbt-1.2.4-orig/config_defaults_inc.php mantisbt-1.2.4/config_defaults_inc.php
--- mantisbt-1.2.4-orig/config_defaults_inc.php	2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/config_defaults_inc.php	2010-12-15 16:54:20.000000000 +0100
@@ -2985,7 +2985,7 @@
 	 *
 	 * @global string $g_custom_field_type_enum_string
 	 */
-	$g_custom_field_type_enum_string    = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio';
+  $g_custom_field_type_enum_string    = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio,10:textarea';
 
 	/*********************************
 	 * MantisBT Javascript Variables *
diff -ur mantisbt-1.2.4-orig/core/cfdefs/cfdef_standard.php mantisbt-1.2.4/core/cfdefs/cfdef_standard.php
--- mantisbt-1.2.4-orig/core/cfdefs/cfdef_standard.php	2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/core/cfdefs/cfdef_standard.php	2010-12-15 16:54:20.000000000 +0100
@@ -31,6 +31,20 @@
 	'#function_string_value_for_email' => null,
 );
 
+$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_TEXTAREA] = array (
+	'#display_possible_values' => TRUE,
+	'#display_valid_regexp' => TRUE,
+	'#display_length_min' => TRUE,
+	'#display_length_max' => TRUE,
+	'#display_default_value' => TRUE,
+	'#function_return_distinct_values' => null,
+	'#function_value_to_database' => null,
+	'#function_database_to_value' => null,
+	'#function_print_input' => 'cfdef_input_textarea',
+	'#function_string_value' => null,
+	'#function_string_value_for_email' => null,
+);
+
 $g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_NUMERIC ] = array (
 	'#display_possible_values' => TRUE,
 	'#display_valid_regexp' => TRUE,
@@ -300,6 +314,16 @@
 	echo ' value="' . string_attribute( $t_custom_field_value ) .'"></input>';
 }
 
+function cfdef_input_textarea($p_field_def, $t_custom_field_value) {
+	echo '<textarea ', helper_get_tab_index(), ' name="custom_field_' . $p_field_def['id'] . '"';
+	if( 0 < $p_field_def['length_max'] ) {
+		echo ' maxlength="' . $p_field_def['length_max'] . '"';
+	} else {
+		echo ' maxlength="255"';
+	}
+	echo 'cols="70" rows="8">' . $t_custom_field_value .'</textarea>';
+}
+
 /**
  * Prints the controls for the date selector.
  *
diff -ur mantisbt-1.2.4-orig/core/constant_inc.php mantisbt-1.2.4/core/constant_inc.php
--- mantisbt-1.2.4-orig/core/constant_inc.php	2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/core/constant_inc.php	2010-12-15 16:54:20.000000000 +0100
@@ -414,6 +414,7 @@
 define( 'CUSTOM_FIELD_TYPE_MULTILIST', 7 );
 define( 'CUSTOM_FIELD_TYPE_DATE', 8 );
 define( 'CUSTOM_FIELD_TYPE_RADIO', 9 );
+define( 'CUSTOM_FIELD_TYPE_TEXTAREA', 10 );
 
 # Meta filter values
 define( 'META_FILTER_MYSELF', -1 );
diff -ur mantisbt-1.2.4-orig/core/custom_field_api.php mantisbt-1.2.4/core/custom_field_api.php
--- mantisbt-1.2.4-orig/core/custom_field_api.php	2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/core/custom_field_api.php	2010-12-15 16:54:20.000000000 +0100
@@ -45,6 +45,7 @@
 # *******************************************
 
 $g_custom_field_types[CUSTOM_FIELD_TYPE_STRING] = 'standard';
+$g_custom_field_types[CUSTOM_FIELD_TYPE_TEXTAREA] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_NUMERIC] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_FLOAT] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_ENUM] = 'standard';
@@ -991,8 +992,10 @@
 		return false;
 	}
 
+  $t_value_field = ( $row['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
 	$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
-	$query = "SELECT value
+
+	$query = "SELECT $t_value_field
 				  FROM $t_custom_field_string_table
 				  WHERE bug_id=" . db_param() . " AND
 				  		field_id=" . db_param();
@@ -1334,8 +1337,10 @@
 	$t_type = custom_field_get_field( $p_field_id, 'type' );
 	$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
 
+	$t_value_field = ( $t_type == CUSTOM_FIELD_TYPE_TEXTAREA ) ? 'text' : 'value';
+
 	# Determine whether an existing value needs to be updated or a new value inserted
-	$query = "SELECT value
+	$query = "SELECT $t_value_field
 				  FROM $t_custom_field_string_table
 				  WHERE field_id=" . db_param() . " AND
 				  		bug_id=" . db_param();
@@ -1343,16 +1348,16 @@
 
 	if( db_num_rows( $result ) > 0 ) {
 		$query = "UPDATE $t_custom_field_string_table
-					  SET value=" . db_param() . "
+					  SET $t_value_field=" . db_param() . "
 					  WHERE field_id=" . db_param() . " AND
 					  		bug_id=" . db_param();
 		db_query_bound( $query, Array( custom_field_value_to_database( $p_value, $t_type ), $c_field_id, $c_bug_id ) );
 
 		$row = db_fetch_array( $result );
-		history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row['value'], $t_type ), $p_value );
+		history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row[$t_value_field], $t_type ), $p_value );
 	} else {
 		$query = "INSERT INTO $t_custom_field_string_table
-						( field_id, bug_id, value )
+						( field_id, bug_id, $t_value_field )
 					  VALUES
 						( " . db_param() . ', ' . db_param() . ', ' . db_param() . ')';
 		db_query_bound( $query, Array( $c_field_id, $c_bug_id, custom_field_value_to_database( $p_value, $t_type ) ) );
diff -ur mantisbt-1.2.4-orig/core/filter_api.php mantisbt-1.2.4/core/filter_api.php
--- mantisbt-1.2.4-orig/core/filter_api.php	2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/core/filter_api.php	2010-12-15 16:55:37.000000000 +0100
@@ -916,10 +916,11 @@
 			if( strpos( $c_sort, 'custom_' ) === 0 ) {
 				$t_custom_field = utf8_substr( $c_sort, utf8_strlen( 'custom_' ) );
 				$t_custom_field_id = custom_field_get_id_from_name( $t_custom_field );
-
+				$t_def = custom_field_get_definition( $t_custom_field_id );
+				$t_value_field = ( $t_def['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
 				$c_cf_alias = str_replace( ' ', '_', $t_custom_field );
 				$t_cf_table_alias = $t_custom_field_string_table . '_' . $t_custom_field_id;
-				$t_cf_select = "$t_cf_table_alias.value $c_cf_alias";
+				$t_cf_select = "$t_cf_table_alias.$t_value_field $c_cf_alias";
 
 				# check to be sure this field wasn't already added to the query.
 				if( !in_array( $t_cf_select, $p_query_clauses['select'] ) ) {
@@ -1902,6 +1903,10 @@
 								$t_where_params[] = '%|' . $t_filter_member . '|%';
 								array_push( $t_filter_array, db_helper_like( "$t_table_name.value" ) );
 								break;
+							case CUSTOM_FIELD_TYPE_TEXTAREA:
+								$t_where_params[] = '%' . $t_filter_member . '%';
+								array_push( $t_filter_array, db_helper_like( "$t_table_name.text" ) );
+								break;
 							default:
 								array_push( $t_filter_array, "$t_table_name.value = '" . db_prepare_string( $t_filter_member ) . "'" );
 						}
@@ -4014,6 +4021,8 @@
 	} else if( isset( $t_accessible_custom_fields_names[$j] ) ) {
 		if( $t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_DATE ) {
 			print_filter_custom_field_date( $j, $p_field_id );
+		} else if( $t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_TEXTAREA ) {
+			echo '<input type="text" name="custom_field_', $p_field_id, '" size="10" value="" />';
 		} else {
 			echo '<select ' . $t_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
 			echo '<option value="' . META_FILTER_ANY . '" ';
diff -ur mantisbt-1.2.4-orig/lang/strings_english.txt mantisbt-1.2.4/lang/strings_english.txt
--- mantisbt-1.2.4-orig/lang/strings_english.txt	2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/lang/strings_english.txt	2010-12-15 16:54:20.000000000 +0100
@@ -1300,7 +1300,7 @@
 $s_linked_projects = 'Linked Projects';
 
 $s_custom_field_sequence = 'Sequence';
-$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio';
+$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio,10:Textarea';
 
 $s_confirm_used_custom_field_deletion = 'This field is currently linked to at least one project. If you continue all values for this field will be permanently deleted. This action cannot be undone. If you do not want to delete this field, hit the Back button in your browser. To proceed, click the button below';
 $s_confirm_custom_field_deletion = 'Are you sure you want to delete this custom field and all associated values?';
diff -ur mantisbt-1.2.4-orig/lang/strings_french.txt mantisbt-1.2.4/lang/strings_french.txt
--- mantisbt-1.2.4-orig/lang/strings_french.txt	2010-12-15 03:26:31.000000000 +0100
+++ mantisbt-1.2.4/lang/strings_french.txt	2010-12-15 17:00:48.000000000 +0100
@@ -1021,7 +1021,7 @@
 $s_link_custom_field_to_project_button = 'Lier champ personnalisé';
 $s_linked_projects = 'Projets liés';
 $s_custom_field_sequence = 'Suite';
-$s_custom_field_type_enum_string = '0:Chaîne de caractères,1:Nombre entier,2:Nombre réel,3:Énumération,4:Courriel,5:Case à cocher,6:Liste,7:Liste à sélection multiple,8:Date,9:Bouton radio';
+$s_custom_field_type_enum_string = '0:Chaîne de caractères,1:Nombre entier,2:Nombre réel,3:Énumération,4:Courriel,5:Case à cocher,6:Liste,7:Liste à sélection multiple,8:Date,9:Bouton radio,10:Zone de texte';
 $s_confirm_used_custom_field_deletion = 'Ce champ est actuellement lié à au moins un projet.  Si vous continuez, toutes les valeurs de ce champ seront supprimées.  Cette action ne peut être annulée.  Si vous ne voulez pas supprimer ce champ, cliquer sur le bouton Retour de votre navigateur.  Sinon pour supprimer ce champ, cliquer sur le bouton ci dessous';
 $s_confirm_custom_field_deletion = 'Êtes vous sûr de vouloir supprimer ce champ personnalisé et toutes les valeurs associées ?';
 $s_field_delete_button = 'Supprimer le champ';
mantis-1.2.5-textarea.patch (11,316 bytes)   
diff --git a/admin/schema.php b/admin/schema.php
index d2b6940..dfaeb15 100644
--- a/admin/schema.php
+++ b/admin/schema.php
@@ -608,3 +608,7 @@ $upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_tag_name', db_get_table( 'mant
 $upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_bug_tag_tag_id', db_get_table( 'mantis_bug_tag_table' ), 'tag_id' ) );
 $upgrade[] = Array( 'CreateIndexSQL', Array( 'idx_email_id', db_get_table( 'mantis_email_table' ), 'email_id', array( 'DROP' ) ), Array( 'db_index_exists', Array( db_get_table( 'mantis_email_table' ), 'idx_email_id') ) );
 $upgrade[] = Array( 'UpdateFunction', 'correct_multiselect_custom_fields_db_format' );
+
+/* Patch to add textareas as custom fields */
+$upgrade[] = Array( 'AddColumnSQL', Array( db_get_table( 'mantis_custom_field_string_table' ), "
+	text		XL  			NULL DEFAULT NULL " ) );
diff --git a/config_defaults_inc.php b/config_defaults_inc.php
index 63626c0..5aaedf1 100644
--- a/config_defaults_inc.php
+++ b/config_defaults_inc.php
@@ -3001,7 +3001,7 @@
 	 *
 	 * @global string $g_custom_field_type_enum_string
 	 */
-	$g_custom_field_type_enum_string    = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio';
+	$g_custom_field_type_enum_string    = '0:string,1:numeric,2:float,3:enum,4:email,5:checkbox,6:list,7:multiselection list,8:date,9:radio,10:textarea';
 
 	/*********************************
 	 * MantisBT Javascript Variables *
diff --git a/core/cfdefs/cfdef_standard.php b/core/cfdefs/cfdef_standard.php
index e802a86..32c415c 100644
--- a/core/cfdefs/cfdef_standard.php
+++ b/core/cfdefs/cfdef_standard.php
@@ -31,6 +31,20 @@ $g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_STRING ] = array (
 	'#function_string_value_for_email' => null,
 );
 
+$g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_TEXTAREA] = array (
+	'#display_possible_values' => TRUE,
+	'#display_valid_regexp' => TRUE,
+	'#display_length_min' => TRUE,
+	'#display_length_max' => TRUE,
+	'#display_default_value' => TRUE,
+	'#function_return_distinct_values' => null,
+	'#function_value_to_database' => null,
+	'#function_database_to_value' => null,
+	'#function_print_input' => 'cfdef_input_textarea',
+	'#function_string_value' => null,
+	'#function_string_value_for_email' => null,
+);
+
 $g_custom_field_type_definition[ CUSTOM_FIELD_TYPE_NUMERIC ] = array (
 	'#display_possible_values' => TRUE,
 	'#display_valid_regexp' => TRUE,
@@ -300,6 +314,16 @@ function cfdef_input_textbox($p_field_def, $t_custom_field_value) {
 	echo ' value="' . string_attribute( $t_custom_field_value ) .'"></input>';
 }
 
+function cfdef_input_textarea($p_field_def, $t_custom_field_value) {
+	echo '<textarea ', helper_get_tab_index(), ' name="custom_field_' . $p_field_def['id'] . '"';
+	if( 0 < $p_field_def['length_max'] ) {
+		echo ' maxlength="' . $p_field_def['length_max'] . '"';
+	} else {
+		echo ' maxlength="255"';
+	}
+	echo 'cols="70" rows="8">' . $t_custom_field_value .'</textarea>';
+}
+
 /**
  * Prints the controls for the date selector.
  *
diff --git a/core/constant_inc.php b/core/constant_inc.php
index c47a93c..bdcab33 100644
--- a/core/constant_inc.php
+++ b/core/constant_inc.php
@@ -414,6 +414,7 @@ define( 'CUSTOM_FIELD_TYPE_LIST', 6 );
 define( 'CUSTOM_FIELD_TYPE_MULTILIST', 7 );
 define( 'CUSTOM_FIELD_TYPE_DATE', 8 );
 define( 'CUSTOM_FIELD_TYPE_RADIO', 9 );
+define( 'CUSTOM_FIELD_TYPE_TEXTAREA', 10 );
 
 # Meta filter values
 define( 'META_FILTER_MYSELF', -1 );
diff --git a/core/custom_field_api.php b/core/custom_field_api.php
index 2c97592..74d4833 100644
--- a/core/custom_field_api.php
+++ b/core/custom_field_api.php
@@ -45,6 +45,7 @@ require_once( 'date_api.php' );
 # *******************************************
 
 $g_custom_field_types[CUSTOM_FIELD_TYPE_STRING] = 'standard';
+$g_custom_field_types[CUSTOM_FIELD_TYPE_TEXTAREA] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_NUMERIC] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_FLOAT] = 'standard';
 $g_custom_field_types[CUSTOM_FIELD_TYPE_ENUM] = 'standard';
@@ -991,8 +992,10 @@ function custom_field_get_value( $p_field_id, $p_bug_id ) {
 		return false;
 	}
 
+	$t_value_field = ( $row['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
 	$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
-	$query = "SELECT value
+
+	$query = "SELECT $t_value_field
 				  FROM $t_custom_field_string_table
 				  WHERE bug_id=" . db_param() . " AND
 				  		field_id=" . db_param();
@@ -1341,8 +1344,10 @@ function custom_field_set_value( $p_field_id, $p_bug_id, $p_value, $p_log_insert
 	$t_type = custom_field_get_field( $p_field_id, 'type' );
 	$t_custom_field_string_table = db_get_table( 'mantis_custom_field_string_table' );
 
+	$t_value_field = ( $t_type == CUSTOM_FIELD_TYPE_TEXTAREA ) ? 'text' : 'value';
+
 	# Determine whether an existing value needs to be updated or a new value inserted
-	$query = "SELECT value
+	$query = "SELECT $t_value_field
 				  FROM $t_custom_field_string_table
 				  WHERE field_id=" . db_param() . " AND
 				  		bug_id=" . db_param();
@@ -1350,16 +1355,16 @@ function custom_field_set_value( $p_field_id, $p_bug_id, $p_value, $p_log_insert
 
 	if( db_num_rows( $result ) > 0 ) {
 		$query = "UPDATE $t_custom_field_string_table
-					  SET value=" . db_param() . "
+					  SET $t_value_field=" . db_param() . "
 					  WHERE field_id=" . db_param() . " AND
 					  		bug_id=" . db_param();
 		db_query_bound( $query, Array( custom_field_value_to_database( $p_value, $t_type ), $c_field_id, $c_bug_id ) );
 
 		$row = db_fetch_array( $result );
-		history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row['value'], $t_type ), $p_value );
+		history_log_event_direct( $c_bug_id, $t_name, custom_field_database_to_value( $row[$t_value_field], $t_type ), $p_value );
 	} else {
 		$query = "INSERT INTO $t_custom_field_string_table
-						( field_id, bug_id, value )
+						( field_id, bug_id, $t_value_field )
 					  VALUES
 						( " . db_param() . ', ' . db_param() . ', ' . db_param() . ')';
 		db_query_bound( $query, Array( $c_field_id, $c_bug_id, custom_field_value_to_database( $p_value, $t_type ) ) );
diff --git a/core/filter_api.php b/core/filter_api.php
index 7b244c3..4cfd326 100644
--- a/core/filter_api.php
+++ b/core/filter_api.php
@@ -916,10 +916,11 @@ function filter_get_query_sort_data( &$p_filter, $p_show_sticky, $p_query_clause
 			if( strpos( $c_sort, 'custom_' ) === 0 ) {
 				$t_custom_field = utf8_substr( $c_sort, utf8_strlen( 'custom_' ) );
 				$t_custom_field_id = custom_field_get_id_from_name( $t_custom_field );
-
+				$t_def = custom_field_get_definition( $t_custom_field_id );
+				$t_value_field = ( $t_def['type'] == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value' );
 				$c_cf_alias = str_replace( ' ', '_', $t_custom_field );
 				$t_cf_table_alias = $t_custom_field_string_table . '_' . $t_custom_field_id;
-				$t_cf_select = "$t_cf_table_alias.value $c_cf_alias";
+				$t_cf_select = "$t_cf_table_alias.$t_value_field $c_cf_alias";
 
 				# check to be sure this field wasn't already added to the query.
 				if( !in_array( $t_cf_select, $p_query_clauses['select'] ) ) {
@@ -1902,6 +1903,10 @@ function filter_get_bug_rows( &$p_page_number, &$p_per_page, &$p_page_count, &$p
 								$t_where_params[] = '%|' . $t_filter_member . '|%';
 								array_push( $t_filter_array, db_helper_like( "$t_table_name.value" ) );
 								break;
+							case CUSTOM_FIELD_TYPE_TEXTAREA:
+								$t_where_params[] = '%' . $t_filter_member . '%';
+								array_push( $t_filter_array, db_helper_like( "$t_table_name.text" ) );
+								break;
 							default:
 								$t_where_params[] = $t_filter_member;
 								array_push( $t_filter_array, "$t_table_name.value = " . db_param() );
@@ -4021,6 +4026,8 @@ function print_filter_custom_field( $p_field_id ) {
 	} else if( isset( $t_accessible_custom_fields_names[$j] ) ) {
 		if( $t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_DATE ) {
 			print_filter_custom_field_date( $j, $p_field_id );
+		} else if( $t_accessible_custom_fields_types[$j] == CUSTOM_FIELD_TYPE_TEXTAREA ) {
+			echo '<input type="text" name="custom_field_', $p_field_id, '" size="10" value="" />';
 		} else {
 			echo '<select ' . $t_select_modifier . ' name="custom_field_' . $p_field_id . '[]">';
 			echo '<option value="' . META_FILTER_ANY . '" ';
diff --git a/core/gpc_api.php b/core/gpc_api.php
index b37bcb9..cc6961a 100644
--- a/core/gpc_api.php
+++ b/core/gpc_api.php
@@ -178,6 +178,7 @@ function gpc_isset_custom_field( $p_var_name, $p_custom_field_type ) {
 				gpc_isset( $t_field_name . '_year' ) &&
 				gpc_get_int( $t_field_name . '_year', 0 ) != 0 ;
 		case CUSTOM_FIELD_TYPE_STRING:
+		case CUSTOM_FIELD_TYPE_TEXTAREA:
 		case CUSTOM_FIELD_TYPE_NUMERIC:
 		case CUSTOM_FIELD_TYPE_FLOAT:
 		case CUSTOM_FIELD_TYPE_ENUM:
diff --git a/lang/strings_english.txt b/lang/strings_english.txt
index cff3989..c781813 100644
--- a/lang/strings_english.txt
+++ b/lang/strings_english.txt
@@ -1300,7 +1300,7 @@ $s_link_custom_field_to_project_button = 'Link Custom Field';
 $s_linked_projects = 'Linked Projects';
 
 $s_custom_field_sequence = 'Sequence';
-$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio';
+$s_custom_field_type_enum_string = '0:String,1:Numeric,2:Float,3:Enumeration,4:E-mail,5:Checkbox,6:List,7:Multiselection list,8:Date,9:Radio,10:Textarea';
 
 $s_confirm_used_custom_field_deletion = 'This field is currently linked to at least one project. If you continue all values for this field will be permanently deleted. This action cannot be undone. If you do not want to delete this field, hit the Back button in your browser. To proceed, click the button below';
 $s_confirm_custom_field_deletion = 'Are you sure you want to delete this custom field and all associated values?';
diff --git a/lang/strings_french.txt b/lang/strings_french.txt
index ee919fd..4c77768 100644
--- a/lang/strings_french.txt
+++ b/lang/strings_french.txt
@@ -1022,7 +1022,7 @@ $s_link_custom_field_to_project_title = 'Lier un champ personnalisé au projet';
 $s_link_custom_field_to_project_button = 'Lier champ personnalisé';
 $s_linked_projects = 'Projets liés';
 $s_custom_field_sequence = 'Suite';
-$s_custom_field_type_enum_string = '0:Chaîne de caractères,1:Nombre entier,2:Nombre réel,3:Énumération,4:Courriel,5:Case à cocher,6:Liste,7:Liste à sélection multiple,8:Date,9:Bouton radio';
+$s_custom_field_type_enum_string = '0:Chaîne de caractères,1:Nombre entier,2:Nombre réel,3:Énumération,4:Courriel,5:Case à cocher,6:Liste,7:Liste à sélection multiple,8:Date,9:Bouton radio,10:Zone de texte';
 $s_confirm_used_custom_field_deletion = 'Ce champ est actuellement lié à au moins un projet.  Si vous continuez, toutes les valeurs de ce champ seront supprimées.  Cette action ne peut être annulée.  Si vous ne voulez pas supprimer ce champ, cliquer sur le bouton Retour de votre navigateur.  Sinon pour supprimer ce champ, cliquer sur le bouton ci dessous';
 $s_confirm_custom_field_deletion = 'Êtes vous sûr de vouloir supprimer ce champ personnalisé et toutes les valeurs associées ?';
 $s_field_delete_button = 'Supprimer le champ';
mantis-1.2.5-textarea.patch (11,316 bytes)   
manage_custom_field_edit_page.php (10,705 bytes)   
<?php
# MantisBT - a php based bugtracking system

# MantisBT is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# MantisBT is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with MantisBT.  If not, see <http://www.gnu.org/licenses/>.

	/**
	 * @package MantisBT
	 * @copyright Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
	 * @copyright Copyright (C) 2002 - 2011  MantisBT Team - mantisbt-dev@lists.sourceforge.net
	 * @link http://www.mantisbt.org
	 */
	 /**
	  * MantisBT Core API's
	  */
	require_once( 'core.php' );

	require_once( 'custom_field_api.php' );

	auth_reauthenticate();

	access_ensure_global_level( config_get( 'manage_custom_fields_threshold' ) );

	$f_field_id	= gpc_get_int( 'field_id' );
	$f_return	= strip_tags( gpc_get_string( 'return', 'manage_custom_field_page.php' ) );

	custom_field_ensure_exists( $f_field_id );

	html_page_top();

	print_manage_menu( 'manage_custom_field_edit_page.php' );
	$t_definition = custom_field_get_definition( $f_field_id );

	$defval = string_attribute($t_definition['default_value']);
	$defval = nl2br2($defval);

	function nl2br2($string) { 
		$string = str_replace(array("\r\n","\r","\n"), array('\\r\\n',"\\r","\\n"), $string); 
		return $string; 
	} 
?>


<script type='text/javascript'>
function defValInputField() 
{
        var select = document.getElementById("type");
        var divv = document.getElementById("containerTxtArea");
        var value = select.value;
 	if (value == 10) {
	   toAppend = "<textarea rows='5' cols='40' name='default_value' id='default_value'></textarea>"; 
        }
	else{
	    toAppend = "<input type='text' name='default_value' id='default_value' size='32' maxlength='255'>";
	}
 	divv.innerHTML=toAppend; 
	
	var textBox = document.getElementById("default_value");
	textBox.value = "<?php echo $defval;?>";
}
</script>

<br />
<div align="center">
<form method="post" action="manage_custom_field_update.php">
<?php echo form_security_field( 'manage_custom_field_update' ); ?>
	<input type="hidden" name="field_id" value="<?php echo $f_field_id ?>" />
	<input type="hidden" name="return" value="<?php echo $f_return ?>" />

	<table class="width50" cellspacing="1">
		<tr>
			<td class="form-title" colspan="2">
				<?php echo lang_get( 'edit_custom_field_title' ) ?>
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_name' ) ?>
			</td>
			<td>
				<input type="text" name="name" size="32" maxlength="64" value="<?php echo string_attribute( $t_definition['name'] ) ?>" />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_type' ) ?>
			</td>
			<td>
				<select name="type" id="type" onchange="defValInputField()">
					<?php print_enum_string_option_list( 'custom_field_type', $t_definition['type'] ) ?>
				</select>
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_possible_values' ) ?>
			</td>
			<td>
				<input type="text" name="possible_values" size="32" value="<?php echo string_attribute( $t_definition['possible_values'] ) ?>" />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_default_value' ) ?>
			</td>
			<td id="containerTxtArea">				
				<script type='text/javascript'>	
					defValInputField();	
				</script>
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_valid_regexp' ) ?>
			</td>
			<td>
				<input type="text" name="valid_regexp" size="32" maxlength="255" value="<?php echo string_attribute( $t_definition['valid_regexp'] ) ?>" />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_access_level_r' ) ?>
			</td>
			<td>
				<select name="access_level_r">
					<?php print_enum_string_option_list( 'access_levels', $t_definition['access_level_r'] ) ?>
				</select>
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_access_level_rw' ) ?>
			</td>
			<td>
				<select name="access_level_rw">
					<?php print_enum_string_option_list( 'access_levels', $t_definition['access_level_rw'] ) ?>
				</select>
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_length_min' ) ?>
			</td>
			<td>
				<input type="text" name="length_min" size="32" maxlength="64" value="<?php echo $t_definition['length_min'] ?>" />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_length_max' ) ?>
			</td>
			<td>
				<input type="text" name="length_max" size="32" maxlength="64" value="<?php echo $t_definition['length_max'] ?>" />
			</td>
		</tr>
        <tr <?php echo helper_alternate_class() ?>>
            <td class="category">
                <?php echo lang_get( 'custom_field_filter_by' ) ?>
            </td>
            <td>
                <input type="checkbox" name="filter_by" <?php if ( $t_definition['filter_by'] ) { ?>checked="checked"<?php } ?>  />
            </td>
        </tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_display_report' ) ?>
			</td>
			<td>
				<input type="checkbox" name="display_report" value="1" <?php check_checked( $t_definition['display_report'] ) ?> />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_display_update' ) ?>
			</td>
			<td>
				<input type="checkbox" name="display_update" value="1" <?php check_checked( $t_definition['display_update'] ) ?> />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_display_resolved' ) ?>
			</td>
			<td>
				<input type="checkbox" name="display_resolved" value="1" <?php check_checked( $t_definition['display_resolved'] ) ?> />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_display_closed' ) ?>
			</td>
			<td>
				<input type="checkbox" name="display_closed" value="1" <?php check_checked( $t_definition['display_closed'] ) ?> />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_require_report' ) ?>
			</td>
			<td>
				<input type="checkbox" name="require_report" value="1" <?php check_checked( $t_definition['require_report'] ) ?> />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_require_update' ) ?>
			</td>
			<td>
				<input type="checkbox" name="require_update" value="1" <?php check_checked( $t_definition['require_update'] ) ?> />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_require_resolved' ) ?>
			</td>
			<td>
				<input type="checkbox" name="require_resolved" value="1" <?php check_checked( $t_definition['require_resolved'] ) ?> />
			</td>
		</tr>
		<tr <?php echo helper_alternate_class() ?>>
			<td class="category">
				<?php echo lang_get( 'custom_field_require_closed' ) ?>
			</td>
			<td>
				<input type="checkbox" name="require_closed" value="1" <?php check_checked( $t_definition['require_closed'] ) ?> />
			</td>
		</tr>
		<tr>
			<td>&#160;</td>
			<td>
				<input type="submit" class="button" value="<?php echo lang_get( 'update_custom_field_button' ) ?>" />
			</td>
		</tr>
	</table>
</form>
</div>

<br />

<div class="border center">
	<form method="post" action="manage_custom_field_delete.php">
<?php echo form_security_field( 'manage_custom_field_delete' ); ?>
		<input type="hidden" name="field_id" value="<?php echo $f_field_id ?>" />
		<input type="hidden" name="return" value="<?php echo string_attribute( $f_return ) ?>" />
		<input type="submit" class="button" value="<?php echo lang_get( 'delete_custom_field_button' ) ?>" />
	</form>
</div>

<?php /** @todo There is access checking in the ADD action page and at the top of this file.
           * We may need to add extra checks to exclude projects from the list that the user
		   * can't link/unlink fields from/to. */
?>
<br />
<div align="center">
<form method="post" action="manage_custom_field_proj_add.php">
<?php echo form_security_field( 'manage_custom_field_proj_add' ); ?>
<table class="width75" cellspacing="1">
<!-- Title -->
<tr>
	<td class="form-title" colspan="2">
		<input type="hidden" name="field_id" value="<?php echo $f_field_id ?>" />
		<?php echo lang_get( 'link_custom_field_to_project_title' ) ?>
	</td>
</tr>

<!-- Assigned Projects -->
<tr <?php echo helper_alternate_class( 1 ) ?> valign="top">
	<td class="category" width="30%">
		<?php echo lang_get( 'linked_projects' ) ?>:
	</td>
	<td width="70%">
		<?php print_custom_field_projects_list( $f_field_id ) ?>
	</td>
</tr>

<!-- Unassigend Project Selection -->
<tr <?php echo helper_alternate_class() ?> valign="top">
	<td class="category">
		<?php echo lang_get( 'projects_title' ) ?>:
	</td>
	<td>
		<select name="project_id[]" multiple="multiple" size="5">
			<?php print_project_option_list( null, false ); ?>
		</select>
	</td>
</tr>

<!-- Sequence Number -->
<tr <?php echo helper_alternate_class() ?> valign="top">
	<td class="category">
		<?php echo lang_get( 'custom_field_sequence' ) ?>:
	</td>
	<td>
		<input type="text" name="sequence" value="0" />
	</td>
</tr>

<!-- Submit Buttom -->
<tr>
	<td class="center" colspan="2">
		<input type="submit" class="button" value="<?php echo lang_get( 'link_custom_field_to_project_button' ) ?>" />
	</td>
</tr>
</table>
</form>
</div>

<?php
	html_page_bottom();

Relationships

has duplicate 0009066 closedvboctor Require custom field type: “Text” 
has duplicate 0005000 closedvboctor String custom field type isnt big enough - need multiline string option 
has duplicate 0004705 closedvboctor Add Text type in addition to String for custom field types 
has duplicate 0005967 closedvboctor Textarea-Fields 
has duplicate 0005679 closedvboctor Make long string custom fields use textarea instead of input 
has duplicate 0005493 closedvboctor Multiline Custom Fields 
has duplicate 0004373 closedvboctor Multi-line custom field type 
has duplicate 0011097 closedvboctor Offer Custom Fields (String) with maxLength > 255 characters and displayed as TEXTAREA 
has duplicate 0011863 closeddaryn Custom Field as TextArea 
has duplicate 0012464 closedatrol Custom Field with a TEXT AREA 
has duplicate 0013688 closedatrol build some custom field item ,how to build custom item is a big window 
has duplicate 0014027 closedatrol Build a new Custom Fields(Type is string) ,word space issue 
related to 0010923 closedvboctor function history_log_event_direct should check (and eventually truncate) the length of the new and the old value 
related to 0014817 closeddregad New column "text" in mantis_custom_field_string_table cause some custom field data missing from display 
related to 0015681 closedatrol [customer fields]: How to make the fileld to multi-rows? 

Activities

Leonard

Leonard

2006-01-25 06:22

reporter   ~0012018

There is a failure in the custom_field_api.php in function custom_field_distinct_values in the first version of the patch, sorry for this. Please use this one.

cjallais

cjallais

2006-05-16 12:02

reporter   ~0012849

Missing this line in config_default_inc.php (add it just after line 1224):

$g_mantis_custom_field_text_table = '%db_table_prefix%_custom_field_text%db_table_suffix%';

vboctor

vboctor

2008-05-20 02:32

manager   ~0017876

Leonard, it would be great if you can upload an updated patch. It would also be very useful in adding a note that describes the functionality that you support for memo custom fields.

For example:

  1. Filtering - probably shouldn't be supported.
  2. Support as columns - View Issues, Print Issues, Word Export, Excel Export, CSV export.
  3. What happens when a custom field type is changed from a string to a memo? Is this supported?
  4. How do you determine the size of the text area?
  5. Does the update custom field page still use a single line edit box for default value?
  6. What about fields like possible values? I assume they don't apply to memo custom fields.
Leonard

Leonard

2008-06-01 16:29

reporter   ~0017984

I couldn't find the old patch. So i used the weekend to rewrite the custom field text support for the current svn head. I uploaded the patch as a zip archive. Now some words to your questions.

  1. I think i would be fine if i can use the search string for custom text fields, but until now it doesn't work.
  2. This should be ok.
  3. If you change from string to memo and back the data is lost. I think i should extend the functions to copy the data from one table to the other.
  4. The text areas are 80 cols and 10 lines like the other text areas description and additional information.
  5. Yes, this is a single line edit box.
  6. I set the values in cfdef_standard.php to false. Is it enough?

I'm very interested in some feedback to finalize the implementation for using in mantis.

vboctor

vboctor

2008-07-15 04:16

manager   ~0018538

I haven't reviewed the patch yet, but we should do that and get support for memo fields added to Mantis.

mthibeault

mthibeault

2008-12-02 16:25

reporter   ~0020201

I updated the code to be used on GIT commit 1d43887af615582304a66d6eca0c9a6cb613e5b5. The only "new" things are:
1) I modified some of the custom field to use db_query_bound instead of db_query.
2) Some code that modifies the custom field in bug view got in the patch. That code pushes three custom fields per line instead of only one. Helps get some space back (anyway, it is possible to get away from that behavior just reverting bug_view* files).

Sadly, I haven't had much time to test everything, hope it still helps.

Baerlon

Baerlon

2009-10-09 10:24

reporter   ~0023109

I would prefer to get a multiline input without any restrictions.

Is the issue 0004373 a duplicate?

liebscher

liebscher

2009-11-02 03:29

reporter   ~0023536

Added patch custom_field_api_1.1.6.php.patch for functionality described in 0011097.

jmonin

jmonin

2010-10-22 04:35

reporter   ~0027117

I've backported the 1.3.x commit for Mantis 1.2.3; it also includes the French translation.
As for the database update, I ran the command: "ALTER TABLE mantis_custom_field_string_table ADD text LONGTEXT NULL DEFAULT NULL"
Btw, the original repo commit uses a "XL" type and I really couldn't figure what it was... Is my assumption about the LONGTEXT correspondence correct?

jmonin

jmonin

2010-12-16 03:53

reporter   ~0027615

You'll find attached my updated patch for Mantis 1.2.4. Hope it helps!

akit

akit

2011-05-24 06:04

reporter   ~0028827

After applying the patch for Mantis 1.2.4 and executing the database update above, I get the following warning in the login page:

APPLICATION WARNING #100: Configuration option 'custom_field_string' Not found

The patch seems to be working allright but I get this warning.

Should I add some configuration option in the config_inc.php?

vboctor

vboctor

2011-07-18 22:04

manager   ~0029192

I've attached an updated patch for Mantis 1.2.5 named 'mantis-1.2.5-textarea.patch'. This patch includes the following changes:

  1. Updated to work with 1.2.5.
  2. Fixed a bug where changes to the schema file were incorrect (had invalid table name) and caused a warning.
  3. Fixed a bug where the custom field validation was broken where it didn't enforce "required" flag on textarea fields.
mantisaccount

mantisaccount

2011-07-27 03:16

reporter   ~0029302

Last edited: 2011-07-27 05:13

I applied the patch "mantis-1.2.5-textarea.patch" to Mantis 1.2.5, and I added the table to the database (copy-pasted the SQL in the description). I added a new custom field of type "textarea".

When I create an issue, I get the following error:

APPLICATION ERROR 401
Database query failed. Error received from database was #1054: Unknown column 'text' in 'field list' for the query: SELECT text
FROM mantis_custom_field_string_table
WHERE field_id=? AND
bug_id=?.

Do I have to apply other patches as well, or should it work when I apply the "mantis-1.2.5-textarea.patch" patch and add the table to the database? Patching went OK btw, no errors or warnings at all...

vboctor

vboctor

2011-07-27 23:05

manager   ~0029307

@mantisaccount, you need to add the memo field to the table. If you logout, you will notice and have the admin/ folder available, you will notice that there is a schema out of date message. Once the schema is upgraded, your error should go away.

Notice that if you do a schema upgrade, future versions of MantisBT may be confused thinking that you applied schema step N, where N in the next version may be a different upgrade step than the memo field.

atrol

atrol

2011-07-28 02:27

developer   ~0029308

Reminder sent to: vboctor

Swapping database upgrades 184 and 185 in master and next branch should prevent breaking the upgrade.
If there are more users providing patches for 1.2.x with database schema changes this will not help.
I will get some fun in forum after releasing 1.3.x ...

mantisaccount

mantisaccount

2011-07-28 02:35

reporter   ~0029309

Last edited: 2011-07-28 03:49

Thank you for your quick answer. I won't risk any upgrade problems in the future, so i´ll skip this patch for now. I assume this textarea / memo issue will be implemented in future versions of Mantis, since lots and lots of users are needing this field? B.t.w. great work!!

@atrol: So if I understand correctly I can apply this patch without having problems with the next upgrade (theoretically), if no other schema-changing patches are applied? If so, I'll apply this patch immediately, since we need it asap :)

atrol

atrol

2011-07-28 04:23

developer   ~0029310

You will get problems the way it is at the moment.
You will not get problems if
a) the current implementation of the 1.3 upgrade will be changed the way I sent to vboctor and
b) there will be no other change in 1.3 that breakes the patch.

a) maybe will be done
b) is gambling because contributors to 1.3 can not take in consideration that their changes might break any unofficial patches

mantisaccount

mantisaccount

2011-07-28 04:27

reporter   ~0029311

Thank you for your answer. I'll wait until it's officially included in Mantis, I can't afford to get into trouble applying this patch...

ezraw

ezraw

2011-08-29 17:55

reporter   ~0029597

I ran the 1.2.5 patch against 1.2.7 and it worked nicely. Thank you.

Just posting here in the hopes that vbocter includes the changes noted in http://www.mantisbt.org/bugs/view.php?id=6626#c29310 in 1.3.

rombert

rombert

2011-09-23 05:20

reporter   ~0029854

I'm interested in seeing this included in 1.2.x . Are there any thoughts about the implications of the fixes suggested by @atrol in 0006626:0029308 ?

rombert

rombert

2011-09-26 08:56

reporter   ~0029864

See also https://github.com/mantisbt/mantisbt/pull/15 .

M.C.S.

M.C.S.

2012-10-25 04:45

reporter   ~0033306

push as a whole year passed now, and 1.3 still seems to be far away...

atrol

atrol

2012-10-25 06:16

developer   ~0033307

M.C.S., maybe you can invest some time resolving the blocking issues for 1.3 0014088
IMO this one is our show stopper at the moment 0014099

M.C.S.

M.C.S.

2012-10-25 06:39

reporter   ~0033309

Phew, I earn my money with writing Java EE software. With PHP I only had little contact, especially since I have to maintain several MantisBT installations for a business customer. I fear that my understanding of PHP is way too small to be helpful at bigger issues :-(

Please don't get my comments wrong, I understand that things need programmers with time and passion, and that especially time is the rarest part. I am glad that I partly understand how to use Git ;-)

chakra

chakra

2013-08-22 02:52

reporter   ~0037911

Last edited: 2013-08-25 21:42

Hi vboctor,
Thank you very much for the patch.
I have following problem using this patch:

The "Default Value" input field for "Textarea" custom field is still a textbox with max length=255. I guess this should be a textarea without any restriction on size.

If any one needs above behavior for "Default Value" "Textarea" custom field:
1.* Execute following SQL query :

alter table mantis_custom_field_table change default_value default_value longtext not null;

  1. Check the attached manage_custom_field_edit_page.php file & make changes accordingly
dregad

dregad

2013-08-26 06:03

developer   ~0037927

@chakra
Thanks for the update and fix. However, please note that this feature has been implemented in 1.3 (master) branch, so please provide your patch against the latest git trunk aswewill not back-port this to 1.2. Also, for security reasons we do not allow inline scripts anymore.

Related Changesets

MantisBT: master 839f1d68

2010-08-25 15:50

daryn


Details Diff
Fix 0006626 - Add text area custom field type. Add column to handle long
text input. If the custom field type is TEXTAREA values are inserted into
the text field. Otherwise they are inserted into the existing value field.
Filters for TEXTAREA custom fields are not populated with existing data. A
text box is provided and a LIKE query is performed.
Affected Issues
0006626
mod - lang/strings_english.txt Diff File
mod - core/cfdefs/cfdef_standard.php Diff File
mod - core/custom_field_api.php Diff File
mod - core/filter_api.php Diff File
mod - admin/schema.php Diff File
mod - config_defaults_inc.php Diff File
mod - core/constant_inc.php Diff File