Example #1
0
    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);
        }
    }
    # copy attachments from parent
    if ($f_copy_attachments_from_parent) {
        file_copy_attachments($f_master_bug_id, $t_bug_id);
    }
}
helper_call_custom_function('issue_create_notify', array($t_bug_id));
# Allow plugins to post-process bug data with the new bug ID
event_signal('EVENT_REPORT_BUG', array($t_bug_data, $t_bug_id));
email_new_bug($t_bug_id);
// log status and resolution changes if they differ from the default
Example #2
0
         # title
         $writer->writeElement('name', $custom_field_name);
         # filename
         $writer->writeElement('type', $t_custom_field['type']);
         # filesize
         $writer->writeElement('value', $t_custom_field['value']);
         # file_type
         $writer->writeElement('access_level_r', $t_custom_field['access_level_r']);
         $writer->endElement();
         # custom_field
     }
     $writer->endElement();
     # custom_fields
 }
 # fetch and export bugnotes
 $t_bugnotes = bugnote_get_all_bugnotes($t_row->id);
 if (is_array($t_bugnotes) && count($t_bugnotes) > 0) {
     $writer->startElement('bugnotes');
     foreach ($t_bugnotes as $t_bugnote) {
         $writer->startElement('bugnote');
         # id
         $writer->writeElement('id', $t_bugnote->id);
         # reporter
         $writer->startElement('reporter');
         $writer->writeAttribute('id', $t_bugnote->reporter_id);
         $writer->text(user_get_name($t_bugnote->reporter_id));
         $writer->endElement();
         # bug note
         $writer->writeElement('note', $t_bugnote->note);
         # view state
         $writer->startElement('view_state');
 function getNotices($p_bug_id)
 {
     return bugnote_get_all_bugnotes($p_bug_id);
 }
Example #4
0
/**
 * Build the bugnotes array for the given bug_id filtered by specified $p_user_access_level.
 * Bugnotes are sorted by date_submitted according to 'bugnote_order' configuration setting.
 * Return BugnoteData class object with raw values from the tables except the field
 * last_modified - it is UNIX_TIMESTAMP.
 * @param int $p_bug_id bug id
 * @param int $p_user_bugnote_order sort order
 * @param int $p_user_bugnote_limit number of bugnotes to display to user
 * @param int $p_user_id user id
 * @return array array of bugnotes
 * @access public
 */
function bugnote_get_all_visible_bugnotes($p_bug_id, $p_user_bugnote_order, $p_user_bugnote_limit, $p_user_id = null)
{
    if ($p_user_id === null) {
        $t_user_id = auth_get_current_user_id();
    } else {
        $t_user_id = $p_user_id;
    }
    $t_project_id = bug_get_field($p_bug_id, 'project_id');
    $t_user_access_level = user_get_access_level($t_user_id, $t_project_id);
    $t_all_bugnotes = bugnote_get_all_bugnotes($p_bug_id);
    $t_private_bugnote_threshold = config_get('private_bugnote_threshold');
    $t_private_bugnote_visible = access_compare_level($t_user_access_level, config_get('private_bugnote_threshold'));
    $t_time_tracking_visible = access_compare_level($t_user_access_level, config_get('time_tracking_view_threshold'));
    $t_bugnotes = array();
    $t_bugnote_count = count($t_all_bugnotes);
    $t_bugnote_limit = $p_user_bugnote_limit > 0 ? $p_user_bugnote_limit : $t_bugnote_count;
    $t_bugnotes_found = 0;
    # build a list of the latest bugnotes that the user can see
    for ($i = 0; $i < $t_bugnote_count && $t_bugnotes_found < $t_bugnote_limit; $i++) {
        $t_bugnote = array_pop($t_all_bugnotes);
        if ($t_private_bugnote_visible || $t_bugnote->reporter_id == $t_user_id || VS_PUBLIC == $t_bugnote->view_state) {
            # If the access level specified is not enough to see time tracking information
            # then reset it to 0.
            if (!$t_time_tracking_visible) {
                $t_bugnote->time_tracking = 0;
            }
            $t_bugnotes[$t_bugnotes_found++] = $t_bugnote;
        }
    }
    # reverse the list for users with ascending view preferences
    if ('ASC' == $p_user_bugnote_order) {
        $t_bugnotes = array_reverse($t_bugnotes);
    }
    return $t_bugnotes;
}
Example #5
0
/**
 * send a generic email
 * $p_notify_type: use check who she get notified of such event.
 * $p_message_id: message id to be translated and included at the top of the email message.
 * Return false if it were problems sending email * @param string
 * @param int $p_bug_id
 * @param string $p_notify_type
 * @param int $p_message_id
 * @param array $p_header_optional_params = null
 * @param array $p_extra_user_ids_to_email
 * @return bool
 */
function email_generic($p_bug_id, $p_notify_type, $p_message_id = null, $p_header_optional_params = null, $p_extra_user_ids_to_email = array())
{
    $t_ok = true;
    if (ON === config_get('enable_email_notification')) {
        ignore_user_abort(true);
        bugnote_get_all_bugnotes($p_bug_id);
        # @todo yarick123: email_collect_recipients(...) will be completely rewritten to provide additional information such as language, user access,..
        # @todo yarick123:sort recipients list by language to reduce switches between different languages
        $t_recipients = email_collect_recipients($p_bug_id, $p_notify_type, $p_extra_user_ids_to_email);
        $t_project_id = bug_get_field($p_bug_id, 'project_id');
        if (is_array($t_recipients)) {
            # send email to every recipient
            foreach ($t_recipients as $t_user_id => $t_user_email) {
                log_event(LOG_EMAIL, sprintf("Issue = #%d, Type = %s, Msg = '%s', User = @U%d, Email = '%s'.", $p_bug_id, $p_notify_type, $p_message_id, $t_user_id, $t_user_email));
                # load (push) user language here as build_visible_bug_data assumes current language
                lang_push(user_pref_get_language($t_user_id, $t_project_id));
                $t_visible_bug_data = email_build_visible_bug_data($t_user_id, $p_bug_id, $p_message_id);
                $t_ok = email_bug_info_to_one_user($t_visible_bug_data, $p_message_id, $t_project_id, $t_user_id, $p_header_optional_params) && $t_ok;
                lang_pop();
            }
        }
        # Only trigger the draining of the email queue if cronjob is disabled and email notifications are enabled.
        if (OFF == config_get('email_send_using_cronjob')) {
            email_send_all();
        }
    }
    return $t_ok;
}
 /**
  * Get last change values for:
  * - amount of bugotes
  *
  * @param $bug_id
  * @param $version_date
  * @return int
  */
 public function calculate_last_bugnotes($bug_id, $version_date)
 {
     $bugnote_count = 0;
     $bugnotes = bugnote_get_all_bugnotes($bug_id);
     foreach ($bugnotes as $bugnote) {
         if ($bugnote->date_submitted <= $version_date) {
             $bugnote_count++;
         }
     }
     return $bugnote_count;
 }
Example #7
0
function bugnote_get_all_visible_bugnotes($p_bug_id, $p_user_access_level, $p_user_bugnote_order, $p_user_bugnote_limit)
{
    $t_all_bugnotes = bugnote_get_all_bugnotes($p_bug_id, $p_user_bugnote_order, $p_user_bugnote_limit);
    $t_private_bugnote_threshold = config_get('private_bugnote_threshold');
    $t_private_bugnote_visible = access_compare_level($p_user_access_level, config_get('private_bugnote_threshold'));
    $t_time_tracking_visible = access_compare_level($p_user_access_level, config_get('time_tracking_view_threshold'));
    $t_bugnotes = array();
    foreach ($t_all_bugnotes as $t_note_index => $t_bugnote) {
        if ($t_private_bugnote_visible || VS_PUBLIC == $t_bugnote->view_state) {
            # If the access level specified is not enough to see time tracking information
            # then reset it to 0.
            if (!$t_time_tracking_visible) {
                $t_bugnote->time_tracking = 0;
            }
            $t_bugnotes[$t_note_index] = $t_bugnote;
        }
    }
    return $t_bugnotes;
}
Example #8
0
/**
 * Sends a generic email to the specific set of recipients.
 *
 * @param integer $p_bug_id                  A bug identifier
 * @param string  $p_notify_type             Notification type
 * @param array   $p_recipients              Array of recipients (key: user id, value: email address)
 * @param integer $p_message_id              Message identifier
 * @param array   $p_header_optional_params  Optional Parameters (default null)
 * @return void
 */
function email_generic_to_recipients($p_bug_id, $p_notify_type, array $p_recipients, $p_message_id = null, array $p_header_optional_params = null)
{
    if (OFF == config_get('enable_email_notification')) {
        return;
    }
    ignore_user_abort(true);
    bugnote_get_all_bugnotes($p_bug_id);
    $t_project_id = bug_get_field($p_bug_id, 'project_id');
    if (is_array($p_recipients)) {
        # send email to every recipient
        foreach ($p_recipients as $t_user_id => $t_user_email) {
            log_event(LOG_EMAIL_VERBOSE, 'Issue = #%d, Type = %s, Msg = \'%s\', User = @U%d, Email = \'%s\'.', $p_bug_id, $p_notify_type, $p_message_id, $t_user_id, $t_user_email);
            # load (push) user language here as build_visible_bug_data assumes current language
            lang_push(user_pref_get_language($t_user_id, $t_project_id));
            $t_visible_bug_data = email_build_visible_bug_data($t_user_id, $p_bug_id, $p_message_id);
            email_bug_info_to_one_user($t_visible_bug_data, $p_message_id, $t_user_id, $p_header_optional_params);
            lang_pop();
        }
    }
}
Example #9
0
/**
 * send a generic email
 * $p_notify_type: use check who she get notified of such event.
 * $p_message_id: message id to be translated and included at the top of the email message.
 * Return false if it were problems sending email * @param string
 * @param int $p_bug_id
 * @param string $p_notify_type
 * @param int $p_message_id
 * @param array $p_header_optional_params = null
 * @param array $p_extra_user_ids_to_email
 * @return bool
 */
function email_generic_to_recipients($p_bug_id, $p_notify_type, array $p_recipients, $p_message_id = null, $p_header_optional_params = null)
{
    $t_ok = true;
    if (ON === config_get('enable_email_notification')) {
        ignore_user_abort(true);
        bugnote_get_all_bugnotes($p_bug_id);
        $t_project_id = bug_get_field($p_bug_id, 'project_id');
        if (is_array($p_recipients)) {
            # send email to every recipient
            foreach ($p_recipients as $t_user_id => $t_user_email) {
                log_event(LOG_EMAIL, sprintf("Issue = #%d, Type = %s, Msg = '%s', User = @U%d, Email = '%s'.", $p_bug_id, $p_notify_type, $p_message_id, $t_user_id, $t_user_email));
                # load (push) user language here as build_visible_bug_data assumes current language
                lang_push(user_pref_get_language($t_user_id, $t_project_id));
                $t_visible_bug_data = email_build_visible_bug_data($t_user_id, $p_bug_id, $p_message_id);
                $t_ok = email_bug_info_to_one_user($t_visible_bug_data, $p_message_id, $t_project_id, $t_user_id, $p_header_optional_params) && $t_ok;
                lang_pop();
            }
        }
        # Only trigger the draining of the email queue if cronjob is disabled and email notifications are enabled.
        if (OFF == config_get('email_send_using_cronjob')) {
            email_send_all();
        }
    }
    return $t_ok;
}
Example #10
0
/**
 * send a generic email
 * $p_notify_type: use check who she get notified of such event.
 * $p_message_id: message id to be translated and included at the top of the email message.
 * Return false if it were problems sending email
 * @param integer $p_bug_id                  A bug identifier.
 * @param string  $p_notify_type             Notification type.
 * @param integer $p_message_id              Message identifier.
 * @param array   $p_header_optional_params  Optional Parameters (default null).
 * @param array   $p_extra_user_ids_to_email Array of additional users to email.
 * @return void
 */
function email_generic($p_bug_id, $p_notify_type, $p_message_id = null, array $p_header_optional_params = null, array $p_extra_user_ids_to_email = array())
{
    if (OFF == config_get('enable_email_notification')) {
        return;
    }
    ignore_user_abort(true);
    bugnote_get_all_bugnotes($p_bug_id);
    # @todo yarick123: email_collect_recipients(...) will be completely rewritten to provide additional information such as language, user access,..
    # @todo yarick123:sort recipients list by language to reduce switches between different languages
    $t_recipients = email_collect_recipients($p_bug_id, $p_notify_type, $p_extra_user_ids_to_email);
    $t_project_id = bug_get_field($p_bug_id, 'project_id');
    if (is_array($t_recipients)) {
        # send email to every recipient
        foreach ($t_recipients as $t_user_id => $t_user_email) {
            log_event(LOG_EMAIL, 'Issue = #%d, Type = %s, Msg = \'%s\', User = @U%d, Email = \'%s\'.', $p_bug_id, $p_notify_type, $p_message_id, $t_user_id, $t_user_email);
            # load (push) user language here as build_visible_bug_data assumes current language
            lang_push(user_pref_get_language($t_user_id, $t_project_id));
            $t_visible_bug_data = email_build_visible_bug_data($t_user_id, $p_bug_id, $p_message_id);
            email_bug_info_to_one_user($t_visible_bug_data, $p_message_id, $t_project_id, $t_user_id, $p_header_optional_params);
            lang_pop();
        }
    }
}
Example #11
0
    function event_view_bug_details($p_event, $p_project_id)
    {
        global $agilemantis_sprint;
        global $agilemantis_pb;
        global $agilemantis_commonlib;
        // Only projects with agilMantis backlog
        if (!$agilemantis_commonlib->projectHasBacklogs(helper_get_current_project())) {
            return;
        }
        if ($_SESSION['AGILEMANTIS_ISMANTISADMIN'] == 1 || $_SESSION['AGILEMANTIS_ISMANTISUSER'] == 1) {
            if ($_POST['saveValues']) {
                $agilemantis_pb->setCustomFieldValues($p_project_id);
                bug_update_date($p_project_id);
                if ((int) $_GET['bug_id']) {
                    header('Location:' . $_SERVER['PHP_SELF'] . '?bug_id=' . $p_project_id . '&save=true');
                } else {
                    header('Location:' . $_SERVER['PHP_SELF'] . '?id=' . $p_project_id . '&save=true');
                }
                email_generic($p_project_id, 'updated', 'email_notification_title_for_action_bug_updated');
            }
            $pbl = $agilemantis_pb->getProjectProductBacklogs(helper_get_current_project());
            $story = $agilemantis_pb->checkForUserStory($p_project_id);
            $s = $agilemantis_sprint->getBacklogSprints($story['name']);
            // check wether bugnotes are available or not
            $t_bugnotes = bugnote_get_all_bugnotes($p_project_id);
            $t_amount_bugnotes = count($t_bugnotes);
            // activate or disable bugnotes link
            $bugnotes_disable = '';
            if ($t_amount_bugnotes > 0) {
                $bugnotes_disable = '<a href="#bugnotes">' . plugin_lang_get('view_issue_look_through_notes') . '</a>';
            }
            $pb_name = $story['name'];
            $sprint_name = $story['sprint'];
            $disable_sprint_button = '';
            if ($sprint_name == "") {
                $disable_sprint_button = 'disabled';
            } else {
                if (plugin_config_get('gadiv_taskboard') == 0) {
                    $page_backlog = plugin_page("sprint_backlog.php");
                } else {
                    $page_backlog = plugin_page("taskboard.php");
                }
            }
            require_once AGILEMANTIS_CORE_URI . "agile_mantis_custom_fields_inc.php";
            if ($_GET['save'] == true) {
                $hinweis = '<span class="message_ok">' . plugin_lang_get('view_issue_successfully_saved') . '</span>';
            } else {
                $hinweis = '';
            }
            if ($story['name'] == "") {
                $task_disable = 'disabled';
            }
            echo '
					<tr ' . helper_alternate_class() . '>
						<td class="custom_field_form">agileMantis-' . plugin_lang_get('common_actions') . '</td>
						<td colspan="5">
							<input type="submit" name="saveValues" value="' . plugin_lang_get('view_issue_save_infos') . '">
							</form>
							<form action="' . plugin_page("task_page.php") . '&us_id=' . $p_project_id . '" method="post">
								<input type="submit" value="' . plugin_lang_get('view_issue_edit_tasks') . '" ' . $task_disable . '>
							</form>
							<form action="' . plugin_page("product_backlog.php") . '" method="post">
								<input type="submit" value="' . plugin_lang_get('view_issue_goto_product_backlog') . '" ' . $task_disable . '>
								<input type="hidden" name="productBacklogName" value="' . $pb_name . '">
							</form>
							<form action="' . $page_backlog . '" method="post">
								<input type="submit" value="' . plugin_lang_get('view_issue_goto_sprint_backlog') . '" ' . $disable_sprint_button . '>
								<input type="hidden" name="sprintName" value="' . $sprint_name . '">
							</form>
							' . $bugnotes_disable . '
							' . $hinweis . '
						</td>
					</tr>
				';
        }
    }
Example #12
0
 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);
         }
     }
     $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;
 }
Example #13
0
function bugnote_get_all_visible_bugnotes($p_bug_id, $p_user_access_level, $p_user_bugnote_order, $p_user_bugnote_limit)
{
    $t_all_bugnotes = bugnote_get_all_bugnotes($p_bug_id, $p_user_bugnote_order, $p_user_bugnote_limit);
    $t_private_bugnote_threshold = config_get('private_bugnote_threshold');
    $t_private_bugnote_visible = access_compare_level($p_user_access_level, config_get('private_bugnote_threshold'));
    $t_bugnotes = array();
    foreach ($t_all_bugnotes as $t_note_index => $t_bugnote) {
        if ($t_private_bugnote_visible || VS_PUBLIC == $t_bugnote->view_state) {
            $t_bugnotes[$t_note_index] = $t_bugnote;
        }
    }
    return $t_bugnotes;
}