} # 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->note)); # Allow plugins to validate/modify the update prior to it being committed. $t_updated_bug = event_signal('EVENT_UPDATE_BUG_DATA', $t_updated_bug, $t_existing_bug); # Commit the bug updates to the database. $t_text_field_update_required = $t_existing_bug->description !== $t_updated_bug->description || $t_existing_bug->additional_information !== $t_updated_bug->additional_information || $t_existing_bug->steps_to_reproduce !== $t_updated_bug->steps_to_reproduce; $t_updated_bug->update($t_text_field_update_required, true); # Update custom field values. foreach ($t_custom_fields_to_set as $t_custom_field_to_set) { custom_field_set_value($t_custom_field_to_set['id'], $f_bug_id, $t_custom_field_to_set['value']); } # Add a bug note if there is one. if ($t_bug_note->note || helper_duration_to_minutes($t_bug_note->time_tracking) > 0) { bugnote_add($f_bug_id, $t_bug_note->note, $t_bug_note->time_tracking, $t_bug_note->view_state == VS_PRIVATE, 0, '', null, false); } # Add a duplicate relationship if requested. if ($t_updated_bug->duplicate_id !== 0) { relationship_add($f_bug_id, $t_updated_bug->duplicate_id, BUG_DUPLICATE); history_log_event_special($f_bug_id, BUG_ADD_RELATIONSHIP, BUG_DUPLICATE, $t_updated_bug->duplicate_id); history_log_event_special($t_updated_bug->duplicate_id, BUG_ADD_RELATIONSHIP, BUG_HAS_DUPLICATE, $f_bug_id); if (user_exists($t_existing_bug->reporter_id)) { bug_monitor($f_bug_id, $t_existing_bug->reporter_id); } if (user_exists($t_existing_bug->handler_id)) { bug_monitor($f_bug_id, $t_existing_bug->handler_id); } bug_monitor_copy($f_bug_id, $t_updated_bug->duplicate_id); }
/** * Update the time_tracking field of the bugnote * @param int $p_bugnote_id bugnote id * @param string $p_time_tracking timetracking string (hh:mm format) * @return bool * @access public */ function bugnote_set_time_tracking($p_bugnote_id, $p_time_tracking) { $c_bugnote_id = db_prepare_int($p_bugnote_id); $c_bugnote_time_tracking = helper_duration_to_minutes($p_time_tracking); $t_bugnote_table = db_get_table('mantis_bugnote_table'); $query = "UPDATE {$t_bugnote_table}\n\t\t\t\tSET time_tracking = " . db_param() . "\n\t\t\t\tWHERE id=" . db_param(); db_query_bound($query, array($c_bugnote_time_tracking, $c_bugnote_id)); # db_query errors if there was a problem so: return true; }
/** * Update the time_tracking field of the bugnote * @param integer $p_bugnote_id A bugnote identifier. * @param string $p_time_tracking Timetracking string (hh:mm format). * @return void * @access public */ function bugnote_set_time_tracking($p_bugnote_id, $p_time_tracking) { $c_bugnote_time_tracking = helper_duration_to_minutes($p_time_tracking); $t_query = 'UPDATE {bugnote} SET time_tracking = ' . db_param() . ' WHERE id=' . db_param(); db_query($t_query, array($c_bugnote_time_tracking, $p_bugnote_id)); }