Commit 32d4033d by Cam Hayes

Got QB ID to be unique and fixed the error modal to hide the spinner and remain on the form

parent 151f60b4
...@@ -91,6 +91,7 @@ end; ...@@ -91,6 +91,7 @@ end;
procedure ShowErrorModal(msg: string); procedure ShowErrorModal(msg: string);
begin begin
HideSpinner('spinner');
asm asm
var modal = document.getElementById('main_errormodal'); var modal = document.getElementById('main_errormodal');
var label = document.getElementById('main_lblmodal_body'); var label = document.getElementById('main_lblmodal_body');
...@@ -106,7 +107,8 @@ begin ...@@ -106,7 +107,8 @@ begin
// Bind hard reload to button // Bind hard reload to button
if (reloadBtn) { if (reloadBtn) {
reloadBtn.onclick = function () { reloadBtn.onclick = function () {
window.location.reload(true); // hard reload, bypass cache //window.location.reload(true); // hard reload, bypass cache
bsModal.hide();
}; };
} }
......
...@@ -61,10 +61,10 @@ ...@@ -61,10 +61,10 @@
</div> </div>
</div> </div>
<div class="col-auto"> <div class="col-auto">
<label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Territory:</label> <label for="wdbe_first_name" style="font-weight: 700; font-size: 15px;" class="form-label mt-2">Representative:</label>
<input id="edtrepuser"type="text" class="form-control" style="width: 150px"/> <input id="edtrepuser"type="text" class="form-control" style="width: 150px"/>
<div class="invalid-feedback" id="territorywarning" style="font-size: 15px;"> <div class="invalid-feedback" id="territorywarning" style="font-size: 15px;">
Territory not found in kgOrders Representative not found in kgOrders
</div> </div>
</div> </div>
</div> </div>
......
...@@ -9,8 +9,8 @@ object FSelectCustomer: TFSelectCustomer ...@@ -9,8 +9,8 @@ object FSelectCustomer: TFSelectCustomer
Width = 95 Width = 95
Height = 15 Height = 15
Caption = 'Search Customers' Caption = 'Search Customers'
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel2: TWebLabel object WebLabel2: TWebLabel
Left = 279 Left = 279
...@@ -18,8 +18,8 @@ object FSelectCustomer: TFSelectCustomer ...@@ -18,8 +18,8 @@ object FSelectCustomer: TFSelectCustomer
Width = 134 Width = 134
Height = 15 Height = 15
Caption = 'Selected Customer Name' Caption = 'Selected Customer Name'
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object WebLabel3: TWebLabel object WebLabel3: TWebLabel
Left = 131 Left = 131
...@@ -27,8 +27,8 @@ object FSelectCustomer: TFSelectCustomer ...@@ -27,8 +27,8 @@ object FSelectCustomer: TFSelectCustomer
Width = 113 Width = 113
Height = 15 Height = 15
Caption = 'Selected Customer ID' Caption = 'Selected Customer ID'
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object edtSearch: TWebEdit object edtSearch: TWebEdit
Left = 4 Left = 4
...@@ -36,8 +36,8 @@ object FSelectCustomer: TFSelectCustomer ...@@ -36,8 +36,8 @@ object FSelectCustomer: TFSelectCustomer
Width = 121 Width = 121
Height = 22 Height = 22
ChildOrder = 2 ChildOrder = 2
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
OnChange = edtSearchChange OnChange = edtSearchChange
end end
object edtName: TWebEdit object edtName: TWebEdit
...@@ -47,8 +47,8 @@ object FSelectCustomer: TFSelectCustomer ...@@ -47,8 +47,8 @@ object FSelectCustomer: TFSelectCustomer
Height = 22 Height = 22
ChildOrder = 1 ChildOrder = 1
Enabled = False Enabled = False
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object TMSFNCGrid1: TTMSFNCGrid object TMSFNCGrid1: TTMSFNCGrid
Left = 0 Left = 0
...@@ -59,7 +59,7 @@ object FSelectCustomer: TFSelectCustomer ...@@ -59,7 +59,7 @@ object FSelectCustomer: TFSelectCustomer
ParentDoubleBuffered = False ParentDoubleBuffered = False
DoubleBuffered = True DoubleBuffered = True
TabOrder = 2 TabOrder = 2
DefaultRowHeight = 40.00000000000000000 DefaultRowHeight = 40.000000000000000000
FixedColumns = 0 FixedColumns = 0
ColumnCount = 4 ColumnCount = 4
Options.Bands.Enabled = True Options.Bands.Enabled = True
...@@ -85,7 +85,7 @@ object FSelectCustomer: TFSelectCustomer ...@@ -85,7 +85,7 @@ object FSelectCustomer: TFSelectCustomer
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 90.00000000000000000 Width = 90.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -100,7 +100,7 @@ object FSelectCustomer: TFSelectCustomer ...@@ -100,7 +100,7 @@ object FSelectCustomer: TFSelectCustomer
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 150.00000000000000000 Width = 150.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -115,7 +115,7 @@ object FSelectCustomer: TFSelectCustomer ...@@ -115,7 +115,7 @@ object FSelectCustomer: TFSelectCustomer
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 400.00000000000000000 Width = 400.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -130,7 +130,7 @@ object FSelectCustomer: TFSelectCustomer ...@@ -130,7 +130,7 @@ object FSelectCustomer: TFSelectCustomer
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 106.00000000000000000 Width = 106.000000000000000000
end end
item item
BorderWidth = 1 BorderWidth = 1
...@@ -145,7 +145,7 @@ object FSelectCustomer: TFSelectCustomer ...@@ -145,7 +145,7 @@ object FSelectCustomer: TFSelectCustomer
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
ID = '' ID = ''
Width = 1.00000000000000000 Width = 1.000000000000000000
end> end>
DefaultFont.Charset = DEFAULT_CHARSET DefaultFont.Charset = DEFAULT_CHARSET
DefaultFont.Color = clWindowText DefaultFont.Color = clWindowText
...@@ -215,8 +215,8 @@ object FSelectCustomer: TFSelectCustomer ...@@ -215,8 +215,8 @@ object FSelectCustomer: TFSelectCustomer
Height = 25 Height = 25
Caption = 'Cancel' Caption = 'Cancel'
ChildOrder = 5 ChildOrder = 5
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCancelClick OnClick = btnCancelClick
end end
object btnConfirm: TWebButton object btnConfirm: TWebButton
...@@ -226,8 +226,8 @@ object FSelectCustomer: TFSelectCustomer ...@@ -226,8 +226,8 @@ object FSelectCustomer: TFSelectCustomer
Height = 25 Height = 25
Caption = 'Select' Caption = 'Select'
ChildOrder = 5 ChildOrder = 5
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnConfirmClick OnClick = btnConfirmClick
end end
object edtID: TWebEdit object edtID: TWebEdit
...@@ -237,8 +237,8 @@ object FSelectCustomer: TFSelectCustomer ...@@ -237,8 +237,8 @@ object FSelectCustomer: TFSelectCustomer
Height = 22 Height = 22
ChildOrder = 1 ChildOrder = 1
Enabled = False Enabled = False
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
Connection = DMConnection.ApiConnection Connection = DMConnection.ApiConnection
......
...@@ -125,7 +125,10 @@ begin ...@@ -125,7 +125,10 @@ begin
PopulateGridManually; PopulateGridManually;
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
begin
Close();
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end;
end; end;
end; end;
......
...@@ -13,8 +13,8 @@ object FViewCustomers: TFViewCustomers ...@@ -13,8 +13,8 @@ object FViewCustomers: TFViewCustomers
ElementID = 'lblentries' ElementID = 'lblentries'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object btnAddCustomer: TWebButton object btnAddCustomer: TWebButton
Left = 12 Left = 12
...@@ -26,10 +26,10 @@ object FViewCustomers: TFViewCustomers ...@@ -26,10 +26,10 @@ object FViewCustomers: TFViewCustomers
ElementID = 'btnaddcustomer' ElementID = 'btnaddcustomer'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
TabOrder = 6 TabOrder = 6
TabStop = False TabStop = False
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnAddCustomerClick OnClick = btnAddCustomerClick
end end
object wcbPageSize: TWebComboBox object wcbPageSize: TWebComboBox
...@@ -41,9 +41,9 @@ object FViewCustomers: TFViewCustomers ...@@ -41,9 +41,9 @@ object FViewCustomers: TFViewCustomers
ElementID = 'wcbpagesize' ElementID = 'wcbpagesize'
ElementFont = efCSS ElementFont = efCSS
HeightStyle = ssAuto HeightStyle = ssAuto
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
Text = '50' Text = '50'
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
OnChange = wcbPageSizeChange OnChange = wcbPageSizeChange
ItemIndex = -1 ItemIndex = -1
Items.Strings = ( Items.Strings = (
...@@ -66,8 +66,8 @@ object FViewCustomers: TFViewCustomers ...@@ -66,8 +66,8 @@ object FViewCustomers: TFViewCustomers
Height = 15 Height = 15
Caption = 'Message' Caption = 'Message'
ElementID = 'view.login.message.label' ElementID = 'view.login.message.label'
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object btnCloseNotification: TWebButton object btnCloseNotification: TWebButton
Left = 96 Left = 96
...@@ -76,8 +76,8 @@ object FViewCustomers: TFViewCustomers ...@@ -76,8 +76,8 @@ object FViewCustomers: TFViewCustomers
Height = 25 Height = 25
ChildOrder = 1 ChildOrder = 1
ElementID = 'view.login.message.button' ElementID = 'view.login.message.button'
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
end end
object wdbtcCustomers: TWebDBTableControl object wdbtcCustomers: TWebDBTableControl
...@@ -139,8 +139,8 @@ object FViewCustomers: TFViewCustomers ...@@ -139,8 +139,8 @@ object FViewCustomers: TFViewCustomers
Height = 22 Height = 22
ChildOrder = 5 ChildOrder = 5
ElementID = 'edtfilter' ElementID = 'edtfilter'
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
OnChange = edtFilterChange OnChange = edtFilterChange
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
......
...@@ -177,10 +177,7 @@ end; ...@@ -177,10 +177,7 @@ end;
procedure TFViewCustomers.btnAddCustomerClick(Sender: TObject); procedure TFViewCustomers.btnAddCustomerClick(Sender: TObject);
begin begin
if AuthService.TokenPayload.Properties['qb_enabled'] then ShowSelectCustomerForm()
ShowSelectCustomerForm()
else
ShowNotificationModal('QuickBooks interface is not currently active');
end; end;
procedure TFViewCustomers.edtFilterChange(Sender: TObject); procedure TFViewCustomers.edtFilterChange(Sender: TObject);
......
...@@ -123,7 +123,10 @@ begin ...@@ -123,7 +123,10 @@ begin
//Utils.HideSpinner('spinner'); //Utils.HideSpinner('spinner');
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
begin
Close();
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end;
end; end;
Utils.HideSpinner('spinner'); Utils.HideSpinner('spinner');
end; end;
......
...@@ -442,39 +442,35 @@ var ...@@ -442,39 +442,35 @@ var
itemOptions: string; itemOptions: string;
newform: TFViewAddItem; newform: TFViewAddItem;
begin begin
if AuthService.TokenPayload.Properties['qb_enabled'] then newform := TFViewAddItem.CreateNew;
begin
newform := TFViewAddItem.CreateNew;
newform.Caption := 'Select Item to Add'; newform.Caption := 'Select Item to Add';
newForm.Popup := True; newForm.Popup := True;
newForm.position:= poScreenCenter; newForm.position:= poScreenCenter;
newForm.Border := fbDialog; newForm.Border := fbDialog;
// used to manage Back button handling to close subform // used to manage Back button handling to close subform
window.location.hash := 'subform'; window.location.hash := 'subform';
newform.ShowModal( newform.ShowModal(
procedure(AValue: TModalResult) procedure(AValue: TModalResult)
begin
if newform.confirm then
begin begin
if newform.confirm then xdwdsItems.Append;
begin
xdwdsItems.Append;
xdwdsItems.FieldByName('QB_ID').AsString := newform.QB_ID; xdwdsItems.FieldByName('QB_ID').AsString := newform.QB_ID;
xdwdsItems.FieldByName('name').AsString := newform.name; xdwdsItems.FieldByName('name').AsString := newform.name;
xdwdsItems.FieldByName('description').AsString := newform.description; xdwdsItems.FieldByName('description').AsString := newform.description;
xdwdsItems.FieldByName('status').AsString := newform.status; xdwdsItems.FieldByName('status').AsString := newform.status;
xdwdsItems.Post; xdwdsItems.Post;
EditMode(); EditMode();
lblFormState.Caption := 'Add Mode'; lblFormState.Caption := 'Add Mode';
end; end;
end end
); );
end end
else
ShowNotificationModal('QuickBooks interface is not currently active.');
end; end;
procedure TFViewItems.btnCancelClick(Sender: TObject); procedure TFViewItems.btnCancelClick(Sender: TObject);
...@@ -511,12 +507,7 @@ var ...@@ -511,12 +507,7 @@ var
itemOptions: string; itemOptions: string;
newform: TFViewAddItem; newform: TFViewAddItem;
begin begin
if AuthService.TokenPayload.Properties['qb_enabled'] then UpdateItem();
begin
UpdateItem();
end
else
ShowNotificationModal('QuickBooks interface is not currently active.');
end; end;
procedure TFViewItems.UpdateItem(); procedure TFViewItems.UpdateItem();
......
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
Please contact EMSystems to solve the issue. Please contact EMSystems to solve the issue.
</div> </div>
<div class="modal-footer justify-content-center"> <div class="modal-footer justify-content-center">
<button type="button" id="btn_modal_restart" class="btn btn-primary">Back to Orders</button> <button type="button" id="btn_modal_restart" class="btn btn-primary">Close</button>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -391,14 +391,6 @@ var ...@@ -391,14 +391,6 @@ var
orderJSON: TJSONObject; orderJSON: TJSONObject;
qbEnabled: boolean; qbEnabled: boolean;
begin begin
qbEnabled := boolean(AuthService.TokenPayload.Properties['qb_enabled']);
if not qbEnabled then
begin
ShowToast('QB interface not currently active', 'info');
Exit;
end;
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
begin begin
if ( VerifyQBOrder() )then if ( VerifyQBOrder() )then
......
...@@ -195,14 +195,6 @@ var ...@@ -195,14 +195,6 @@ var
orderJSON: TJSONObject; orderJSON: TJSONObject;
qbEnabled: boolean; qbEnabled: boolean;
begin begin
qbEnabled := boolean(AuthService.TokenPayload.Properties['qb_enabled']);
if not qbEnabled then
begin
ShowToast('QB interface not currently active', 'info');
Exit;
end;
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
begin begin
if ( VerifyQBOrder() )then if ( VerifyQBOrder() )then
......
...@@ -455,14 +455,6 @@ var ...@@ -455,14 +455,6 @@ var
orderJSON: TJSONObject; orderJSON: TJSONObject;
qbEnabled: boolean; qbEnabled: boolean;
begin begin
qbEnabled := boolean(AuthService.TokenPayload.Properties['qb_enabled']);
if not qbEnabled then
begin
ShowToast('QB interface not currently active', 'info');
Exit;
end;
if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then if JS.toString(AuthService.TokenPayload.Properties['user_qb_id']) <> '' then
begin begin
if ( VerifyQBOrder() )then if ( VerifyQBOrder() )then
......
...@@ -13,9 +13,9 @@ object FQBInfo: TFQBInfo ...@@ -13,9 +13,9 @@ object FQBInfo: TFQBInfo
Font.Height = -24 Font.Height = -24
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
ParentFont = False ParentFont = False
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object lblCompanyName: TWebLabel object lblCompanyName: TWebLabel
Left = 16 Left = 16
...@@ -28,9 +28,9 @@ object FQBInfo: TFQBInfo ...@@ -28,9 +28,9 @@ object FQBInfo: TFQBInfo
Font.Height = -16 Font.Height = -16
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
ParentFont = False ParentFont = False
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object lblCompanyID: TWebLabel object lblCompanyID: TWebLabel
Left = 15 Left = 15
...@@ -43,9 +43,9 @@ object FQBInfo: TFQBInfo ...@@ -43,9 +43,9 @@ object FQBInfo: TFQBInfo
Font.Height = -16 Font.Height = -16
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
ParentFont = False ParentFont = False
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object lblLastRefresh: TWebLabel object lblLastRefresh: TWebLabel
Left = 16 Left = 16
...@@ -58,9 +58,9 @@ object FQBInfo: TFQBInfo ...@@ -58,9 +58,9 @@ object FQBInfo: TFQBInfo
Font.Height = -16 Font.Height = -16
Font.Name = 'Segoe UI' Font.Name = 'Segoe UI'
Font.Style = [] Font.Style = []
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
ParentFont = False ParentFont = False
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
end end
object btnLinkToQB: TWebButton object btnLinkToQB: TWebButton
Left = 235 Left = 235
...@@ -69,8 +69,8 @@ object FQBInfo: TFQBInfo ...@@ -69,8 +69,8 @@ object FQBInfo: TFQBInfo
Height = 25 Height = 25
Caption = 'Link to QB' Caption = 'Link to QB'
ChildOrder = 3 ChildOrder = 3
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnLinkToQBClick OnClick = btnLinkToQBClick
end end
object btnClose: TWebButton object btnClose: TWebButton
...@@ -80,8 +80,8 @@ object FQBInfo: TFQBInfo ...@@ -80,8 +80,8 @@ object FQBInfo: TFQBInfo
Height = 25 Height = 25
Caption = 'Close' Caption = 'Close'
ChildOrder = 3 ChildOrder = 3
HeightPercent = 100.00000000000000000 HeightPercent = 100.000000000000000000
WidthPercent = 100.00000000000000000 WidthPercent = 100.000000000000000000
OnClick = btnCloseClick OnClick = btnCloseClick
end end
object XDataWebClient1: TXDataWebClient object XDataWebClient1: TXDataWebClient
......
...@@ -86,7 +86,10 @@ begin ...@@ -86,7 +86,10 @@ begin
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
begin
Close();
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
end;
end; end;
end; end;
......
...@@ -99,7 +99,10 @@ begin ...@@ -99,7 +99,10 @@ begin
xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser', [userInfo])); xdcResponse := await(XDataWebClient1.RawInvokeAsync('ILookupService.AddUser', [userInfo]));
responseString := TJSObject(xdcResponse.Result); responseString := TJSObject(xdcResponse.Result);
Info := string(responseString['value']); Info := string(responseString['value']);
FViewMain.ShowUserForm(Info); if Info.ToLower.Contains('failure') then
ShowToast(Info)
else
FViewMain.ShowUserForm(Info);
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
...@@ -129,7 +132,10 @@ begin ...@@ -129,7 +132,10 @@ begin
[editOptions])); [editOptions]));
responseString := TJSObject(xdcResponse.Result); responseString := TJSObject(xdcResponse.Result);
Info := string(responseString['value']); Info := string(responseString['value']);
FViewMain.ShowUserForm(Info); if Info.ToLower.Contains('failure') then
ShowToast(Info)
else
FViewMain.ShowUserForm(Info);
except except
on E: EXDataClientRequestException do on E: EXDataClientRequestException do
Utils.ShowErrorModal(E.ErrorResult.ErrorMessage); Utils.ShowErrorModal(E.ErrorResult.ErrorMessage);
......
...@@ -127,14 +127,6 @@ begin ...@@ -127,14 +127,6 @@ begin
raise EXDataHttpUnauthorized.Create('User not active!'); raise EXDataHttpUnauthorized.Create('User not active!');
end; end;
iniFile := TIniFile.Create(ChangeFileExt(ParamStr(0), '.ini'));
try
qbEnabled := iniFile.ReadBool('Quickbooks', 'Enabled', true);
finally
iniFile.Free;
end;
JWT := TJWT.Create; JWT := TJWT.Create;
try try
JWT.Claims.JWTId := LowerCase(Copy(TUtils.GuidToVariant(TUtils.NewGuid), 2, 36)); JWT.Claims.JWTId := LowerCase(Copy(TUtils.GuidToVariant(TUtils.NewGuid), 2, 36));
...@@ -147,7 +139,6 @@ begin ...@@ -147,7 +139,6 @@ begin
JWT.Claims.SetClaimOfType<string>('user_email', authDB.uq.FieldByName('EMAIL').AsString); JWT.Claims.SetClaimOfType<string>('user_email', authDB.uq.FieldByName('EMAIL').AsString);
JWT.Claims.SetClaimOfType<string>('user_qb_id', authDB.uq.FieldByName('QB_ID').AsString); JWT.Claims.SetClaimOfType<string>('user_qb_id', authDB.uq.FieldByName('QB_ID').AsString);
JWT.Claims.SetClaimOfType<string>('user_access_type', authDB.uq.FieldByName('ACCESS_TYPE').AsString); JWT.Claims.SetClaimOfType<string>('user_access_type', authDB.uq.FieldByName('ACCESS_TYPE').AsString);
JWT.Claims.SetClaimOfType<boolean>('qb_enabled', qbEnabled);
Result := TJOSE.SHA256CompactToken(serverConfig.jwtTokenSecret, JWT); Result := TJOSE.SHA256CompactToken(serverConfig.jwtTokenSecret, JWT);
finally finally
......
...@@ -193,11 +193,6 @@ begin ...@@ -193,11 +193,6 @@ begin
Logger.Log( 1, '----Database->Password: xxxxxxxx' ); Logger.Log( 1, '----Database->Password: xxxxxxxx' );
Logger.Log(1, '---Quickbooks---'); Logger.Log(1, '---Quickbooks---');
iniStr := IniFile.ReadString( 'Quickbooks', 'Enabled', '' );
if iniStr.IsEmpty then
Logger.Log( 1, '--Quickbooks->Enabled: Entry not found - default: true' )
else
Logger.Log( 1, '--Quickbooks->Enabled: ' + iniStr );
iniStr := IniFile.ReadString( 'Quickbooks', 'CompanyID', '' ); iniStr := IniFile.ReadString( 'Quickbooks', 'CompanyID', '' );
if iniStr.IsEmpty then if iniStr.IsEmpty then
......
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