View Issue Details

IDProjectCategoryView StatusLast Update
0005942mantisbtcustomizationpublic2019-01-10 02:34
Reporterselena Assigned To 
PrioritynormalSeverityminorReproducibilityN/A
Status newResolutionopen 
Product Version1.0.0a3 
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.
Attached Files
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;
+		}
 	}
 
 	# --------------------
custom_field_api.php.diff (715 bytes)   
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.

Relationships

has duplicate 0025181 closeddregad string_custom_field_value function can pass p_bug_id as parameter 

Activities

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.