global $user;
$mdb2 = getConnection();
+ $group_id = $user->getActiveGroup();
+ $org_id = $user->org_id;
+
$id = (int)$fields['id'];
if (isset($fields['name'])) $name_part = 'name = '.$mdb2->quote($fields['name']);
if (isset($fields['rank'])) $rank_part = ', rank = '.(int)$fields['rank'];
if (isset($fields['status'])) $status_part = ', status = '.(int)$fields['status'];
if (isset($fields['rights'])) $rights_part = ', rights = '.$mdb2->quote($fields['rights']);
$parts = trim($name_part.$rank_part.$descr_part.$status_part.$rights_part, ',');
- $sql = "update tt_roles set $parts where id = $id and group_id = $user->group_id";
+ $sql = "update tt_roles set $parts where id = $id and group_id = $group_id and org_id = $org_id";
$affected = $mdb2->exec($sql);
return (!is_a($affected, 'PEAR_Error'));
}
global $user;
$mdb2 = getConnection();
+ $group_id = $user->getActiveGroup();
+ $org_id = $user->org_id;
// Mark the task as deleted.
- $sql = "update tt_roles set status = NULL where id = $role_id and group_id = $user->group_id";
+ $sql = "update tt_roles set status = NULL where id = $role_id and group_id = $group_id and org_id = $org_id";
$affected = $mdb2->exec($sql);
return (!is_a($affected, 'PEAR_Error'));
}
$result = array();
$mdb2 = getConnection();
- $sql = "select id, name, description, rank, rights from tt_roles where group_id = $user->group_id and org_id = $user->org_id and rank < $user->rank and status = 1 order by rank";
+ $group_id = $user->getActiveGroup();
+ $org_id = $user->org_id;
+
+ $sql = "select id, name, description, rank, rights from tt_roles where group_id = $group_id and org_id = $org_id and rank < $user->rank and status = 1 order by rank";
$res = $mdb2->query($sql);
$result = array();
if (!is_a($res, 'PEAR_Error')) {
$result = array();
$mdb2 = getConnection();
- $sql = "select id, name, description, rank, rights from tt_roles where group_id = $user->group_id and org_id = $user->org_id and rank < $user->rank and status = 0 order by rank";
+ $group_id = $user->getActiveGroup();
+ $org_id = $user->org_id;
+
+ $sql = "select id, name, description, rank, rights from tt_roles where group_id = $group_id and org_id = $org_id and rank < $user->rank and status = 0 order by rank";
$res = $mdb2->query($sql);
$result = array();
if (!is_a($res, 'PEAR_Error')) {
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.28.4511 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.28.4512 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
<tr>
<td>
<table cellspacing="1" cellpadding="2" border="0">
+{if isTrue($smarty.const.SUBGROUP_DEBUG)}
+{if $user->can('manage_subgroups')}
+ <tr>
+ <td align="right" nowrap>{$i18n.label.group}:</td>
+ <td>{$forms.groupForm.group.control}</td>
+ </tr>
+{/if}
+{/if}
{if $user->can('manage_basic_settings')}
<tr>
<td align="right" nowrap>{$i18n.label.group_name} (*):</td>
{if $user->can('manage_roles')}
<tr>
<td align="right" nowrap>{$i18n.label.roles}:</td>
- <td><a href="roles.php">{$i18n.label.configure}</a></td>
+ <td><a href="roles.php?group_id={$group_id}">{$i18n.label.configure}</a></td>
</tr>
{/if}
-{if $smarty.const.SUBGROUP_DEBUG == 'true'}
- {if $user->can('manage_subgroups')}
- <tr>
- <td align="right" nowrap>{$i18n.label.subgroups}:</td>
- <td><a href="groups.php">{$i18n.label.configure}</a></td>
- </tr>
- {/if}
-{/if}
<tr>
<td align="right" nowrap>{$i18n.label.language}:</td>
<td>{$forms.groupForm.lang.control}</td>
}
// End of access checks.
+if ($group_id) {
+ // We are passed a valid group_id.
+ // Set on behalf group accordingly.
+ $user->setOnBehalfGroup($group_id);
+}
+
if (!$group_id) $group_id = $user->getActiveGroup();
+$groups = $user->getGroupsForDropdown();
$group = ttGroupHelper::getGroupAttrs($group_id);
$config = new ttConfigHelper($group['config']);
$form = new Form('groupForm');
$form->addInput(array('type'=>'hidden','name'=>'id','value'=>$group_id));
+if (count($groups) > 1) {
+ $form->addInput(array('type'=>'combobox',
+ 'onchange'=>'document.groupForm.group_changed.value=1;document.groupForm.submit();',
+ 'name'=>'group',
+ 'style'=>'width: 250px;',
+ 'value'=>$group_id,
+ 'data'=>$groups,
+ 'datakeys'=>array('id','name')));
+ $form->addInput(array('type'=>'hidden','name'=>'group_changed'));
+}
$form->addInput(array('type'=>'text','maxlength'=>'200','name'=>'group_name','value'=>$cl_group,'enable'=>$advanced_settings));
$form->addInput(array('type'=>'textarea','name'=>'description','style'=>'width: 250px; height: 40px;','value'=>$cl_description));
$form->addInput(array('type'=>'text','maxlength'=>'7','name'=>'currency','value'=>$cl_currency));
$form->addInput(array('type'=>'submit','name'=>'btn_save','value'=>$i18n->get('button.save')));
if ($user->can('delete_group')) $form->addInput(array('type'=>'submit','name'=>'btn_delete','value'=>$i18n->get('button.delete')));
+$form->setValueByElement('group_changed','');
+
if ($request->isPost()) {
+ if ($request->getParameter('group_changed')) {
+ // User changed the group in dropdown.
+ $new_group_id = $request->getParameter('group');
+ // Redirect to self.
+ header('Location: group_edit.php?id='.$new_group_id);
+ exit();
+ }
if ($request->getParameter('btn_delete')) {
// Delete button pressed, redirect.
} // isPost
$smarty->assign('auth_external', $auth->isPasswordExternal());
+$smarty->assign('group_id', $group_id);
+$smarty->assign('group_dropdown', count($groups) > 1);
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
$smarty->assign('onload', 'onLoad="handleTaskRequiredCheckbox(); handlePluginCheckboxes();"');
$smarty->assign('title', $i18n->get('title.edit_group'));
header('Location: access_denied.php');
exit();
}
+$group_id = (int)$request->getParameter('group_id');
+if ($group_id && !$user->isGroupValid($group_id)) {
+ header('Location: access_denied.php');
+ exit();
+}
// End of access checks.
+if ($group_id) {
+ // We are passed a valid group_id (most likely from group_edit.php).
+ // Set on behalf group accordingly.
+ $user->setOnBehalfGroup($group_id);
+}
+
$smarty->assign('active_roles', ttTeamHelper::getActiveRolesForUser());
$smarty->assign('inactive_roles', ttTeamHelper::getInactiveRolesForUser());
$smarty->assign('title', $i18n->get('title.roles'));