$mdb2 = getConnection();
- $group_id = (int) $fields['group_id'];
+ $group_id = $user->getActiveGroup();
+ $org_id = $user->org_id;
$name = $fields['name'];
$cost = $fields['cost'];
if ('.' != $user->decimal_mark)
$cost = str_replace($user->decimal_mark, '.', $cost);
- $sql = "insert into tt_predefined_expenses (group_id, name, cost)
- values ($group_id, ".$mdb2->quote($name).", ".$mdb2->quote($cost).")";
+ $sql = "insert into tt_predefined_expenses (group_id, org_id, name, cost)".
+ " values ($group_id, $org_id, ".$mdb2->quote($name).", ".$mdb2->quote($cost).")";
$affected = $mdb2->exec($sql);
if (is_a($affected, 'PEAR_Error'))
return false;
$mdb2 = getConnection();
+ $group_id = $user->getActiveGroup();
+ $org_id = $user->org_id;
$predefined_expense_id = (int) $fields['id'];
- $group_id = (int) $fields['group_id'];
$name = $fields['name'];
$cost = $fields['cost'];
if ('.' != $user->decimal_mark)
$cost = str_replace($user->decimal_mark, '.', $cost);
$sql = "update tt_predefined_expenses set name = ".$mdb2->quote($name).", cost = ".$mdb2->quote($cost).
- " where id = $predefined_expense_id and group_id = $group_id";
+ " where id = $predefined_expense_id and group_id = $group_id"; // TODO: add org_id when possible.
$affected = $mdb2->exec($sql);
return (!is_a($affected, 'PEAR_Error'));
}
<br>
<table cellspacing="0" cellpadding="4" width="100%" border="0">
<tr>
- <td align="center"> Anuko Time Tracker 1.18.16.4440 | Copyright © <a href="https://www.anuko.com/lp/tt_3.htm" target="_blank">Anuko</a> |
+ <td align="center"> Anuko Time Tracker 1.18.16.4441 | 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>
setChange("UPDATE `tt_site_config` SET param_value = '1.18.15', modified = now() where param_name = 'version_db' and param_value = '1.18.14'");
setChange("ALTER TABLE `tt_predefined_expenses` ADD `org_id` int(11) default NULL AFTER `group_id`");
setChange("UPDATE `tt_site_config` SET param_value = '1.18.16', modified = now() where param_name = 'version_db' and param_value = '1.18.15'");
+ setChange("UPDATE `tt_predefined_expenses` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.16') set org_id = group_id where org_id is null");
// TODO: this does not work as we just introduced group_id and it is NULL. Same for tt_project_task_binds. Improve.
// setChange("UPDATE `tt_user_project_binds` inner join `tt_site_config` sc on (sc.param_name = 'version_db' and sc.param_value = '1.18.12') set org_id = group_id where org_id is null");
if (!ttValidFloat($cl_cost)) $err->add($i18n->get('error.field'), $i18n->get('label.cost'));
if ($err->no()) {
if (ttPredefinedExpenseHelper::insert(array(
- 'group_id' => $user->group_id,
'name' => $cl_name,
'cost' => $cl_cost))) {
header('Location: predefined_expenses.php');