diff --git a/Service/ServiceUtils/History/HistoryCreator.cs b/Service/ServiceUtils/History/HistoryCreator.cs index d4892d027..d7633f4b6 100644 --- a/Service/ServiceUtils/History/HistoryCreator.cs +++ b/Service/ServiceUtils/History/HistoryCreator.cs @@ -73,7 +73,21 @@ namespace BeWo.ServiceUtils.History } } } + CreateAbsenceTimeHistoryEntry(originalEmployee.AbsenceTimes, newEmployee.AbsenceTimes); + + if (newEmployee.Overtimes != null) + { + foreach (var item in newEmployee.Overtimes) + { + if (!item.EmployeeOid.HasValue) + { + item.EmployeeOid = originalEmployee.Oid.Value; + } + } + } + + CreateOvertimeHistoryEntry(originalEmployee.Overtimes, newEmployee.Overtimes); @@ -482,7 +496,7 @@ namespace BeWo.ServiceUtils.History //CostBearer2SupportConcept_ServiceRecords = originalC2S.ServiceRecords, CostBearer2SupportConcept_Status = originalC2S.Status, //CostBearer2SupportConcept_SupportConceptApprovalPeriodList = originalC2S.ApprovalPeriodList - CostBearer2SupportConcept_SupportConceptHistoryOid = lOriginal.Oid.Value, + CostBearer2SupportConcept_SupportConceptHistoryOid = lOriginal?.Oid, ChangeType = statementType, Notice = originalC2S.Notice }; @@ -502,14 +516,14 @@ namespace BeWo.ServiceUtils.History SupportConceptApprovalPeriod_BudgetOid = item.Budget?.Oid.Value, SupportConceptApprovalPeriod_ContactCountInterval = item.ContactCountInterval, SupportConceptApprovalPeriod_ContactCountPerInterval = item.ContactCountPerInterval, - SupportConceptApprovalPeriod_CostBearer2SupportConceptHistoryOid = originalC2S.Oid.Value, + SupportConceptApprovalPeriod_CostBearer2SupportConceptHistoryOid = originalC2S?.Oid, SupportConceptApprovalPeriod_EndDate = item.EndDate, SupportConceptApprovalPeriod_IsApprovedBEShifting = item.IsApprovedBEShifting, SupportConceptApprovalPeriod_IsApprovedFixedAmountShifting = item.IsApprovedFixedAmountShifting, SupportConceptApprovalPeriod_MonthlyPayment = item.MonthlyPayment, SupportConceptApprovalPeriod_StartDate = item.StartDate, SupportConceptApprovalPeriod_SupportConceptApprovalPeriod2Employee = item.SupportConceptApprovalPeriod2Employee, - SupportConceptApprovalPeriod_SupportConceptHistoryOid = supportConceptHistoryEntry.Oid.Value, + SupportConceptApprovalPeriod_SupportConceptHistoryOid = supportConceptHistoryEntry?.Oid, Notice = item.Notice }; DAOFactory.GenericDAO.Insert(scApprovalPeriodHistory);