Skip to content

Commit

Permalink
Newest plug-in fixes/development changes added with latest executable.
Browse files Browse the repository at this point in the history
  • Loading branch information
willrennie committed Aug 12, 2016
1 parent 48ffe98 commit 6cdf119
Show file tree
Hide file tree
Showing 15 changed files with 3,182 additions and 448 deletions.
40 changes: 40 additions & 0 deletions SugarCRMClient/RESTObjects/eGetRelationshipResult.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/**
* Outlook integration for SuiteCRM.
* @package Outlook integration for SuiteCRM
* @copyright SalesAgility Ltd http://www.salesagility.com
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE
* along with this program; if not, see http://www.gnu.org/licenses
* or write to the Free Software Foundation,Inc., 51 Franklin Street,
* Fifth Floor, Boston, MA 02110-1301 USA
*
* @author SalesAgility <[email protected]>
*/

using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace SuiteCRMClient.RESTObjects
{
public class eGetRelationshipResult
{
[JsonProperty("entry_list")]
public eEntryValue[] entry_list { get; set; }
[JsonProperty("relationship_list")]
public eEntryValue[] relationship_list { get; set; }
}
}
29 changes: 29 additions & 0 deletions SugarCRMClient/RESTObjects/eModuleList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,5 +69,34 @@ public class module_data
public string module_key { get; set; }
[JsonProperty("module_label")]
public string module_label { get; set; }

public List<module_access> module_acls1 { get; set; }

private List<JObject> _module_acls;
[JsonProperty("acls")]
public List<JObject> module_acls
{
get
{
return this._module_acls;
}
set
{
this._module_acls = value;
this.module_acls1 = new List<module_access>();
foreach (object objField in value.ToArray<object>())
{
string strFieldString = objField.ToString();
module_access objActualField = JsonConvert.DeserializeObject<module_access>(strFieldString);
this.module_acls1.Add(objActualField);
}
}
}
}

public class module_access
{
public string action { get; set; }
public bool access { get; set; }
}
}
1 change: 1 addition & 0 deletions SugarCRMClient/SuiteCRMClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<Compile Include="RESTObjects\eGetEntryListResultEncoded.cs" />
<Compile Include="RESTObjects\eGetEntryResult.cs" />
<Compile Include="RESTObjects\eGetMailmergeDocumentResult.cs" />
<Compile Include="RESTObjects\eGetRelationshipResult.cs" />
<Compile Include="RESTObjects\eGetRelationshipsResult.cs" />
<Compile Include="RESTObjects\eGetSyncResultEncoded.cs" />
<Compile Include="RESTObjects\eIdMod.cs" />
Expand Down
74 changes: 70 additions & 4 deletions SugarCRMClient/clsSuiteCRMHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public static eModuleList GetModules()
};
return clsGlobals.GetResponse<eModuleList>("get_available_modules", data);
}


public static string GetUserId()
{
Expand Down Expand Up @@ -100,6 +101,70 @@ public static string SetEntry(eNameValue[] Data, string ModuleName = "Emails")
}
}

public static string getRelationship(string MainModule, string ID, string ModuleToFind)
{
try
{
string strUserID = clsSuiteCRMHelper.GetUserId();
if (strUserID == "")
{
SuiteCRMUserSession.Login();
}
object data = new
{
@session = SuiteCRMUserSession.id,
@module_name = MainModule,
@module_id = ID,
@link_field_name = ModuleToFind,
@related_module_query = "",
@related_fields = new string[] { "id" }/*,
@query = ""
//@limit = 1*/
};
eGetRelationshipResult _result = clsGlobals.GetResponse<eGetRelationshipResult>("get_relationships", data);
if (_result.entry_list.Length > 0)
return _result.entry_list[0].id;
return "";
}
catch (System.Exception exception)
{
exception.Data.Clear();
return "";
}
}

public static eEntryValue[] getRelationships(string MainModule, string ID, string ModuleToFind, string[] fields)
{
try
{
string strUserID = clsSuiteCRMHelper.GetUserId();
if (strUserID == "")
{
SuiteCRMUserSession.Login();
}
object data = new
{
@session = SuiteCRMUserSession.id,
@module_name = MainModule,
@module_id = ID,
@link_field_name = ModuleToFind,
@related_module_query = "",
@related_fields = fields/*,
@query = ""
//@limit = 1*/
};
eGetRelationshipResult _result = clsGlobals.GetResponse<eGetRelationshipResult>("get_relationships", data);
if (_result.entry_list.Length > 0)
return _result.entry_list;
return null;
}
catch (System.Exception exception)
{
exception.Data.Clear();
return null;
}
}

public static bool SetRelationship(eSetRelationshipValue info)
{
try
Expand Down Expand Up @@ -186,7 +251,7 @@ public static eNameValue SetNameValuePair(string name, string value)
return new eNameValue { name = name, value = value };
}

public static string GetAttendeeList(string module, string id)
public static string GetAttendeeList(string id)
{
string strUserID = clsSuiteCRMHelper.GetUserId();
if (strUserID == "")
Expand All @@ -199,9 +264,9 @@ public static string GetAttendeeList(string module, string id)
object data = new
{
@session = SuiteCRMUserSession.id,
@module_name = module,
@module_name = "Meetings",
@module_id = id,
@link_field_name = "employees",
@link_field_name = "contacts",
@related_fields = new string[] { "email1" }
/*,
@related_module_link_name_to_fields_array = new object[] {new object[]{
Expand All @@ -216,6 +281,7 @@ public static string GetAttendeeList(string module, string id)
}
return _result;
}

public static eGetEntryListResult GetEntryList(string module, string query, int limit, string order_by, int offset, bool GetDeleted, string[] fields)
{
string strUserID = clsSuiteCRMHelper.GetUserId();
Expand Down Expand Up @@ -332,7 +398,7 @@ public static string[] GetSugarFields(string module)
}
if (module == "Meetings")
{
return new string[] { "id", "name", "description", "date_start", "date_end", "location", "date_modified", "duration_minutes", "duration_hours", "Users" };
return new string[] { "id", "name", "description", "date_start", "date_end", "location", "date_modified", "duration_minutes", "duration_hours", "invitees" };
}
if (module == "Calls")
{
Expand Down
Loading

0 comments on commit 6cdf119

Please sign in to comment.