projects
/
timetracker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactored mobile expenses.php for subgroups.
[timetracker.git]
/
WEB-INF
/
lib
/
ttUserHelper.class.php
diff --git
a/WEB-INF/lib/ttUserHelper.class.php
b/WEB-INF/lib/ttUserHelper.class.php
index
2ff774f
..
0d628f6
100644
(file)
--- a/
WEB-INF/lib/ttUserHelper.class.php
+++ b/
WEB-INF/lib/ttUserHelper.class.php
@@
-120,11
+120,7
@@
class ttUserHelper {
// Now deal with project assignment.
if (!is_a($affected, 'PEAR_Error')) {
// Now deal with project assignment.
if (!is_a($affected, 'PEAR_Error')) {
- $sql = "SELECT LAST_INSERT_ID() AS last_id";
- $res = $mdb2->query($sql);
- $val = $res->fetchRow();
- $last_id = $val['last_id'];
-
+ $last_id = $mdb2->lastInsertID('tt_users', 'id');
$projects = isset($fields['projects']) ? $fields['projects'] : array();
if (count($projects) > 0) {
// We have at least one project assigned. Insert corresponding entries in tt_user_project_binds table.
$projects = isset($fields['projects']) ? $fields['projects'] : array();
if (count($projects) > 0) {
// We have at least one project assigned. Insert corresponding entries in tt_user_project_binds table.
@@
-193,7
+189,7
@@
class ttUserHelper {
// otherwise de-activate the bind (set its status to inactive). This will keep the bind
// and its rate in database for reporting.
// otherwise de-activate the bind (set its status to inactive). This will keep the bind
// and its rate in database for reporting.
- $all_projects = ttTeamHelper::getAllProjects($user->g
roup_id
);
+ $all_projects = ttTeamHelper::getAllProjects($user->g
etGroup()
);
$assigned_projects = isset($fields['projects']) ? $fields['projects'] : array();
foreach($all_projects as $p) {
$assigned_projects = isset($fields['projects']) ? $fields['projects'] : array();
foreach($all_projects as $p) {
@@
-232,8
+228,6
@@
class ttUserHelper {
ttUserHelper::insertBind(array(
'user_id' => $user_id,
'project_id' => $project_id,
ttUserHelper::insertBind(array(
'user_id' => $user_id,
'project_id' => $project_id,
- 'group_id' => $user->getGroup(),
- 'org_id' => $user->org_id,
'rate' => $rate,
'status' => ACTIVE));
}
'rate' => $rate,
'status' => ACTIVE));
}
@@
-319,10
+313,8
@@
class ttUserHelper {
global $user;
$mdb2 = getConnection();
global $user;
$mdb2 = getConnection();
- // This may be used during import. Use the following until we have import refactored.
- $group_id = $fields['group_id'] ? (int) $fields['group_id'] : $user->getGroup();
- $org_id = $fields['org_id'] ? (int) $fields['org_id'] : $user->org_id;
-
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
$user_id = (int) $fields['user_id'];
$project_id = (int) $fields['project_id'];
$rate = $mdb2->quote($fields['rate']);
$user_id = (int) $fields['user_id'];
$project_id = (int) $fields['project_id'];
$rate = $mdb2->quote($fields['rate']);