Some refactoring for subgroups.
[timetracker.git] / WEB-INF / lib / ttInvoiceHelper.class.php
index 3a8dbe2..13e5dea 100644 (file)
@@ -73,7 +73,7 @@ class ttInvoiceHelper {
     if ($user->isClient()) $client_part = " and client_id = $user->client_id";
 
     $sql = "select * from tt_invoices where id = $invoice_id and group_id = ".
-            $user->getActiveGroup()."$client_part and status = 1";
+            $user->getGroup()."$client_part and status = 1";
     $res = $mdb2->query($sql);
     if (!is_a($res, 'PEAR_Error')) {
       if ($val = $res->fetchRow())
@@ -89,7 +89,7 @@ class ttInvoiceHelper {
     global $user;
 
     $sql = "select id from tt_invoices where group_id = ".
-            $user->getActiveGroup()." and name = ".$mdb2->quote($invoice_name)." and status = 1";
+            $user->getGroup()." and name = ".$mdb2->quote($invoice_name)." and status = 1";
     $res = $mdb2->query($sql);
     if (!is_a($res, 'PEAR_Error')) {
       $val = $res->fetchRow();
@@ -236,7 +236,7 @@ class ttInvoiceHelper {
     $affected = $mdb2->exec($sql);
     if (is_a($affected, 'PEAR_Error')) return false;
 
-    $sql = "update tt_invoices set status = NULL where id = $invoice_id and group_id = ".$user->getActiveGroup();
+    $sql = "update tt_invoices set status = NULL where id = $invoice_id and group_id = ".$user->getGroup();
     $affected = $mdb2->exec($sql);
     return (!is_a($affected, 'PEAR_Error'));
   }
@@ -332,7 +332,7 @@ class ttInvoiceHelper {
 
     // Create a new invoice record.
     $sql = "insert into tt_invoices (group_id, org_id, name, date, client_id) values(".
-      $user->getActiveGroup().", $user->org_id, ".$mdb2->quote($name).", ".$mdb2->quote($date).", $client_id)";
+      $user->getGroup().", $user->org_id, ".$mdb2->quote($name).", ".$mdb2->quote($date).", $client_id)";
     $affected = $mdb2->exec($sql);
     if (is_a($affected, 'PEAR_Error')) return false;