本文整理汇总了PHP中date_get_null函数的典型用法代码示例。如果您正苦于以下问题:PHP date_get_null函数的具体用法?PHP date_get_null怎么用?PHP date_get_null使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了date_get_null函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: date_strtotime
/**
* gets Unix timestamp from date string
* @param string $p_date A valid date/time string (see http://php.net/manual/en/datetime.formats.php)
* @return false|int a timestamp on success, null date when $p_date is blank or false on failure.
* @access public
*/
function date_strtotime($p_date)
{
if (is_blank($p_date)) {
return date_get_null();
}
return strtotime($p_date);
}
示例2: __set
/**
* @param string $name
* @param string $value
* @private
*/
public function __set($name, $value) {
switch ($name) {
case 'date_order':
if( !is_numeric($value) ) {
if( $value == '' ) {
$value = date_get_null();
} else {
$value = strtotime( $value );
if ( $value === false ) {
trigger_error( ERROR_INVALID_DATE_FORMAT, ERROR );
}
}
}
}
$this->$name = $value;
}
示例3: gpc_get_string
$f_target_version = gpc_get_string('target_version', '');
$f_profile_id = gpc_get_int('profile_id', 0);
$f_handler_id = gpc_get_int('handler_id', 0);
$f_category_id = gpc_get_int('category_id', 0);
$f_reproducibility = gpc_get_int('reproducibility', (int) config_get('default_bug_reproducibility'));
$f_eta = gpc_get_int('eta', (int) config_get('default_bug_eta'));
$f_severity = gpc_get_int('severity', (int) config_get('default_bug_severity'));
$f_priority = gpc_get_int('priority', (int) config_get('default_bug_priority'));
$f_summary = gpc_get_string('summary', '');
$f_description = gpc_get_string('description', '');
$f_steps_to_reproduce = gpc_get_string('steps_to_reproduce', config_get('default_bug_steps_to_reproduce'));
$f_additional_info = gpc_get_string('additional_info', config_get('default_bug_additional_info'));
$f_view_state = gpc_get_int('view_state', (int) config_get('default_bug_view_status'));
$f_due_date = gpc_get_string('due_date', '');
if ($f_due_date == '') {
$f_due_date = date_get_null();
}
$t_changed_project = false;
}
$f_report_stay = gpc_get_bool('report_stay', false);
$f_copy_notes_from_parent = gpc_get_bool('copy_notes_from_parent', false);
$f_copy_attachments_from_parent = gpc_get_bool('copy_attachments_from_parent', false);
$t_fields = config_get('bug_report_page_fields');
$t_fields = columns_filter_disabled($t_fields);
$t_show_category = in_array('category_id', $t_fields);
$t_show_reproducibility = in_array('reproducibility', $t_fields);
$t_show_eta = in_array('eta', $t_fields);
$t_show_severity = in_array('severity', $t_fields);
$t_show_priority = in_array('priority', $t_fields);
$t_show_steps_to_reproduce = in_array('steps_to_reproduce', $t_fields);
$t_show_handler = in_array('handler', $t_fields) && access_has_project_level(config_get('update_bug_assign_threshold'));
示例4: date_is_null
/**
* checks if date is null
* @param int $p_date
* @return bool
* @access public
*/
function date_is_null($p_date)
{
return $p_date == date_get_null();
}
示例5: gpc_get_int
$t_bug_data->view_state = gpc_get_int('view_state', config_get('default_bug_view_status'));
$t_bug_data->category_id = gpc_get_int('category_id', 0);
$t_bug_data->reproducibility = gpc_get_int('reproducibility', config_get('default_bug_reproducibility'));
$t_bug_data->severity = gpc_get_int('severity', config_get('default_bug_severity'));
$t_bug_data->priority = gpc_get_int('priority', config_get('default_bug_priority'));
$t_bug_data->projection = gpc_get_int('projection', config_get('default_bug_projection'));
$t_bug_data->eta = gpc_get_int('eta', config_get('default_bug_eta'));
$t_bug_data->resolution = gpc_get_string('resolution', config_get('default_bug_resolution'));
$t_bug_data->status = gpc_get_string('status', config_get('bug_submit_status'));
$t_bug_data->summary = trim(gpc_get_string('summary'));
$t_bug_data->description = gpc_get_string('description');
$t_bug_data->steps_to_reproduce = gpc_get_string('steps_to_reproduce', config_get('default_bug_steps_to_reproduce'));
$t_bug_data->additional_information = gpc_get_string('additional_info', config_get('default_bug_additional_info'));
$t_bug_data->due_date = gpc_get_string('due_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);
$f_copy_attachments_from_parent = gpc_get_bool('copy_attachments_from_parent', false);
if (access_has_project_level(config_get('roadmap_update_threshold'), $t_bug_data->project_id)) {
$t_bug_data->target_version = gpc_get_string('target_version', '');
}
# if a profile was selected then let's use that information
if (0 != $t_bug_data->profile_id) {
if (profile_is_global($t_bug_data->profile_id)) {
$row = user_get_profile_row(ALL_USERS, $t_bug_data->profile_id);
} else {
$row = user_get_profile_row($t_bug_data->reporter_id, $t_bug_data->profile_id);
示例6: mc_issue_update
//.........这里部分代码省略.........
if (isset($p_issue['view_state'])) {
$t_bug_data->view_state = mci_get_view_state_id($p_issue['view_state']);
}
if (isset($p_issue['date_submitted'])) {
$t_bug_data->date_submitted = $p_issue['date_submitted'];
}
if (isset($p_issue['date_updated'])) {
$t_bug_data->last_updated = $p_issue['last_updated'];
}
if (isset($p_issue['profile_id'])) {
$t_bug_data->profile_id = $p_issue['profile_id'];
}
if (isset($p_issue['os'])) {
$t_bug_data->os = $p_issue['os'];
}
if (isset($p_issue['os_build'])) {
$t_bug_data->os_build = $p_issue['os_build'];
}
if (isset($p_issue['build'])) {
$t_bug_data->build = $p_issue['build'];
}
if (isset($p_issue['platform'])) {
$t_bug_data->platform = $p_issue['platform'];
}
if (isset($p_issue['version'])) {
$t_bug_data->version = $p_issue['version'];
}
if (isset($p_issue['fixed_in_version'])) {
$t_bug_data->fixed_in_version = $p_issue['fixed_in_version'];
}
if (isset($p_issue['sticky']) && access_has_bug_level(config_get('set_bug_sticky_threshold'), $t_bug_data->id)) {
$t_bug_data->sticky = $p_issue['sticky'];
}
if (isset($p_issue['due_date']) && access_has_global_level(config_get('due_date_update_threshold'))) {
$t_bug_data->due_date = SoapObjectsFactory::parseDateTimeString($p_issue['due_date']);
} else {
$t_bug_data->due_date = date_get_null();
}
if (access_has_project_level(config_get('roadmap_update_threshold'), $t_bug_data->project_id, $t_user_id)) {
$t_bug_data->target_version = isset($p_issue['target_version']) ? $p_issue['target_version'] : '';
}
$t_set_custom_field_error = mci_issue_set_custom_fields($p_issue_id, $p_issue['custom_fields'], true);
if ($t_set_custom_field_error != null) {
return $t_set_custom_field_error;
}
if (isset($p_issue['monitors'])) {
mci_issue_set_monitors($p_issue_id, $t_user_id, $p_issue['monitors']);
}
if (isset($p_issue['notes']) && is_array($p_issue['notes'])) {
$t_bugnotes = bugnote_get_all_visible_bugnotes($p_issue_id, 'DESC', 0);
$t_bugnotes_by_id = array();
foreach ($t_bugnotes as $t_bugnote) {
$t_bugnotes_by_id[$t_bugnote->id] = $t_bugnote;
}
foreach ($p_issue['notes'] as $t_note) {
$t_note = SoapObjectsFactory::unwrapObject($t_note);
if (isset($t_note['view_state'])) {
$t_view_state = $t_note['view_state'];
} else {
$t_view_state = config_get('default_bugnote_view_status');
}
if (isset($t_note['id']) && (int) $t_note['id'] > 0) {
$t_bugnote_id = (int) $t_note['id'];
$t_view_state_id = mci_get_enum_id_from_objectref('view_state', $t_view_state);
if (array_key_exists($t_bugnote_id, $t_bugnotes_by_id)) {
$t_bugnote_changed = false;
if ($t_bugnote->note !== $t_note['text']) {
bugnote_set_text($t_bugnote_id, $t_note['text']);
$t_bugnote_changed = true;
}
if ($t_bugnote->view_state != $t_view_state_id) {
bugnote_set_view_state($t_bugnote_id, $t_view_state_id == VS_PRIVATE);
$t_bugnote_changed = true;
}
if (isset($t_note['time_tracking']) && $t_note['time_tracking'] != $t_bugnote->time_tracking) {
bugnote_set_time_tracking($t_bugnote_id, mci_get_time_tracking_from_note($p_issue_id, $t_note));
$t_bugnote_changed = true;
}
if ($t_bugnote_changed) {
bugnote_date_update($t_bugnote_id);
}
}
} else {
$t_view_state_id = mci_get_enum_id_from_objectref('view_state', $t_view_state);
$t_note_type = isset($t_note['note_type']) ? (int) $t_note['note_type'] : BUGNOTE;
$t_note_attr = isset($t_note['note_type']) ? $t_note['note_attr'] : '';
bugnote_add($p_issue_id, $t_note['text'], mci_get_time_tracking_from_note($p_issue_id, $t_note), $t_view_state_id == VS_PRIVATE, $t_note_type, $t_note_attr, $t_user_id, false);
}
}
# The issue has been cached earlier in the bug_get() call. Flush the cache since it is
# now stale. Otherwise, the email notification will be based on the cached data.
bugnote_clear_cache($p_issue_id);
}
if (isset($p_issue['tags']) && is_array($p_issue['tags'])) {
mci_tag_set_for_issue($p_issue_id, $p_issue['tags'], $t_user_id);
}
# submit the issue
log_event(LOG_WEBSERVICE, 'updating issue \'' . $p_issue_id . '\'');
return $t_bug_data->update(true, true);
}
示例7: 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
//.........这里部分代码省略.........
示例8: mc_issue_update
//.........这里部分代码省略.........
if ( is_blank( $t_description ) ) {
return new soap_fault( 'Client', '', "Mandatory field 'description' is missing." );
}
// fields which we expect to always be set
$t_bug_data = bug_get( $p_issue_id, true );
$t_bug_data->project_id = $t_project_id;
$t_bug_data->reporter_id = $t_reporter_id;
$t_bug_data->handler_id = $t_handler_id;
$t_bug_data->category_id = $t_category_id;
$t_bug_data->summary = $t_summary;
$t_bug_data->description = $t_description;
// fields which might not be set
if ( isset ( $p_issue['steps_to_reproduce'] ) )
$t_bug_data->steps_to_reproduce = $p_issue['steps_to_reproduce'];
if ( isset ( $p_issue['additional_information'] ) )
$t_bug_data->additional_information = $p_issue['additional_information'];
if ( isset( $p_issue['priority'] ) )
$t_bug_data->priority = mci_get_priority_id( $p_issue['priority'] );
if ( isset( $p_issue['severity'] ) )
$t_bug_data->severity = mci_get_severity_id( $p_issue['severity'] );
if ( isset( $p_issue['status'] ) )
$t_bug_data->status = mci_get_status_id ( $p_issue['status'] );
if ( isset ( $p_issue['reproducibility'] ) )
$t_bug_data->reproducibility = mci_get_reproducibility_id( $p_issue['reproducibility'] );
if ( isset ( $p_issue['resolution'] ) )
$t_bug_data->resolution = mci_get_resolution_id( $p_issue['resolution'] );
if ( isset ( $p_issue['projection'] ) )
$t_bug_data->projection = mci_get_projection_id( $p_issue['projection'] );
if ( isset ( $p_issue['eta'] ) )
$t_bug_data->eta = mci_get_eta_id( $p_issue['eta'] );
if ( isset ( $p_issue['view_state'] ) )
$t_bug_data->view_state = mci_get_view_state_id( $p_issue['view_state'] );
if ( isset ( $p_issue['date_submitted'] ) )
$t_bug_data->date_submitted = $p_issue['date_submitted'];
if ( isset ( $p_issue['date_updated'] ) )
$t_bug_data->last_updated = $p_issue['last_updated'];
if ( isset ( $p_issue['os'] ) )
$t_bug_data->os = $p_issue['os'];
if ( isset ( $p_issue['os_build'] ) )
$t_bug_data->os_build = $p_issue['os_build'];
if ( isset ( $p_issue['build'] ) )
$t_bug_data->build = $p_issue['build'];
if ( isset ( $p_issue['platform'] ) )
$t_bug_data->platform = $p_issue['platform'];
if ( isset ( $p_issue['version'] ) )
$t_bug_data->version = $p_issue['version'];
if ( isset ( $p_issue['fixed_in_version'] ) )
$t_bug_data->fixed_in_version = $p_issue['fixed_in_version'];
if ( isset( $p_issue['due_date'] ) && access_has_global_level( config_get( 'due_date_update_threshold' ) ) ) {
$t_bug_data->due_date = mci_iso8601_to_timestamp( $p_issue['due_date'] );
} else {
$t_bug_data->due_date = date_get_null();
}
if( access_has_project_level( config_get( 'roadmap_update_threshold' ), $t_bug_data->project_id, $t_user_id ) ) {
$t_bug_data->target_version = isset( $p_issue['target_version'] ) ? $p_issue['target_version'] : '';
}
mci_issue_set_custom_fields( $p_issue_id, $p_issue['custom_fields'], true );
if ( isset ( $p_issue['monitors'] ) )
mci_issue_set_monitors( $p_issue_id , $t_user_id, $p_issue['monitors'] );
if ( isset( $p_issue['notes'] ) && is_array( $p_issue['notes'] ) ) {
foreach ( $p_issue['notes'] as $t_note ) {
if ( isset( $t_note['view_state'] ) ) {
$t_view_state = $t_note['view_state'];
} else {
$t_view_state = config_get( 'default_bugnote_view_status' );
}
if ( isset( $t_note['id'] ) && ( (int)$t_note['id'] > 0 ) ) {
$t_bugnote_id = (integer)$t_note['id'];
$t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state );
if ( bugnote_exists( $t_bugnote_id ) ) {
bugnote_set_text( $t_bugnote_id, $t_note['text'] );
bugnote_set_view_state( $t_bugnote_id, $t_view_state_id == VS_PRIVATE );
bugnote_date_update( $t_bugnote_id );
if ( isset( $t_note['time_tracking'] ) )
bugnote_set_time_tracking( $t_bugnote_id, mci_get_time_tracking_from_note( $p_issue_id, $t_note ) );
}
} else {
$t_view_state_id = mci_get_enum_id_from_objectref( 'view_state', $t_view_state );
$note_type = isset ( $t_note['note_type'] ) ? (int) $t_note['note_type'] : BUGNOTE;
$note_attr = isset ( $t_note['note_type'] ) ? $t_note['note_attr'] : '';
bugnote_add( $p_issue_id, $t_note['text'], mci_get_time_tracking_from_note( $p_issue_id, $t_note ), $t_view_state_id == VS_PRIVATE, $note_type, $note_attr, $t_user_id, FALSE );
}
}
}
# submit the issue
return $t_bug_data->update( /* update_extended */ true, /* bypass_email */ true );
}
示例9: add_bug
private function add_bug(&$p_email, $p_overwrite_project_id = FALSE)
{
$this->show_memory_usage('Start add bug');
//Merge References and In-Reply-To headers into one array
$t_references = $p_email['References'];
$t_references[] = $p_email['In-Reply-To'];
if ($this->_mail_add_bugnotes) {
$t_bug_id = $this->mail_is_a_bugnote($p_email['Subject'], $t_references);
} else {
$t_bug_id = FALSE;
}
if ($t_bug_id !== FALSE && !bug_is_readonly($t_bug_id)) {
// @TODO@ Disabled for now until we find a good solution on how to handle the reporters possible lack of access permissions
// access_ensure_bug_level( config_get( 'add_bugnote_threshold' ), $f_bug_id );
$t_description = $p_email['X-Mantis-Body'];
$t_description = $this->identify_replies($t_description);
$t_description = $this->strip_signature($t_description);
$t_description = $this->add_additional_info('note', $p_email, $t_description);
$t_project_id = bug_get_field($t_bug_id, 'project_id');
ERP_set_temporary_overwrite('project_override', $t_project_id);
# Event integration
# Core mantis event already exists within bugnote_add function
$t_description = event_signal('EVENT_ERP_BUGNOTE_DATA', $t_description, $t_bug_id);
if (bug_is_resolved($t_bug_id)) {
# Reopen issue and add a bug note
bug_reopen($t_bug_id, $t_description);
} elseif (!is_blank($t_description)) {
# Add a bug note
bugnote_add($t_bug_id, $t_description);
}
} elseif ($this->_mail_add_bug_reports) {
// @TODO@ Disabled for now until we find a good solution on how to handle the reporters possible lack of access permissions
// access_ensure_project_level( config_get('report_bug_threshold' ) );
$f_master_bug_id = $t_bug_id !== FALSE && bug_is_readonly($t_bug_id) ? $t_bug_id : 0;
$this->fix_empty_fields($p_email);
$t_project_id = $p_overwrite_project_id === FALSE ? $this->_mailbox['project_id'] : $p_overwrite_project_id;
ERP_set_temporary_overwrite('project_override', $t_project_id);
$t_bug_data = new BugData();
$t_bug_data->build = '';
$t_bug_data->platform = '';
$t_bug_data->os = '';
$t_bug_data->os_build = '';
$t_bug_data->version = '';
$t_bug_data->profile_id = 0;
$t_bug_data->handler_id = 0;
$t_bug_data->view_state = (int) config_get('default_bug_view_status');
$t_bug_data->category_id = (int) $this->_mailbox['global_category_id'];
$t_bug_data->reproducibility = (int) config_get('default_bug_reproducibility');
$t_bug_data->severity = (int) config_get('default_bug_severity');
$t_bug_data->priority = (int) ($this->_mail_use_bug_priority ? $p_email['Priority'] : config_get('default_bug_priority'));
$t_bug_data->projection = (int) config_get('default_bug_projection');
$t_bug_data->eta = (int) config_get('default_bug_eta');
$t_bug_data->resolution = config_get('default_bug_resolution');
$t_bug_data->status = config_get('bug_submit_status');
$t_bug_data->summary = $p_email['Subject'];
$t_description = $p_email['X-Mantis-Body'];
$t_description = $this->strip_signature($t_description);
$t_description = $this->add_additional_info('issue', $p_email, $t_description);
$t_bug_data->description = $t_description;
$t_bug_data->steps_to_reproduce = config_get('default_bug_steps_to_reproduce');
$t_bug_data->additional_information = config_get('default_bug_additional_info');
$t_bug_data->due_date = date_get_null();
$t_bug_data->project_id = $t_project_id;
$t_bug_data->reporter_id = $p_email['Reporter_id'];
// This function might do stuff that EmailReporting cannot handle. Disabled
//helper_call_custom_function( 'issue_create_validate', array( $t_bug_data ) );
// @TODO@ Disabled for now but possibly needed for other future features
# 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'] ||
$t_def['type'] == CUSTOM_FIELD_TYPE_ENUM ||
$t_def['type'] == CUSTOM_FIELD_TYPE_LIST ||
$t_def['type'] == CUSTOM_FIELD_TYPE_MULTILIST ||
$t_def['type'] == CUSTOM_FIELD_TYPE_RADIO ) ) {
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);
$t_bug_data = event_signal('EVENT_ERP_REPORT_BUG_DATA', $t_bug_data);
# Create the bug
$t_bug_id = $t_bug_data->create();
// @TODO@ Disabled for now but possibly needed for other future features
# 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 ) )
//.........这里部分代码省略.........
示例10: save_bug
function save_bug($p_project_id, $p_user_id)
{
require 'ProfileAcraExt.php';
$t_project_id = $p_project_id;
global $g_cache_current_user_id;
$g_cache_current_user_id = $p_user_id;
$t_bug_data = new BugData();
$t_bug_data->project_id = $t_project_id;
$t_bug_data->reporter_id = $p_user_id;
$t_bug_data->build = gpc_get_string('APP_VERSION_CODE', '');
$t_bug_data->platform = "Android";
$t_bug_data->os = gpc_get_string('ANDROID_VERSION', '');
//gpc_get_string( 'os', '' );
$t_os_build = gpc_get_string('BUILD', '');
if (preg_match('/DISPLAY\\s*=\\s*(.*)/', $t_os_build, $t_match)) {
var_dump($t_match);
$t_os_build = $t_match[1];
} else {
$t_os_build = gpc_get_string('ANDROID_VERSION', '');
}
$t_bug_data->os_build = $t_os_build;
//gpc_get_string( 'os_build', '' );
$t_bug_data->version = gpc_get_string('APP_VERSION_NAME', '');
$t_bug_data->profile_id = profile_create_unique(ALL_USERS, $t_bug_data->platform, $t_bug_data->os, $t_bug_data->os_build, "");
$t_bug_data->handler_id = gpc_get_int('handler_id', 0);
$t_bug_data->view_state = gpc_get_int('view_state', config_get('default_bug_view_status', 'VS_PRIVATE', 'acra_reporter'));
$t_bug_data->category_id = $this->get_category_id($p_project_id);
//gpc_get_int( 'category_id', 0 );
$t_bug_data->reproducibility = 10;
//gpc_get_int( 'reproducibility', config_get( 'default_bug_reproducibility' ) );
$t_bug_data->severity = CRASH;
//gpc_get_int( 'severity', config_get( 'default_bug_severity' ) );
$t_bug_data->priority = HIGH;
//gpc_get_int( 'priority', config_get( 'default_bug_priority' ) );
$t_bug_data->projection = gpc_get_int('projection', config_get('default_bug_projection'));
$t_bug_data->eta = gpc_get_int('eta', config_get('default_bug_eta'));
$t_bug_data->resolution = OPEN;
//gpc_get_string('resolution', config_get( 'default_bug_resolution' ) );
$t_bug_data->status = NEW_;
//gpc_get_string( 'status', config_get( 'bug_submit_status' ) );
$t_bug_data->description = gpc_get_string('STACK_TRACE');
//gpc_get_string( 'description' );
$t_bug_data->summary = get_bug_summary_by_version(gpc_get_string('APP_VERSION_NAME', ''), $t_bug_data->description, $t_project_id);
$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);
}
//.........这里部分代码省略.........
示例11: mc_issue_update
//.........这里部分代码省略.........
return new soap_fault('Client', '', "Category field must be supplied.");
} else {
return new soap_fault('Client', '', "Category '" . $p_issue['category'] . "' not found for project '{$t_project_name}'.");
}
}
if (isset($p_issue['version']) && !is_blank($p_issue['version']) && !version_get_id($p_issue['version'], $t_project_id)) {
$t_error_when_version_not_found = config_get('mc_error_when_version_not_found');
if ($t_error_when_version_not_found == ON) {
$t_project_name = project_get_name($t_project_id);
return new soap_fault('Client', '', "Version '" . $p_issue['version'] . "' does not exist in project '{$t_project_name}'.");
} else {
$t_version_when_not_found = config_get('mc_version_when_not_found');
$p_issue['version'] = $t_version_when_not_found;
}
}
if (is_blank($t_summary)) {
return new soap_fault('Client', '', "Mandatory field 'summary' is missing.");
}
if (is_blank($t_description)) {
return new soap_fault('Client', '', "Mandatory field 'description' is missing.");
}
if ($t_priority_id == 0) {
$t_priority_id = config_get('default_bug_priority');
}
if ($t_severity_id == 0) {
$t_severity_id = config_get('default_bug_severity');
}
if ($t_view_state_id == 0) {
$t_view_state_id = config_get('default_bug_view_status');
}
if ($t_reproducibility_id == 0) {
$t_reproducibility_id = config_get('default_bug_reproducibility');
}
$t_bug_data = new BugData();
$t_bug_data->id = $p_issue_id;
$t_bug_data->project_id = $t_project_id;
$t_bug_data->reporter_id = $t_reporter_id;
$t_bug_data->handler_id = $t_handler_id;
$t_bug_data->priority = $t_priority_id;
$t_bug_data->severity = $t_severity_id;
$t_bug_data->reproducibility = $t_reproducibility_id;
$t_bug_data->status = $t_status_id;
$t_bug_data->resolution = $t_resolution_id;
$t_bug_data->projection = $t_projection_id;
$t_bug_data->category_id = $t_category_id;
$t_bug_data->date_submitted = isset($v_date_submitted) ? $v_date_submitted : '';
$t_bug_data->last_updated = isset($v_last_updated) ? $v_last_updated : '';
$t_bug_data->eta = $t_eta_id;
$t_bug_data->os = $t_os;
$t_bug_data->os_build = $t_os_build;
$t_bug_data->platform = $t_platform;
$t_bug_data->version = isset($p_issue['version']) ? $p_issue['version'] : '';
$t_bug_data->fixed_in_version = isset($p_issue['fixed_in_version']) ? $p_issue['fixed_in_version'] : '';
$t_bug_data->build = $t_build;
$t_bug_data->view_state = $t_view_state_id;
$t_bug_data->summary = $t_summary;
$t_bug_data->sponsorship_total = $t_sponsorship_total;
if (isset($p_issue['due_date']) && access_has_global_level(config_get('due_date_update_threshold'))) {
$t_bug_data->due_date = mci_iso8601_to_timestamp($p_issue['due_date']);
} else {
$t_bug_data->due_date = date_get_null();
}
if (access_has_project_level(config_get('roadmap_update_threshold'), $t_bug_data->project_id, $t_user_id)) {
$t_bug_data->target_version = isset($p_issue['target_version']) ? $p_issue['target_version'] : '';
}
# omitted:
# var $bug_text_id
# $t_bug_data->profile_id;
# extended info
$t_bug_data->description = $t_description;
$t_bug_data->steps_to_reproduce = isset($t_steps_to_reproduce) ? $t_steps_to_reproduce : '';
$t_bug_data->additional_information = isset($t_additional_information) ? $t_additional_information : '';
# submit the issue
$t_is_success = $t_bug_data->update(true, true);
mci_issue_set_custom_fields($p_issue_id, $p_issue['custom_fields'], true);
if (isset($p_issue['notes']) && is_array($p_issue['notes'])) {
foreach ($p_issue['notes'] as $t_note) {
if (isset($t_note['view_state'])) {
$t_view_state = $t_note['view_state'];
} else {
$t_view_state = config_get('default_bugnote_view_status');
}
if (isset($t_note['id']) && (int) $t_note['id'] > 0) {
$t_bugnote_id = (int) $t_note['id'];
if (bugnote_exists($t_bugnote_id)) {
bugnote_set_text($t_bugnote_id, $t_note['text']);
bugnote_set_view_state($t_bugnote_id, $t_view_state_id == VS_PRIVATE);
bugnote_date_update($t_bugnote_id);
if (isset($t_note['time_tracking'])) {
bugnote_set_time_tracking($t_bugnote_id, mci_get_time_tracking_from_note($p_issue_id, $t_note));
}
}
} else {
$t_view_state_id = mci_get_enum_id_from_objectref('view_state', $t_view_state);
bugnote_add($p_issue_id, $t_note['text'], mci_get_time_tracking_from_note($p_issue_id, $t_note), $t_view_state_id == VS_PRIVATE, BUGNOTE, '', $t_user_id, FALSE);
}
}
}
return $t_is_success;
}