From 99e86f894495a4672226f113b043595052025fc7 Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Mon, 24 Aug 2009 12:16:50 +1200 Subject: [PATCH] Fix broken SQL when selecting user list for group. --- inc/DAViCalUser.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/inc/DAViCalUser.php b/inc/DAViCalUser.php index b4d5c85b..a52b7d47 100644 --- a/inc/DAViCalUser.php +++ b/inc/DAViCalUser.php @@ -199,17 +199,19 @@ class DAViCalUser extends User * Present an extra editable row at the bottom of the browse. */ if ( $ef->EditMode ) { // && $session->AllowedTo("MaintainRelationships") ) { - $sql = <<user_no)) - AND user_no != $this->user_no ORDER BY fullname -EOSQL; if ( isset($this->roles['Group']) ) { /** * We only allow individuals to link to groups at this stage. */ - $sql .= 'AND NOT EXISTS (SELECT 1 FROM role_member WHERE role_no = 2 AND user_no=usr.user_no)'; + $groupsql = 'AND NOT EXISTS (SELECT 1 FROM role_member WHERE role_no = 2 AND user_no=usr.user_no)'; } + else $groupsql = ''; + + $sql = <<user_no)) + AND user_no != $this->user_no $groupsql ORDER BY fullname +EOSQL; if ( ! isset($this->roles['Group']) ) $nullvalue = translate( "--- select a user, group or resource ---" );