Skip to content

Commit

Permalink
Fixed #6830: custom_function_override_issue_delete_notify and custom_…
Browse files Browse the repository at this point in the history
…function_override_issue_update_notify are not being triggered.

git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@4275 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
vboctor committed Feb 20, 2007
1 parent 7e0eac9 commit b828c85
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 7 deletions.
27 changes: 26 additions & 1 deletion bug_actiongroup.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_actiongroup.php,v 1.49 2006-12-16 20:12:55 vboctor Exp $
# $Id: bug_actiongroup.php,v 1.50 2007-02-20 05:24:14 vboctor Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -62,7 +62,10 @@
if ( access_can_close_bug( $t_bug_id ) &&
( $t_status < CLOSED ) &&
bug_check_workflow($t_status, CLOSED) ) {

# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $f_bug_id, $t_bug_data, $f_bugnote_text ) );
bug_close( $t_bug_id );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
if ( ! access_can_close_bug( $t_bug_id ) ) {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
Expand All @@ -82,8 +85,10 @@

case 'MOVE':
if ( access_has_bug_level( config_get( 'move_bug_threshold' ), $t_bug_id ) ) {
# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
$f_project_id = gpc_get_int( 'project_id' );
bug_set_field( $t_bug_id, 'project_id', $f_project_id );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
Expand Down Expand Up @@ -112,7 +117,9 @@
if ( access_has_bug_level( $t_threshold , $t_bug_id, $f_assign ) &&
access_has_bug_level( config_get( 'update_bug_assign_threshold', config_get( 'update_bug_threshold' ) ), $t_bug_id ) &&
bug_check_workflow($t_status, $t_assign_status ) ) {
# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
bug_assign( $t_bug_id, $f_assign );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
if ( bug_check_workflow($t_status, $t_assign_status ) ) {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
Expand All @@ -129,7 +136,9 @@
bug_check_workflow($t_status, $t_resolved_status ) ) {
$f_resolution = gpc_get_int( 'resolution' );
$f_fixed_in_version = gpc_get_string( 'fixed_in_version', '' );
# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
bug_resolve( $t_bug_id, $f_resolution, $f_fixed_in_version );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
if ( ( $t_status < $t_resolved_status ) &&
bug_check_workflow($t_status, $t_resolved_status ) ) {
Expand All @@ -143,7 +152,9 @@
case 'UP_PRIOR':
if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) {
$f_priority = gpc_get_int( 'priority' );
# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
bug_set_field( $t_bug_id, 'priority', $f_priority );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
Expand All @@ -154,7 +165,9 @@
$t_project = bug_get_field( $t_bug_id, 'project_id' );
if ( access_has_bug_level( access_get_status_threshold( $f_status, $t_project ), $t_bug_id ) ) {
if ( TRUE == bug_check_workflow($t_status, $f_status ) ) {
# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
bug_set_field( $t_bug_id, 'status', $f_status );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_status' );
}
Expand All @@ -168,7 +181,9 @@
$t_project = bug_get_field( $t_bug_id, 'project_id' );
if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) {
if ( category_exists( $t_project, $f_category ) ) {
# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
bug_set_field( $t_bug_id, 'category', $f_category );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_category' );
}
Expand All @@ -183,7 +198,9 @@

if ( access_has_bug_level( config_get( 'update_bug_threshold' ), $t_bug_id ) ) {
if ( version_exists( $t_project_id, $f_version ) ) {
# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
bug_set_field( $t_bug_id, 'fixed_in_version', $f_fixed_in_version );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_failed' );
}
Expand All @@ -196,7 +213,9 @@

if ( access_has_bug_level( config_get( 'roadmap_view_threshold' ), $t_bug_id ) ) {
if ( version_exists( $t_project_id, $f_version ) ) {
# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
bug_set_field( $t_bug_id, 'target_version', $f_fixed_in_version );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_failed' );
}
Expand All @@ -206,7 +225,9 @@
case 'VIEW_STATUS':
if ( access_has_bug_level( config_get( 'change_view_status_threshold' ), $t_bug_id ) ) {
$f_view_status = gpc_get_int( 'view_status' );
# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
bug_set_field( $t_bug_id, 'view_state', $f_view_status );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
Expand All @@ -216,7 +237,9 @@
if ( access_has_bug_level( config_get( 'set_bug_sticky_threshold' ), $t_bug_id ) ) {
$f_sticky = bug_get_field( $t_bug_id, 'sticky' );
// The new value is the inverted old value
# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
bug_set_field( $t_bug_id, 'sticky', intval( !$f_sticky ) );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
} else {
$t_failed_ids[$t_bug_id] = lang_get( 'bug_actiongroup_access' );
}
Expand All @@ -227,9 +250,11 @@
trigger_error( ERROR_GENERIC, ERROR );
}

# @@@ we need to issue a helper_call_custom_function( 'issue_update_validate', array( $t_bug_id, $t_bug_data, $f_bugnote_text ) );
$t_form_var = "custom_field_$f_custom_field_id";
$t_custom_field_value = gpc_get_custom_field( $t_form_var, $t_custom_field_def['type'], null );
custom_field_set_value( $f_custom_field_id, $t_bug_id, $t_custom_field_value );
helper_call_custom_function( 'issue_update_notify', array( $t_bug_id ) );
break;

default:
Expand Down
6 changes: 1 addition & 5 deletions bug_delete.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_delete.php,v 1.40 2005-07-25 16:34:10 thraxisp Exp $
# $Id: bug_delete.php,v 1.41 2007-02-20 05:24:14 vboctor Exp $
# --------------------------------------------------------
?>
<?php
Expand Down Expand Up @@ -35,11 +35,7 @@

$t_bug = bug_get( $f_bug_id, true );

helper_call_custom_function( 'issue_delete_validate', array( $f_bug_id ) );

bug_delete( $f_bug_id );

helper_call_custom_function( 'issue_delete_notify', array( $f_bug_id ) );

print_successful_redirect( 'view_all_bug_page.php' );
?>
10 changes: 9 additions & 1 deletion core/bug_api.php
Expand Up @@ -6,7 +6,7 @@
# See the README and LICENSE files for details

# --------------------------------------------------------
# $Id: bug_api.php,v 1.103 2006-12-12 18:26:29 davidnewcomb Exp $
# $Id: bug_api.php,v 1.104 2007-02-20 05:24:15 vboctor Exp $
# --------------------------------------------------------

$t_core_dir = dirname( __FILE__ ).DIRECTORY_SEPARATOR;
Expand Down Expand Up @@ -662,11 +662,19 @@ function bug_delete( $p_bug_id ) {
$t_bug_table = config_get( 'mantis_bug_table' );
$t_bug_text_table = config_get( 'mantis_bug_text_table' );

# call pre-deletion custom function
helper_call_custom_function( 'issue_delete_validate', array( $p_bug_id ) );

# log deletion of bug
history_log_event_special( $p_bug_id, BUG_DELETED, bug_format_id( $p_bug_id ) );

email_bug_deleted( $p_bug_id );

# call post-deletion custom function. We call this here to allow the custom function to access the details of the bug before
# they are deleted from the database given it's id. The other option would be to move this to the end of the function and
# provide it with bug data rather than an id, but this will break backward compatibility.
helper_call_custom_function( 'issue_delete_notify', array( $f_bug_id ) );

# Unmonitor bug for all users
bug_unmonitor( $p_bug_id, null );

Expand Down

0 comments on commit b828c85

Please sign in to comment.