while ($val = $res->fetchRow()) {
// Localize top manager role name, as it is not localized in db.
if ($val['rank'] == 512)
while ($val = $res->fetchRow()) {
// Localize top manager role name, as it is not localized in db.
if ($val['rank'] == 512)
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) return false;
// Demote self.
$role_id = $val['role_id'];
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) return false;
// Demote self.
$role_id = $val['role_id'];
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) return false;
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) return false;
if (is_a($res, 'PEAR_Error'))
return false;
while ($val = $res->fetchRow()) {
if (is_a($res, 'PEAR_Error'))
return false;
while ($val = $res->fetchRow()) {
- $isClient = in_array('track_own_time', explode(',', $val['rights'])) ? 0 : 1; // Clients do not have data entry right.
+ $isClient = in_array('track_own_time', explode(',', $val['rights'])) ? 0 : 1; // Clients do not have track_own_time right.
// Get all team ids for teams created or modified more than 8 months ago.
// $ts = date('Y-m-d', strtotime('-1 year'));
// 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);
if (!is_a($res, 'PEAR_Error')) {
if ($val = $res->fetchRow()) {
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
if ($val = $res->fetchRow()) {
// 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'));
// 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'));
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
if ($val = $res->fetchRow()) {
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
if ($val = $res->fetchRow()) {