View Issue Details

IDProjectCategoryView StatusLast Update
0005942mantisbtcustomizationpublic2019-01-10 02:34
ReporterselenaAssigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
Product Version1.0.0a3 
Target VersionFixed in Version 
Summary0005942: string_custom_field_value - custom function
Description

It would be nice to override custom field display in view.php. I specifically want to use this to perform calculations on required custom fields.

To do this, I modified print_custom_field_value in core/custom_field_api.php and declared 'custom_function_default_string_custom_field_value' in core/custom_function_api.php

Any feedback on whether this is the correct place to do this type of modification? Or is there an easier/better way to do this?

TagsNo tags attached.

Relationships

has duplicate 0025181 closeddregad string_custom_field_value function can pass p_bug_id as parameter 

Activities

2005-07-14 21:34

 

custom_field_api.php.diff (715 bytes)
--- custom_field_api.php-orig	Thu Jul 14 18:31:43 2005
+++ custom_field_api.php	Thu Jul 14 17:54:37 2005
@@ -1248,7 +1248,12 @@
 	# $p_bug_id		contains the bug id to display the custom field value for
 	# NOTE: This probably belongs in the print_api.php
 	function print_custom_field_value( $p_def, $p_field_id, $p_bug_id ) {
-		echo string_custom_field_value( $p_def, $p_field_id, $p_bug_id );
+		$t_custom_field_value = helper_call_custom_function( 'string_custom_field_value', array( $p_def, $p_field_id, $p_bug_id ) );
+		if ( empty ($t_custom_field_value) ) {
+			echo string_custom_field_value( $p_def, $p_field_id, $p_bug_id );
+		} else {
+			echo $t_custom_field_value;
+		}
 	}
 
 	# --------------------

2005-07-14 21:42

 

custom_function_api.php.diff (425 bytes)
--- custom_function_api.php-orig	Thu Jul 14 18:30:37 2005
+++ custom_function_api.php	Thu Jul 14 17:07:11 2005
@@ -15,6 +15,10 @@
 
 	### Custom Function API ###
 
+	# customizing a custom field
+	function custom_function_default_string_custom_field_value( $p_def, $p_field_id, $p_bug_id ) {
+	}
+
 	# --------------------
 	# Checks the provided bug and determines whether it should be included in the changelog
 	# or not.
smartmantis

smartmantis

2011-09-26 09:30

reporter   ~0029865

This customization way can be fine, we had nearly the same issue.
We need a runtime auto generated custom field in the bug view page.

Our solution was:
We create a new custom field type without any core modification. But to show the value we must modify only one core line:

core/custom_field_api.php:1453: function string_custom_field_value...
original was:
return call_user_func( $g_custom_field_type_definition[$p_def['type']]['#function_string_value'], $t_custom_field_value );
new line:
return call_user_func( $g_custom_field_type_definition[$p_def['type']]['#function_string_value'], $t_custom_field_value , $p_bug_id);

we need the bug id for the custom field calculations, so maybe in the $g_custom_field_type_definition we can define #function_string_value_parameter or something like that can be a perfect solution.

smartmantis

smartmantis

2019-01-09 11:27

reporter   ~0061173

ok, you closed the new issue but i think we can upgrade the product version
Product Version 1.0.0a3 --> 2.19

other hand it will be never resolved.

thank you

dregad

dregad

2019-01-10 02:34

developer   ~0061183

@smartmantis Product version represents the release in which the problem was reported / observed. It has nothing to do with if or when it would eventuelly be resolved.

Issue History

Date Modified Username Field Change
2005-07-14 21:34 selena New Issue
2005-07-14 21:34 selena File Added: custom_field_api.php.diff
2005-07-14 21:42 selena File Added: custom_function_api.php.diff
2005-07-16 09:39 grangeway Assigned To => grangeway
2011-09-26 09:30 smartmantis Note Added: 0029865
2014-11-07 15:44 atrol Assigned To grangeway =>
2019-01-09 09:18 dregad Relationship added has duplicate 0025181
2019-01-09 11:27 smartmantis Note Added: 0061173
2019-01-10 02:34 dregad Note Added: 0061183