Skip to content

Commit

Permalink
Merge branch 'release/3.0.11rc2'
Browse files Browse the repository at this point in the history
  • Loading branch information
simon-brooke committed Feb 2, 2018
2 parents 923d6c6 + 0987d8b commit f664959
Show file tree
Hide file tree
Showing 25 changed files with 832 additions and 478 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ SuiteCRMAddIn/Documentation/latex/

*.pcapng

*.vsp
*.xlsx

*.psess

*.xlsx
*.vsp
2 changes: 1 addition & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ PROJECT_NAME = "SuiteCRM Outlook Add-in"
# could be handy for archiving the generated documentation or if some version
# control system is used.

PROJECT_NUMBER = 3.0.11.0
PROJECT_NUMBER = 3.0.12.0

# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
Expand Down
68 changes: 21 additions & 47 deletions SuiteCRMAddIn/BusinessLogic/AppointmentSyncState.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,25 @@ namespace SuiteCRMAddIn.BusinessLogic
using Outlook = Microsoft.Office.Interop.Outlook;
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using SuiteCRMClient.Logging;

public class AppointmentSyncState: SyncState<Outlook.AppointmentItem>
{
public AppointmentSyncState()
{
}

/// <summary>
/// When we're asked for the CrmType the underlying object may have ceased to
/// exist - so cache it!
/// </summary>
private string crmType;


/// <summary>
/// The CRM type of the item I represent.
/// </summary>
public override string CrmType
{
get
Expand All @@ -45,10 +57,17 @@ public override string CrmType
switch (olItem.MeetingStatus)
{
case Outlook.OlMeetingStatus.olNonMeeting:
return AppointmentSyncing.AltCrmModule;
crmType = AppointmentSyncing.AltCrmModule;
break;
default:
return AppointmentSyncing.CrmModule;
crmType = AppointmentSyncing.CrmModule;
break;
}
return crmType;
}
catch (COMException)
{
return crmType;
}
catch (Exception)
{
Expand Down Expand Up @@ -87,51 +106,6 @@ public override void DeleteItem()
this.OutlookItem.Delete();
}


/// <summary>
/// An appointment may be changed because its recipients have changed.
/// </summary>
/// <returns>True if the underlying item has changed, or its recipients have changed.</returns>
protected override bool ReallyChanged()
{
var result = base.ReallyChanged();

ProtoItem older = this.Cache as ProtoAppointment;

if (older != null)
{
var currentAddresses = new HashSet<string>();
var olderAddresses = new List<string>();
olderAddresses.AddRange(((ProtoAppointment)older).RecipientAddresses);

foreach (Outlook.Recipient recipient in olItem.Recipients)
{
currentAddresses.Add(recipient.GetSmtpAddress());
}
if (currentAddresses.Count == olderAddresses.Count)
{
var sorted = new List<string>();
sorted.AddRange(currentAddresses);
sorted.Sort();

for (int i = 0; i < sorted.Count; i++)
{
if (sorted[i] != olderAddresses[i])
{
result = true;
break;
}
}
}
else
{
result = true;
}
}

return result;
}

/// <summary>
/// Construct a JSON-serialisable representation of my appointment item.
/// </summary>
Expand Down
Loading

0 comments on commit f664959

Please sign in to comment.