tvplanit: Alternative code to r8279.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8280 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2022-05-23 11:14:19 +00:00
parent 3bb0cf5482
commit c682182420

View File

@ -405,14 +405,6 @@ var
autocommit: Boolean; autocommit: Boolean;
fieldnames: TStrings; fieldnames: TStrings;
begin begin
if not ContactsTable.Active then
begin
ContactsTable.Open;
// If field "Department" exists then it is a v1.05 table, and there's nothing to do.
if ContactsTable.Fields.FindField('Department') <> nil then
exit;
end;
autocommit := FConnection.AutoCommit; autocommit := FConnection.AutoCommit;
ContactsTable.Close; ContactsTable.Close;
list := TStringList.Create; list := TStringList.Create;
@ -635,8 +627,13 @@ begin
FConnection.Connected := AValue; FConnection.Connected := AValue;
if FConnection.Connected and TablesExist then begin if FConnection.Connected and TablesExist then begin
FixContactsTable;
FContactsTable.Open; FContactsTable.Open;
// If field "Department" does not exist then it is an old table and must be reworked.
if ContactsTable.Fields.FindField('Department') = nil then
begin
FixContactsTable;
FContactsTable.Open;
end;
FEventsTable.Open; FEventsTable.Open;
FResourceTable.Open; FResourceTable.Open;
FTasksTable.Open; FTasksTable.Open;