} # Handle the file upload if ($f_files !== null) { if (!file_allow_bug_upload($f_bug_id)) { access_denied(); } file_process_posted_files_for_bug($f_bug_id, $f_files); } # We always set the note time to BUGNOTE, and the API will overwrite it with TIME_TRACKING # if $f_time_tracking is not 0 and the time tracking feature is enabled. $t_bugnote_id = bugnote_add($t_bug->id, $f_bugnote_text, $f_time_tracking, $f_private, BUGNOTE); if (!$t_bugnote_id) { error_parameters(lang_get('bugnote')); trigger_error(ERROR_EMPTY_FIELD, ERROR); } # Process the mentions in the added note bugnote_process_mentions($t_bug->id, $t_bugnote_id, $f_bugnote_text); # Handle the reassign on feedback feature. Note that this feature generally # won't work very well with custom workflows as it makes a lot of assumptions # that may not be true. It assumes you don't have any statuses in the workflow # between 'bug_submit_status' and 'bug_feedback_status'. It assumes you only # have one feedback, assigned and submitted status. if (config_get('reassign_on_feedback') && $t_bug->status === config_get('bug_feedback_status') && $t_bug->handler_id !== auth_get_current_user_id() && $t_bug->reporter_id === auth_get_current_user_id()) { if ($t_bug->handler_id !== NO_USER) { bug_set_field($t_bug->id, 'status', config_get('bug_assigned_status')); } else { bug_set_field($t_bug->id, 'status', config_get('bug_submit_status')); } } form_security_purge('bugnote_add'); print_successful_redirect_to_bug($t_bug->id);
email_bug_updated($t_bug_id); helper_call_custom_function('issue_update_notify', array($t_bug_id)); } else { $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_access'); } break; case 'UP_STATUS': $f_status = gpc_get_int('status'); if (access_has_bug_level(access_get_status_threshold($f_status, $t_bug->project_id), $t_bug_id)) { if (true == bug_check_workflow($t_status, $f_status)) { # @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) ); bug_set_field($t_bug_id, 'status', $f_status); # Add bugnote if supplied if (!is_blank($f_bug_notetext)) { $t_bugnote_id = bugnote_add($t_bug_id, $f_bug_notetext, null, $f_bug_noteprivate); bugnote_process_mentions($t_bug_id, $t_bugnote_id, $f_bug_notetext); # No need to call email_generic(), bugnote_add() does it } else { email_bug_updated($t_bug_id); } helper_call_custom_function('issue_update_notify', array($t_bug_id)); } else { $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_status'); } } else { $t_failed_ids[$t_bug_id] = lang_get('bug_actiongroup_access'); } break; case 'UP_CATEGORY': $f_category_id = gpc_get_int('category'); if (access_has_bug_level(config_get('update_bug_threshold'), $t_bug_id)) {
# 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) { $t_bugnote_id = bugnote_add($f_bug_id, $t_bug_note->note, $t_bug_note->time_tracking, $t_bug_note->view_state == VS_PRIVATE, 0, '', null, false); bugnote_process_mentions($f_bug_id, $t_bugnote_id, $t_bug_note->note); } # 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); } event_signal('EVENT_UPDATE_BUG', array($t_existing_bug, $t_updated_bug));
/** * Executes the custom action on the specified bug id. * * @param integer $p_bug_id The bug id to execute the custom action on. * @return null Previous validation ensures that this function doesn't fail. Therefore we can always return null to indicate no errors occurred. */ function action_add_note_process($p_bug_id) { $f_bugnote_text = gpc_get_string('bugnote_text'); $f_view_state = gpc_get_int('view_state'); $t_bugnote_id = bugnote_add($p_bug_id, $f_bugnote_text, '0:00', $f_view_state != VS_PUBLIC); bugnote_process_mentions($p_bug_id, $t_bugnote_id, $f_bugnote_text); return null; }
/** * reopen the given bug * @param integer $p_bug_id A bug identifier. * @param string $p_bugnote_text The bugnote text. * @param string $p_time_tracking Time tracking value. * @param boolean $p_bugnote_private Whether this is a private bugnote. * @return boolean (always true) * @access public * @uses database_api.php * @uses email_api.php * @uses bugnote_api.php * @uses config_api.php */ function bug_reopen($p_bug_id, $p_bugnote_text = '', $p_time_tracking = '0:00', $p_bugnote_private = false) { $p_bugnote_text = trim($p_bugnote_text); # Add bugnote if supplied # Moved bugnote_add before bug_set_field calls in case time_tracking_no_note is off. # Error condition stopped execution but status had already been changed $t_bugnote_id = bugnote_add($p_bug_id, $p_bugnote_text, $p_time_tracking, $p_bugnote_private, 0, '', null, false); bugnote_process_mentions($p_bug_id, $t_bugnote_id, $p_bugnote_text); bug_set_field($p_bug_id, 'status', config_get('bug_reopen_status')); bug_set_field($p_bug_id, 'resolution', config_get('bug_reopen_resolution')); email_bug_reopened($p_bug_id); return true; }