projects
/
timetracker.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Refactored ttRoleHelper::getRoleByRank().
[timetracker.git]
/
WEB-INF
/
lib
/
ttTaskHelper.class.php
diff --git
a/WEB-INF/lib/ttTaskHelper.class.php
b/WEB-INF/lib/ttTaskHelper.class.php
index
c7f25d1
..
2987d27
100644
(file)
--- a/
WEB-INF/lib/ttTaskHelper.class.php
+++ b/
WEB-INF/lib/ttTaskHelper.class.php
@@
-35,9
+35,11
@@
class ttTaskHelper {
global $user;
$mdb2 = getConnection();
global $user;
$mdb2 = getConnection();
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
$sql = "select id, name, description, status from tt_tasks
$sql = "select id, name, description, status from tt_tasks
- where id = $id and group_id = $
user->group
_id and (status = 0 or status = 1)";
+ where id = $id and group_id = $
group_id and org_id = $org
_id and (status = 0 or status = 1)";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
@@
-53,15
+55,17
@@
class ttTaskHelper {
// getAssignedProjects - returns an array of projects associatied with a task.
static function getAssignedProjects($task_id)
{
// getAssignedProjects - returns an array of projects associatied with a task.
static function getAssignedProjects($task_id)
{
-
global $user;
+ global $user;
$result = array();
$mdb2 = getConnection();
$result = array();
$mdb2 = getConnection();
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
// Do a query with inner join to get assigned projects.
$sql = "select p.id, p.name from tt_projects p
inner join tt_project_task_binds ptb on (ptb.project_id = p.id and ptb.task_id = $task_id)
// Do a query with inner join to get assigned projects.
$sql = "select p.id, p.name from tt_projects p
inner join tt_project_task_binds ptb on (ptb.project_id = p.id and ptb.task_id = $task_id)
- where p.group_id = $
user->group
_id and p.status = 1 order by p.name";
+ where p.group_id = $
group_id and p.org_id = $org
_id and p.status = 1 order by p.name";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
while ($val = $res->fetchRow()) {
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
while ($val = $res->fetchRow()) {
@@
-149,11
+153,8
@@
class ttTaskHelper {
if (is_a($affected, 'PEAR_Error'))
return false;
if (is_a($affected, 'PEAR_Error'))
return false;
- $sql = "select last_insert_id() as last_insert_id";
- $res = $mdb2->query($sql);
- $val = $res->fetchRow();
- $last_id = $val['last_insert_id'];
-
+ $last_id = $mdb2->lastInsertID('tt_tasks', 'id');
+
if (is_array($projects)) {
foreach ($projects as $p_id) {
// Insert task binds into tt_project_task_binds table.
if (is_array($projects)) {
foreach ($projects as $p_id) {
// Insert task binds into tt_project_task_binds table.