本文整理汇总了PHP中bug_update_date函数的典型用法代码示例。如果您正苦于以下问题:PHP bug_update_date函数的具体用法?PHP bug_update_date怎么用?PHP bug_update_date使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了bug_update_date函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_bugs
/**
* Update changeset relations to affected bugs.
*/
function save_bugs($p_user_id = null)
{
$t_bug_table = plugin_table('bug', 'Source');
$this->bugs = array_unique($this->bugs);
$this->__bugs = array_unique($this->__bugs);
$t_bugs_added = array_unique(array_diff($this->bugs, $this->__bugs));
$t_bugs_deleted = array_unique(array_diff($this->__bugs, $this->bugs));
$this->load_repo();
$t_vcs = SourceVCS::repo($this->repo);
$t_user_id = (int) $p_user_id;
if ($t_user_id < 1) {
if ($this->committer_id > 0) {
$t_user_id = $this->committer_id;
} else {
if ($this->user_id > 0) {
$t_user_id = $this->user_id;
}
}
}
if (count($t_bugs_deleted)) {
$t_bugs_deleted_str = join(',', $t_bugs_deleted);
$t_query = "DELETE FROM {$t_bug_table} WHERE change_id=" . $this->id . " AND bug_id IN ( {$t_bugs_deleted_str} )";
db_query_bound($t_query);
foreach ($t_bugs_deleted as $t_bug_id) {
plugin_history_log($t_bug_id, 'changeset_removed', $this->repo->name . ' ' . $t_vcs->show_changeset($this->repo, $this), '', $t_user_id, 'Source');
bug_update_date($t_bug_id);
}
}
if (count($t_bugs_added) > 0) {
$t_query = "INSERT INTO {$t_bug_table} ( change_id, bug_id ) VALUES ";
$t_count = 0;
$t_params = array();
foreach ($t_bugs_added as $t_bug_id) {
$t_query .= ($t_count == 0 ? '' : ', ') . '(' . db_param() . ', ' . db_param() . ')';
$t_params[] = $this->id;
$t_params[] = $t_bug_id;
$t_count++;
}
db_query_bound($t_query, $t_params);
foreach ($t_bugs_added as $t_bug_id) {
plugin_history_log($t_bug_id, 'changeset_attached', '', $this->repo->name . ' ' . $t_vcs->show_changeset($this->repo, $this), $t_user_id, 'Source');
bug_update_date($t_bug_id);
}
}
}
示例2: bugnote_set_text
/**
* Set the bugnote text
* @param integer $p_bugnote_id A bugnote identifier.
* @param string $p_bugnote_text The bugnote text to set.
* @return boolean
* @access public
*/
function bugnote_set_text($p_bugnote_id, $p_bugnote_text)
{
$t_old_text = bugnote_get_text($p_bugnote_id);
if ($t_old_text == $p_bugnote_text) {
return true;
}
# MySQL 4-bytes UTF-8 chars workaround #21101
$p_bugnote_text = db_mysql_fix_utf8($p_bugnote_text);
$t_bug_id = bugnote_get_field($p_bugnote_id, 'bug_id');
$t_bugnote_text_id = bugnote_get_field($p_bugnote_id, 'bugnote_text_id');
# insert an 'original' revision if needed
if (bug_revision_count($t_bug_id, REV_BUGNOTE, $p_bugnote_id) < 1) {
$t_user_id = bugnote_get_field($p_bugnote_id, 'reporter_id');
$t_timestamp = bugnote_get_field($p_bugnote_id, 'last_modified');
bug_revision_add($t_bug_id, $t_user_id, REV_BUGNOTE, $t_old_text, $p_bugnote_id, $t_timestamp);
}
db_param_push();
$t_query = 'UPDATE {bugnote_text} SET note=' . db_param() . ' WHERE id=' . db_param();
db_query($t_query, array($p_bugnote_text, $t_bugnote_text_id));
# updated the last_updated date
bugnote_date_update($p_bugnote_id);
bug_update_date($t_bug_id);
# insert a new revision
$t_user_id = auth_get_current_user_id();
$t_revision_id = bug_revision_add($t_bug_id, $t_user_id, REV_BUGNOTE, $p_bugnote_text, $p_bugnote_id);
# log new bugnote
history_log_event_special($t_bug_id, BUGNOTE_UPDATED, bugnote_format_id($p_bugnote_id), $t_revision_id);
return true;
}
示例3: bugnote_set_text
/**
* Set the bugnote text
* @param int $p_bugnote_id bugnote id
* @param string $p_bugnote_text bugnote text
* @return bool
* @access public
*/
function bugnote_set_text($p_bugnote_id, $p_bugnote_text)
{
$t_old_text = bugnote_get_text($p_bugnote_id);
if ($t_old_text == $p_bugnote_text) {
return true;
}
$t_bug_id = bugnote_get_field($p_bugnote_id, 'bug_id');
$t_bugnote_text_id = bugnote_get_field($p_bugnote_id, 'bugnote_text_id');
$t_bugnote_text_table = db_get_table('mantis_bugnote_text_table');
# insert an 'original' revision if needed
if (bug_revision_count($t_bug_id, REV_BUGNOTE, $p_bugnote_id) < 1) {
$t_user_id = bugnote_get_field($p_bugnote_id, 'reporter_id');
$t_timestamp = bugnote_get_field($p_bugnote_id, 'last_modified');
bug_revision_add($t_bug_id, $t_user_id, REV_BUGNOTE, $t_old_text, $p_bugnote_id, $t_timestamp);
}
$query = "UPDATE {$t_bugnote_text_table}\n\t\t\tSET note=" . db_param() . " WHERE id=" . db_param();
db_query_bound($query, array($p_bugnote_text, $t_bugnote_text_id));
# updated the last_updated date
bugnote_date_update($p_bugnote_id);
bug_update_date($t_bug_id);
# insert a new revision
$t_user_id = auth_get_current_user_id();
$t_revision_id = bug_revision_add($t_bug_id, $t_user_id, REV_BUGNOTE, $p_bugnote_text, $p_bugnote_id);
# log new bugnote
history_log_event_special($t_bug_id, BUGNOTE_UPDATED, bugnote_format_id($p_bugnote_id), $t_revision_id);
return true;
}
示例4: helper_call_custom_function
# @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, 'sticky', intval(!$f_sticky));
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 'CUSTOM':
if (0 === $f_custom_field_id) {
trigger_error(ERROR_GENERIC, ERROR);
}
# @todo we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
$t_form_var = 'custom_field_' . $f_custom_field_id;
$t_custom_field_value = gpc_get_custom_field($t_form_var, $t_custom_field_def['type'], null);
custom_field_set_value($f_custom_field_id, $t_bug_id, $t_custom_field_value);
bug_update_date($t_bug_id);
email_bug_updated($t_bug_id);
helper_call_custom_function('issue_update_notify', array($t_bug_id));
break;
default:
trigger_error(ERROR_GENERIC, ERROR);
}
# Bug Action Event
event_signal('EVENT_BUG_ACTION', array($f_action, $t_bug_id));
}
form_security_purge($t_form_name);
$t_redirect_url = 'view_all_bug_page.php';
if (count($t_failed_ids) > 0) {
html_page_top();
echo '<div><br />';
echo '<table class="width75">';
示例5: relationship_get_linked_bug_id
# retrieve the destination bug of the relationship
$t_dest_bug_id = relationship_get_linked_bug_id($f_rel_id, $f_bug_id);
# user can access to the related bug at least as viewer, if it's exist...
if (bug_exists($t_dest_bug_id)) {
if (!access_has_bug_level(VIEWER, $t_dest_bug_id)) {
error_parameters($t_dest_bug_id);
trigger_error(ERROR_RELATIONSHIP_ACCESS_LEVEL_TO_DEST_BUG_TOO_LOW, ERROR);
}
}
helper_ensure_confirmed(lang_get('delete_relationship_sure_msg'), lang_get('delete_relationship_button'));
$t_bug_relationship_data = relationship_get($f_rel_id);
$t_rel_type = $t_bug_relationship_data->type;
# delete relationship from the DB
relationship_delete($f_rel_id);
# update bug last updated (just for the src bug)
bug_update_date($f_bug_id);
# set the rel_type for both bug and dest_bug based on $t_rel_type and on who is the dest bug
if ($f_bug_id == $t_bug_relationship_data->src_bug_id) {
$t_bug_rel_type = $t_rel_type;
$t_dest_bug_rel_type = relationship_get_complementary_type($t_rel_type);
} else {
$t_bug_rel_type = relationship_get_complementary_type($t_rel_type);
$t_dest_bug_rel_type = $t_rel_type;
}
# send email and update the history for the src issue
history_log_event_special($f_bug_id, BUG_DEL_RELATIONSHIP, $t_bug_rel_type, $t_dest_bug_id);
email_relationship_deleted($f_bug_id, $t_dest_bug_id, $t_bug_rel_type);
if (bug_exists($t_dest_bug_id)) {
# send email and update the history for the dest issue
history_log_event_special($t_dest_bug_id, BUG_DEL_RELATIONSHIP, $t_dest_bug_rel_type, $f_bug_id);
email_relationship_deleted($t_dest_bug_id, $f_bug_id, $t_dest_bug_rel_type);
示例6: mc_issue_relationship_delete
/**
* Delete the relationship with the specified target id.
*
* @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 source issue for the relationship.
* @param integer $p_relationship_id The id of relationship to delete.
* @return boolean true: success, false: failure
*/
function mc_issue_relationship_delete($p_username, $p_password, $p_issue_id, $p_relationship_id)
{
global $g_project_override;
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return mci_soap_fault_login_failed();
}
$t_project_id = bug_get_field($p_issue_id, 'project_id');
$g_project_override = $t_project_id;
if (!mci_has_readwrite_access($t_user_id, $t_project_id)) {
return mci_soap_fault_access_denied($t_user_id);
}
# user has access to update the bug...
if (!access_has_bug_level(config_get('update_bug_threshold'), $p_issue_id, $t_user_id)) {
return mci_soap_fault_access_denied($t_user_id, 'Active user does not have access level required to remove a relationship from this issue.');
}
# bug is not read-only...
if (bug_is_readonly($p_issue_id)) {
return mci_soap_fault_access_denied($t_user_id, 'Issue \'' . $p_issue_id . '\' is readonly.');
}
# retrieve the destination bug of the relationship
$t_dest_issue_id = relationship_get_linked_bug_id($p_relationship_id, $p_issue_id);
# user can access to the related bug at least as viewer, if it's exist...
if (bug_exists($t_dest_issue_id)) {
if (!access_has_bug_level(config_get('view_bug_threshold', null, null, $t_project_id), $t_dest_issue_id, $t_user_id)) {
return mci_soap_fault_access_denied($t_user_id, 'The issue \'' . $t_dest_issue_id . '\' requires higher access level.');
}
}
$t_bug_relationship_data = relationship_get($p_relationship_id);
$t_rel_type = $t_bug_relationship_data->type;
# delete relationship from the DB
log_event(LOG_WEBSERVICE, 'deleting relationship id \'' . $p_relationship_id . '\'');
relationship_delete($p_relationship_id);
# update bug last updated
bug_update_date($p_issue_id);
bug_update_date($t_dest_issue_id);
# set the rel_type for both bug and dest_bug based on $t_rel_type and on who is the dest bug
if ($p_issue_id == $t_bug_relationship_data->src_bug_id) {
$t_bug_rel_type = $t_rel_type;
$t_dest_bug_rel_type = relationship_get_complementary_type($t_rel_type);
} else {
$t_bug_rel_type = relationship_get_complementary_type($t_rel_type);
$t_dest_bug_rel_type = $t_rel_type;
}
# send email and update the history for the src issue
history_log_event_special($p_issue_id, BUG_DEL_RELATIONSHIP, $t_bug_rel_type, $t_dest_issue_id);
email_relationship_deleted($p_issue_id, $t_dest_issue_id, $t_bug_rel_type);
if (bug_exists($t_dest_issue_id)) {
# send email and update the history for the dest issue
history_log_event_special($t_dest_issue_id, BUG_DEL_RELATIONSHIP, $t_dest_bug_rel_type, $p_issue_id);
email_relationship_deleted($t_dest_issue_id, $p_issue_id, $t_dest_bug_rel_type);
}
return true;
}
示例7: mc_issue_relationship_delete
/**
* Delete the relationship with the specified target id.
*
* @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 source issue for the relationship
* @param integer $p_relationship_id The id of relationship to delete.
* @return true: success, false: failure
*/
function mc_issue_relationship_delete($p_username, $p_password, $p_issue_id, $p_relationship_id)
{
$t_user_id = mci_check_login($p_username, $p_password);
if ($t_user_id === false) {
return new soap_fault('Client', '', 'Access Denied');
}
$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');
}
# user has access to update the bug...
if (!access_has_bug_level(config_get('update_bug_threshold'), $p_issue_id, $t_user_id)) {
return new soap_fault('Client', '', "Active user does not have access level required to remove a relationship from this issue.");
}
# bug is not read-only...
if (bug_is_readonly($p_issue_id)) {
return new soap_fault('Client', '', "Issue '{$p_issue_id}' is readonly.");
}
# retrieve the destination bug of the relationship
$t_dest_issue_id = relationship_get_linked_bug_id($p_relationship_id, $p_issue_id);
# user can access to the related bug at least as viewer, if it's exist...
if (bug_exists($t_dest_issue_id)) {
if (!access_has_bug_level(VIEWER, $t_dest_issue_id, $t_user_id)) {
return new soap_fault('Client', '', "The issue '{$t_dest_issue_id}' requires higher access level.");
}
}
$t_bug_relationship_data = relationship_get($p_relationship_id);
$t_rel_type = $t_bug_relationship_data->type;
# delete relationship from the DB
relationship_delete($p_relationship_id);
# update bug last updated (just for the src bug)
bug_update_date($p_issue_id);
# set the rel_type for both bug and dest_bug based on $t_rel_type and on who is the dest bug
if ($p_issue_id == $t_bug_relationship_data->src_bug_id) {
$t_bug_rel_type = $t_rel_type;
$t_dest_bug_rel_type = relationship_get_complementary_type($t_rel_type);
} else {
$t_bug_rel_type = relationship_get_complementary_type($t_rel_type);
$t_dest_bug_rel_type = $t_rel_type;
}
# send email and update the history for the src issue
history_log_event_special($p_issue_id, BUG_DEL_RELATIONSHIP, $t_bug_rel_type, $t_dest_issue_id);
email_relationship_deleted($p_issue_id, $t_dest_issue_id, $t_bug_rel_type);
if (bug_exists($t_dest_issue_id)) {
# send email and update the history for the dest issue
history_log_event_special($t_dest_issue_id, BUG_DEL_RELATIONSHIP, $t_dest_bug_rel_type, $p_issue_id);
email_relationship_deleted($t_dest_issue_id, $p_issue_id, $t_dest_bug_rel_type);
}
return true;
}
示例8: tag_bug_detach
/**
* Detach a tag from a bug.
* @param integer Tag ID
* @param integer Bug ID
* @param boolean Add history entries to bug
* @param integer User Id (or null for current logged in user)
*/
function tag_bug_detach($p_tag_id, $p_bug_id, $p_add_history = true, $p_user_id = null)
{
if ($p_user_id === null) {
$t_user_id = auth_get_current_user_id();
} else {
$t_user_id = $p_user_id;
}
if (!tag_bug_is_attached($p_tag_id, $p_bug_id)) {
trigger_error(TAG_NOT_ATTACHED, ERROR);
}
$t_tag_row = tag_bug_get_row($p_tag_id, $p_bug_id);
if ($t_user_id == tag_get_field($p_tag_id, 'user_id') || $t_user_id == $t_tag_row['user_id']) {
$t_detach_level = config_get('tag_detach_own_threshold');
} else {
$t_detach_level = config_get('tag_detach_threshold');
}
access_ensure_bug_level($t_detach_level, $p_bug_id, $t_user_id);
$c_tag_id = db_prepare_int($p_tag_id);
$c_bug_id = db_prepare_int($p_bug_id);
$t_bug_tag_table = db_get_table('bug_tag');
$query = "DELETE FROM {$t_bug_tag_table}\n\t\t\t\t\tWHERE tag_id=" . db_param() . ' AND bug_id=' . db_param();
db_query_bound($query, array($c_tag_id, $c_bug_id));
if ($p_add_history) {
$t_tag_name = tag_get_field($p_tag_id, 'name');
history_log_event_special($p_bug_id, TAG_DETACHED, $t_tag_name);
}
# updated the last_updated date
bug_update_date($p_bug_id);
return true;
}
示例9: event_bug_action
function event_bug_action($p_event, $p_action, $p_bug_id)
{
global $agilemantis_pb;
global $agilemantis_commonlib;
global $agilemantis_sprint;
// Only projects with agilMantis backlog
if (!$agilemantis_commonlib->projectHasBacklogs(helper_get_current_project())) {
return;
}
$agilemantis_commonlib->getAdditionalProjectFields();
$t_custom_field_id = $_SESSION['custom_field_id'];
$pb_id = $agilemantis_commonlib->getProductBacklogIDByBugId($p_bug_id);
$list_sprints = $agilemantis_commonlib->getSprintsByBacklogId($pb_id);
$current_sprint = $agilemantis_commonlib->getSprintByBugId($p_bug_id);
$t_custom_field_value = $_SESSION['custom_field'][$p_bug_id];
if (!$t_custom_field_value) {
$t_custom_field_value = '';
}
$t_status = bug_get_field($p_bug_id, 'status');
# restore story points value
if ($t_custom_field_id == $agilemantis_commonlib->sp) {
if ($current_sprint[0]['status'] > 1 || $pb_id == 0 || $t_status >= 80) {
$agilemantis_commonlib->restoreCustomFieldValue($p_bug_id, $t_custom_field_id, $t_custom_field_value);
}
}
# restore product backlog value
if ($t_custom_field_id == $agilemantis_commonlib->pb) {
$pbl = $agilemantis_commonlib->getProjectProductBacklogs(helper_get_current_project());
$do_not_reset = false;
if (!empty($pbl)) {
foreach ($pbl as $key => $value) {
if ($value['pb_id'] == $pb_id) {
$do_not_reset = true;
}
}
}
$value_resettet = false;
if ($current_sprint[0]['name'] != '' || $pb_id == 0 || empty($pbl) || $do_not_reset == false) {
$agilemantis_commonlib->restoreCustomFieldValue($p_bug_id, $t_custom_field_id, $t_custom_field_value);
$value_resettet = true;
}
if (empty($t_custom_field_value) && $value_resettet == false) {
$agilemantis_commonlib->setTrackerStatus($p_bug_id, 50);
$agilemantis_commonlib->id = $pb_id;
$backlog = $agilemantis_commonlib->getSelectedProductBacklog();
$agilemantis_commonlib->updateTrackerHandler($p_bug_id, $backlog[0]['user_id'], $pb_id);
}
}
if ($t_custom_field_id == $agilemantis_commonlib->spr) {
if (empty($list_sprints)) {
$agilemantis_commonlib->restoreCustomFieldValue($p_bug_id, $t_custom_field_id, $t_custom_field_value);
}
# old sprint information
$agilemantis_commonlib->sprint_id = $t_custom_field_value;
$sprintInfo = $agilemantis_sprint->getSprintById();
if ($current_sprint[0]['pb_id'] != $pb_id) {
$agilemantis_commonlib->restoreCustomFieldValue($p_bug_id, $t_custom_field_id, $t_custom_field_value);
}
if ($current_sprint[0]['status'] > 1 || $pb_id == 0 || $t_status >= 80) {
$agilemantis_commonlib->restoreCustomFieldValue($p_bug_id, $t_custom_field_id, $t_custom_field_value);
}
}
# update bug date
bug_update_date($p_bug_id);
}
示例10: bug_assign
function bug_assign($p_bug_id, $p_user_id, $p_bugnote_text = '', $p_bugnote_private = false)
{
$c_bug_id = db_prepare_int($p_bug_id);
$c_user_id = db_prepare_int($p_user_id);
if ($c_user_id != NO_USER && !access_has_bug_level(config_get('handle_bug_threshold'), $p_bug_id, $p_user_id)) {
trigger_error(ERROR_USER_DOES_NOT_HAVE_REQ_ACCESS);
}
# extract current information into history variables
$h_status = bug_get_field($p_bug_id, 'status');
$h_handler_id = bug_get_field($p_bug_id, 'handler_id');
if (ON == config_get('auto_set_status_to_assigned') && NO_USER != $p_user_id) {
$t_ass_val = config_get('bug_assigned_status');
} else {
$t_ass_val = $h_status;
}
$t_bug_table = config_get('mantis_bug_table');
if ($t_ass_val != $h_status || $p_user_id != $h_handler_id) {
# get user id
$query = "UPDATE {$t_bug_table}\n\t\t\t\t\t SET handler_id='{$c_user_id}', status='{$t_ass_val}'\n\t\t\t\t\t WHERE id='{$c_bug_id}'";
db_query($query);
# log changes
history_log_event_direct($c_bug_id, 'status', $h_status, $t_ass_val);
history_log_event_direct($c_bug_id, 'handler_id', $h_handler_id, $p_user_id);
# Add bugnote if supplied ignore false return
bugnote_add($p_bug_id, $p_bugnote_text, 0, $p_bugnote_private, 0, '', NULL, FALSE);
# updated the last_updated date
bug_update_date($p_bug_id);
bug_clear_cache($p_bug_id);
# send assigned to email
email_assign($p_bug_id);
}
return true;
}
示例11: save_bug
//.........这里部分代码省略.........
$t_bug_data->steps_to_reproduce = gpc_get_string('LOGCAT', "");
$t_bug_data->additional_information = gpc_get_string('CRASH_CONFIGURATION', "");
$t_bug_data->due_date = gpc_get_string('USER_CRASH_DATE', '');
if (is_blank($t_bug_data->due_date)) {
$t_bug_data->due_date = date_get_null();
}
$f_files = gpc_get_file('ufile', null);
/** @todo (thraxisp) Note that this always returns a structure */
$f_report_stay = gpc_get_bool('report_stay', false);
$f_copy_notes_from_parent = gpc_get_bool('copy_notes_from_parent', false);
helper_call_custom_function('issue_create_validate', array($t_bug_data));
# Validate the custom fields before adding the bug.
$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);
# Produce an error if the field is required but wasn't posted
if (!gpc_isset_custom_field($t_id, $t_def['type']) && $t_def['require_report']) {
error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
if (!custom_field_validate($t_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')));
trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
}
}
# Allow plugins to pre-process bug data
$t_bug_data = event_signal('EVENT_REPORT_BUG_DATA', $t_bug_data);
# Ensure that resolved bugs have a handler
if ($t_bug_data->handler_id == NO_USER && $t_bug_data->status >= config_get('bug_resolved_status_threshold')) {
$t_bug_data->handler_id = $this->get_user_id();
}
# Create the bug
$t_bug_id = $t_bug_data->create();
# Mark the added issue as visited so that it appears on the last visited list.
last_visited_issue($t_bug_id);
# Handle the file upload
if ($f_files != null) {
$t_files = helper_array_transpose($f_files);
if ($t_files != null) {
foreach ($t_files as $t_file) {
if (!empty($t_file['name'])) {
file_add($t_bug_id, $t_file, 'bug');
}
}
}
}
# Handle custom field submission
foreach ($t_related_custom_field_ids as $t_id) {
# Do not set custom field value if user has no write access
if (!custom_field_has_write_access($t_id, $t_bug_id)) {
continue;
}
$t_def = custom_field_get_definition($t_id);
if (!custom_field_set_value($t_id, $t_bug_id, gpc_get_custom_field("custom_field_{$t_id}", $t_def['type'], $t_def['default_value']), false)) {
error_parameters(lang_get_defaulted(custom_field_get_field($t_id, 'name')));
trigger_error(ERROR_CUSTOM_FIELD_INVALID_VALUE, ERROR);
}
}
$f_master_bug_id = gpc_get_int('m_id', 0);
$f_rel_type = gpc_get_int('rel_type', -1);
if ($f_master_bug_id > 0) {
# it's a child generation... let's create the relationship and add some lines in the history
# update master bug last updated
bug_update_date($f_master_bug_id);
# Add log line to record the cloning action
history_log_event_special($t_bug_id, BUG_CREATED_FROM, '', $f_master_bug_id);
history_log_event_special($f_master_bug_id, BUG_CLONED_TO, '', $t_bug_id);
if ($f_rel_type >= 0) {
# 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);
# update relationship target bug last updated
bug_update_date($t_bug_id);
# Send the email notification
email_relationship_added($f_master_bug_id, $t_bug_id, relationship_get_complementary_type($f_rel_type));
}
# 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, FALSE);
}
}
}
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_new_bug($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'));
}
if ($t_bug_data->resolution != config_get('default_bug_resolution')) {
history_log_event($t_bug_id, 'resolution', config_get('default_bug_resolution'));
}
return $t_bug_id;
}
示例12: file_add
//.........这里部分代码省略.........
* @param bool $p_skip_bug_update skip bug last modification update (useful when importing bug attachments)
*/
function file_add($p_bug_id, $p_file, $p_table = 'bug', $p_title = '', $p_desc = '', $p_user_id = null, $p_date_added = 0, $p_skip_bug_update = false)
{
file_ensure_uploaded($p_file);
$t_file_name = $p_file['name'];
$t_tmp_file = $p_file['tmp_name'];
if (!file_type_check($t_file_name)) {
trigger_error(ERROR_FILE_NOT_ALLOWED, ERROR);
}
if (!file_is_name_unique($t_file_name, $p_bug_id)) {
trigger_error(ERROR_FILE_DUPLICATE, ERROR);
}
$t_file_size = filesize($t_tmp_file);
if (0 == $t_file_size) {
trigger_error(ERROR_FILE_NO_UPLOAD_FAILURE, ERROR);
}
$t_max_file_size = (int) min(ini_get_number('upload_max_filesize'), ini_get_number('post_max_size'), config_get('max_file_size'));
if ($t_file_size > $t_max_file_size) {
trigger_error(ERROR_FILE_TOO_BIG, ERROR);
}
if ('bug' == $p_table) {
$t_project_id = bug_get_field($p_bug_id, 'project_id');
$t_id = (int) $p_bug_id;
$t_bug_id = bug_format_id($p_bug_id);
} else {
$t_project_id = helper_get_current_project();
$t_id = $t_project_id;
$t_bug_id = 0;
}
if ($p_user_id === null) {
$p_user_id = auth_get_current_user_id();
}
if ($p_date_added <= 0) {
$p_date_added = db_now();
}
if ($t_project_id == ALL_PROJECTS) {
$t_file_path = config_get('absolute_path_default_upload_folder');
} else {
$t_file_path = project_get_field($t_project_id, 'file_path');
if (is_blank($t_file_path)) {
$t_file_path = config_get('absolute_path_default_upload_folder');
}
}
$t_file_hash = 'bug' == $p_table ? $t_bug_id : config_get('document_files_prefix') . '-' . $t_project_id;
$t_unique_name = file_generate_unique_name($t_file_hash . '-' . $t_file_name, $t_file_path);
$t_disk_file_name = $t_file_path . $t_unique_name;
$t_method = config_get('file_upload_method');
switch ($t_method) {
case FTP:
case DISK:
file_ensure_valid_upload_path($t_file_path);
if (!file_exists($t_disk_file_name)) {
if (FTP == $t_method) {
$conn_id = file_ftp_connect();
file_ftp_put($conn_id, $t_disk_file_name, $t_tmp_file);
file_ftp_disconnect($conn_id);
}
if (!move_uploaded_file($t_tmp_file, $t_disk_file_name)) {
trigger_error(ERROR_FILE_MOVE_FAILED, ERROR);
}
chmod($t_disk_file_name, config_get('attachments_file_permissions'));
$c_content = '';
} else {
trigger_error(ERROR_FILE_DUPLICATE, ERROR);
}
break;
case DATABASE:
$c_content = db_prepare_binary_string(fread(fopen($t_tmp_file, 'rb'), $t_file_size));
break;
default:
trigger_error(ERROR_GENERIC, ERROR);
}
$t_file_table = db_get_table($p_table . '_file');
$t_id_col = $p_table . "_id";
$t_query_fields = "\n\t\t{$t_id_col}, title, description, diskfile, filename, folder,\n\t\tfilesize, file_type, date_added, user_id";
$t_param = array($t_id, $p_title, $p_desc, $t_unique_name, $t_file_name, $t_file_path, $t_file_size, $p_file['type'], $p_date_added, (int) $p_user_id);
# oci8 stores contents in a BLOB, which is updated separately
if (!db_is_oracle()) {
$t_query_fields .= ", content";
$t_param[] = $c_content;
}
$t_query_param = db_param();
for ($i = 1; $i < count($t_param); $i++) {
$t_query_param .= ", " . db_param();
}
$t_query = "INSERT INTO {$t_file_table} ( {$t_query_fields} )\n\tVALUES\n\t\t( {$t_query_param} )";
db_query_bound($t_query, $t_param);
if (db_is_oracle()) {
db_update_blob($t_file_table, 'content', $c_content, "diskfile='{$t_unique_name}'");
}
if ('bug' == $p_table) {
# update the last_updated date
if (!$p_skip_bug_update) {
$result = bug_update_date($p_bug_id);
}
# log file added to bug history
history_log_event_special($p_bug_id, FILE_ADDED, $t_file_name);
}
}
示例13: helper_call_custom_function
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_new_bug($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'));
}
if ($t_bug_data->resolution != config_get('default_bug_resolution')) {
history_log_event($t_bug_id, 'resolution', config_get('default_bug_resolution'));
}
if (!$f_report_stay) {
if ($t_bug_data->status < config_get('bug_readonly_status_threshold')) {
html_meta_redirect('view.php?id=' . $t_bug_id);
} else {
bug_update_date($t_bug_id, $t_bug_data->date_submitted);
$t_category_table = db_get_table('mantis_category_table');
$result = db_query_bound("SELECT `name` FROM " . $t_category_table . " WHERE `id` = " . db_param(), array($t_bug_data->category_id));
$row = db_fetch_array($result);
html_meta_redirect('browse.php?reset=true&category=' . $row['name']);
}
}
?>
<br />
<div align="center">
<?php
echo lang_get('operation_successful') . '<br />';
print_bracket_link(string_get_bug_view_url($t_bug_id), sprintf(lang_get('view_submitted_bug_link'), $t_bug_id));
print_bracket_link('view_all_bug_page.php', lang_get('view_bugs_link'));
if ($f_report_stay) {
?>
示例14: sponsorship_update_bug
/**
* Update bug to reflect sponsorship change
* This is to be called after adding/updating/deleting sponsorships
* @param int $p_bug_id
* @return null
*/
function sponsorship_update_bug($p_bug_id)
{
$t_total_amount = sponsorship_get_amount(sponsorship_get_all_ids($p_bug_id));
bug_set_field($p_bug_id, 'sponsorship_total', $t_total_amount);
bug_update_date($p_bug_id);
}
示例15: 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);
}