diff --git a/components/tvplanit/source/vpconst.pas b/components/tvplanit/source/vpconst.pas index 8000b87ca..4915783e5 100644 --- a/components/tvplanit/source/vpconst.pas +++ b/components/tvplanit/source/vpconst.pas @@ -63,6 +63,8 @@ const NO_DATE = 9999999; FOREVER_DATE = 999999; + NO_BIRTHDATE = 0; + NO_ANNIVERSARY = 0; SecondsInDay = 86400; { Number of seconds in a day } SecondsInHour = 3600; { Number of seconds in an hour } diff --git a/components/tvplanit/source/vpcontacteditdlg.lfm b/components/tvplanit/source/vpcontacteditdlg.lfm index 9a32df36e..7c2a89084 100644 --- a/components/tvplanit/source/vpcontacteditdlg.lfm +++ b/components/tvplanit/source/vpcontacteditdlg.lfm @@ -9,19 +9,19 @@ object ContactEditForm: TContactEditForm Caption = 'ContactEdit' ClientHeight = 610 ClientWidth = 506 + Position = poScreenCenter + LCLVersion = '3.99.0.0' OnCreate = FormCreate OnKeyDown = FormKeyDown OnShow = FormShow - Position = poScreenCenter - LCLVersion = '2.3.0.0' object PageControl: TPageControl Left = 0 Height = 577 Top = 0 Width = 506 - ActivePage = tabAddresses + ActivePage = tabBaseData Align = alClient - TabIndex = 1 + TabIndex = 0 TabOrder = 0 OnChange = PageControlChange object tabBaseData: TTabSheet @@ -57,8 +57,8 @@ object ContactEditForm: TContactEditForm BorderSpacing.Top = 8 BorderSpacing.Right = 8 MaxLength = 100 - OnChange = ItemChanged TabOrder = 0 + OnChange = ItemChanged end object lblFirstName: TLabel AnchorSideTop.Control = edFirstName @@ -90,8 +90,8 @@ object ContactEditForm: TContactEditForm BorderSpacing.Top = 4 BorderSpacing.Right = 8 MaxLength = 100 - OnChange = ItemChanged TabOrder = 1 + OnChange = ItemChanged end object lblTitle: TLabel AnchorSideTop.Control = edTitle @@ -119,8 +119,8 @@ object ContactEditForm: TContactEditForm Width = 153 BorderSpacing.Top = 4 MaxLength = 50 - OnChange = ItemChanged TabOrder = 2 + OnChange = ItemChanged end object lblCategory: TLabel AnchorSideTop.Control = cbCategory @@ -179,13 +179,47 @@ object ContactEditForm: TContactEditForm DateOrder = doNone ButtonWidth = 23 BorderSpacing.Top = 4 - BorderSpacing.Bottom = 8 NumGlyphs = 1 MaxLength = 0 ParentFont = False TabOrder = 4 Text = 'edBirthdate' end + object lblAnniversary: TLabel + AnchorSideTop.Control = edAnniversary + AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = edAnniversary + Left = 36 + Height = 15 + Top = 147 + Width = 62 + Alignment = taRightJustify + Anchors = [akTop, akRight] + BorderSpacing.Left = 8 + BorderSpacing.Right = 8 + Caption = 'Anniversary' + FocusControl = edAnniversary + ParentColor = False + end + object edAnniversary: TDateEdit + AnchorSideLeft.Control = edLastName + AnchorSideTop.Control = edBirthdate + AnchorSideTop.Side = asrBottom + Left = 106 + Height = 23 + Top = 143 + Width = 153 + CalendarDisplaySettings = [dsShowHeadings, dsShowDayNames] + DateOrder = doNone + ButtonWidth = 23 + BorderSpacing.Top = 4 + BorderSpacing.Bottom = 8 + NumGlyphs = 1 + MaxLength = 0 + ParentFont = False + TabOrder = 5 + Text = 'edAnniversary' + end end object tabAddresses: TTabSheet Caption = 'tabAddresses' @@ -220,9 +254,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Right = 8 MaxLength = 50 - OnChange = ItemChanged ParentFont = False TabOrder = 0 + OnChange = ItemChanged end object lblCompany: TLabel AnchorSideTop.Control = edCompany @@ -271,9 +305,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 4 MaxLength = 50 - OnChange = ItemChanged ParentFont = False TabOrder = 1 + OnChange = ItemChanged end object lblPosition: TLabel AnchorSideTop.Control = edPosition @@ -305,9 +339,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 4 MaxLength = 50 - OnChange = ItemChanged ParentFont = False TabOrder = 2 + OnChange = ItemChanged end object lblAddressW: TLabel AnchorSideTop.Control = edAddressW @@ -339,9 +373,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 4 MaxLength = 100 - OnChange = ItemChanged ParentFont = False TabOrder = 3 + OnChange = ItemChanged end object lblCityW: TLabel AnchorSideTop.Control = edCityW @@ -373,9 +407,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 4 MaxLength = 50 - OnChange = ItemChanged ParentFont = False TabOrder = 4 + OnChange = ItemChanged end object lblStateW: TLabel AnchorSideTop.Control = edStateW @@ -407,9 +441,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 4 MaxLength = 25 - OnChange = ItemChanged ParentFont = False TabOrder = 5 + OnChange = ItemChanged end object lblStateComboW: TLabel AnchorSideTop.Control = cbStateW @@ -476,9 +510,9 @@ object ContactEditForm: TContactEditForm BorderSpacing.Top = 4 BorderSpacing.Right = 8 MaxLength = 10 - OnChange = ItemChanged ParentFont = False TabOrder = 7 + OnChange = ItemChanged end object lblCountryComboW: TLabel AnchorSideTop.Control = cbCountryW @@ -513,10 +547,10 @@ object ContactEditForm: TContactEditForm BorderSpacing.Bottom = 8 ItemHeight = 15 MaxLength = 65535 - OnChange = cbCountryChange ParentFont = False TabOrder = 8 Visible = False + OnChange = cbCountryChange end object lblCountryW: TLabel AnchorSideTop.Control = edCountryW @@ -597,9 +631,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Right = 8 MaxLength = 100 - OnChange = ItemChanged ParentFont = False TabOrder = 0 + OnChange = ItemChanged end object lblCityH: TLabel AnchorSideTop.Control = edCityH @@ -631,9 +665,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 4 MaxLength = 50 - OnChange = ItemChanged ParentFont = False TabOrder = 1 + OnChange = ItemChanged end object lblStateH: TLabel AnchorSideTop.Control = edStateH @@ -665,9 +699,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 4 MaxLength = 25 - OnChange = ItemChanged ParentFont = False TabOrder = 2 + OnChange = ItemChanged end object lblStateComboH: TLabel AnchorSideTop.Control = cbStateH @@ -734,9 +768,9 @@ object ContactEditForm: TContactEditForm BorderSpacing.Top = 4 BorderSpacing.Right = 8 MaxLength = 10 - OnChange = ItemChanged ParentFont = False TabOrder = 4 + OnChange = ItemChanged end object lblCountryComboH: TLabel AnchorSideTop.Control = cbCountryH @@ -771,10 +805,10 @@ object ContactEditForm: TContactEditForm BorderSpacing.Bottom = 8 ItemHeight = 15 MaxLength = 65535 - OnChange = cbCountryChange ParentFont = False TabOrder = 5 Visible = False + OnChange = cbCountryChange end object lblCountryH: TLabel AnchorSideTop.Control = edCountryH @@ -920,9 +954,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 4 MaxLength = 25 - OnChange = ItemChanged ParentFont = False TabOrder = 7 + OnChange = ItemChanged end object edPhone3: TEdit AnchorSideLeft.Control = cbPhone3 @@ -938,9 +972,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 4 MaxLength = 25 - OnChange = ItemChanged ParentFont = False TabOrder = 5 + OnChange = ItemChanged end object edPhone2: TEdit AnchorSideLeft.Control = cbPhone2 @@ -956,9 +990,9 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 4 MaxLength = 25 - OnChange = ItemChanged ParentFont = False TabOrder = 3 + OnChange = ItemChanged end object edPhone1: TEdit AnchorSideLeft.Control = cbPhone1 @@ -975,9 +1009,9 @@ object ContactEditForm: TContactEditForm BorderSpacing.Left = 4 BorderSpacing.Right = 8 MaxLength = 25 - OnChange = ItemChanged ParentFont = False TabOrder = 1 + OnChange = ItemChanged end object cbPhone5: TComboBox AnchorSideLeft.Control = gbPhone @@ -1014,9 +1048,9 @@ object ContactEditForm: TContactEditForm BorderSpacing.Left = 4 BorderSpacing.Bottom = 8 MaxLength = 25 - OnChange = ItemChanged ParentFont = False TabOrder = 9 + OnChange = ItemChanged end end object gbEMail: TGroupBox @@ -1307,8 +1341,8 @@ object ContactEditForm: TContactEditForm BorderSpacing.Top = 8 BorderSpacing.Right = 8 MaxLength = 100 - OnChange = ItemChanged TabOrder = 0 + OnChange = ItemChanged end object edCustom2: TEdit AnchorSideLeft.Control = edCustom1 @@ -1323,8 +1357,8 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 4 MaxLength = 100 - OnChange = ItemChanged TabOrder = 1 + OnChange = ItemChanged end object edCustom3: TEdit AnchorSideLeft.Control = edCustom1 @@ -1339,8 +1373,8 @@ object ContactEditForm: TContactEditForm Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 4 MaxLength = 100 - OnChange = ItemChanged TabOrder = 2 + OnChange = ItemChanged end object edCustom4: TEdit AnchorSideLeft.Control = edCustom1 @@ -1356,8 +1390,8 @@ object ContactEditForm: TContactEditForm BorderSpacing.Top = 4 BorderSpacing.Bottom = 8 MaxLength = 100 - OnChange = ItemChanged TabOrder = 3 + OnChange = ItemChanged end end object tabNotes: TTabSheet @@ -1401,8 +1435,8 @@ object ContactEditForm: TContactEditForm BorderSpacing.Bottom = 4 Caption = 'OK' Default = True - OnClick = OKBtnClick TabOrder = 0 + OnClick = OKBtnClick end object CancelBtn: TButton Left = 436 @@ -1416,8 +1450,8 @@ object ContactEditForm: TContactEditForm BorderSpacing.Bottom = 4 Cancel = True Caption = 'Cancel' - OnClick = CancelBtnClick TabOrder = 1 + OnClick = CancelBtnClick end end end diff --git a/components/tvplanit/source/vpcontacteditdlg.lrj b/components/tvplanit/source/vpcontacteditdlg.lrj index 2ac48dddf..e7eec1cb5 100644 --- a/components/tvplanit/source/vpcontacteditdlg.lrj +++ b/components/tvplanit/source/vpcontacteditdlg.lrj @@ -7,6 +7,8 @@ {"hash":145482249,"name":"tcontacteditform.lblcategory.caption","sourcebytes":[67,97,116,101,103,111,114,121],"value":"Category"}, {"hash":178403381,"name":"tcontacteditform.lblbirthdate.caption","sourcebytes":[66,105,114,116,104,32,100,97,116,101],"value":"Birth date"}, {"hash":163914149,"name":"tcontacteditform.edbirthdate.text","sourcebytes":[101,100,66,105,114,116,104,100,97,116,101],"value":"edBirthdate"}, +{"hash":209833369,"name":"tcontacteditform.lblanniversary.caption","sourcebytes":[65,110,110,105,118,101,114,115,97,114,121],"value":"Anniversary"}, +{"hash":121753081,"name":"tcontacteditform.edanniversary.text","sourcebytes":[101,100,65,110,110,105,118,101,114,115,97,114,121],"value":"edAnniversary"}, {"hash":204197475,"name":"tcontacteditform.tabaddresses.caption","sourcebytes":[116,97,98,65,100,100,114,101,115,115,101,115],"value":"tabAddresses"}, {"hash":181789747,"name":"tcontacteditform.gbworkaddress.caption","sourcebytes":[103,98,87,111,114,107,65,100,100,114,101,115,115],"value":"gbWorkAddress"}, {"hash":174280537,"name":"tcontacteditform.lblcompany.caption","sourcebytes":[108,98,108,67,111,109,112,97,110,121],"value":"lblCompany"}, diff --git a/components/tvplanit/source/vpcontacteditdlg.pas b/components/tvplanit/source/vpcontacteditdlg.pas index 0988e250d..4b6d644ee 100644 --- a/components/tvplanit/source/vpcontacteditdlg.pas +++ b/components/tvplanit/source/vpcontacteditdlg.pas @@ -60,6 +60,7 @@ type cbEMail3: TComboBox; cbWebsite1: TComboBox; edAddressH: TEdit; + edAnniversary: TDateEdit; edCityH: TEdit; edCompany: TEdit; edCountryH: TEdit; @@ -69,6 +70,7 @@ type gbWorkAddress: TGroupBox; gbHomeAddress: TGroupBox; lblAddressH: TLabel; + lblAnniversary: TLabel; lblCityH: TLabel; lblCompany: TLabel; lblCountryComboH: TLabel; @@ -229,6 +231,7 @@ begin lblTitle.Caption := RSTitleLbl; lblCategory.Caption := RSCategoryLbl; lblBirthdate.Caption := RSBirthDateLbl; + lblAnniversary.Caption := RSAnniversaryLbl; lblCompany.Caption := RSCompanyLbl; lblDepartment.Caption := RSDepartmentLbl; @@ -278,7 +281,16 @@ begin Contact.FirstName := edFirstName.Text; Contact.Title := edTitle.Text; Contact.Category := cbCategory.ItemIndex; - Contact.Birthdate := edBirthdate.Date; + + if edBirthDate.Text = '' then + Contact.Birthdate := NO_BIRTHDATE + else + Contact.Birthdate := edBirthdate.Date; + + if edAnniversary.Text = '' then + Contact.Anniversary := NO_ANNIVERSARY + else + Contact.Anniversary := edAnniversary.Date; Contact.Company := edCompany.Text; Contact.Department := edDepartment.Text; @@ -352,20 +364,22 @@ begin edLastName.Text := Contact.LastName; edFirstName.Text := Contact.FirstName; edTitle.Text := Contact.Title; - if contact.Birthdate = 0.0 then + + if contact.Birthdate = NO_BIRTHDATE then edBirthdate.Clear else edBirthdate.Date := Contact.Birthdate; + if contact.Anniversary = NO_ANNIVERSARY then + edAnniversary.Clear + else + edAnniversary.Date := Contact.Anniversary; + cbCategory.Items.Clear; for ct := Low(TVpCategoryType) to High(TVpCategoryType) do cbCategory.Items.Add(CategoryLabel(ct)); cbCategory.ItemIndex := Contact.Category; - if Contact.Birthdate = 0.0 then - edBirthdate.Clear else - edBirthdate.Date := Contact.Birthdate; - edCompany.Text := Contact.Company; edDepartment.Text := Contact.Department; edPosition.Text := Contact.Job_Position; @@ -528,6 +542,7 @@ begin hBorder := ScaleX(hBorder, DesignTimeDPI); vBorder := ScaleY(vBorder, DesignTimeDPI); edBirthdate.ButtonWidth := edBirthdate.Height; + edAnniversary.ButtonWidth := edAnniversary.Height; comboArrowWidth := GetSystemMetrics(SM_CXVSCROLL) * 2; for i := 0 to ComponentCount-1 do @@ -547,21 +562,24 @@ begin {----------------------------------------------------------------------------} { Page "Base data" } {----------------------------------------------------------------------------} - SetLength(labels, 5); + SetLength(labels, 6); labels[0] := lblLastName; labels[1] := lblFirstName; labels[2] := lblTitle; labels[3] := lblCategory; labels[4] := lblBirthdate; + labels[5] := lblAnniversary; largestLabelWidth := 0; for i:=0 to High(labels) do largestLabelWidth := Max(largestLabelWidth, GetLabelWidth(labels[i])); edLastName.Left := largestLabelWidth + hlabelDist; edBirthdate.Width := edTitle.Width; + edAnniversary.Width := edTitle.Width; cbCategory.Width := edTitle.Width; {$IFDEF NEW_ICONS} LoadGlyphFromRCDATA(edBirthDate.Button.Glyph, 'VpDateEdit', 16, 24, 32); + LoadGlyphFromRCDATA(edAnniversary.Button.Glyph, 'VpDateEdit', 16, 24, 32); {$ENDIF} {----------------------------------------------------------------------------} diff --git a/components/tvplanit/source/vpdata.pas b/components/tvplanit/source/vpdata.pas index 62422987e..17fc21622 100644 --- a/components/tvplanit/source/vpdata.pas +++ b/components/tvplanit/source/vpdata.pas @@ -2237,6 +2237,9 @@ begin FAddressType1 := ord(atWork); FAddressType2 := ord(atHome); + + FBirthDate := NO_BIRTHDATE; + FAnniversary := NO_ANNIVERSARY; end; destructor TVpContact.Destroy; diff --git a/components/tvplanit/source/vpflxds.pas b/components/tvplanit/source/vpflxds.pas index e2f92c2b7..2b785c7d0 100644 --- a/components/tvplanit/source/vpflxds.pas +++ b/components/tvplanit/source/vpflxds.pas @@ -840,11 +840,11 @@ begin AContact.LastName := FieldByName(FN).AsString; FN := GetFieldName(FContactMappings, 'BirthDate'); - if FN <> '' then + if (FN <> '') and not FieldByName(FN).IsNull then AContact.Birthdate := FieldByName(FN).AsDateTime; FN := GetFieldName(FContactMappings, 'Anniversary'); - if FN <> '' then + if (FN <> '') and not FieldByName(FN).IsNull then AContact.Anniversary := FieldByName(FN).AsDateTime; FN := GetFieldName(FContactMappings, 'Title'); @@ -1788,11 +1788,11 @@ begin ContactsTable.FieldByName(FN).AsString := Contact.LastName; FN := GetFieldName(FContactMappings, 'Birthdate'); - if FN <> '' then + if (FN <> '') and (Contact.BirthDate <> NO_BIRTHDATE) then ContactsTable.FieldByName(FN).AsDateTime := Contact.Birthdate; FN := GetFieldName(FContactMappings, 'Anniversary'); - if FN <> '' then + if (FN <> '') and (Contact.Anniversary <> NO_ANNIVERSARY) then ContactsTable.FieldByName(FN).AsDateTime := Contact.Anniversary; FN := GetFieldName(FContactMappings, 'Title');