X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;ds=sidebyside;f=WEB-INF%2Flib%2FttFavReportHelper.class.php;h=a3e130c302cf18b5e6e2e7296e8b0e6b83183689;hb=9c1005341a3db52333fcb732960acbdf03fbe4e7;hp=97f7e47aefde606bc6c31b16e5af3efb520a985a;hpb=da31afab09f45aa188f4a6a8c939715a80216992;p=timetracker.git diff --git a/WEB-INF/lib/ttFavReportHelper.class.php b/WEB-INF/lib/ttFavReportHelper.class.php index 97f7e47a..a3e130c3 100644 --- a/WEB-INF/lib/ttFavReportHelper.class.php +++ b/WEB-INF/lib/ttFavReportHelper.class.php @@ -72,6 +72,7 @@ class ttFavReportHelper { } return false; } + // getReport - returns a report identified by its id. // TODO: get rid of this function by encapsulating all cron related tasks in its own class. // Because cron works for all orgs and we want this class to always work in context of @@ -225,10 +226,16 @@ class ttFavReportHelper { if (!$bean->getAttribute('chtotalsonly')) $bean->setAttribute('chtotalsonly', 0); - $users_in_bean = $bean->getAttribute('users'); - if ($users_in_bean && is_array($users_in_bean)) { - $users = join(',', $users_in_bean); + $active_users_in_bean = $bean->getAttribute('users_active'); + if ($active_users_in_bean && is_array($active_users_in_bean)) { + $users = join(',', $active_users_in_bean); + } + $inactive_users_in_bean = $bean->getAttribute('users_inactive'); + if ($inactive_users_in_bean && is_array($inactive_users_in_bean)) { + if ($users) $users .= ','; + $users .= join(',', $inactive_users_in_bean); } + if ($bean->getAttribute('start_date')) { $dt = new DateAndTime($user->getDateFormat(), $bean->getAttribute('start_date')); $from = $dt->toString(DB_DATEFORMAT); @@ -322,7 +329,8 @@ class ttFavReportHelper { $bean->setAttribute('invoice', $val['invoice']); $bean->setAttribute('paid_status', $val['paid_status']); $bean->setAttribute('timesheet', $val['timesheet']); - $bean->setAttribute('users', explode(',', $val['users'])); + $bean->setAttribute('users_active', explode(',', $val['users'])); + $bean->setAttribute('users_inactive', explode(',', $val['users'])); $bean->setAttribute('period', $val['period']); if ($val['period_start']) { $dt = new DateAndTime(DB_DATEFORMAT, $val['period_start']); @@ -414,7 +422,7 @@ class ttFavReportHelper { return $options; } - // adjustOptions takes and array or report options and adjusts them for current user + // adjustOptions takes an array or report options and adjusts them for current user // (and group) settings. This is needed in situations when a fav report is stored in db // long ago, but user or group attributes are now changed, so we have to adjust. static function adjustOptions($options) { @@ -448,8 +456,8 @@ class ttFavReportHelper { $user_ids[] = $single_user['id']; } foreach ($users_to_adjust as $user_to_adjust) { - if (in_array($user_to_adjust['id'], $user_ids)) { - $adjusted_user_ids[] = $user_to_adjust['id']; + if (in_array($user_to_adjust, $user_ids)) { + $adjusted_user_ids[] = $user_to_adjust; } } $options['users'] = implode(',', $adjusted_user_ids); @@ -457,6 +465,9 @@ class ttFavReportHelper { // TODO: add checking the existing user list for potentially changed access rights for user. } + if ($user->isPluginEnabled('ap') && $user->isClient() && !$user->can('view_client_unapproved')) + $options['approved'] = 1; // Restrict clients to approved records only. + return $options; } }