From 552e35cefcbc83ff75b4010757791d2f6916188f Mon Sep 17 00:00:00 2001 From: Meik Date: Fri, 14 Nov 2025 15:07:42 +0100 Subject: [PATCH] category added --- .../DataHistoryCollectorM42Wpm.cs | 44 ++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/F4SD-Cockpit-ServerCore/DataHistoryCollectorM42Wpm.cs b/F4SD-Cockpit-ServerCore/DataHistoryCollectorM42Wpm.cs index a9cbbba..599026d 100644 --- a/F4SD-Cockpit-ServerCore/DataHistoryCollectorM42Wpm.cs +++ b/F4SD-Cockpit-ServerCore/DataHistoryCollectorM42Wpm.cs @@ -2008,17 +2008,24 @@ namespace C4IT.DataHistoryProvider LogEntry($"No initiating user found with state active (710) and AD Common Name: {ticketInfo.User}", LogLevels.Error); return null; } - var ticketInfo2 = new cM42TicketInfo() - { - Subject = ticketInfo.Summary, - DescriptionHTML = ticketInfo.DescriptionHtml, - SolutionHTML = ticketInfo.SolutionHtml, - User = userID, + Guid? requestCategoryId = ticketInfo.CategoryId; + if (requestCategoryId.HasValue && requestCategoryId.Value == Guid.Empty) + { + requestCategoryId = null; + } + + var ticketInfo2 = new cM42TicketInfo() + { + Subject = ticketInfo.Summary, + DescriptionHTML = ticketInfo.DescriptionHtml, + SolutionHTML = ticketInfo.SolutionHtml, + User = userID, Asset = assetId, - Service = ticketInfo.AffectedService, - Template = ticketInfo.Quickcall, - EntryBy = 20500 - }; + Service = ticketInfo.AffectedService, + Template = ticketInfo.Quickcall, + Category = requestCategoryId, + EntryBy = 20500 + }; var quickCallFragments = quickCallFragmentListTask?.Result; if (quickCallFragments != null) @@ -2052,8 +2059,8 @@ namespace C4IT.DataHistoryProvider if (Guid.TryParse((string)quickCallData?.Service, out Guid service)) ticketInfo2.Service = ticketInfo2.Service ?? service; - if (Guid.TryParse((string)quickCallData?.Category, out Guid category)) - ticketInfo2.Category = category; + if (!ticketInfo2.Category.HasValue && Guid.TryParse((string)quickCallData?.Category, out Guid category)) + ticketInfo2.Category = category; if (bool.TryParse((string)quickCallData?.NotifyResponsible, out bool notifyResponsible)) ticketInfo2.NotifyResponsible = notifyResponsible; @@ -2203,10 +2210,15 @@ namespace C4IT.DataHistoryProvider var ticketID = (Guid)ticketInfo.Ticket; var ticket = await GetObjectAsync(activityType, ticketID, false, requestInfo, LogDeep + 1, token); - if (ticketInfo.Quickcall.HasValue && ticketInfo.Quickcall.Value != Guid.Empty) - { - ticket["SPSActivityClassIncident"]["Quickcall"] = ticketInfo.Quickcall.Value; - } + if (ticketInfo.Quickcall.HasValue && ticketInfo.Quickcall.Value != Guid.Empty) + { + ticket["SPSActivityClassIncident"]["Quickcall"] = ticketInfo.Quickcall.Value; + } + + if (ticketInfo.CategoryId.HasValue && ticketInfo.CategoryId.Value != Guid.Empty) + { + ticket["SPSActivityClassIncident"]["Category"] = ticketInfo.CategoryId.Value; + } if (ticketInfo.AffectedService.HasValue && ticketInfo.AffectedService.Value == Guid.Empty) { ticket["SPSActivityClassBase"]["Service"] = null;