From c682182420d14f67f74d70bc48d432f05326e903 Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Mon, 23 May 2022 11:14:19 +0000 Subject: [PATCH] tvplanit: Alternative code to r8279. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8280 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../tvplanit/source/addons/zeos/vpzeosds.pas | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/components/tvplanit/source/addons/zeos/vpzeosds.pas b/components/tvplanit/source/addons/zeos/vpzeosds.pas index 391259c22..5462adadf 100644 --- a/components/tvplanit/source/addons/zeos/vpzeosds.pas +++ b/components/tvplanit/source/addons/zeos/vpzeosds.pas @@ -405,14 +405,6 @@ var autocommit: Boolean; fieldnames: TStrings; 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; ContactsTable.Close; list := TStringList.Create; @@ -635,8 +627,13 @@ begin FConnection.Connected := AValue; if FConnection.Connected and TablesExist then begin - FixContactsTable; 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; FResourceTable.Open; FTasksTable.Open;