Commit ef41aacf by Cam Hayes

changed error handling to say if we couldnt find the item in qb and changed link…

changed error handling to say if we couldnt find the item in qb and changed link to QB to also update the item
parent 85750ff1
......@@ -6,7 +6,7 @@ object FViewAddCustomer: TFViewAddCustomer
object lblFormState: TWebLabel
Left = 395
Top = 8
Width = 26
Width = 3
Height = 15
ElementID = 'lbl_form_state'
HeightPercent = 100.000000000000000000
......@@ -408,6 +408,7 @@ object FViewAddCustomer: TFViewAddCustomer
HeightPercent = 100.000000000000000000
WidthPercent = 100.000000000000000000
OnChange = wdblcbRepChange
OnEnter = wdblcbRepChange
DataField = 'REP_USER_ID'
DataSource = WebDataSource1
KeyField = 'userID'
......
......@@ -370,8 +370,8 @@ begin
XDataWebDataSet1.Edit;
XDataWebDataSet1QB_LIST_ID.AsString := newform.QB_ID;
XDataWebDataSet1.Post;
UpdateCustomer();
end;
end
);
end;
......
......@@ -3064,6 +3064,11 @@ begin
jsObj := TJSONObject(jsValue);
ItemList := TJSONArray(TJSONObject(jsObj.GetValue('QueryResponse')).GetValue('Item'));
if ItemList = nil then
begin
Logger.Log(1, 'Unable to find match in Quickbooks for item: ' + itemName);
raise EXDataHttpException.Create(500, 'Unable to find match in Quickbooks for item: ' + itemName + '! Make sure to double check the spelling.');
end;
Item := ItemList.Items[0] as TJSONObject;
ParsedItem := TJSONObject.Create;
......@@ -3084,9 +3089,12 @@ begin
result.QB_ID := Item.GetValue<string>('Id');
except
on E: EXDataHttpException do
raise;
on E: Exception do
begin
Logger.Log(2, 'Error in UpdateItem: ' + E.Message);
Logger.Log(1, 'Error in UpdateItem: ' + E.Message);
raise EXDataHttpException.Create(500, 'Unable to retrieve QuickBooks Items: A QuickBooks interface error has occurred!');
end;
end;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment