本文整理汇总了PHP中history_log_event_direct函数的典型用法代码示例。如果您正苦于以下问题:PHP history_log_event_direct函数的具体用法?PHP history_log_event_direct怎么用?PHP history_log_event_direct使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了history_log_event_direct函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: history_log_event
/**
* log the changes
* events should be logged *after* the modification
* @param integer $p_bug_id The bug identifier of the bug being modified.
* @param string $p_field_name The field name of the field being modified.
* @param string $p_old_value The old value of the field.
* @return void
*/
function history_log_event($p_bug_id, $p_field_name, $p_old_value)
{
history_log_event_direct($p_bug_id, $p_field_name, $p_old_value, bug_get_field($p_bug_id, $p_field_name));
}
示例2: plugin_history_log
function plugin_history_log($p_bug_id, $p_field_name, $p_old_value, $p_new_value = '', $p_user_id = null, $p_basename = null)
{
if (is_null($p_basename)) {
$t_basename = plugin_get_current();
} else {
$t_basename = $p_basename;
}
$t_field_name = $t_basename . '_' . $p_field_name;
history_log_event_direct($p_bug_id, $t_field_name, $p_old_value, $p_new_value, $p_user_id, PLUGIN_HISTORY);
}
示例3: custom_field_set_value
/**
* Set the value of a custom field for a given bug
* return true on success, false on failure
* @param integer $p_field_id Custom field identifier.
* @param integer $p_bug_id A bug identifier.
* @param mixed $p_value New custom field value.
* @param boolean $p_log_insert Create history logs for new values.
* @return boolean
* @access public
*/
function custom_field_set_value($p_field_id, $p_bug_id, $p_value, $p_log_insert = true)
{
custom_field_ensure_exists($p_field_id);
if (!custom_field_validate($p_field_id, $p_value)) {
return false;
}
$t_name = custom_field_get_field($p_field_id, 'name');
$t_type = custom_field_get_field($p_field_id, 'type');
$t_value_field = $t_type == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value';
# Determine whether an existing value needs to be updated or a new value inserted
$t_query = 'SELECT ' . $t_value_field . '
FROM {custom_field_string}
WHERE field_id=' . db_param() . ' AND
bug_id=' . db_param();
$t_result = db_query($t_query, array($p_field_id, $p_bug_id));
if ($t_row = db_fetch_array($t_result)) {
$t_query = 'UPDATE {custom_field_string}
SET ' . $t_value_field . '=' . db_param() . '
WHERE field_id=' . db_param() . ' AND
bug_id=' . db_param();
$t_params = array(custom_field_value_to_database($p_value, $t_type), (int) $p_field_id, (int) $p_bug_id);
db_query($t_query, $t_params);
history_log_event_direct($p_bug_id, $t_name, custom_field_database_to_value($t_row[$t_value_field], $t_type), $p_value);
} else {
$t_query = 'INSERT INTO {custom_field_string}
( field_id, bug_id, ' . $t_value_field . ' )
VALUES
( ' . db_param() . ', ' . db_param() . ', ' . db_param() . ')';
$t_params = array((int) $p_field_id, (int) $p_bug_id, custom_field_value_to_database($p_value, $t_type));
db_query($t_query, $t_params);
# Don't log history events for new bug reports or on other special occasions
if ($p_log_insert) {
history_log_event_direct($p_bug_id, $t_name, '', $p_value);
}
}
custom_field_clear_cache($p_field_id);
# db_query() errors on failure so:
return true;
}
示例4: category_remove_all
/**
* Remove all categories associated with a project
* @param int $p_project_id Project ID
* @param int $p_new_category_id new category id (to replace existing category)
* @return bool
* @access public
*/
function category_remove_all( $p_project_id, $p_new_category_id = 0 ) {
project_ensure_exists( $p_project_id );
if( 0 != $p_new_category_id ) {
category_ensure_exists( $p_new_category_id );
}
# cache category names
category_get_all_rows( $p_project_id );
$t_category_table = db_get_table( 'category' );
$t_bug_table = db_get_table( 'bug' );
# get a list of affected categories
$t_query = "SELECT id FROM $t_category_table WHERE project_id=" . db_param();
$t_result = db_query_bound( $t_query, array( $p_project_id ) );
$t_category_ids = array();
while( $t_row = db_fetch_array( $t_result ) ) {
$t_category_ids[] = $t_row['id'];
}
# Handle projects with no categories
if( count( $t_category_ids ) < 1 ) {
return true;
}
$t_category_ids = join( ',', $t_category_ids );
# update bug history entries
$t_query = "SELECT id, category_id FROM $t_bug_table WHERE category_id IN ( $t_category_ids )";
$t_result = db_query_bound( $t_query );
while( $t_bug_row = db_fetch_array( $t_result ) ) {
history_log_event_direct( $t_bug_row['id'], 'category', category_full_name( $t_bug_row['category_id'], false ), category_full_name( $p_new_category_id, false ) );
}
# update bug data
$t_query = "UPDATE $t_bug_table SET category_id=" . db_param() . " WHERE category_id IN ( $t_category_ids )";
db_query_bound( $t_query, array( $p_new_category_id ) );
# delete categories
$t_query = "DELETE FROM $t_category_table WHERE project_id=" . db_param();
db_query_bound( $t_query, array( $p_project_id ) );
return true;
}
示例5: update
/**
* Update a bug from the given data structure
* If the third parameter is true, also update the longer strings table
* @param bool p_update_extended
* @param bool p_bypass_email Default false, set to true to avoid generating emails (if sending elsewhere)
* @return bool (always true)
* @access public
*/
function update($p_update_extended = false, $p_bypass_mail = false)
{
self::validate($p_update_extended);
$c_bug_id = $this->id;
if (is_blank($this->due_date)) {
$this->due_date = date_get_null();
}
$t_old_data = bug_get($this->id, true);
$t_bug_table = db_get_table('mantis_bug_table');
# Update all fields
# Ignore date_submitted and last_updated since they are pulled out
# as unix timestamps which could confuse the history log and they
# shouldn't get updated like this anyway. If you really need to change
# them use bug_set_field()
$query = "UPDATE {$t_bug_table}\n\t\t\t\t\tSET project_id=" . db_param() . ', reporter_id=' . db_param() . ",\n\t\t\t\t\t\thandler_id=" . db_param() . ', duplicate_id=' . db_param() . ",\n\t\t\t\t\t\tpriority=" . db_param() . ', severity=' . db_param() . ",\n\t\t\t\t\t\treproducibility=" . db_param() . ', status=' . db_param() . ",\n\t\t\t\t\t\tresolution=" . db_param() . ', projection=' . db_param() . ",\n\t\t\t\t\t\tcategory_id=" . db_param() . ', eta=' . db_param() . ",\n\t\t\t\t\t\tos=" . db_param() . ', os_build=' . db_param() . ",\n\t\t\t\t\t\tplatform=" . db_param() . ', version=' . db_param() . ",\n\t\t\t\t\t\tbuild=" . db_param() . ', fixed_in_version=' . db_param() . ',';
$t_fields = array($this->project_id, $this->reporter_id, $this->handler_id, $this->duplicate_id, $this->priority, $this->severity, $this->reproducibility, $this->status, $this->resolution, $this->projection, $this->category_id, $this->eta, $this->os, $this->os_build, $this->platform, $this->version, $this->build, $this->fixed_in_version);
$t_roadmap_updated = false;
if (access_has_project_level(config_get('roadmap_update_threshold'))) {
$query .= "\n\t\t\t\t\t\ttarget_version=" . db_param() . ",";
$t_fields[] = $this->target_version;
$t_roadmap_updated = true;
}
$query .= "\n\t\t\t\t\t\tview_state=" . db_param() . ",\n\t\t\t\t\t\tsummary=" . db_param() . ",\n\t\t\t\t\t\tsponsorship_total=" . db_param() . ",\n\t\t\t\t\t\tsticky=" . db_param() . ",\n\t\t\t\t\t\tdue_date=" . db_param() . "\n\t\t\t\t\tWHERE id=" . db_param();
$t_fields[] = $this->view_state;
$t_fields[] = $this->summary;
$t_fields[] = $this->sponsorship_total;
$t_fields[] = (bool) $this->sticky;
$t_fields[] = $this->due_date;
$t_fields[] = $this->id;
db_query_bound($query, $t_fields);
bug_clear_cache($this->id);
# log changes
history_log_event_direct($c_bug_id, 'project_id', $t_old_data->project_id, $this->project_id);
history_log_event_direct($c_bug_id, 'reporter_id', $t_old_data->reporter_id, $this->reporter_id);
history_log_event_direct($c_bug_id, 'handler_id', $t_old_data->handler_id, $this->handler_id);
history_log_event_direct($c_bug_id, 'priority', $t_old_data->priority, $this->priority);
history_log_event_direct($c_bug_id, 'severity', $t_old_data->severity, $this->severity);
history_log_event_direct($c_bug_id, 'reproducibility', $t_old_data->reproducibility, $this->reproducibility);
history_log_event_direct($c_bug_id, 'status', $t_old_data->status, $this->status);
history_log_event_direct($c_bug_id, 'resolution', $t_old_data->resolution, $this->resolution);
history_log_event_direct($c_bug_id, 'projection', $t_old_data->projection, $this->projection);
history_log_event_direct($c_bug_id, 'category', category_full_name($t_old_data->category_id, false), category_full_name($this->category_id, false));
history_log_event_direct($c_bug_id, 'eta', $t_old_data->eta, $this->eta);
history_log_event_direct($c_bug_id, 'os', $t_old_data->os, $this->os);
history_log_event_direct($c_bug_id, 'os_build', $t_old_data->os_build, $this->os_build);
history_log_event_direct($c_bug_id, 'platform', $t_old_data->platform, $this->platform);
history_log_event_direct($c_bug_id, 'version', $t_old_data->version, $this->version);
history_log_event_direct($c_bug_id, 'build', $t_old_data->build, $this->build);
history_log_event_direct($c_bug_id, 'fixed_in_version', $t_old_data->fixed_in_version, $this->fixed_in_version);
if ($t_roadmap_updated) {
history_log_event_direct($c_bug_id, 'target_version', $t_old_data->target_version, $this->target_version);
}
history_log_event_direct($c_bug_id, 'view_state', $t_old_data->view_state, $this->view_state);
history_log_event_direct($c_bug_id, 'summary', $t_old_data->summary, $this->summary);
history_log_event_direct($c_bug_id, 'sponsorship_total', $t_old_data->sponsorship_total, $this->sponsorship_total);
history_log_event_direct($c_bug_id, 'sticky', $t_old_data->sticky, $this->sticky);
history_log_event_direct($c_bug_id, 'due_date', $t_old_data->due_date != date_get_null() ? $t_old_data->due_date : null, $this->due_date != date_get_null() ? $this->due_date : null);
# Update extended info if requested
if ($p_update_extended) {
$t_bug_text_table = db_get_table('mantis_bug_text_table');
$t_bug_text_id = bug_get_field($c_bug_id, 'bug_text_id');
$query = "UPDATE {$t_bug_text_table}\n\t\t\t\t\t\t\tSET description=" . db_param() . ",\n\t\t\t\t\t\t\t\tsteps_to_reproduce=" . db_param() . ",\n\t\t\t\t\t\t\t\tadditional_information=" . db_param() . "\n\t\t\t\t\t\t\tWHERE id=" . db_param();
db_query_bound($query, array($this->description, $this->steps_to_reproduce, $this->additional_information, $t_bug_text_id));
bug_text_clear_cache($c_bug_id);
$t_current_user = auth_get_current_user_id();
if ($t_old_data->description != $this->description) {
if (bug_revision_count($c_bug_id, REV_DESCRIPTION) < 1) {
$t_revision_id = bug_revision_add($c_bug_id, $t_old_data->reporter_id, REV_DESCRIPTION, $t_old_data->description, 0, $t_old_data->date_submitted);
}
$t_revision_id = bug_revision_add($c_bug_id, $t_current_user, REV_DESCRIPTION, $this->description);
history_log_event_special($c_bug_id, DESCRIPTION_UPDATED, $t_revision_id);
}
if ($t_old_data->steps_to_reproduce != $this->steps_to_reproduce) {
if (bug_revision_count($c_bug_id, REV_STEPS_TO_REPRODUCE) < 1) {
$t_revision_id = bug_revision_add($c_bug_id, $t_old_data->reporter_id, REV_STEPS_TO_REPRODUCE, $t_old_data->steps_to_reproduce, 0, $t_old_data->date_submitted);
}
$t_revision_id = bug_revision_add($c_bug_id, $t_current_user, REV_STEPS_TO_REPRODUCE, $this->steps_to_reproduce);
history_log_event_special($c_bug_id, STEP_TO_REPRODUCE_UPDATED, $t_revision_id);
}
if ($t_old_data->additional_information != $this->additional_information) {
if (bug_revision_count($c_bug_id, REV_ADDITIONAL_INFO) < 1) {
$t_revision_id = bug_revision_add($c_bug_id, $t_old_data->reporter_id, REV_ADDITIONAL_INFO, $t_old_data->additional_information, 0, $t_old_data->date_submitted);
}
$t_revision_id = bug_revision_add($c_bug_id, $t_current_user, REV_ADDITIONAL_INFO, $this->additional_information);
history_log_event_special($c_bug_id, ADDITIONAL_INFO_UPDATED, $t_revision_id);
}
}
# Update the last update date
bug_update_date($c_bug_id);
# allow bypass if user is sending mail separately
if (false == $p_bypass_mail) {
# bug assigned
//.........这里部分代码省略.........
示例6: form_security_validate
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Notes: Based on the Time Tracking plugin by Elmar:
2005 by Elmar Schumacher - GAMBIT Consulting GmbH
http://www.mantisbt.org/forums/viewtopic.php?f=4&t=589
*/
form_security_validate('plugin_TimeTracking_delete_record');
$f_bug_id = gpc_get_int('bug_id');
$f_delete_id = gpc_get_int('delete_id');
$table = plugin_table('data', 'TimeTracking');
$query_pull_timerecords = "SELECT * FROM {$table} WHERE id = {$f_delete_id} ORDER BY timestamp DESC";
$result_pull_timerecords = db_query($query_pull_timerecords);
$row = db_fetch_array($result_pull_timerecords);
$t_user_id = auth_get_current_user_id();
if ($row[user] == $t_user_id) {
access_ensure_bug_level(plugin_config_get('admin_own_threshold'), $f_bug_id);
} else {
access_ensure_bug_level(plugin_config_get('admin_threshold'), $f_bug_id);
}
$query_delete = "DELETE FROM {$table} WHERE id = {$f_delete_id}";
db_query($query_delete);
history_log_event_direct($f_bug_id, plugin_lang_get('history') . " " . plugin_lang_get('deleted'), date(config_get("short_date_format"), strtotime($row["expenditure_date"])) . ": " . number_format($row["hours"], 2, ',', '.') . " h.", "deleted", $user);
form_security_purge('plugin_TimeTracking_delete_record');
$t_url = string_get_bug_view_url($f_bug_id, auth_get_current_user_id());
print_successful_redirect($t_url . "#timerecord");
示例7: tts_log_history
/**
* @author Lennard Bredenkamp, BFE
* compose and store issue history log entry, action ( 'add' or 'delete') determines the text
*/
function tts_log_history($action, $tproject_id, $exec_id, $bug_id)
{
switch ($action) {
case 'add':
//ADD
$change_text = "mit [ Testprojekt-ID: {$tproject_id} Ausführungs-ID: {$exec_id} ]";
$field_text = "Testausführung verknüpft";
break;
case 'delete':
//DELETE
$change_text = "Verknüpfung gelöscht: [ Testprojekt-ID: {$tproject_id} Ausführungs-ID: {$exec_id} ]";
//man könnte hier noch einen Link zur Ausführung einfügen (besonders, falls gelöscht?) .create_link_to_tc_execution($f_tts_tproject_id, $f_tts_exec_id);
$field_text = "Testausführung abgekoppelt";
break;
}
// function history_log_event_direct( $p_bug_id, $p_field_name, $p_old_value, $p_new_value, $p_user_id = null, $p_type = 0 )
//p_type: ENUMERATION/CONSTANT -> number (defined in core/constant_inc.php), standard: normal, 0)
history_log_event_direct($bug_id, $field_text, '', $change_text);
}
示例8: custom_field_set_value
/**
* Set the value of a custom field for a given bug
* return true on success, false on failure
* @param int $p_field_id custom field id
* @param int $p_bug_id bug id
* @param mixed $p_value
* @param boolean $p_log create history logs for new values
* @return bool
* @access public
*/
function custom_field_set_value($p_field_id, $p_bug_id, $p_value, $p_log_insert = true)
{
$c_field_id = db_prepare_int($p_field_id);
$c_bug_id = db_prepare_int($p_bug_id);
custom_field_ensure_exists($p_field_id);
if (!custom_field_validate($p_field_id, $p_value)) {
return false;
}
$t_name = custom_field_get_field($p_field_id, 'name');
$t_type = custom_field_get_field($p_field_id, 'type');
$t_custom_field_string_table = db_get_table('custom_field_string');
$t_value_field = $t_type == CUSTOM_FIELD_TYPE_TEXTAREA ? 'text' : 'value';
# Determine whether an existing value needs to be updated or a new value inserted
$query = "SELECT {$t_value_field}\n\t\t\t\t FROM {$t_custom_field_string_table}\n\t\t\t\t WHERE field_id=" . db_param() . " AND\n\t\t\t\t \t\tbug_id=" . db_param();
$result = db_query_bound($query, array($c_field_id, $c_bug_id));
if (db_num_rows($result) > 0) {
$query = "UPDATE {$t_custom_field_string_table}\n\t\t\t\t\t SET {$t_value_field}=" . db_param() . "\n\t\t\t\t\t WHERE field_id=" . db_param() . " AND\n\t\t\t\t\t \t\tbug_id=" . db_param();
db_query_bound($query, array(custom_field_value_to_database($p_value, $t_type), $c_field_id, $c_bug_id));
$row = db_fetch_array($result);
history_log_event_direct($c_bug_id, $t_name, custom_field_database_to_value($row[$t_value_field], $t_type), $p_value);
} else {
$query = "INSERT INTO {$t_custom_field_string_table}\n\t\t\t\t\t\t( field_id, bug_id, {$t_value_field} )\n\t\t\t\t\t VALUES\n\t\t\t\t\t\t( " . db_param() . ', ' . db_param() . ', ' . db_param() . ')';
db_query_bound($query, array($c_field_id, $c_bug_id, custom_field_value_to_database($p_value, $t_type)));
# Don't log history events for new bug reports or on other special occasions
if ($p_log_insert) {
history_log_event_direct($c_bug_id, $t_name, '', $p_value);
}
}
custom_field_clear_cache($p_field_id);
# db_query errors on failure so:
return true;
}
示例9: custom_field_set_value
function custom_field_set_value($p_field_id, $p_bug_id, $p_value)
{
$c_field_id = db_prepare_int($p_field_id);
$c_bug_id = db_prepare_int($p_bug_id);
custom_field_ensure_exists($p_field_id);
$t_custom_field_table = config_get('mantis_custom_field_table');
$query = "SELECT name, type, possible_values, valid_regexp,\r\n\t\t\t\t access_level_rw, length_min, length_max, default_value\r\n\t\t\t\t FROM {$t_custom_field_table}\r\n\t\t\t\t WHERE id='{$c_field_id}'";
$result = db_query($query);
$row = db_fetch_array($result);
$t_name = $row['name'];
$t_type = $row['type'];
$t_possible_values = $row['possible_values'];
$t_valid_regexp = $row['valid_regexp'];
$t_access_level_rw = $row['access_level_rw'];
$t_length_min = $row['length_min'];
$t_length_max = $row['length_max'];
$t_default_value = $row['default_value'];
$c_value = db_prepare_string(custom_field_value_to_database($p_value, $t_type));
# check for valid value
if (!is_blank($t_valid_regexp)) {
if (!ereg($t_valid_regexp, $p_value)) {
return false;
}
}
if (strlen($p_value) < $t_length_min) {
return false;
}
if (0 != $t_length_max && strlen($p_value) > $t_length_max) {
return false;
}
if (!custom_field_has_write_access($p_field_id, $p_bug_id, auth_get_current_user_id())) {
return false;
}
$t_custom_field_string_table = config_get('mantis_custom_field_string_table');
# do I need to update or insert this value?
$query = "SELECT value\r\n\t\t\t\t FROM {$t_custom_field_string_table}\r\n\t\t\t\t WHERE field_id='{$c_field_id}' AND\r\n\t\t\t\t \t\tbug_id='{$c_bug_id}'";
$result = db_query($query);
if (db_num_rows($result) > 0) {
$query = "UPDATE {$t_custom_field_string_table}\r\n\t\t\t\t\t SET value='{$c_value}'\r\n\t\t\t\t\t WHERE field_id='{$c_field_id}' AND\r\n\t\t\t\t\t \t\tbug_id='{$c_bug_id}'";
db_query($query);
$row = db_fetch_array($result);
history_log_event_direct($c_bug_id, $t_name, custom_field_database_to_value($row['value'], $t_type), $p_value);
} else {
# Always store the value, even if it's the dafault value
# This is important, as the definitions might change but the
# values stored with a bug must not change
$query = "INSERT INTO {$t_custom_field_string_table}\r\n\t\t\t\t\t\t( field_id, bug_id, value )\r\n\t\t\t\t\t VALUES\r\n\t\t\t\t\t\t( '{$c_field_id}', '{$c_bug_id}', '{$c_value}' )";
db_query($query);
history_log_event_direct($c_bug_id, $t_name, '', $p_value);
}
custom_field_clear_cache($p_field_id);
#db_query() errors on failure so:
return true;
}
示例10: form_security_validate
form_security_validate('plugin_TimeTracking_add_record');
$f_bug_id = gpc_get_int('bug_id');
$f_time_info = gpc_get_string('time_info');
$f_time_value = gpc_get_string('time_value');
$f_year = gpc_get_int('year');
$f_month = gpc_get_int('month');
$f_day = gpc_get_int('day');
access_ensure_bug_level(plugin_config_get('admin_own_threshold'), $f_bug_id);
# Current UserID
$user = auth_get_current_user_id();
$t_time_info = db_prepare_string($f_time_info);
# Work on Time-Entry so we can eval it
$t_time_value = plugin_TimeTracking_hhmm_to_minutes($f_time_value);
$t_time_value = doubleval($t_time_value / 60);
# Trigger in case of non-evaluable entry
if ($t_time_value == 0) {
trigger_error(plugin_lang_get('value_error'), ERROR);
}
# Write Post-Data to DB
$now = date("Y-m-d G:i:s");
$expend = date("Y-m-d", strtotime("{$f_year}-{$f_month}-{$f_day}"));
$table = plugin_table('data', 'TimeTracking');
$query = "INSERT INTO {$table} ( user, bug_id, expenditure_date, hours, timestamp, info ) \r\n VALUES ( '{$user}', '{$f_bug_id}', '{$expend}', '{$t_time_value}', '{$now}', '{$t_time_info}')";
if (!db_query($query)) {
trigger_error(ERROR_DB_QUERY_FAILED, ERROR);
}
# Event is logged in the project
history_log_event_direct($bug_id, plugin_lang_get('history'), "{$f_day}.{$f_month}.{$f_year}: {$t_time_value} h.", "set", $user);
form_security_purge('plugin_TimeTracking_add_record');
$t_url = string_get_bug_view_url($f_bug_id, auth_get_current_user_id());
print_successful_redirect($t_url . "#timerecord");
示例11: 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;
}
示例12: addUserStory
function addUserStory($bug_id, $backlog, $backlog_old = "")
{
$this->getAdditionalProjectFields();
$this->upsertCustomField($this->pb, $bug_id, $backlog);
$t_mantis_user_table = db_get_table('mantis_user_table');
if ($backlog != "") {
$t_sql = "SELECT ut.id AS id \n\t\t\t\t\tFROM gadiv_productbacklogs pb \n\t\t\t\t\tLEFT JOIN {$t_mantis_user_table} ut ON pb.user_id=ut.id \n\t\t\t\t\tWHERE pb.name=" . db_param(0);
$t_params = array($backlog);
$result = $this->executeQuery($t_sql, $t_params);
if ($this->hasTasks($bug_id) == false) {
if (!empty($result[0]['id'])) {
bug_set_field($bug_id, 'handler_id', $result[0]['id']);
bug_set_field($bug_id, 'status', '50');
}
}
}
$_SESSION['tracker_handler'] = $result[0]['id'];
$_SESSION['tracker_id'] = $bug_id;
$_SESSION['backlog'] = $_POST['backlog'];
$_SESSION['old_product_backlog'] = $_POST['old_product_backlog'];
if ($_POST['backlog'] != $_POST['old_product_backlog']) {
$this->updateTrackerHandler($bug_id, $result[0]['id'], $this->get_product_backlog_id($_POST['old_product_backlog']));
}
$this->pb = "";
if ($backlog != '') {
history_log_event_direct($bug_id, 'Product Backlog', $backlog_old, $backlog, auth_get_current_user_id(), $p_type = 0);
}
}
示例13: category_remove_all
/**
* Remove all categories associated with a project.
* This will skip processing of categories that can't be deleted.
* @param integer $p_project_id A Project identifier.
* @param integer $p_new_category_id New category id (to replace existing category).
* @return boolean
* @access public
*/
function category_remove_all($p_project_id, $p_new_category_id = 0)
{
project_ensure_exists($p_project_id);
if (0 != $p_new_category_id) {
category_ensure_exists($p_new_category_id);
}
# cache category names
category_get_all_rows($p_project_id);
# get a list of affected categories
db_param_push();
$t_query = 'SELECT id FROM {category} WHERE project_id=' . db_param();
$t_result = db_query($t_query, array($p_project_id));
$t_category_ids = array();
while ($t_row = db_fetch_array($t_result)) {
# Don't add category to the list if it can't be deleted
if (!category_can_remove($t_row['id'])) {
continue;
}
$t_category_ids[] = $t_row['id'];
}
# Handle projects with no categories
if (count($t_category_ids) < 1) {
return true;
}
$t_category_ids = join(',', $t_category_ids);
# update bug history entries
$t_query = 'SELECT id, category_id FROM {bug} WHERE category_id IN ( ' . $t_category_ids . ' )';
$t_result = db_query($t_query);
while ($t_bug_row = db_fetch_array($t_result)) {
history_log_event_direct($t_bug_row['id'], 'category', category_full_name($t_bug_row['category_id'], false), category_full_name($p_new_category_id, false));
}
# update bug data
db_param_push();
$t_query = 'UPDATE {bug} SET category_id=' . db_param() . ' WHERE category_id IN ( ' . $t_category_ids . ' )';
db_query($t_query, array($p_new_category_id));
# delete categories
db_param_push();
$t_query = 'DELETE FROM {category} WHERE project_id=' . db_param();
db_query($t_query, array($p_project_id));
return true;
}
示例14: save_bug
public function save_bug($p_event, $p_bug_data, $p_bug_id)
{
if (!access_has_global_level(plugin_config_get('edit_customer_fields_threshold'))) {
return;
}
$customer_id = gpc_get_int('cm_plugin_customer_id', null);
$service_id = gpc_get_int('cm_plugin_service_id', null);
$is_billable = CustomerManagementDao::isServiceBillable($customer_id, $service_id);
$invoice = gpc_get_string('cm_plugin_invoice', null);
if ($customer_id) {
if ($is_billable && is_blank($invoice) && $p_bug_data->status >= plugin_config_get('require_invoice_field_status_threshold')) {
error_parameters(plugin_lang_get('invoice'));
trigger_error(ERROR_EMPTY_FIELD, ERROR);
}
$bug_data = CustomerManagementDao::getBugData($p_bug_id);
CustomerManagementDao::saveBugData($p_bug_id, $customer_id, $service_id, $is_billable, $invoice);
if ($bug_data) {
history_log_event_direct($p_bug_id, 'invoice', $bug_data['invoice'], $invoice);
}
}
return $p_bug_data;
}