Kategorien
PHP Webdeveloper Tools

Mantis Benachrichtigungs Emails Inhalt reduzieren

Mantis als PM Tool versendet bei konfigurierbaren Events an bestimmte User Benachrichtigungs E-Mails, die sehr viele Informationen beinhalten und schnell lang werden können.

Um nicht immer die gesamte History in der E-Mail zu sehen, kann man folgenden Code ändern:

core/bugnote_api.php l.372:

$t_bugnote_count = 1;// vorher: count( $t_all_bugnotes );

Damit wird nur die letzte Note versendet.

Oder man konfiguriert diesen Wert bei jedem User einzeln: My Account->Preferences->E-mail Notes Limit = 1

Ticket Informationen kürzen

Wenn man die Informationen am Anfang der Benachrichtigungs mail kürzen will, wie:

Reported By:                sebastian
Assigned To:                sebastian
======================================================================
Project:                    foo
Issue ID:                   9
Category:                   foo
Reproducibility:            have not tried
Severity:                   minor
Priority:                   normal
Status:                     assigned
======================================================================
Date Submitted:             2012-08-06 08:49 CEST
Last Modified:              2012-10-14 13:38 CEST
======================================================================

kann man die Datei core/email_api.php anpassen und bestimmte werte auskommentieren:

l.1228 Funktion email_format_bug_message()

    $t_message .= email_format_attribute( $p_visible_bug_data, 'email_reporter' );
    $t_message .= email_format_attribute( $p_visible_bug_data, 'email_handler' );
    $t_message .= $t_email_separator1 . " \n";
    $t_message .= email_format_attribute( $p_visible_bug_data, 'email_project' );
    /*    $t_message .= email_format_attribute( $p_visible_bug_data, 'email_bug' );
    $t_message .= email_format_attribute( $p_visible_bug_data, 'email_category' );
     $t_message .= email_format_attribute( $p_visible_bug_data, 'email_reproducibility' );
     $t_message .= email_format_attribute( $p_visible_bug_data, 'email_severity' );
     $t_message .= email_format_attribute( $p_visible_bug_data, 'email_priority' );
     $t_message .= email_format_attribute( $p_visible_bug_data, 'email_status' );
     $t_message .= email_format_attribute( $p_visible_bug_data, 'email_target_version' );*/

    # custom fields formatting
    foreach( $p_visible_bug_data['custom_fields'] as $t_custom_field_name => $t_custom_field_data ) {
        $t_message .= utf8_str_pad( lang_get_defaulted( $t_custom_field_name, null ) . ': ', $t_email_padding_length, ' ', STR_PAD_RIGHT );
        $t_message .= string_custom_field_value_for_email( $t_custom_field_data['value'], $t_custom_field_data['type'] );
        $t_message .= " \n";
    }

    # end foreach custom field

    if( config_get( 'bug_resolved_status_threshold' ) <= $t_status ) {
        $p_visible_bug_data['email_resolution'] = get_enum_element( 'resolution', $p_visible_bug_data['email_resolution'] );
        $t_message .= email_format_attribute( $p_visible_bug_data, 'email_resolution' );
        $t_message .= email_format_attribute( $p_visible_bug_data, 'email_fixed_in_version' );
    }
/*    $t_message .= $t_email_separator1 . " \n";

    $t_message .= email_format_attribute( $p_visible_bug_data, 'email_date_submitted' );
    $t_message .= email_format_attribute( $p_visible_bug_data, 'email_last_modified' );
    $t_message .= $t_email_separator1 . " \n";

    $t_message .= email_format_attribute( $p_visible_bug_data, 'email_summary' );

    $t_message .= lang_get( 'email_description' ) . ": \n" . $p_visible_bug_data['email_description'] . "\n";

    if ( !is_blank( $p_visible_bug_data['email_steps_to_reproduce'] ) ) {
        $t_message .= "\n" . lang_get( 'email_steps_to_reproduce' ) . ": \n" . $p_visible_bug_data['email_steps_to_reproduce'] . "\n";
    }

    if ( !is_blank( $p_visible_bug_data['email_additional_information'] ) ) {
        $t_message .= "\n" . lang_get( 'email_additional_information' ) . ": \n" . $p_visible_bug_data['email_additional_information'] . "\n";
    }

    if( isset( $p_visible_bug_data['relations'] ) ) {
        if( $p_visible_bug_data['relations'] != '' ) {
            $t_message .= $t_email_separator1 . "\n" . str_pad( lang_get( 'bug_relationships' ), 20 ) . str_pad( lang_get( 'id' ), 8 ) . lang_get( 'summary' ) . "\n" . $t_email_separator2 . "\n" . $p_visible_bug_data['relations'];
        }
    }*/

    # Sponsorship
    if( isset( $p_visible_bug_data['sponsorship_total'] ) && ( $p_visible_bug_data['sponsorship_total'] > 0 ) ) {