Time_tracking required custom function

Post about your customizations to share with others.

Moderators: Contributor, Developer

Post Reply
bentobox
Posts: 1
Joined: Mar 28, 2019 12:25 pm

Time_tracking required custom function

Post by bentobox » Mar 28, 2019 12:29 pm

Hi, I wanted to share if anyone else needed or propose a change to custom function.

I ran into a issue where I needed my developers to make sure they used the time tracking function, the following changes were required.

bug_update.php

# Allow a custom function to validate the proposed bug updates. Note that
# custom functions are being deprecated in MantisBT. You should migrate to
# the new plugin system instead.
helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_updated_bug, $t_bug_note ) );

Previously
helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_updated_bug, $t_bug_note->note ) );

custom function
custom_functions_inc.php
function custom_function_override_issue_update_validate( $p_issue_id, $p_bug_data, $p_bugnote) {
if( $p_bug_data->status == CLOSED ) {
if ( helper_duration_to_minutes( $p_bugnote->time_tracking ) == 0 ) {
error_parameters( 'time tracking = 0 ' );
trigger_error( ERROR_VALIDATE_FAILURE, ERROR );
}
}
}


Please note this change allows access to t_bug_note variable which previously did not have full access to this variable and only the text.

Post Reply