本文整理汇总了PHP中bugnote_add函数的典型用法代码示例。如果您正苦于以下问题:PHP bugnote_add函数的具体用法?PHP bugnote_add怎么用?PHP bugnote_add使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bugnote_add函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addBugNote
function addBugNote($p_bug_id, $p_user_id, $p_email, $p_privacy = true)
{
$t_note = $p_email['subject'];
$t_note .= '<br>';
$t_note .= $p_email['message'];
bugnote_add($p_bug_id, $t_note, '0:00', false, 0, '', $p_user_id, false);
}
示例2: custom_function_default_checkin
function custom_function_default_checkin($p_issue_id, $p_comment, $p_file, $p_new_version, $p_fixed)
{
if (bug_exists($p_issue_id)) {
history_log_event_special($p_issue_id, CHECKIN, $p_file, $p_new_version);
bugnote_add($p_issue_id, $p_comment, VS_PRIVATE == config_get('source_control_notes_view_status'));
$t_status = config_get('source_control_set_status_to');
if (OFF != $t_status && $p_fixed) {
bug_set_field($p_issue_id, 'status', $t_status);
bug_set_field($p_issue_id, 'resolution', config_get('source_control_set_resolution_to'));
}
}
}
示例3: relationship_add
# Add the relationship
relationship_add($t_bug_id, $f_master_bug_id, $f_rel_type);
# Add log line to the history (both issues)
history_log_event_special($f_master_bug_id, BUG_ADD_RELATIONSHIP, relationship_get_complementary_type($f_rel_type), $t_bug_id);
history_log_event_special($t_bug_id, BUG_ADD_RELATIONSHIP, $f_rel_type, $f_master_bug_id);
# Send the email notification
email_relationship_added($f_master_bug_id, $t_bug_id, relationship_get_complementary_type($f_rel_type));
# update relationship target bug last updated
bug_update_date($t_bug_id);
}
# copy notes from parent
if ($f_copy_notes_from_parent) {
$t_parent_bugnotes = bugnote_get_all_bugnotes($f_master_bug_id);
foreach ($t_parent_bugnotes as $t_parent_bugnote) {
$t_private = $t_parent_bugnote->view_state == VS_PRIVATE;
bugnote_add($t_bug_id, $t_parent_bugnote->note, $t_parent_bugnote->time_tracking, $t_private, $t_parent_bugnote->note_type, $t_parent_bugnote->note_attr, $t_parent_bugnote->reporter_id, false, 0, 0, false);
# Note: we won't trigger mentions in the clone scenario.
}
}
# copy attachments from parent
if ($f_copy_attachments_from_parent) {
file_copy_attachments($f_master_bug_id, $t_bug_id);
}
}
helper_call_custom_function('issue_create_notify', array($t_bug_id));
# Allow plugins to post-process bug data with the new bug ID
event_signal('EVENT_REPORT_BUG', array($t_bug_data, $t_bug_id));
email_bug_added($t_bug_id);
# log status and resolution changes if they differ from the default
if ($t_bug_data->status != config_get('bug_submit_status')) {
history_log_event($t_bug_id, 'status', config_get('bug_submit_status'));
示例4: createBugNote
function createBugNote($p_story_id, $p_user_id, $p_note)
{
$id = bugnote_add($p_story_id, $p_note, null, false, 0, "", $p_user_id, null);
return $id;
}
示例5: bugnote_get_all_bugnotes
# update relationship target bug last updated
bug_update_date( $t_bug_id );
}
# copy notes from parent
if ( $f_copy_notes_from_parent ) {
$t_parent_bugnotes = bugnote_get_all_bugnotes( $f_master_bug_id );
foreach ( $t_parent_bugnotes as $t_parent_bugnote ) {
$t_private = $t_parent_bugnote->view_state == VS_PRIVATE;
bugnote_add( $t_bug_id, $t_parent_bugnote->note, $t_parent_bugnote->time_tracking,
$t_private, $t_parent_bugnote->note_type, $t_parent_bugnote->note_attr,
$t_parent_bugnote->reporter_id, /* send_email */ FALSE , /* date submitted */ 0,
/* date modified */ 0, /* log history */ FALSE);
}
}
# copy attachments from parent
if ( $f_copy_attachments_from_parent ) {
file_copy_attachments( $f_master_bug_id, $t_bug_id );
}
}
helper_call_custom_function( 'issue_create_notify', array( $t_bug_id ) );
# Allow plugins to post-process bug data with the new bug ID
event_signal( 'EVENT_REPORT_BUG', array( $t_bug_data, $t_bug_id ) );
示例6: helper_call_custom_function
# 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);
}
event_signal('EVENT_UPDATE_BUG', array($t_existing_bug, $t_updated_bug));
示例7: form_security_validate
/**
* MantisBT Core API's
*/
require_once 'core.php';
require_once 'bug_api.php';
require_once 'bugnote_api.php';
form_security_validate('bugnote_add');
$f_bug_id = gpc_get_int('bug_id');
$f_private = gpc_get_bool('private');
$f_time_tracking = gpc_get_string('time_tracking', '0:00');
$f_bugnote_text = trim(gpc_get_string('bugnote_text', ''));
$t_bug = bug_get($f_bug_id, true);
if ($t_bug->project_id != helper_get_current_project()) {
# in case the current project is not the same project of the bug we are viewing...
# ... override the current project. This to avoid problems with categories and handlers lists etc.
$g_project_override = $t_bug->project_id;
}
if (bug_is_readonly($f_bug_id)) {
error_parameters($f_bug_id);
trigger_error(ERROR_BUG_READ_ONLY_ACTION_DENIED, ERROR);
}
access_ensure_bug_level(config_get('add_bugnote_threshold'), $f_bug_id);
// 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($f_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);
}
form_security_purge('bugnote_add');
print_successful_redirect_to_bug($f_bug_id);
示例8: process
//.........这里部分代码省略.........
$t_custom_fields[++$i] = new stdClass();
}
switch ($reader->localName) {
default:
$field = $reader->localName;
$reader->read();
$t_custom_fields[$i]->{$field} = $reader->value;
}
}
}
break;
case 'bugnotes':
// store bug notes
$i = -1;
$depth_bn = $reader->depth;
while ($reader->read() && ($reader->depth > $depth_bn || $reader->nodeType != XMLReader::END_ELEMENT)) {
if ($reader->nodeType == XMLReader::ELEMENT) {
if ($reader->localName == 'bugnote') {
$t_bugnotes[++$i] = new stdClass();
}
switch ($reader->localName) {
case 'reporter':
$t_old_id = $reader->getAttribute('id');
$reader->read();
$t_bugnotes[$i]->reporter_id = $this->get_user_id($reader->value, $userId);
break;
case 'view_state':
$t_old_id = $reader->getAttribute('id');
$reader->read();
$t_bugnotes[$i]->private = $reader->value == VS_PRIVATE ? true : false;
break;
default:
$field = $reader->localName;
$reader->read();
$t_bugnotes[$i]->{$field} = $reader->value;
}
}
}
break;
case 'attachments':
// store attachments
$i = -1;
$depth_att = $reader->depth;
while ($reader->read() && ($reader->depth > $depth_att || $reader->nodeType != XMLReader::END_ELEMENT)) {
if ($reader->nodeType == XMLReader::ELEMENT) {
if ($reader->localName == 'attachment') {
$t_attachments[++$i] = new stdClass();
}
switch ($reader->localName) {
default:
$field = $reader->localName;
$reader->read();
$t_attachments[$i]->{$field} = $reader->value;
}
}
}
break;
default:
$field = $reader->localName;
//echo "using default handler for field: $field\n";
$reader->read();
$this->newbug_->{$field} = $reader->value;
}
}
}
// now save the new bug
$this->new_id_ = $this->newbug_->create();
// add custom fields
if ($this->new_id_ > 0 && is_array($t_custom_fields) && count($t_custom_fields) > 0) {
foreach ($t_custom_fields as $t_custom_field) {
$t_custom_field_id = custom_field_get_id_from_name($t_custom_field->name);
if (custom_field_ensure_exists($t_custom_field_id) && custom_field_is_linked($t_custom_field_id, $t_project_id)) {
custom_field_set_value($t_custom_field->id, $this->new_id_, $t_custom_field->value);
} else {
error_parameters($t_custom_field->name, $t_custom_field_id);
trigger_error(ERROR_CUSTOM_FIELD_NOT_LINKED_TO_PROJECT, ERROR);
}
}
}
// add bugnotes
if ($this->new_id_ > 0 && is_array($t_bugnotes) && count($t_bugnotes) > 0) {
foreach ($t_bugnotes as $t_bugnote) {
bugnote_add($this->new_id_, $t_bugnote->note, $t_bugnote->time_tracking, $t_bugnote->private, $t_bugnote->note_type, $t_bugnote->note_attr, $t_bugnote->reporter_id, false, $t_bugnote->date_submitted, $t_bugnote->last_modified, true);
}
}
// add attachments
if ($this->new_id_ > 0 && is_array($t_attachments) && count($t_attachments) > 0) {
foreach ($t_attachments as $t_attachment) {
// Create a temporary file in the temporary files directory using sys_get_temp_dir()
$temp_file_name = tempnam(sys_get_temp_dir(), 'MantisImport');
file_put_contents($temp_file_name, base64_decode($t_attachment->content));
$file_data = array('name' => $t_attachment->filename, 'type' => $t_attachment->file_type, 'tmp_name' => $temp_file_name, 'size' => filesize($temp_file_name), 'error' => UPLOAD_ERR_OK);
// unfortunately we have no clue who has added the attachment (this could only be fetched from history -> feel free to implement this)
// also I have no clue where description should come from...
file_add($this->new_id_, $file_data, 'bug', $t_attachment->title, $p_desc = '', $p_user_id = null, $t_attachment->date_added, true);
unlink($temp_file_name);
}
}
//echo "\nnew bug: $this->new_id_\n";
}
示例9: bug_close
# bug_close updates the status and bugnote and sends message
bug_close($f_bug_id, $f_bugnote_text, $f_private, $f_time_tracking);
$t_notify = false;
$t_bug_note_set = true;
break;
case config_get('bug_reopen_status'):
if ($t_old_bug_status >= $t_resolved) {
bug_set_field($f_bug_id, 'handler_id', $t_bug_data->handler_id);
# fix: update handler_id before calling bug_reopen
# bug_reopen updates the status and bugnote and sends message
bug_reopen($f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private);
$t_notify = false;
$t_bug_note_set = true;
// update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
// in bug_update() call below.
$t_bug_data->status = bug_get_field($f_bug_id, 'status');
$t_bug_data->resolution = bug_get_field($f_bug_id, 'resolution');
break;
}
# else fall through to default
}
}
# Add a bugnote if there is one
if (!$t_bug_note_set) {
bugnote_add($f_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, 0, '', NULL, FALSE);
}
# Update the bug entry, notify if we haven't done so already
bug_update($f_bug_id, $t_bug_data, true, false == $t_notify);
form_security_purge('bug_update');
helper_call_custom_function('issue_update_notify', array($f_bug_id));
print_successful_redirect_to_bug($f_bug_id);
示例10: post
public function post($request)
{
/**
* Creates a new bugnote.
*
* Sets the location header and returns the main URL of the created resource,
* as RFC2616 says we SHOULD.
*
* @param $request - The Request we're responding to
*/
$this->bug_id = BugnoteList::get_bug_id_from_url($request->url);
if (!access_has_bug_level(config_get('add_bugnote_threshold'), $this->bug_id)) {
throw new HTTPException(403, "Access denied to add bugnote");
}
if (bug_is_readonly($this->bug_id)) {
throw new HTTPException(500, "Cannot add a bugnote to a read-only bug");
}
$new_note = new Bugnote();
$new_note->populate_from_repr($request->body);
$bugnote_added = bugnote_add($this->bug_id, $new_note->mantis_data['note'], '0:00', $new_note->mantis_data['view_state'] == VS_PRIVATE);
if ($bugnote_added) {
$bugnote_added_url = Bugnote::get_url_from_mantis_id($bugnote_added);
$this->rsrc_data = $bugnote_added_url;
$resp = new Response();
$resp->headers[] = "location: {$bugnote_added_url}";
$resp->status = 201;
$resp->body = json_encode($bugnote_added_url);
return $resp;
} else {
throw new HTTPException(500, "Couldn't create bugnote");
}
}
示例11: copyUserStory
function copyUserStory($us_id, $status, $sprintname)
{
global $agilemantis_pb;
global $agilemantis_tasks;
global $agilemantis_sprint;
$new_bug_id = bug_copy($us_id, null, true, true, false, true, true, true);
$agilemantis_pb->doUserStoryToSprint($new_bug_id, $sprintname);
relationship_add($new_bug_id, $us_id, 0);
$task = $agilemantis_sprint->getSprintTasks($us_id);
$agilemantis_sprint->sprint_id = $sprintname;
$sprintinfo = $agilemantis_sprint->getSprintById();
$old_userstory = $agilemantis_pb->checkForUserStory($us_id);
$agilemantis_pb->addStoryPoints($new_bug_id, $old_userstory['storypoints']);
$agilemantis_pb->addBusinessValue($new_bug_id, $old_userstory['businessValue']);
$agilemantis_pb->addRankingOrder($new_bug_id, $old_userstory['rankingorder']);
$agilemantis_pb->addTechnical($new_bug_id, $old_userstory['technical']);
$agilemantis_pb->addPresentable($new_bug_id, $old_userstory['presentable']);
$agilemantis_pb->AddInReleaseDocu($new_bug_id, $old_userstory['inReleaseDocu']);
$agilemantis_pb->AddPlannedWork($new_bug_id, $old_userstory['plannedWork']);
history_delete($new_bug_id);
$bugnote_text_new = plugin_lang_get('divide_userstories_from') . $agilemantis_pb->getUserName(auth_get_current_user_id()) . plugin_lang_get('divide_userstories_of') . ' #' . $us_id . plugin_lang_get('divide_userstories_splitted');
$bugnote_text_old = plugin_lang_get('divide_userstories_from') . $agilemantis_pb->getUserName(auth_get_current_user_id()) . plugin_lang_get('divide_userstories_from') . ', #' . $new_bug_id . plugin_lang_get('divide_userstories_splitted');
$agilemantis_sprint->sprint_id = $old_userstory['sprint'];
$sprintinfo = $agilemantis_sprint->getSprintById();
$userstory_performed = false;
$wmu = 0;
$spmu = 0;
if (!empty($task)) {
foreach ($task as $key => $value) {
if ($value['performed_capacity'] > 0 || $value['status'] >= 4) {
$userstory_performed = true;
}
if ($value['status'] < 4) {
$agilemantis_tasks->user_id = auth_get_current_user_id();
$agilemantis_tasks->name = $value['name'];
$agilemantis_tasks->us_id = $value['us_id'];
$agilemantis_tasks->description = $value['description'];
$agilemantis_tasks->developer = $value['developer_id'];
$agilemantis_tasks->status = 5;
$agilemantis_tasks->capacity = $value['performed_capacity'];
$agilemantis_tasks->planned_capacity = $value['planned_capacity'];
$agilemantis_tasks->rest_capacity = 0;
$agilemantis_tasks->id = $value['id'];
$agilemantis_tasks->unit = $value['unit'];
$agilemantis_tasks->editTask();
$agilemantis_tasks->saveDailyPerformance(0);
$agilemantis_tasks->id = 0;
$agilemantis_tasks->name = $value['name'];
$agilemantis_tasks->us_id = $new_bug_id;
$agilemantis_tasks->description = $value['description'];
$agilemantis_tasks->status = $value['status'];
if ($value['status'] == 3) {
$agilemantis_tasks->status = 2;
}
$agilemantis_tasks->developer = $value['developer_id'];
if ($agilemantis_sprint->getUnitId(plugin_config_get('gadiv_task_unit_mode')) != $sprintinfo['unit_planned_task']) {
$agilemantis_tasks->planned_capacity = 0;
$agilemantis_tasks->rest_capacity = 0;
} else {
$agilemantis_tasks->planned_capacity = $value['rest_capacity'];
$agilemantis_tasks->rest_capacity = $value['rest_capacity'];
}
$agilemantis_tasks->addFinishedNote($value['us_id'], $value['id'], auth_get_current_user_id());
$agilemantis_tasks->editTask();
$agilemantis_tasks->id = 0;
$agilemantis_tasks->updateTaskLog($value['id'], auth_get_current_user_id(), "closed");
$agilemantis_tasks->setTaskStatus($value['id'], 5);
$wmu += $value['rest_capacity'];
$new_storypoints += $value['performed_capacity'];
}
}
}
if ($sprintinfo['unit_planned_task'] == 3) {
$spmu = $wmu;
} else {
$spmu = 0;
}
# collect all user story splitting information and write these into database
$agilemantis_sprint->setSplittingInformation($us_id, $new_bug_id, $wmu, $spmu);
if ($userstory_performed === true) {
if ($sprintinfo['unit_planned_task'] < 3) {
$agilemantis_pb->addStoryPoints($new_bug_id, '');
} elseif ($sprintinfo['unit_planned_task'] == 3) {
$agilemantis_pb->addStoryPoints($new_bug_id, $old_userstory['storypoints'] - $new_storypoints);
}
$bugnote_text_new .= plugin_lang_get('divide_userstories_old_estimation') . " #" . $us_id . plugin_lang_get('divide_userstories_with') . $old_userstory['storypoints'] . " SP.";
bugnote_add($new_bug_id, $bugnote_text_new);
}
# add bug note
bugnote_add($us_id, $bugnote_text_old);
$agilemantis_tasks->setUserStoryStatus($us_id, $status, auth_get_current_user_id());
$agilemantis_tasks->closeUserStory($us_id, $status, auth_get_current_user_id());
bug_update_date($us_id);
}
示例12: email_bug_reminder
}
}
$result = email_bug_reminder( $f_to, $f_bug_id, $f_body );
# Add reminder as bugnote if store reminders option is ON.
if ( ON == config_get( 'store_reminders' ) ) {
if ( count( $f_to ) > 50 ) { # too many recipients to log, truncate the list
$t_to = array();
for ( $i=0; $i<50; $i++ ) {
$t_to[] = $f_to[$i];
}
$f_to = $t_to;
}
$t_attr = '|' . implode( '|', $f_to ) . '|';
bugnote_add( $f_bug_id, $f_body, 0, config_get( 'default_reminder_view_status' ) == VS_PRIVATE, REMINDER, $t_attr, NULL, FALSE );
}
form_security_purge( 'bug_reminder' );
html_page_top( null, string_get_bug_view_url( $f_bug_id ) );
?>
<br />
<div>
<?php
echo lang_get( 'operation_successful' ).'<br />';
print_bracket_link( string_get_bug_view_url( $f_bug_id ), lang_get( 'proceed' ) );
?>
</div>
<?php
html_page_bottom();
示例13: mc_issue_note_add
/**
* Add a note to an existing issue.
*
* @param string $p_username The name of the user trying to add a note to an issue.
* @param string $p_password The password of the user.
* @param integer $p_issue_id The id of the issue to add the note to.
* @param IssueNoteData $p_note The note to add.
* @return integer The id of the added note.
*/
function mc_issue_note_add($p_username, $p_password, $p_issue_id, $p_note)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return new soap_fault('Client', '', 'Access Denied');
}
if ((int) $p_issue_id < 1) {
return new soap_fault('Client', '', "Invalid issue id '{$p_issue_id}'.");
}
if (!bug_exists($p_issue_id)) {
return new soap_fault('Client', '', "Issue '{$p_issue_id}' does not exist");
}
$t_project_id = bug_get_field($p_issue_id, 'project_id');
if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
return new soap_fault('Client', '', 'Access Denied');
}
if (!access_has_bug_level(config_get('add_bugnote_threshold'), $p_issue_id, $t_user_id)) {
return new soap_fault('Client', '', "User '{$t_user_id}' does not have access right to add notes to this issue.");
}
if (bug_is_readonly($p_issue_id)) {
return new soap_fault('Client', '', "Issue '{$p_issue_id}' is readonly.");
}
if (isset($p_note['view_state'])) {
$t_view_state = $p_note['view_state'];
} else {
$t_view_state = array('id' => config_get('default_bug_view_status'));
}
$t_view_state_id = mci_get_enum_id_from_objectref('view_state', $t_view_state);
return bugnote_add($p_issue_id, $p_note['text'], '0:00', $t_view_state_id == VS_PRIVATE, BUGNOTE, '', $t_user_id);
}
示例14: kanban_ajax_request_bug_update_status
//.........这里部分代码省略.........
$t_bug_data->steps_to_reproduce = gpc_get_string('steps_to_reproduce', $t_bug_data->steps_to_reproduce);
$t_bug_data->additional_information = gpc_get_string('additional_information', $t_bug_data->additional_information);
$f_private = gpc_get_bool('private');
$f_bugnote_text = gpc_get_string('bugnote_text', '');
$f_time_tracking = gpc_get_string('time_tracking', '0:00');
$f_close_now = gpc_get_string('close_now', false);
# Handle auto-assigning
if (config_get('bug_submit_status') == $t_bug_data->status && $t_bug_data->status == $t_old_bug_status && 0 != $t_bug_data->handler_id && ON == config_get('auto_set_status_to_assigned')) {
$t_bug_data->status = config_get('bug_assigned_status');
}
helper_call_custom_function('issue_update_validate', array($c_bug_id, $t_bug_data, $f_bugnote_text));
$t_resolved = config_get('bug_resolved_status_threshold');
$t_closed = config_get('bug_closed_status_threshold');
$t_custom_status_label = "update";
# default info to check
if ($t_bug_data->status == $t_resolved) {
$t_custom_status_label = "resolved";
}
if ($t_bug_data->status == $t_closed) {
$t_custom_status_label = "closed";
}
$t_related_custom_field_ids = custom_field_get_linked_ids($t_bug_data->project_id);
foreach ($t_related_custom_field_ids as $t_id) {
$t_def = custom_field_get_definition($t_id);
# Only update the field if it would have been display for editing
if (!(!$f_update_mode && $t_def['require_' . $t_custom_status_label] || !$f_update_mode && $t_def['display_' . $t_custom_status_label] && in_array($t_custom_status_label, array("resolved", "closed")) || $f_update_mode && $t_def['display_update'] || $f_update_mode && $t_def['require_update'])) {
continue;
}
# Do not set custom field value if user has no write access.
if (!custom_field_has_write_access($t_id, $c_bug_id)) {
continue;
}
if ($t_def['require_' . $t_custom_status_label] && !gpc_isset_custom_field($t_id, $t_def['type'])) {
error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
# Only update the field if it is posted,
# or if it is empty, and the current value isn't the default
if (!gpc_isset_custom_field($t_id, $t_def['type']) && custom_field_get_value($t_id, $c_bug_id) == $t_def['default_value']) {
continue;
}
if (!custom_field_set_value($t_id, $c_bug_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], NULL))) {
error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
log_event(LOG_AJAX, "Error setting new status: " . ERROR_CUSTOM_FIELD_INVALID_VALUE . "\nBugdata: " . print_r($t_bug_data, true) . " Line: " . __LINE__);
trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
}
}
$t_notify = true;
$t_bug_note_set = false;
if ($t_old_bug_status != $t_bug_data->status && FALSE == $f_update_mode) {
# handle status transitions that come from pages other than bug_*update_page.php
# this does the minimum to act on the bug and sends a specific message
if ($t_bug_data->status >= $t_resolved && $t_bug_data->status < $t_closed && $t_old_bug_status < $t_resolved) {
# bug_resolve updates the status, fixed_in_version, resolution, handler_id and bugnote and sends message
bug_resolve($c_bug_id, $t_bug_data->resolution, $t_bug_data->fixed_in_version, $f_bugnote_text, $t_bug_data->duplicate_id, $t_bug_data->handler_id, $f_private, $f_time_tracking);
$t_notify = false;
$t_bug_note_set = true;
if ($f_close_now) {
bug_set_field($c_bug_id, 'status', $t_closed);
}
// update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
// in bug_update() call below.
$t_bug_data->handler_id = bug_get_field($c_bug_id, 'handler_id');
$t_bug_data->status = bug_get_field($c_bug_id, 'status');
} else {
if ($t_bug_data->status >= $t_closed && $t_old_bug_status < $t_closed) {
# bug_close updates the status and bugnote and sends message
bug_close($c_bug_id, $f_bugnote_text, $f_private, $f_time_tracking);
$t_notify = false;
$t_bug_note_set = true;
} else {
if ($t_bug_data->status == config_get('bug_reopen_status') && $t_old_bug_status >= $t_resolved) {
bug_set_field($c_bug_id, 'handler_id', $t_bug_data->handler_id);
# fix: update handler_id before calling bug_reopen
# bug_reopen updates the status and bugnote and sends message
bug_reopen($c_bug_id, $f_bugnote_text, $f_time_tracking, $f_private);
$t_notify = false;
$t_bug_note_set = true;
// update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
// in bug_update() call below.
$t_bug_data->status = bug_get_field($c_bug_id, 'status');
$t_bug_data->resolution = bug_get_field($c_bug_id, 'resolution');
}
}
}
}
# Plugin support
$t_new_bug_data = event_signal('EVENT_UPDATE_BUG', $t_bug_data, $c_bug_id);
if (!is_null($t_new_bug_data)) {
$t_bug_data = $t_new_bug_data;
}
# Add a bugnote if there is one
if (false == $t_bug_note_set) {
bugnote_add($c_bug_id, $f_bugnote_text, $f_time_tracking, $f_private, 0, '', NULL, FALSE);
}
# Update the bug entry, notify if we haven't done so already
$t_bug_data->update(true, false == $t_notify);
helper_call_custom_function('issue_update_notify', array($c_bug_id));
return true;
}
示例15: bug_close
case CLOSED:
# bug_close updates the status and bugnote and sends message
bug_close($f_bug_id, $f_bugnote_text, $f_private);
$t_notify = false;
$t_bug_note_set = true;
break;
case config_get('bug_reopen_status'):
if ($t_old_bug_status >= $t_resolved) {
bug_set_field($f_bug_id, 'handler_id', $t_bug_data->handler_id);
# fix: update handler_id before calling bug_reopen
# bug_reopen updates the status and bugnote and sends message
bug_reopen($f_bug_id, $f_bugnote_text, $f_private);
$t_notify = false;
$t_bug_note_set = true;
// update bug data with fields that may be updated inside bug_resolve(), otherwise changes will be overwritten
// in bug_update() call below.
$t_bug_data->status = bug_get_field($f_bug_id, 'status');
$t_bug_data->resolution = bug_get_field($f_bug_id, 'resolution');
break;
}
# else fall through to default
}
}
# Add a bugnote if there is one
if (!is_blank($f_bugnote_text) && false == $t_bug_note_set) {
bugnote_add($f_bug_id, $f_bugnote_text, $f_private);
}
# Update the bug entry, notify if we haven't done so already
bug_update($f_bug_id, $t_bug_data, true, false == $t_notify);
helper_call_custom_function('issue_update_notify', array($f_bug_id));
print_successful_redirect_to_bug($f_bug_id);