From a42f1a92f2bc8dbbe108556c8799cc8de66ef635 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 12 May 2023 23:07:47 +0000 Subject: [PATCH] case 4377 --- .vscode/launch.json | 14 ++++++------- dist/latest-version.json | 2 +- docs/8.0/ayanova/docs/changelog.md | 9 ++++++++ .../AyaNova/Controllers/CustomerController.cs | 21 +++++++++++++++++++ server/AyaNova/biz/CustomerBiz.cs | 8 +++++++ server/AyaNova/resource/rpt/ay-report.js | 11 +++++----- 6 files changed, 52 insertions(+), 13 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index a19242a4..3e375c76 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -29,13 +29,13 @@ "cwd": "${workspaceFolder}/server/AyaNova", "stopAtEntry": false, "internalConsoleOptions": "openOnSessionStart", - // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser - //this needs to be tweaked probably - //https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#starting-a-web-browser - "serverReadyAction": { - "action": "openExternally", - "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)" - }, + // // Enable launching a web browser when ASP.NET Core starts. For more information: https://aka.ms/VSCode-CS-LaunchJson-WebBrowser + // //this needs to be tweaked probably + // //https://github.com/OmniSharp/omnisharp-vscode/blob/master/debugger-launchjson.md#starting-a-web-browser + // "serverReadyAction": { + // "action": "openExternally", + // "pattern": "^\\s*Now listening on:\\s+(https?://\\S+)" + // }, // "launchBrowser": { // "enabled": true, diff --git a/dist/latest-version.json b/dist/latest-version.json index 70b14daa..0ebdfe3b 100644 --- a/dist/latest-version.json +++ b/dist/latest-version.json @@ -1,4 +1,4 @@ { "latestversion":"8.1.0", - "changelogurl":"https://ayanova.com/docs/changelog/#ayanova-8100" + "changelogurl":"https://ayanova.com/docs/changelog/#ayanova-810" } \ No newline at end of file diff --git a/docs/8.0/ayanova/docs/changelog.md b/docs/8.0/ayanova/docs/changelog.md index 98b37e49..de90cca7 100644 --- a/docs/8.0/ayanova/docs/changelog.md +++ b/docs/8.0/ayanova/docs/changelog.md @@ -8,6 +8,15 @@ See the [upgrade instructions](ops-upgrade.md) section of this manual for detail ## 2023 + +### AyaNova 8.1.0 + +Released 2023-XX-XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX + +**Changed** + +- App, Server: Reporting - the ayT translation key helper function now shows an error directly in the rendered report in place of an incorrect or uncached translation key rather than the report failing entirely with an error message + ### AyaNova 8.0.43 Released 2023-05-10 diff --git a/server/AyaNova/Controllers/CustomerController.cs b/server/AyaNova/Controllers/CustomerController.cs index 1da47b36..6de9355f 100644 --- a/server/AyaNova/Controllers/CustomerController.cs +++ b/server/AyaNova/Controllers/CustomerController.cs @@ -198,6 +198,27 @@ namespace AyaNova.Api.Controllers } + /// + /// Get list of Customer Contacts for workorder + /// + /// Customer Id + /// Name list + [HttpGet("contact-name-list/{id}")] + public async Task GetContactNameList([FromRoute] long id) + { + if (!serverState.IsOpen) + return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason)); + CustomerBiz biz = CustomerBiz.GetBiz(ct, HttpContext); + if (!Authorized.HasReadFullRole(HttpContext.Items, biz.BizType)) + return StatusCode(403, new ApiNotAuthorizedResponse()); + if (!ModelState.IsValid) + return BadRequest(new ApiErrorResponse(ModelState)); + var o = await biz.GetContactNameListAsync(id); + if (o == null) return NotFound(new ApiErrorResponse(ApiErrorCode.NOT_FOUND)); + return Ok(ApiOkResponse.Response(o)); + } + + // /// // /// Get service (physical) address for this customer // /// diff --git a/server/AyaNova/biz/CustomerBiz.cs b/server/AyaNova/biz/CustomerBiz.cs index f997a69f..f3688fd6 100644 --- a/server/AyaNova/biz/CustomerBiz.cs +++ b/server/AyaNova/biz/CustomerBiz.cs @@ -202,6 +202,14 @@ namespace AyaNova.Biz return await ct.Customer.AsNoTracking().OrderBy(x => x.Name).Select(x => new NameIdActiveItem { Name = x.Name, Id = x.Id, Active = x.Active }).ToListAsync(); } + //////////////////////////////////////////////////////////////////////////////////////////////// + //GET LIST OF CONTACTS FOR THIS CUSTOMER FOR SELECTION ON WORKORDERS + // + internal async Task> GetContactNameListAsync(long customerId) + { + return await ct.User.AsNoTracking().Where(z => z.Active && z.UserType == UserType.Customer && z.CustomerId == customerId).OrderBy(x => x.Name).Select(x=> x.Name).ToListAsync(); + } + //////////////////////////////////////////////////////////////////////////////////////////////// //SEARCH // diff --git a/server/AyaNova/resource/rpt/ay-report.js b/server/AyaNova/resource/rpt/ay-report.js index 5e591db3..45f470c2 100644 --- a/server/AyaNova/resource/rpt/ay-report.js +++ b/server/AyaNova/resource/rpt/ay-report.js @@ -98,11 +98,12 @@ function ayRegisterHelpers() { Handlebars.registerHelper("ayT", function (translationKey) { if (ayTranslationKeyCache[translationKey] == undefined) { - throw `ayT reporting helper error: the key "${translationKey}" is not present in the translation cache, did you forget to include it in your call to "await ayGetTranslations(['ExampleTranslationKey1','ExampleTranslationKey2','etc']);" in ayPrepareData()\nTranslationKeyCache contains: ${JSON.stringify( - ayTranslationKeyCache, - null, - 3 - )}?`; + return `**Error: "${translationKey}" translation key not cached or unknown**`; + // throw `ayT reporting helper error: the key "${translationKey}" is not present in the translation cache, did you forget to include it in your call to "await ayGetTranslations(['ExampleTranslationKey1','ExampleTranslationKey2','etc']);" in ayPrepareData()\nTranslationKeyCache contains: ${JSON.stringify( + // ayTranslationKeyCache, + // null, + // 3 + // )}?`; // return translationKey; } return ayTranslationKeyCache[translationKey];