}
}
- // The getUser returns user id on behalf of whom the current user is operating.
+ // getUser returns user id on behalf of whom the current user is operating.
function getUser() {
- return ($this->behalf_id ? $this->behalf_id : $this->id);
+ return ($this->behalfUser ? $this->behalfUser->id : $this->id);
+ }
+
+ // getQuotaPercent returns quota percent for active user.
+ function getQuotaPercent() {
+ return ($this->behalfUser ? $this->behalfUser->quota_percent : $this->quota_percent);
}
// The getGroup returns group id on behalf of which the current user is operating.
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.34.4671 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.34.4672 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
<a href="https://www.anuko.com/lp/tt_4.htm" target="_blank">{$i18n.footer.credits}</a> |
<a href="https://www.anuko.com/lp/tt_5.htm" target="_blank">{$i18n.footer.license}</a> |
<a href="https://www.anuko.com/lp/tt_7.htm" target="_blank">{$i18n.footer.improve}</a>
return $numWorkdays * $user->getWorkdayMinutes();
}
+ // getUserQuota - obtains a quota for user for a single month.
+ // This quota is adjusted by quota_percent value for user.
+ public function getUserQuota($year, $month) {
+ global $user;
+
+ $minutes = $this->getSingle($year, $month);
+ $userMinutes = (int) $minutes * $user->getQuotaPercent() / 100;
+ return $userMinutes;
+ }
+
// getMany - returns an array of quotas for a given year for group.
private function getMany($year){
$sql = "select month, minutes from tt_monthly_quotas".
if ($user->isPluginEnabled('mq')){
require_once('plugins/MonthlyQuota.class.php');
$quota = new MonthlyQuota();
- $month_quota_minutes = $quota->get($selected_date->mYear, $selected_date->mMonth);
+ $month_quota_minutes = $quota->getUserQuota($selected_date->mYear, $selected_date->mMonth);
$month_total = ttTimeHelper::getTimeForMonth($selected_date);
$minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total);
if ($user->isPluginEnabled('mq')){
require_once('plugins/MonthlyQuota.class.php');
$quota = new MonthlyQuota();
- $month_quota_minutes = $quota->get($selected_date->mYear, $selected_date->mMonth);
+ $month_quota_minutes = $quota->getUserQuota($selected_date->mYear, $selected_date->mMonth);
$month_total = ttTimeHelper::getTimeForMonth($selected_date);
$minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total);