This commit is contained in:
@@ -582,7 +582,7 @@ namespace AyaNova.PlugIn.QBOI
|
||||
}
|
||||
}
|
||||
|
||||
todo: call this from all over the place (i.e. before every api call) //and remove logging
|
||||
//todo: call this from all over the place (i.e. before every api call) //and remove logging
|
||||
RefreshTokens();
|
||||
|
||||
IntegrationLog.Log(QBID, "PFC: Authentication completed, validating company data");
|
||||
@@ -1714,6 +1714,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
Waiting w = new Waiting();
|
||||
w.Show();
|
||||
w.Ops = "Reading from QuickBooks Online...";
|
||||
RefreshTokens();
|
||||
|
||||
w.Step = "Company preferences";
|
||||
PopulateQBPreferencesCache();
|
||||
@@ -1809,6 +1810,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
/// </summary>
|
||||
private static void PopulateQBItemCache()
|
||||
{
|
||||
RefreshTokens();
|
||||
if (_dtQBItems == null)
|
||||
{
|
||||
_dtQBItems = new DataTable("QBItems");
|
||||
@@ -1930,6 +1932,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
/// </summary>
|
||||
private static void PopulateQBClassCache()
|
||||
{
|
||||
RefreshTokens();
|
||||
if (_dtQBClasses == null)
|
||||
{
|
||||
_dtQBClasses = new DataTable("QBClasses");
|
||||
@@ -2007,6 +2010,8 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
/// </summary>
|
||||
private static void PopulateQBInvoiceTemplates()
|
||||
{
|
||||
RefreshTokens();
|
||||
|
||||
if (_dtQBInvoiceTemplates == null)
|
||||
{
|
||||
_dtQBInvoiceTemplates = new DataTable("QBInvoiceTemplates");
|
||||
@@ -2043,6 +2048,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
#region SyncToken fetching
|
||||
private static string GetQBCustomerSyncToken(string customerid)
|
||||
{
|
||||
RefreshTokens();
|
||||
try
|
||||
{
|
||||
QueryService<q.Customer> qs = new QueryService<q.Customer>(SC);
|
||||
@@ -2096,6 +2102,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
/// </summary>
|
||||
private static void PopulateQBClientCache()
|
||||
{
|
||||
RefreshTokens();
|
||||
if (_dtQBClients == null)
|
||||
{
|
||||
_dtQBClients = new DataTable("QBClients");
|
||||
@@ -2320,6 +2327,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
/// </summary>
|
||||
private static void PopulateQBVendorCache()
|
||||
{
|
||||
RefreshTokens();
|
||||
if (_dtQBVendors == null)
|
||||
{
|
||||
_dtQBVendors = new DataTable("QBVendors");
|
||||
@@ -2419,6 +2427,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
/// </summary>
|
||||
private static void PopulateQBAccountCache()
|
||||
{
|
||||
RefreshTokens();
|
||||
if (_dtQBAccounts == null)
|
||||
{
|
||||
_dtQBAccounts = new DataTable("QBAccounts");
|
||||
@@ -2495,6 +2504,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
/// </summary>
|
||||
private static void PopulateQBTermsCache()
|
||||
{
|
||||
RefreshTokens();
|
||||
if (_dtQBTerms == null)
|
||||
{
|
||||
_dtQBTerms = new DataTable("QBTerms");
|
||||
@@ -2572,6 +2582,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
/// </summary>
|
||||
private static void PopulateQBTaxCodesCache()
|
||||
{
|
||||
RefreshTokens();
|
||||
if (_dtQBTaxCodes == null)
|
||||
{
|
||||
_dtQBTaxCodes = new DataTable("QBTaxCodes");
|
||||
@@ -2661,6 +2672,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
/// </summary>
|
||||
private static void PopulateQBPreferencesCache()
|
||||
{
|
||||
RefreshTokens();
|
||||
try
|
||||
{
|
||||
QueryService<q.Preferences> qs = new QueryService<q.Preferences>(SC);
|
||||
@@ -2733,6 +2745,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
|
||||
public static void RefreshAyaNovaClientFromQB(List<Guid> objectIDList)
|
||||
{
|
||||
|
||||
PopulateQBClientCache();
|
||||
foreach (Guid g in objectIDList)
|
||||
{
|
||||
@@ -2750,6 +2763,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
|
||||
public static void RefreshAyaNovaClientFromQB(Client c)
|
||||
{
|
||||
|
||||
PopulateQBClientCache();
|
||||
IntegrationMap im = QBOIntegration.Maps[c.ID];
|
||||
if (im == null) return;//this client is not linked
|
||||
@@ -2780,6 +2794,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
public static void ImportQBCustomer(string QuickBooksID, ArrayList alErrors)
|
||||
{
|
||||
|
||||
|
||||
DataRow dr = _dtQBClients.Rows.Find(QuickBooksID);
|
||||
//QBListID not found in client list?
|
||||
if (dr == null)
|
||||
@@ -3325,6 +3340,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
ca.SalesTermRef.Value = QDat.TermsDefault;
|
||||
|
||||
//----------- UPDATE VIA API -------------
|
||||
RefreshTokens();
|
||||
DataService service = new DataService(SC);
|
||||
q.Customer resultCustomer = service.Update(ca) as q.Customer;
|
||||
|
||||
@@ -3585,6 +3601,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
}
|
||||
|
||||
//============ ADD VIA API================================
|
||||
RefreshTokens();
|
||||
DataService service = new DataService(SC);
|
||||
q.Customer resultCustomer = service.Add(ca) as q.Customer;
|
||||
//========================================================
|
||||
@@ -3786,6 +3803,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
|
||||
|
||||
//============ ADD VIA API================================
|
||||
RefreshTokens();
|
||||
DataService service = new DataService(SC);
|
||||
q.Vendor resultVendor = service.Add(ca) as q.Vendor;
|
||||
//========================================================
|
||||
@@ -3890,6 +3908,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
CopyAyPartToQBOItem(c, ca);
|
||||
|
||||
//----------- UPDATE VIA API -------------
|
||||
RefreshTokens();
|
||||
DataService service = new DataService(SC);
|
||||
q.Item resultItem = service.Update(ca) as q.Item;
|
||||
|
||||
@@ -4071,6 +4090,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
}
|
||||
|
||||
//============ ADD VIA API================================
|
||||
RefreshTokens();
|
||||
DataService service = new DataService(SC);
|
||||
q.Item resultItem = service.Add(ca) as q.Item;
|
||||
|
||||
@@ -4194,6 +4214,7 @@ KEY: AssignedTime, VALUE: 12/08/2017 18:52:04
|
||||
|
||||
|
||||
//============ ADD VIA API================================
|
||||
RefreshTokens();
|
||||
DataService service = new DataService(SC);
|
||||
q.Item resultItem = service.Add(ca) as q.Item;
|
||||
//========================================================
|
||||
|
||||
Reference in New Issue
Block a user