projects
/
timetracker.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
d741429
)
Started using quota percent for users if defined.
author
Nik Okuntseff
<support@anuko.com>
Thu, 20 Dec 2018 19:13:18 +0000
(19:13 +0000)
committer
Nik Okuntseff
<support@anuko.com>
Thu, 20 Dec 2018 19:13:18 +0000
(19:13 +0000)
WEB-INF/lib/ttUser.class.php
patch
|
blob
|
history
WEB-INF/templates/footer.tpl
patch
|
blob
|
history
plugins/MonthlyQuota.class.php
patch
|
blob
|
history
time.php
patch
|
blob
|
history
week.php
patch
|
blob
|
history
diff --git
a/WEB-INF/lib/ttUser.class.php
b/WEB-INF/lib/ttUser.class.php
index
4145f60
..
7d6ee6d
100644
(file)
--- a/
WEB-INF/lib/ttUser.class.php
+++ b/
WEB-INF/lib/ttUser.class.php
@@
-162,9
+162,14
@@
class ttUser {
}
}
}
}
- //
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() {
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.
}
// The getGroup returns group id on behalf of which the current user is operating.
diff --git
a/WEB-INF/templates/footer.tpl
b/WEB-INF/templates/footer.tpl
index
7d3abc6
..
a0c889c
100644
(file)
--- a/
WEB-INF/templates/footer.tpl
+++ b/
WEB-INF/templates/footer.tpl
@@
-12,7
+12,7
@@
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.34.467
1
| Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.34.467
2
| 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>
<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>
diff --git
a/plugins/MonthlyQuota.class.php
b/plugins/MonthlyQuota.class.php
index
29d8cfb
..
a1c1b5d
100644
(file)
--- a/
plugins/MonthlyQuota.class.php
+++ b/
plugins/MonthlyQuota.class.php
@@
-84,6
+84,16
@@
class MonthlyQuota {
return $numWorkdays * $user->getWorkdayMinutes();
}
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".
// getMany - returns an array of quotas for a given year for group.
private function getMany($year){
$sql = "select month, minutes from tt_monthly_quotas".
diff --git
a/time.php
b/time.php
index
013f15c
..
ac6b69b
100644
(file)
--- a/
time.php
+++ b/
time.php
@@
-85,7
+85,7
@@
if ($user->isPluginEnabled('cf')) {
if ($user->isPluginEnabled('mq')){
require_once('plugins/MonthlyQuota.class.php');
$quota = new MonthlyQuota();
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->get
UserQuota
($selected_date->mYear, $selected_date->mMonth);
$month_total = ttTimeHelper::getTimeForMonth($selected_date);
$minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total);
$month_total = ttTimeHelper::getTimeForMonth($selected_date);
$minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total);
diff --git
a/week.php
b/week.php
index
1dd6e56
..
f18817d
100644
(file)
--- a/
week.php
+++ b/
week.php
@@
-91,7
+91,7
@@
if ($user->isPluginEnabled('cf')) {
if ($user->isPluginEnabled('mq')){
require_once('plugins/MonthlyQuota.class.php');
$quota = new MonthlyQuota();
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->get
UserQuota
($selected_date->mYear, $selected_date->mMonth);
$month_total = ttTimeHelper::getTimeForMonth($selected_date);
$minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total);
$month_total = ttTimeHelper::getTimeForMonth($selected_date);
$minutes_left = $month_quota_minutes - ttTimeHelper::toMinutes($month_total);