Refactoring. Renamed team_id fields to become group_id.
[timetracker.git] / WEB-INF / lib / ttPredefinedExpenseHelper.class.php
index 556bc42..c292870 100644 (file)
@@ -39,7 +39,7 @@ class ttPredefinedExpenseHelper {
     $mdb2 = getConnection();
 
     $sql = "select id, name, cost from tt_predefined_expenses
-      where id = $id and team_id = $user->team_id";
+      where id = $id and group_id = $user->group_id";
     $res = $mdb2->query($sql);
     if (!is_a($res, 'PEAR_Error')) {
       $val = $res->fetchRow();
@@ -58,7 +58,7 @@ class ttPredefinedExpenseHelper {
 
     $mdb2 = getConnection();
 
-    $sql = "delete from tt_predefined_expenses where id = $id and team_id = $user->team_id";
+    $sql = "delete from tt_predefined_expenses where id = $id and group_id = $user->group_id";
     $affected = $mdb2->exec($sql);
     if (is_a($affected, 'PEAR_Error'))
       return false;
@@ -73,14 +73,14 @@ class ttPredefinedExpenseHelper {
 
     $mdb2 = getConnection();
 
-    $team_id = (int) $fields['team_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 = "insert into tt_predefined_expenses (team_id, name, cost)
-      values ($team_id, ".$mdb2->quote($name).", ".$mdb2->quote($cost).")";
+    $sql = "insert into tt_predefined_expenses (group_id, name, cost)
+      values ($group_id, ".$mdb2->quote($name).", ".$mdb2->quote($cost).")";
     $affected = $mdb2->exec($sql);
     if (is_a($affected, 'PEAR_Error'))
       return false;
@@ -96,14 +96,14 @@ class ttPredefinedExpenseHelper {
     $mdb2 = getConnection();
 
     $predefined_expense_id = (int) $fields['id'];
-    $team_id = (int) $fields['team_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 team_id = $team_id";
+      " where id = $predefined_expense_id and group_id = $group_id";
     $affected = $mdb2->exec($sql);
     return (!is_a($affected, 'PEAR_Error'));
   }