From c0f7949ec43e60447053cec98bb178a14ad3be8b Mon Sep 17 00:00:00 2001 From: Andrew McMillan Date: Sat, 3 Apr 2010 17:30:41 +1300 Subject: [PATCH] Don't query the entries unless we actually have a collection. --- inc/ui/collection-edit.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/inc/ui/collection-edit.php b/inc/ui/collection-edit.php index eaab62b3..9f8da177 100644 --- a/inc/ui/collection-edit.php +++ b/inc/ui/collection-edit.php @@ -120,6 +120,9 @@ else { } if ( $editor->Available() ) { $c->page_title = $editor->Title(translate('Collection').': '.$editor->Value('dav_displayname')); + $entryqry = new AwlQuery( 'SELECT count(*) as count from caldav_data where collection_id='.$editor->Value('collection_id') ); + $entryqry->Exec('admin-collection-edit'); + $entries = $entryqry->Fetch(); $entries = $entries->count; } else { $c->page_title = $editor->Title(translate('Create New Collection')); @@ -129,11 +132,9 @@ else { $editor->Assign('user_no', $usr->user_no); $editor->Assign('is_calendar', 't' ); $editor->Assign('use_default_privs', 't'); + $entries = 0; } -$entryqry = new AwlQuery( 'SELECT count(*) as count from caldav_data where collection_id='.$id ); -$entryqry->Exec('admin-collection-edit'); -$entries = $entryqry->Fetch(); $entries = $entries->count; $privilege_xlate = array( 'read' => translate('Read'),