|| $name == 'PROJECT'
|| $name == 'CLIENT'
|| $name == 'INVOICE'
+ || $name == 'MONTHLY_QUOTA'
|| $name == 'LOG_ITEM'
|| $name == 'CUSTOM_FIELD'
|| $name == 'CUSTOM_FIELD_OPTION'
'address' => $this->teamData['ADDRESS'],
'currency' => $this->teamData['CURRENCY'],
'lock_spec' => $this->teamData['LOCK_SPEC'],
+ 'workday_hours' => $this->teamData['WORKDAY_HOURS'],
'lang' => $this->teamData['LANG'],
'decimal_mark' => $this->teamData['DECIMAL_MARK'],
'date_format' => $this->teamData['DATE_FORMAT'],
'status' => $this->currentElement['STATUS']));
}
+ if ($name == 'MONTHLY_QUOTA' && $this->canImport) {
+ $this->insertMonthlyQuota($this->team_id, $this->currentElement['YEAR'], $this->currentElement['MONTH'], $this->currentElement['QUOTA']);
+ }
+
if ($name == 'LOG_ITEM' && $this->canImport) {
$this->logMap[$this->currentElement['ID']] =
ttTimeHelper::insert(array(
fclose ($out_file);
return true;
}
+
+ // insertMonthlyQuota - a helper function to insert a monthly quota.
+ private function insertMonthlyQuota($team_id, $year, $month, $quota) {
+ $mdb2 = getConnection();
+ $sql = "INSERT INTO tt_monthly_quotas (team_id, year, month, quota) values ($team_id, $year, $month, $quota)";
+ $affected = $mdb2->exec($sql);
+ return (!is_a($affected, 'PEAR_Error'));
+ }
}
$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')) {