Skip to content

Commit

Permalink
fixed bug #6848: Bugs in manage_config_*_set.php
Browse files Browse the repository at this point in the history
  based on patch by jiangxin
  • Loading branch information
thraxisp committed Mar 16, 2009
1 parent f461da7 commit 2af0fcf
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 9 deletions.
8 changes: 6 additions & 2 deletions manage_config_email_set.php
Expand Up @@ -116,7 +116,9 @@
$t_default_flags['threshold_max'] = $t_default_max;

$t_existing_default_flags = config_get( 'default_notify_flags' );
if ( $t_existing_default_flags != $t_default_flags ) { # only set the flags if they are different
$t_existing_default_access = config_get_access( 'default_notify_flags' );
if ( ( $t_existing_default_flags != $t_default_flags )
|| ( $t_existing_default_access != $f_actions_access ) ) { # only set the flags if they are different
config_set( 'default_notify_flags', $t_default_flags, NO_USER, $t_project, $f_actions_access );
}
} else {
Expand Down Expand Up @@ -144,7 +146,9 @@
}
if ( isset( $t_notify_flags ) ) {
$t_existing_flags = config_get( 'notify_flags' );
if ( $t_existing_flags != $t_notify_flags ) { # only set the flags if they are different
$t_existing_access = config_get_access( 'notify_flags' );
if ( ( $t_existing_flags != $t_notify_flags )
|| ( $t_existing_access != $f_actions_access ) ) { # only set the flags if they are different
config_set( 'notify_flags', $t_notify_flags, NO_USER, $t_project, $f_actions_access );
}
}
Expand Down
11 changes: 7 additions & 4 deletions manage_config_work_threshold_set.php
Expand Up @@ -68,12 +68,15 @@ function set_capability_row( $p_threshold, $p_all_projects_only=false ) {
# @@debug @@ var_dump($$t_access_level, $t_lower_threshold, $t_array_threshold); echo '<br />';
}
$t_existing_threshold = config_get( $p_threshold );
$t_existing_access = config_get_access( $p_threshold );
if ( -1 == $t_lower_threshold ) {
if ( $t_existing_threshold != $t_array_threshold ) {
if ( ( $t_existing_threshold != $t_array_threshold )
|| ( $t_existing_access != $f_access ) ) {
config_set( $p_threshold, $t_array_threshold, NO_USER, $t_project, $f_access );
}
} else {
if ( $t_existing_threshold != $t_lower_threshold ) {
if ( ( $t_existing_threshold != $t_lower_threshold )
|| ( $t_existing_access != $f_access ) ) {
config_set( $p_threshold, $t_lower_threshold, NO_USER, $t_project, $f_access );
}
}
Expand All @@ -90,7 +93,7 @@ function set_capability_boolean( $p_threshold, $p_all_projects_only=false ) {
$f_flag = ( OFF == $f_flag ) ? OFF : ON;
# @@debug @@ echo "<br />for $p_threshold "; var_dump($f_flag, $f_access); echo '<br />';

if ( $f_flag != config_get( $p_threshold ) ) {
if ( ( $f_flag != config_get( $p_threshold ) ) || ( $f_access != config_get_access( $p_threshold ) ) ) {
config_set( $p_threshold, $f_flag, NO_USER, $t_project, $f_access );
}
}
Expand All @@ -105,7 +108,7 @@ function set_capability_enum( $p_threshold, $p_all_projects_only=false ) {
$f_access = gpc_get_int( 'access_' . $p_threshold );
# @@debug @@ echo "<br />for $p_threshold "; var_dump($f_flag, $f_access); echo '<br />';

if ( $f_flag != config_get( $p_threshold ) ) {
if ( ( $f_flag != config_get( $p_threshold ) ) || ( $f_access != config_get_access( $p_threshold ) ) ) {
config_set( $p_threshold, $f_flag, NO_USER, $t_project, $f_access );
}
}
Expand Down
9 changes: 6 additions & 3 deletions manage_config_workflow_set.php
Expand Up @@ -48,7 +48,8 @@
if( config_get_access( $t_threshold ) <= $t_access ) {
$f_value = gpc_get( 'threshold_' . $t_threshold );
$f_access = gpc_get( 'access_' . $t_threshold );
if ( $f_value != config_get( $t_threshold ) ) {
if ( ( $f_value != config_get( $t_threshold ) )
|| ( $f_access != config_get_access( $t_threshold ) ) ) {
config_set( $t_threshold, $f_value, NO_USER, $t_project, $f_access );
}
}
Expand Down Expand Up @@ -90,7 +91,8 @@
$t_workflow[$t_state] = $t_workflow_row;
}
}
if ( $t_workflow != config_get( 'status_enum_workflow' ) ) {
if ( ( $t_workflow != config_get( 'status_enum_workflow' ) )
|| ( $f_access != config_get_access( 'status_enum_workflow' ) ) ) {
config_set( 'status_enum_workflow', $t_workflow, NO_USER, $t_project, $f_access );
}
}
Expand All @@ -114,7 +116,8 @@
}
}

if ( $t_set_status != config_get( 'set_status_threshold' ) ) {
if ( ( $t_set_status != config_get( 'set_status_threshold' ) )
|| ( $f_access != config_get_access( 'status_enum_workflow' ) ) ) {
config_set( 'set_status_threshold', $t_set_status, ALL_USERS, $t_project, $f_access );
}
}
Expand Down

0 comments on commit 2af0fcf

Please sign in to comment.