From 49d927b96a181cbe2ff721000aac1ea88de24b69 Mon Sep 17 00:00:00 2001 From: skeeter Date: Sat, 10 Feb 2001 19:54:32 +0000 Subject: [PATCH] takes into account having 0 apps enabled for the group --- admin/editgroup.php | 42 ++++++++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 18 deletions(-) diff --git a/admin/editgroup.php b/admin/editgroup.php index dda1e3ea88..22f80efc54 100755 --- a/admin/editgroup.php +++ b/admin/editgroup.php @@ -49,11 +49,15 @@ $apps = CreateObject('phpgwapi.applications',intval($group_id)); $apps_before = $apps->read_account_specific(); $apps->update_data(Array()); - while($app = each($n_group_permissions)) { - if($app[1]) { - $apps->add($app[0]); - if(!$apps_before[$app[0]]) { - $new_apps[] = $app[0]; + $new_apps = Array(); + if(isset($n_group_permissions)) { + reset($n_group_permissions); + while($app = each($n_group_permissions)) { + if($app[1]) { + $apps->add($app[0]); + if(!$apps_before[$app[0]]) { + $new_apps[] = $app[0]; + } } } } @@ -75,24 +79,26 @@ $acl->add_repository('phpgw_group',$group_id,$n_users[$i],1); // If the user is logged in, it will force a refresh of the session_info - $phpgw->db->query("update phpgw_sessions set session_info='' " + $phpgw->db->query("update phpgw_sessions set session_action='' " ."where session_lid='" . $phpgw->accounts->id2name(intval($n_users[$i])) . "@" . $phpgw_info["user"]["domain"] . "'",__LINE__,__FILE__); // The following sets any default preferences needed for new applications.. // This is smart enough to know if previous preferences were selected, use them. - $pref = CreateObject('phpgwapi.preferences',intval($n_users[$i])); - $t = $pref->read_repository(); - $docommit = False; - for ($j=1;$jcommon->hook_single('add_def_pref', $new_apps[$j]); - $docommit = True; + if($new_apps) { + $pref = CreateObject('phpgwapi.preferences',intval($n_users[$i])); + $t = $pref->read_repository(); + + for ($j=1;$jcommon->hook_single('add_def_pref', $new_apps[$j]); + $docommit = True; + } } } if ($docommit) {