X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=WEB-INF%2Flib%2FttTeamHelper.class.php;h=0d10a84f02a2a6a17c5215c783249adc0b12b937;hb=a62e4bdd1bc89ea4f3cf29507399b5b8f229597a;hp=27f31bb32d1ee7aa82b21a9d6b77cc3eb758ce44;hpb=e80e19c6b609af8e06403a337a5cd46200ab4fc6;p=timetracker.git diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 27f31bb3..0d10a84f 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -85,7 +85,7 @@ class ttTeamHelper { while ($val = $res->fetchRow()) { // Localize top manager role name, as it is not localized in db. if ($val['rank'] == 512) - $val['role_name'] = $i18n->getKey('role.top_manager.label'); + $val['role_name'] = $i18n->get('role.top_manager.label'); $user_list[] = $val; } @@ -688,24 +688,6 @@ class ttTeamHelper { return false; } - // The getTeams function returns an array of all active teams on the server. - static function getTeams() { - $result = array(); - $mdb2 = getConnection(); - - $sql = "select id, name, created, lang from tt_teams where status = 1 order by id desc"; - $res = $mdb2->query($sql); - $result = array(); - if (!is_a($res, 'PEAR_Error')) { - while ($val = $res->fetchRow()) { - $val['date'] = substr($val['created'], 0, 10); // Strip the time. - $result[] = $val; - } - return $result; - } - return false; - } - // The markDeleted function marks the team and everything in it as deleted. static function markDeleted($team_id) { @@ -916,8 +898,8 @@ class ttTeamHelper { // Get all team ids for teams created or modified more than 8 months ago. // $ts = date('Y-m-d', strtotime('-1 year')); - $ts = date('Y-m-d', strtotime('-8 month')); - $sql = "select id from tt_teams where timestamp < '$ts' order by id"; + $ts = $mdb2->quote(date('Y-m-d', strtotime('-8 month'))); + $sql = "select id from tt_teams where created < $ts and (modified is null or modified < $ts) order by id"; $res = $mdb2->query($sql); $count = 0; @@ -953,7 +935,7 @@ class ttTeamHelper { $count = 0; $ts = date('Y-m-d', strtotime('-2 years')); - $sql = "select count(*) as cnt from tt_log where user_id in ($user_list) and timestamp > '$ts'"; + $sql = "select count(*) as cnt from tt_log where user_id in ($user_list) and created > '$ts'"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { if ($val = $res->fetchRow()) { @@ -968,7 +950,7 @@ class ttTeamHelper { // We will consider a team inactive if it has 5 or less time entries made more than 1 year ago. $count_last_year = 0; $ts = date('Y-m-d', strtotime('-1 year')); - $sql = "select count(*) as cnt from tt_log where user_id in ($user_list) and timestamp > '$ts'"; + $sql = "select count(*) as cnt from tt_log where user_id in ($user_list) and created > '$ts'"; $res = $mdb2->query($sql); if (!is_a($res, 'PEAR_Error')) { if ($val = $res->fetchRow()) {