projects
/
timetracker.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
83e5b07
)
Some more refactoring for subgroups.
author
Nik Okuntseff
<support@anuko.com>
Thu, 13 Dec 2018 17:11:47 +0000
(17:11 +0000)
committer
Nik Okuntseff
<support@anuko.com>
Thu, 13 Dec 2018 17:11:47 +0000
(17:11 +0000)
WEB-INF/lib/ttReportHelper.class.php
patch
|
blob
|
history
WEB-INF/lib/ttTimeHelper.class.php
patch
|
blob
|
history
WEB-INF/templates/footer.tpl
patch
|
blob
|
history
mobile/time.php
patch
|
blob
|
history
mobile/timer.php
patch
|
blob
|
history
time.php
patch
|
blob
|
history
diff --git
a/WEB-INF/lib/ttReportHelper.class.php
b/WEB-INF/lib/ttReportHelper.class.php
index
38da987
..
26478c3
100644
(file)
--- a/
WEB-INF/lib/ttReportHelper.class.php
+++ b/
WEB-INF/lib/ttReportHelper.class.php
@@
-40,6
+40,9
@@
class ttReportHelper {
static function getWhere($options) {
global $user;
static function getWhere($options) {
global $user;
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+
// Prepare dropdown parts.
$dropdown_parts = '';
if ($options['client_id'])
// Prepare dropdown parts.
$dropdown_parts = '';
if ($options['client_id'])
@@
-61,17
+64,18
@@
class ttReportHelper {
if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient())
$user_list_part = " and l.user_id in ($userlist)";
else
if ($user->can('view_reports') || $user->can('view_all_reports') || $user->isClient())
$user_list_part = " and l.user_id in ($userlist)";
else
- $user_list_part = " and l.user_id = ".$user->
id
;
- $user_list_part .= " and l.group_id =
".$user->getGroup()
;
+ $user_list_part = " and l.user_id = ".$user->
getUser()
;
+ $user_list_part .= " and l.group_id =
$group_id and l.org_id = $org_id"
;
// Prepare sql query part for where.
// Prepare sql query part for where.
+ $dateFormat = $user->getDateFormat();
if ($options['period'])
if ($options['period'])
- $period = new Period($options['period'], new DateAndTime($
user->date_f
ormat));
+ $period = new Period($options['period'], new DateAndTime($
dateF
ormat));
else {
$period = new Period();
$period->setPeriod(
else {
$period = new Period();
$period->setPeriod(
- new DateAndTime($
user->date_f
ormat, $options['period_start']),
- new DateAndTime($
user->date_f
ormat, $options['period_end']));
+ new DateAndTime($
dateF
ormat, $options['period_start']),
+ new DateAndTime($
dateF
ormat, $options['period_end']));
}
$where = " where l.status = 1 and l.date >= '".$period->getStartDate(DB_DATEFORMAT)."' and l.date <= '".$period->getEndDate(DB_DATEFORMAT)."'".
" $user_list_part $dropdown_parts";
}
$where = " where l.status = 1 and l.date >= '".$period->getStartDate(DB_DATEFORMAT)."' and l.date <= '".$period->getEndDate(DB_DATEFORMAT)."'".
" $user_list_part $dropdown_parts";
diff --git
a/WEB-INF/lib/ttTimeHelper.class.php
b/WEB-INF/lib/ttTimeHelper.class.php
index
f48ecc8
..
5eeed1f
100644
(file)
--- a/
WEB-INF/lib/ttTimeHelper.class.php
+++ b/
WEB-INF/lib/ttTimeHelper.class.php
@@
-530,10
+530,16
@@
class ttTimeHelper {
}
// getTimeForDay - gets total time for a user for a specific date.
}
// getTimeForDay - gets total time for a user for a specific date.
- static function getTimeForDay($user_id, $date) {
+ static function getTimeForDay($date) {
+ global $user;
$mdb2 = getConnection();
$mdb2 = getConnection();
- $sql = "select sum(time_to_sec(duration)) as sm from tt_log where user_id = $user_id and date = '$date' and status = 1";
+ $user_id = $user->getUser();
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
+
+ $sql = "select sum(time_to_sec(duration)) as sm from tt_log".
+ " where user_id = $user_id and group_id = $group_id and org_id = $org_id and date = '$date' and status = 1";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
$val = $res->fetchRow();
diff --git
a/WEB-INF/templates/footer.tpl
b/WEB-INF/templates/footer.tpl
index
e031d38
..
861431d
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.30.464
3
| Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.30.464
4
| 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/mobile/time.php
b/mobile/time.php
index
6bacd08
..
80049a9
100644
(file)
--- a/
mobile/time.php
+++ b/
mobile/time.php
@@
-286,7
+286,7
@@
if ($request->isPost()) {
$smarty->assign('next_date', $next_date);
$smarty->assign('prev_date', $prev_date);
$smarty->assign('time_records', ttTimeHelper::getRecords($user_id, $cl_date));
$smarty->assign('next_date', $next_date);
$smarty->assign('prev_date', $prev_date);
$smarty->assign('time_records', ttTimeHelper::getRecords($user_id, $cl_date));
-$smarty->assign('day_total', ttTimeHelper::getTimeForDay($
user_id, $
cl_date));
+$smarty->assign('day_total', ttTimeHelper::getTimeForDay($cl_date));
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);
$smarty->assign('task_list', $task_list);
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);
$smarty->assign('task_list', $task_list);
diff --git
a/mobile/timer.php
b/mobile/timer.php
index
73035a3
..
682634c
100644
(file)
--- a/
mobile/timer.php
+++ b/
mobile/timer.php
@@
-291,7
+291,7
@@
$smarty->assign('uncompleted', $uncompleted);
$smarty->assign('time_records', ttTimeHelper::getRecords($user->getUser(), $cl_date));
$smarty->assign('time_records', ttTimeHelper::getRecords($user->getUser(), $cl_date));
-$smarty->assign('day_total', ttTimeHelper::getTimeForDay($
user->getUser(), $
cl_date));
+$smarty->assign('day_total', ttTimeHelper::getTimeForDay($cl_date));
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);
$smarty->assign('task_list', $task_list);
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);
$smarty->assign('task_list', $task_list);
diff --git
a/time.php
b/time.php
index
0666531
..
b85cad0
100644
(file)
--- a/
time.php
+++ b/
time.php
@@
-398,7
+398,7
@@
$week_total = ttTimeHelper::getTimeForWeek($user_id, $selected_date);
$smarty->assign('selected_date', $selected_date);
$smarty->assign('week_total', $week_total);
$smarty->assign('selected_date', $selected_date);
$smarty->assign('week_total', $week_total);
-$smarty->assign('day_total', ttTimeHelper::getTimeForDay($
user_id, $
cl_date));
+$smarty->assign('day_total', ttTimeHelper::getTimeForDay($cl_date));
$smarty->assign('time_records', ttTimeHelper::getRecords($user_id, $cl_date));
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);
$smarty->assign('time_records', ttTimeHelper::getRecords($user_id, $cl_date));
$smarty->assign('client_list', $client_list);
$smarty->assign('project_list', $project_list);