From ddc62584117da0fc8f3437dc137b5fe3a60eadaf Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Thu, 25 Jan 2024 23:03:23 +0000 Subject: [PATCH] case 4568 --- docs/8.0/ayanova/docs/changelog.md | 4 +++- server/AyaNova/biz/ReportBiz.cs | 36 ++++++++++++++++++++++++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/docs/8.0/ayanova/docs/changelog.md b/docs/8.0/ayanova/docs/changelog.md index c8f09809..82399fa3 100644 --- a/docs/8.0/ayanova/docs/changelog.md +++ b/docs/8.0/ayanova/docs/changelog.md @@ -14,7 +14,9 @@ Released XXXXX **Fixed** -- App: Fixed issue where some users were seeing an error when dropping file attachments on to a record. (This error did not affect the functionatlity of attaching files) +- App: Fixed issue where some users were seeing an error when dropping file attachments on to a record. (This error was "cosmetic" only and did not affect the functionality of attaching files) + +- Reporting: Fixed issue where some "Viz" server populated fields such as Work order item Task completion types and other similar pick list related fields on reports were defaulting to English translation instead of the User's selected translation ## 2023 diff --git a/server/AyaNova/biz/ReportBiz.cs b/server/AyaNova/biz/ReportBiz.cs index 01cbb2da..71c8e582 100644 --- a/server/AyaNova/biz/ReportBiz.cs +++ b/server/AyaNova/biz/ReportBiz.cs @@ -310,9 +310,24 @@ namespace AyaNova.Biz if (selectedRequest.SelectedRowIds.Length == 0) selectedRequest.SelectedRowIds = await DataListSelectedProcessingOptions.RehydrateIdList(selectedRequest, ct, effectiveRoles, log, UserId, UserTranslationId); + //case 4568 get translation id ultimately without failing so as to not affect any existing callers that this might not work with + long RequestorUserTranslationId = UserTranslationId; + try + { + JToken clientMeta = ((DataListReportRequest)selectedRequest).ClientMeta; + if (clientMeta["UserId"] != null) + { + RequestorUserTranslationId = await ct.User.AsNoTracking().Where(a => a.Id == clientMeta["UserId"].ToObject()).Select(m => m.UserOptions.TranslationId).FirstAsync();//m => new { roles = m.Roles, name = m.Name, m.UserType, id = m.Id, translationId = m.UserOptions.TranslationId, currentAuthToken = m.CurrentAuthToken }).FirstAsync(); + } + } + catch (Exception exx) + { + log.LogDebug(exx, $"Failed to get RequestionUserTranslationId from ClientMeta"); + }; + log.LogDebug($"Instantiating biz object handler for {selectedRequest.AType}"); - var biz = BizObjectFactory.GetBizObject(selectedRequest.AType, ct, UserId, CurrentUserRoles, UserTranslationId); + var biz = BizObjectFactory.GetBizObject(selectedRequest.AType, ct, UserId, CurrentUserRoles, RequestorUserTranslationId); log.LogDebug($"Fetching data for {selectedRequest.SelectedRowIds.Length} {selectedRequest.AType} items"); return await ((IReportAbleObject)biz).GetReportData(selectedRequest, Guid.Empty);//Guid.empty signifies it's not a job calling it } @@ -342,8 +357,25 @@ namespace AyaNova.Biz if (!ReportRenderManager.KeepGoing(jobId)) return null; + + //case 4568 get translation id ultimately without failing so as to not affect any existing callers that this might not work with + long RequestorUserTranslationId = UserTranslationId; + try + { + JToken clientMeta = ((DataListReportRequest)selectedRequest).ClientMeta; + if (clientMeta["UserId"] != null) + { + RequestorUserTranslationId = await ct.User.AsNoTracking().Where(a => a.Id == clientMeta["UserId"].ToObject()).Select(m => m.UserOptions.TranslationId).FirstAsync();//m => new { roles = m.Roles, name = m.Name, m.UserType, id = m.Id, translationId = m.UserOptions.TranslationId, currentAuthToken = m.CurrentAuthToken }).FirstAsync(); + } + } + catch (Exception exx) + { + log.LogDebug(exx, $"Failed to get RequestionUserTranslationId from ClientMeta"); + }; + + log.LogDebug($"Instantiating biz object handler for {selectedRequest.AType}"); - var biz = BizObjectFactory.GetBizObject(selectedRequest.AType, ct, UserId, CurrentUserRoles, UserTranslationId); + var biz = BizObjectFactory.GetBizObject(selectedRequest.AType, ct, UserId, CurrentUserRoles, RequestorUserTranslationId); log.LogDebug($"Fetching data for {selectedRequest.SelectedRowIds.Length} {selectedRequest.AType} items"); return await ((IReportAbleObject)biz).GetReportData(selectedRequest, jobId); }