Skip to content

Commit

Permalink
fix name group empty
Browse files Browse the repository at this point in the history
  • Loading branch information
osben committed Nov 12, 2015
1 parent c701376 commit 916d918
Showing 1 changed file with 26 additions and 20 deletions.
46 changes: 26 additions & 20 deletions simpla/GroupAdmin.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -41,4 +48,3 @@ public function fetch()
}

}

0 comments on commit 916d918

Please sign in to comment.