Commit 56578151 authored by Jean-Paul Saman's avatar Jean-Paul Saman

Woraround problem where hours worked from other periods where accounted in...

Woraround problem where hours worked from other periods where accounted in this period. Now all hours worked are recalculated iso using the 'stored/cached' values that were created at timesheet creation time.
parent 31b0cd18
...@@ -256,7 +256,15 @@ else { ...@@ -256,7 +256,15 @@ else {
<select name="timesheet_status" size="1" class="text" onChange="changeIt()"> <select name="timesheet_status" size="1" class="text" onChange="changeIt()">
<option <?php if ($status == 0) echo "selected"; ?> value="0"><? echo dPformSafe('Open for Editing');?></option> <option <?php if ($status == 0) echo "selected"; ?> value="0"><? echo dPformSafe('Open for Editing');?></option>
<option <?php if ($status == 1) echo "selected"; ?> value="1"><? echo dPformSafe('Submitted');?></option> <option <?php if ($status == 1) echo "selected"; ?> value="1"><? echo dPformSafe('Submitted');?></option>
<?php
// Only the user with Timesheet Approval rights may set a timesheet to approved status.
if ( $config_options['approval_by']['value'] == $AppUI->user_id )
{
?>
<option <?php if ($status == 2) echo "selected"; ?> value="2"><? echo dPformSafe('Approved');?></option> <option <?php if ($status == 2) echo "selected"; ?> value="2"><? echo dPformSafe('Approved');?></option>
<?php
}
?>
</select> </select>
<?php <?php
} }
...@@ -329,7 +337,7 @@ function showproject() ...@@ -329,7 +337,7 @@ function showproject()
$amount = 0; $amount = 0;
foreach ($tasks as $item) { foreach ($tasks as $item) {
// Query the task_log table for actual start dates. // Query the task_log table for actual start dates.
$t->addQuery('task_log_id'); $t->addQuery('task_log_id');
$t->addQuery('task_log_name'); $t->addQuery('task_log_name');
$t->addQuery('task_log_creator'); $t->addQuery('task_log_creator');
...@@ -375,6 +383,10 @@ function showtimesheetproject() ...@@ -375,6 +383,10 @@ function showtimesheetproject()
{ {
global $timesheet_id, $project_types; global $timesheet_id, $project_types;
// FIXME: There is a bug in this function. It doesn't take current timesheet into account
// as well as it should. Some hours from other periods maybe accounted on this project, while
// we only want to see the time worked in this period.
$q = new DBQuery(); $q = new DBQuery();
$q->addQuery('timesheet_id'); $q->addQuery('timesheet_id');
$q->addQuery('timesheet_project'); $q->addQuery('timesheet_project');
...@@ -384,7 +396,6 @@ function showtimesheetproject() ...@@ -384,7 +396,6 @@ function showtimesheetproject()
$q->addOrder('timesheet_project ASC'); $q->addOrder('timesheet_project ASC');
$timesheet = $q->LoadList(); $timesheet = $q->LoadList();
foreach ($timesheet as $row) { foreach ($timesheet as $row) {
$p = new DBQuery(); $p = new DBQuery();
$p->addQuery('project_id'); $p->addQuery('project_id');
$p->addQuery('project_name'); $p->addQuery('project_name');
...@@ -429,7 +440,11 @@ function showtimesheetproject() ...@@ -429,7 +440,11 @@ function showtimesheetproject()
if ($status == 0) if ($status == 0)
showproject(); showproject();
else else
showtimesheetproject(); // FIXME: Workaround for problem in showtimesheetproject(); function. Now all hours worked are
// recalculated from the projects table, while you actually would like to see the hours as
// submitted/approved by users and manager.
showproject();
//showtimesheetproject();
?> ?>
<script language="javascript"> <script language="javascript">
workedHoursChange(<?php echo $obj->timesheet_worked; ?>); workedHoursChange(<?php echo $obj->timesheet_worked; ?>);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment