diff --git a/simpla/GroupAdmin.php b/simpla/GroupAdmin.php index 7c7b35a..fe3ae75 100755 --- a/simpla/GroupAdmin.php +++ b/simpla/GroupAdmin.php @@ -9,25 +9,32 @@ public function fetch() if($this->request->method('post')) { $group->id = $this->request->post('id', 'integer'); - $group->name = $this->request->post('name'); - $group->discount = $this->request->post('discount'); - - if(empty($group->name)) { - $this->design->assign('message_error', 'empty_name'); - } - else { - if (empty($group->id)) { - $group->id = $this->users->add_group($group); - $this->design->assign('message_success', 'added'); - } else { - $group->id = $this->users->update_group($group->id, $group); - $this->design->assign('message_success', 'updated'); - } - $group = $this->users->get_group(intval($group->id)); - } - else - { - $id = $this->request->get('id', 'integer'); + $group->name = $this->request->post('name'); + $group->discount = $this->request->post('discount'); + + if(empty($group->name)) + { + $this->design->assign('message_error', 'name_empty'); + } + else + { + if(empty($group->id)) + { + $group->id = $this->users->add_group($group); + $this->design->assign('message_success', 'added'); + } + else + { + $group->id = $this->users->update_group($group->id, $group); + $this->design->assign('message_success', 'updated'); + } + $group = $this->users->get_group(intval($group->id)); + } + + } + else + { + $id = $this->request->get('id', 'integer'); if(!empty($id)) $group = $this->users->get_group(intval($id)); } @@ -41,4 +48,3 @@ public function fetch() } } -