Skip to content

Commit

Permalink
0001845: Added the support for sending an e-mail notification when a bug
Browse files Browse the repository at this point in the history
is deleted.


git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@1165 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
vboctor committed Jul 4, 2002
1 parent bf48809 commit 378ad7c
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 106 deletions.
74 changes: 1 addition & 73 deletions bug_delete.php
Expand Up @@ -15,79 +15,7 @@
check_access( $g_handle_bug_threshold );
check_bug_exists( $f_id );

deleteBug($f_id, $f_bug_text_id);

# function put in core_helper_API.php
/*
$c_id = (integer)$f_id;
$c_bug_text_id = (integer)$f_bug_text_id;
# Delete the bug entry
$query = "DELETE
FROM $g_mantis_bug_table
WHERE id='$c_id'";
$result = db_query($query);
# Delete the corresponding bug text
$query = "DELETE
FROM $g_mantis_bug_text_table
WHERE id='$c_bug_text_id'";
$result = db_query($query);
# Delete the bugnote text items
$query = "SELECT bugnote_text_id
FROM $g_mantis_bugnote_table
WHERE bug_id='$c_id'";
$result = db_query($query);
$bugnote_count = db_num_rows( $result );
for ($i=0;$i<$bugnote_count;$i++){
$row = db_fetch_array( $result );
$t_bugnote_text_id = $row['bugnote_text_id'];
# Delete the corresponding bugnote texts
$query = "DELETE
FROM $g_mantis_bugnote_text_table
WHERE id='$t_bugnote_text_id'";
$result2 = db_query( $query );
}
# Delete the corresponding bugnotes
$query = "DELETE
FROM $g_mantis_bugnote_table
WHERE bug_id='$c_id'";
$result = db_query($query);
if ( DISK == $g_file_upload_method ) {
# Delete files from disk
$query = "SELECT diskfile
FROM $g_mantis_bug_file_table
WHERE bug_id='$c_id'";
$result = db_query($query);
$file_count = db_num_rows( $result );
# there may be more than one file
for ($i=0;$i<$file_count;$i++){
$row = db_fetch_array( $result );
$t_diskfile = $row['diskfile'];
# use this instead of delete;
# in windows replace with system("del $t_diskfile");
chmod( $t_diskfile, 0775 );
unlink( $t_diskfile );
}
}
# Delete the corresponding files
$query = "DELETE
FROM $g_mantis_bug_file_table
WHERE bug_id='$c_id'";
$result = db_query($query);
# Delete the bug history
$query = "DELETE
FROM $g_mantis_bug_history_table
WHERE bug_id='$c_id'";
$result = db_query($query); */
delete_bug($f_id, $f_bug_text_id);

$t_redirect_url = 'view_all_bug_page.php';
if ( $result ) {
Expand Down
36 changes: 23 additions & 13 deletions core_email_API.php
Expand Up @@ -7,11 +7,11 @@
###########################################################################
# Email API
# -------------------------------------------------
# $Revision: 1.64 $
# $Revision: 1.65 $
# $Author: vboctor $
# $Date: 2002-07-02 12:48:52 $
# $Date: 2002-07-04 10:00:59 $
#
# $Id: core_email_API.php,v 1.64 2002-07-02 12:48:52 vboctor Exp $
# $Id: core_email_API.php,v 1.65 2002-07-04 10:00:59 vboctor Exp $
###########################################################################
# --------------------
# check to see that the format is valid and that the mx record exists
Expand Down Expand Up @@ -343,9 +343,17 @@ function email_assign( $p_bug_id ) {
email_bug_info( $p_bug_id, $s_email_assigned_msg, $t_bcc );
}
# --------------------
# send notices when a bug is DELETED
function email_bug_deleted( $p_bug_id ) {
global $s_email_bug_deleted_msg;

$t_bcc = build_bcc_list( $p_bug_id, 'deleted' );
email_bug_info( $p_bug_id, $s_email_bug_deleted_msg, $t_bcc );
}
# --------------------
# messages are in two parts, the bug info and the bugnotes
# Build the bug info part of the message
function email_build_bug_message( $p_bug_id ) {
function email_build_bug_message( $p_bug_id, $p_message ) {
global $g_mantis_bug_table, $g_mantis_bug_text_table,
$g_mantis_project_table,
$g_complete_date_format, $g_show_view,
Expand All @@ -357,7 +365,7 @@ function email_build_bug_message( $p_bug_id ) {
$s_email_duplicate, $s_email_date_submitted,
$s_email_last_modified, $s_email_summary,
$s_email_description,
$g_email_separator1,
$g_email_separator1, $s_email_bug_deleted_msg,
$g_email_padding_length;

$c_bug_id = (integer)$p_bug_id;
Expand Down Expand Up @@ -397,14 +405,16 @@ function email_build_bug_message( $p_bug_id ) {
$t_sta_str = get_enum_element( 'status', $v_status );
$t_rep_str = get_enum_element( 'reproducibility', $v_reproducibility );
$t_message = $g_email_separator1."\n";
$t_message .= $g_path;
if ( ADVANCED_ONLY == $g_show_view || ( BOTH == $g_show_view && ON == get_current_user_pref_field( 'advanced_view' ) ) ) {
$t_message .= 'view_bug_advanced_page.php';
} else {
$t_message .= 'view_bug_page.php';
if ( $p_message != $s_email_bug_deleted_msg) {
$t_message .= $g_path;
if ( ADVANCED_ONLY == $g_show_view || ( BOTH == $g_show_view && ON == get_current_user_pref_field( 'advanced_view' ) ) ) {
$t_message .= 'view_bug_advanced_page.php';
} else {
$t_message .= 'view_bug_page.php';
}
$t_message .= '?f_id='.$p_bug_id."\n";
$t_message .= $g_email_separator1."\n";
}
$t_message .= '?f_id='.$p_bug_id."\n";
$t_message .= $g_email_separator1."\n";
$t_message .= str_pd( $s_email_reporter.': ', ' ', $g_email_padding_length, STR_PAD_RIGHT ).$t_reporter_name."\n";
$t_message .= str_pd( $s_email_handler.': ', ' ', $g_email_padding_length, STR_PAD_RIGHT ).$t_handler_name."\n";
$t_message .= $g_email_separator1."\n";
Expand Down Expand Up @@ -484,7 +494,7 @@ function email_bug_info( $p_bug_id, $p_message, $p_headers='' ) {

# build message
$t_message = $p_message."\n";
$t_message .= email_build_bug_message( $p_bug_id );
$t_message .= email_build_bug_message( $p_bug_id, $p_message );
$t_message .= email_build_bugnote_message( $p_bug_id );

# send mail
Expand Down
18 changes: 7 additions & 11 deletions core_helper_API.php
Expand Up @@ -5,11 +5,11 @@
# See the files README and LICENSE for details

# --------------------------------------------------------
# $Revision: 1.50 $
# $Author: jctrosset $
# $Date: 2002-06-24 10:06:18 $
# $Revision: 1.51 $
# $Author: vboctor $
# $Date: 2002-07-04 10:00:59 $
#
# $Id: core_helper_API.php,v 1.50 2002-06-24 10:06:18 jctrosset Exp $
# $Id: core_helper_API.php,v 1.51 2002-07-04 10:00:59 vboctor Exp $
# --------------------------------------------------------

###########################################################################
Expand Down Expand Up @@ -146,18 +146,17 @@ function check_bug_exists( $p_bug_id ) {
print_header_redirect( 'main_page.php' );
}
}


# --------------------
#
# allows bug deletion :
# delete the bug, bugtext, bugnote, and bugtexts selected
# used in bug_delete.php & mass treatments
function deleteBug( $p_id, $p_bug_text_id ) {
function delete_bug( $p_id, $p_bug_text_id ) {
global $g_mantis_bug_file_table, $g_mantis_bug_table, $g_mantis_bug_text_table,
$g_mantis_bugnote_table, $g_mantis_bugnote_text_table, $g_mantis_bug_history_table,
$g_file_upload_method ;

email_bug_deleted($p_id);

$c_id = (integer)$p_id;
$c_bug_text_id = (integer)$p_bug_text_id;

Expand Down Expand Up @@ -228,9 +227,6 @@ function deleteBug( $p_id, $p_bug_text_id ) {
WHERE bug_id='$c_id'";
$result = db_query($query);
}



# --------------------
# check to see if bugnote exists
# if it doesn't exist then redirect to the main page
Expand Down
1 change: 1 addition & 0 deletions doc/ChangeLog
Expand Up @@ -75,6 +75,7 @@ Mantis ChangeLog
* Added configuration flags ($g_show_queries_count and $g_show_queries_list) that track the executed queries and display their total count, unique queries count, and the actual list of queries executed.
* Added more visual graph pages in summary_page.php. Caution, old versions of JPGraph may cause problems, use v1.6.3 or above if you can.
* Added $g_default_notify_flags and $g_notify_flags which replace $g_notify_developers_on_new, $g_notify_on_new_threshold, and $g_notify_admin_on_new. The old flags are no longer supported. The new ones provide full control on who should be notified on each event/action.
* Added notifications when a bug is deleted.

2002.05.19 - 0.17.3

Expand Down
9 changes: 5 additions & 4 deletions lang/strings_english.txt
Expand Up @@ -8,11 +8,11 @@
###########################################################################
# English strings for Mantis
# -------------------------------------------------
# $Revision: 1.56 $
# $Author: jctrosset $
# $Date: 2002-07-04 09:18:35 $
# $Revision: 1.57 $
# $Author: vboctor $
# $Date: 2002-07-04 10:01:12 $
#
# $Id: strings_english.txt,v 1.56 2002-07-04 09:18:35 jctrosset Exp $
# $Id: strings_english.txt,v 1.57 2002-07-04 10:01:12 vboctor Exp $
###########################################################################
?>
<?php
Expand Down Expand Up @@ -174,6 +174,7 @@
$s_email_feedback_msg = 'The following bug requires your FEEDBACK.';
$s_email_reopen_msg = 'The following bug has been REOPENED.';
$s_email_assigned_msg = 'The following bug has been ASSIGNED.';
$s_email_bug_deleted_msg = 'The following bug has been DELETED.';

$s_email_reporter = 'Reporter';
$s_email_handler = 'Handler';
Expand Down
10 changes: 5 additions & 5 deletions lang/strings_german.txt
Expand Up @@ -9,11 +9,11 @@
# German: Stefan Meier, Stefan.Meier@cimsource.com
# German: Matthias Bauer, mantis-de@moeffju.de
# -------------------------------------------------
# $Revision: 1.33 $
# $Author: jctrosset $
# $Date: 2002-07-04 09:18:35 $
# $Revision: 1.34 $
# $Author: vboctor $
# $Date: 2002-07-04 10:01:12 $
#
# $Id: strings_german.txt,v 1.33 2002-07-04 09:18:35 jctrosset Exp $
# $Id: strings_german.txt,v 1.34 2002-07-04 10:01:12 vboctor Exp $
###########################################################################
?>
<?php
Expand Down Expand Up @@ -175,7 +175,7 @@
$s_email_close_msg = 'Der folgende Fehler wurde geschlossen';
$s_email_feedback_msg = 'Der folgende Fehler ben�tigt Ihr Feedback.';
$s_email_reopen_msg = 'Der folgende Fehler wurde wiederer�ffnet.';
$s_email_assigned_msg = 'Der folgende Fehler wurde zugewiesen.';
$s_email_bug_deleted_msg = 'Dieser Fehler wurde gel�scht.';

$s_email_reporter = 'Reporter';
$s_email_handler = 'Bearbeiter';
Expand Down

0 comments on commit 378ad7c

Please sign in to comment.