// +----------------------------------------------------------------------+
import('ttUserHelper');
-import('ttTaskHelper');
import('ttInvoiceHelper');
// ttOrgImportHelper class is used to import organization data from an XML file
if ($name == 'TASK') {
// We get here when processing <task> tags for the current group.
- $task_id = ttTaskHelper::insert(array(
+ $task_id = $this->insertTask(array(
'group_id' => $this->current_group_id,
'org_id' => $this->org_id,
'name' => $attrs['NAME'],
return (!is_a($affected, 'PEAR_Error'));
}
+ // insertTask function inserts a new task into database.
+ private function insertTask($fields)
+ {
+ $mdb2 = getConnection();
+
+ $group_id = (int) $fields['group_id'];
+ $org_id = (int) $fields['org_id'];
+ $name = $fields['name'];
+ $description = $fields['description'];
+ $projects = $fields['projects'];
+ $status = $fields['status'];
+
+ $sql = "insert into tt_tasks (group_id, org_id, name, description, status)
+ values ($group_id, $org_id, ".$mdb2->quote($name).", ".$mdb2->quote($description).", ".$mdb2->quote($status).")";
+ $affected = $mdb2->exec($sql);
+ $last_id = 0;
+ if (is_a($affected, 'PEAR_Error'))
+ return false;
+
+ $last_id = $mdb2->lastInsertID('tt_tasks', 'id');
+ return $last_id;
+ }
+
// insertProject - a helper function to insert a project as well as project to task binds.
private function insertProject($fields)
{
// insert function inserts a new task into database.
static function insert($fields)
{
+ global $user;
$mdb2 = getConnection();
- $group_id = (int) $fields['group_id'];
- $org_id = (int) $fields['org_id'];
+ $group_id = $user->getGroup();
+ $org_id = $user->org_id;
$name = $fields['name'];
$description = $fields['description'];
$projects = $fields['projects'];
// sort function sorts task ids passed as comma-separated list by their name.
static function sort($comma_separated) {
- // We can't sort an empty string.
- if (!$comma_separated)
- return $comma_separated;
-
+ // We can't sort an empty string.
+ if (!$comma_separated)
+ return $comma_separated;
+
$mdb2 = getConnection();
-
- $sql = "select id, name from tt_tasks where id in ($comma_separated)";
+
+ $sql = "select id, name from tt_tasks where id in ($comma_separated)";
$res = $mdb2->query($sql);
if (is_a($res, 'PEAR_Error'))
die ($res->getMessage());
-
+
$task_arr = array();
while ($val = $res->fetchRow()) {
$task_arr[] = array('id'=>$val['id'],'name'=>$val['name']);
for($i = 0; $i < count($task_arr); $i++) {
$task_ids[] = $task_arr[$i]['id'];
}
- $result = implode(',', $task_ids);
+ $result = implode(',', $task_ids);
return $result;
}
}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.28.4548 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.28.4549 | 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>
if ($err->no()) {
if (!ttTaskHelper::getTaskByName($cl_name)) {
if (ttTaskHelper::insert(array(
- 'group_id' => $user->getGroup(),
- 'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
'status' => ACTIVE,
if ($request->getParameter('btn_copy')) {
if (!ttTaskHelper::getTaskByName($cl_name)) {
if (ttTaskHelper::insert(array(
- 'group_id' => $user->getGroup(),
- 'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
'status' => $cl_status,
if ($err->no()) {
if (!ttTaskHelper::getTaskByName($cl_name)) {
if (ttTaskHelper::insert(array(
- 'group_id' => $user->getGroup(),
- 'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
'status' => ACTIVE,
if ($request->getParameter('btn_copy')) {
if (!ttTaskHelper::getTaskByName($cl_name)) {
if (ttTaskHelper::insert(array(
- 'group_id' => $user->getGroup(),
- 'org_id' => $user->org_id,
'name' => $cl_name,
'description' => $cl_description,
'status' => $cl_status,