X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/timetracker.git/blobdiff_plain/270ff8df9ea85d9deb349accedfaedc2f8734251..139889a67699143cce59a4f3136b3158058b9ce2:/WEB-INF/lib/ttTeamHelper.class.php diff --git a/WEB-INF/lib/ttTeamHelper.class.php b/WEB-INF/lib/ttTeamHelper.class.php index 4ac69c3b..7b1fc245 100644 --- a/WEB-INF/lib/ttTeamHelper.class.php +++ b/WEB-INF/lib/ttTeamHelper.class.php @@ -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,29 @@ 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) + $uncompleted_entries = $fields['uncompleted_entries']; + if ($uncompleted_entries !== null) { + $uncompleted_entries_f = ', uncompleted_entries'; + $uncompleted_entries_v = ', ' . (int)$uncompleted_entries; + } else { + $uncompleted_entries_f = ''; + $uncompleted_entries_v = ''; + } + + $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 $uncompleted_entries_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 $uncompleted_entries_v $workday_hours_v)"; $affected = $mdb2->exec($sql); if (!is_a($affected, 'PEAR_Error')) { @@ -716,9 +751,10 @@ class ttTeamHelper { $week_start_part = ''; $tracking_mode_part = ''; $record_type_part = ''; + $uncompleted_entries_part = ''; $plugins_part = ''; $lock_spec_part = ''; - $working_hours_part = ''; + $workday_hours_part = ''; if (isset($fields['address'])) $addr_part = ', address = '.$mdb2->quote($fields['address']); if (isset($fields['currency'])) $currency_part = ', currency = '.$mdb2->quote($fields['currency']); @@ -729,13 +765,14 @@ class ttTeamHelper { if (isset($fields['week_start'])) $week_start_part = ', week_start = '.intval($fields['week_start']); if (isset($fields['tracking_mode'])) $tracking_mode_part = ', tracking_mode = '.intval($fields['tracking_mode']); if (isset($fields['record_type'])) $record_type_part = ', record_type = '.intval($fields['record_type']); + if (isset($fields['uncompleted_entries'])) $uncompleted_entries_part = ', uncompleted_entries = '.intval($fields['uncompleted_entries']); if (isset($fields['plugins'])) $plugins_part = ', plugins = '.$mdb2->quote($fields['plugins']); if (isset($fields['lock_spec'])) $lock_spec_part = ', lock_spec = '.$mdb2->quote($fields['lock_spec']); - if (isset($fields['working_hours'])) $working_hours_part = ', workday_hours = '.$mdb2->quote($fields['working_hours']); + if (isset($fields['workday_hours'])) $workday_hours_part = ', workday_hours = '.$mdb2->quote($fields['workday_hours']); $sql = "update tt_teams set $name_part $addr_part $currency_part $lang_part $decimal_mark_part $date_format_part $time_format_part $week_start_part $tracking_mode_part $record_type_part - $plugins_part $lock_spec_part $working_hours_part where id = $team_id"; + $uncompleted_entries_part $plugins_part $lock_spec_part $workday_hours_part where id = $team_id"; $affected = $mdb2->exec($sql); if (is_a($affected, 'PEAR_Error')) return false;