From 42a028a26a3cc4aac9ae99e6a17cec4335244fa6 Mon Sep 17 00:00:00 2001 From: Angel Fernando Quiroz Campos Date: Fri, 26 Aug 2016 16:15:45 -0500 Subject: [PATCH] Fix course group editing - refs BT#11564 --- main/group/group_creation.php | 10 ++++------ main/group/settings.php | 2 ++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/main/group/group_creation.php b/main/group/group_creation.php index 3ee7af0e7f..e8b6ed536f 100755 --- a/main/group/group_creation.php +++ b/main/group/group_creation.php @@ -39,11 +39,6 @@ if (isset($_POST['action'])) { if (!empty($_POST['same_places'])) { $group['places'] = $_POST['group_0_places']; } - if (api_get_setting('allow_group_categories') == 'false') { - $group['category'] = 0; - } elseif (isset($_POST['same_category']) && $_POST['same_category']) { - $group['category'] = $_POST['group_0_category']; - } GroupManager::create_group( $group['name'], @@ -199,7 +194,10 @@ EOT; $cat_options, array('id' => 'category_'.$group_number) ); - } + } else { + $group_el[] = $form->createElement('hidden', 'group_'.$group_number.'_category', 0); + $defaults['group_'.$group_number.'_category'] = array_keys($cat_options)[0]; + } $group_el[] = $form->createElement( 'text', 'group_'.$group_number.'_places', diff --git a/main/group/settings.php b/main/group/settings.php index e8f64dd642..64e4f63026 100755 --- a/main/group/settings.php +++ b/main/group/settings.php @@ -48,6 +48,8 @@ if (api_get_setting('allow_group_categories') == 'true') { $categoryList[$category['id']] = $category['title']; } $form->addElement('select', 'category_id', get_lang('Category'), $categoryList); +} else { + $form->addHidden('category_id', 0); } // Members per group