Getting rid of PHP Deprecated warnings.
[timetracker.git] / WEB-INF / lib / ttTeamHelper.class.php
index f3763c2..4c1af14 100644 (file)
@@ -517,6 +517,23 @@ class ttTeamHelper {
     return false;
   }
 
+    // getNotifications - obtains monthly quotas for team.
+  static function getMonthlyQuotas($team_id) {
+    $mdb2 = getConnection();
+
+    $result = array();
+    $sql = "select year, month, quota from tt_monthly_quotas where team_id = $team_id";
+    $res = $mdb2->query($sql);
+    $result = array();
+    if (!is_a($res, 'PEAR_Error')) {
+      while ($val = $res->fetchRow()) {
+        $result[] = $val;
+      }
+      return $result;
+    }
+    return false;
+  }
+
   // The getTeams function returns an array of all active teams on the server.
   static function getTeams() {
     $result = array();
@@ -684,11 +701,20 @@ class ttTeamHelper {
       $record_type_v = '';
     }
 
-    $sql = "insert into tt_teams (name, address, currency $lockspec_f, lang $decimal_mark_f $date_format_f $time_format_f $week_start_f $plugins_f $tracking_mode_f $record_type_f)
+    $workday_hours = $fields['workday_hours'];
+    if ($workday_hours !== null) {
+      $workday_hours_f = ', workday_hours';
+      $workday_hours_v = ', ' . (int)$workday_hours;
+    } else {
+      $workday_hours_f = '';
+      $workday_hours_v = '';
+    }
+
+    $sql = "insert into tt_teams (name, address, currency $lockspec_f, lang $decimal_mark_f $date_format_f $time_format_f $week_start_f $plugins_f $tracking_mode_f $record_type_f $workday_hours_f)
       values(".$mdb2->quote(trim($fields['name'])).
       ", ".$mdb2->quote(trim($fields['address'])).
       ", ".$mdb2->quote(trim($fields['currency']))." $lockspec_v, ".$mdb2->quote($lang).
-      "$decimal_mark_v $date_format_v $time_format_v $week_start_v $plugins_v $tracking_mode_v $record_type_v)";
+      "$decimal_mark_v $date_format_v $time_format_v $week_start_v $plugins_v $tracking_mode_v $record_type_v $workday_hours_v)";
     $affected = $mdb2->exec($sql);
 
     if (!is_a($affected, 'PEAR_Error')) {