$org_id = $user->org_id;
$client_id = $fields['client_id'];
+ $project_id = $fields['project_id'];
$name = $fields['name'];
$comment = $fields['comment'];
$end_date = new DateAndTime($user->date_format, $fields['end_date']);
$end = $end_date->toString(DB_DATEFORMAT);
- $sql = "insert into tt_timesheets (user_id, group_id, org_id, client_id, name, comment, start_date, end_date)".
- " values ($user_id, $group_id, $org_id, ".$mdb2->quote($client_id).", ".$mdb2->quote($name).
+ $sql = "insert into tt_timesheets (user_id, group_id, org_id, client_id, project_id, name, comment, start_date, end_date)".
+ " values ($user_id, $group_id, $org_id, ".$mdb2->quote($client_id).", ".$mdb2->quote($project_id).", ".$mdb2->quote($name).
", ".$mdb2->quote($comment).", ".$mdb2->quote($start).", ".$mdb2->quote($end).")";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
$group_id = $user->getGroup();
$org_id = $user->org_id;
- $sql = "select * from tt_timesheets".
- " where id = $timesheet_id and user_id = $user_id and group_id = $group_id and org_id = $org_id and status is not null";
+ $sql = "select ts.*, u.name as user_name, c.name as client_name,".
+ " p.name as project_name from tt_timesheets ts".
+ " left join tt_users u on (ts.user_id = u.id)".
+ " left join tt_clients c on (ts.client_id = c.id)".
+ " left join tt_projects p on (ts.project_id = p.id)".
+ " where ts.id = $timesheet_id and ts.user_id = $user_id and ts.group_id = $group_id and ts.org_id = $org_id and ts.status is not null";
$res = $mdb2->query($sql);
if (!is_a($res, 'PEAR_Error')) {
if ($val = $res->fetchRow())
// Even if mail part below does not work, this will get us a functioning workflow
// (without email notifications).
$timesheet_id = $fields['timesheet_id'];
- $manager_comment = $fields['comment'];
+ $comment = $fields['comment'];
- $sql = "update tt_timesheets set approval_status = 1, manager_comment = ".$mdb2->quote($manager_comment).
+ $sql = "update tt_timesheets set approve_status = 1, approve_comment = ".$mdb2->quote($comment).
" where id = $timesheet_id and submit_status = 1 and group_id = $group_id and org_id = $org_id";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) return false;
// Even if mail part below does not work, this will get us a functioning workflow
// (without email notifications).
$timesheet_id = $fields['timesheet_id'];
- $manager_comment = $fields['comment'];
+ $comment = $fields['comment'];
- $sql = "update tt_timesheets set approval_status = 0, manager_comment = ".$mdb2->quote($manager_comment).
+ $sql = "update tt_timesheets set approve_status = 0, approve_comment = ".$mdb2->quote($comment).
" where id = $timesheet_id and submit_status = 1 and group_id = $group_id and org_id = $org_id";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error')) return false;
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.47.4803 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.50.4804 | 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>
<td>
<table border=0 width=100%>
<tr><td align="center"><b style="font-size: 15pt; font-family: Arial, Helvetica, sans-serif;">{$timesheet['name']|escape} </b></td></tr>
+{if $user->behalfUser}
<tr><td align="left"><b>{$i18n.label.user}:</b> {$timesheet['user_name']|escape}</td></tr>
+{/if}
{if $timesheet['client_id']}
<tr><td align="left"><b>{$i18n.label.client}:</b> {$timesheet['client_name']|escape}</td></tr>
{/if}
+{if $timesheet['project_id']}
+ <tr><td align="left"><b>{$i18n.label.project}:</b> {$timesheet['project_name']|escape}</td></tr>
+{/if}
+{if $timesheet['comment']}
+ <tr><td align="left"><b>{$i18n.label.comment}:</b> {$timesheet['comment']|escape}</td></tr>
+{/if}
+{if $timesheet['approve_status'] == null}
<tr><td align="left"><b>{$i18n.label.submitted}:</b> {if $timesheet.submit_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td></tr>
-{if $timesheet['submitter_comment']}
- <tr><td align="left"><b>{$i18n.label.comment}:</b> {$timesheet['submitter_comment']|escape}</td></tr>
{/if}
-{if $timesheet['submit_status']}
- <tr><td align="left"><b>{$i18n.label.approved}:</b> {if $timesheet.approval_status != null}{if $timesheet.approval_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td></tr>{/if}
+{if $timesheet['approve_status'] != null}
+ <tr><td align="left"><b>{$i18n.label.approved}:</b> {if $timesheet.approve_status}{$i18n.label.yes}{else}{$i18n.label.no}{/if}</td></tr>
{/if}
-{if $timesheet['manager_comment']}
- <tr><td align="left"><b>{$i18n.label.note}:</b> {$timesheet['manager_comment']|escape}</td></tr>
+{if $timesheet['approve_comment']}
+ <tr><td align="left"><b>{$i18n.label.note}:</b> {$timesheet['approve_comment']|escape}</td></tr>
{/if}
</table>
</td>
<tr>
<td align="center">
<table>
- <tr><td> {if $show_approvers}{$i18n.form.mail.to}: {$forms.timesheetForm.approver.control}{/if} {$forms.timesheetForm.btn_submit.control}</td></tr>
+ <tr><td>{if $show_approvers}{$i18n.form.mail.to}: {$forms.timesheetForm.approver.control}{/if} {$forms.timesheetForm.btn_submit.control}</td></tr>
</table>
</td>
</tr>
print "Updated $tt_expense_items_updated tt_expense_items records...<br>\n";
}
- if ($_POST["convert11797to11849"]) {
+ if ($_POST["convert11797to11850"]) {
ttExecute("ALTER TABLE `tt_fav_reports` CHANGE `group_by` `group_by1` varchar(20) default NULL");
ttExecute("ALTER TABLE `tt_fav_reports` ADD `group_by2` varchar(20) default NULL AFTER `group_by1`");
ttExecute("ALTER TABLE `tt_fav_reports` ADD `group_by3` varchar(20) default NULL AFTER `group_by2`");
ttExecute("update `tt_roles` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.48') set rights = replace(rights, 'manage_all_timesheets,', '')");
ttExecute("update `tt_roles` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.48') set rights = replace(rights, 'approve_all_timesheets,', 'approve_own_timesheets,')");
ttExecute("UPDATE `tt_site_config` SET param_value = '1.18.49', modified = now() where param_name = 'version_db' and param_value = '1.18.48'");
+ ttExecute("ALTER TABLE `tt_timesheets` ADD `project_id` int(11) default NULL AFTER `client_id`");
+ ttExecute("UPDATE `tt_site_config` SET param_value = '1.18.50', modified = now() where param_name = 'version_db' and param_value = '1.18.49'");
}
if ($_POST["cleanup"]) {
<h2>DB Install</h2>
<table width="80%" border="1" cellpadding="10" cellspacing="0">
<tr>
- <td width="80%"><b>Create database structure (v1.18.49)</b>
+ <td width="80%"><b>Create database structure (v1.18.50)</b>
<br>(applies only to new installations, do not execute when updating)</br></td><td><input type="submit" name="crstructure" value="Create"></td>
</tr>
</table>
</tr>
</tr>
<tr valign="top">
- <td>Update database structure (v1.17.97 to v1.18.49)</td>
- <td><input type="submit" name="convert11797to11849" value="Update"></td>
+ <td>Update database structure (v1.17.97 to v1.18.50)</td>
+ <td><input type="submit" name="convert11797to11850" value="Update"></td>
</tr>
</table>
`group_id` int(11) default NULL, # group id
`org_id` int(11) default NULL, # organization id
`client_id` int(11) default NULL, # client id
+ `project_id` int(11) default NULL, # project id
`name` varchar(80) COLLATE utf8mb4_bin NOT NULL, # timesheet name
`comment` text, # timesheet comment
`start_date` date NOT NULL, # timesheet start date
PRIMARY KEY (`param_name`)
);
-INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.49', now()); # TODO: change when structure changes.
+INSERT INTO `tt_site_config` (`param_name`, `param_value`, `created`) VALUES ('version_db', '1.18.50', now()); # TODO: change when structure changes.
$smarty->assign('show_submit', $showSubmit);
$smarty->assign('show_approve', $showApprove);
$smarty->assign('forms', array($form->getName()=>$form->toArray()));
-$smarty->assign('title', $i18n->get('title.timesheet'));
+$smarty->assign('title', $i18n->get('title.timesheet').": ".$timesheet['start_date']." - ".$timesheet['end_date']);
$smarty->assign('content_page_name', 'timesheet_view.tpl');
$smarty->display('index.tpl');