From 1109c692acfb5ece1718aacb7b34f3d18c7fd356 Mon Sep 17 00:00:00 2001 From: Tobias Legind Date: Thu, 7 Jun 2018 11:16:49 +0200 Subject: [PATCH] Revert to master for release --- .../it-system-overview.controller.ts | 36 ++++++++++--------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/Presentation.Web/app/components/it-system/it-system-overview.controller.ts b/Presentation.Web/app/components/it-system/it-system-overview.controller.ts index 6ac4294f79..d7c8eec9c7 100644 --- a/Presentation.Web/app/components/it-system/it-system-overview.controller.ts +++ b/Presentation.Web/app/components/it-system/it-system-overview.controller.ts @@ -268,8 +268,8 @@ if (!usage.ItSystem.TaskRefs) { usage.ItSystem.TaskRefs = { TaskKey: "", Description: "" }; } if (!usage.SensitiveDataType) { usage.SensitiveDataType = { Name: "" }; } if (!usage.MainContract) { usage.MainContract = { ItContract: { Supplier: { Name: "" } } }; } - if (!usage.Reference) { usage.Reference = { Title: "", ExternalReferenceId: "" }; } - if (!usage.MainContract.ItContract.Supplier) { usage.MainContract.ItContract.Supplier = { Name: "" }; } + if (!usage.Reference) { usage.Reference = { Title: "" }; } + if (!usage.MainContract.ItContract.Supplier) { usage.MainContract = { ItContract: { Supplier: { Name: "" } } }; } }); return response; } @@ -618,9 +618,10 @@ field: "MainContract", title: "Kontrakt", width: 120, persistId: "contract", // DON'T YOU DARE RENAME! template: dataItem => { - if (!dataItem.MainContract || !dataItem.MainContract.ItContract || !dataItem.MainContract.ItContract.Name) { + if (!dataItem.MainContract || !dataItem.MainContract.ItContract) { return ""; } + if (this.isContractActive(dataItem.MainContract.ItContract)) { return ``; } else { @@ -980,20 +981,23 @@ } private isContractActive(dataItem) { - if (!dataItem.Active) { - var today = moment(); - var startDate = dataItem.Concluded ? moment(dataItem.Concluded, "YYYY-MM-DD").startOf('day') : moment().startOf('day'); - var endDate = dataItem.ExpirationDate ? moment(dataItem.ExpirationDate, "YYYY-MM-DD").endOf('day') : this.moment("9999-12-30", "YYYY-MM-DD").endOf('day'); - if (dataItem.Terminated) { - var terminationDate = moment(dataItem.Terminated, "YYYY-MM-DD").endOf('day'); - if (dataItem.TerminationDeadline) { - terminationDate.add(dataItem.TerminationDeadline.Name, "months"); - } - // indgået-dato <= dags dato <= opsagt-dato + opsigelsesfrist - return today.isBetween(startDate, terminationDate, null, '[]'); + + if (!dataItem.Active) { + var today = this.moment().startOf('day'); + var startDate = dataItem.Concluded ? moment(dataItem.Concluded).startOf('day') : today; + var endDate = dataItem.ExpirationDate ? moment(dataItem.ExpirationDate).startOf('day') : this.moment("9999-12-30").startOf('day'); + + if (dataItem.Terminated) { + var terminationDate = moment(dataItem.Terminated); + if (dataItem.TerminationDeadline) { + terminationDate.add(dataItem.TerminationDeadline.Name, "months"); } - // indgået-dato <= dags dato <= udløbs-dato - return today.isBetween(startDate, endDate, null, '[]'); + // indgået-dato <= dags dato <= opsagt-dato + opsigelsesfrist + return today >= startDate && today <= terminationDate; + } + + // indgået-dato <= dags dato <= udløbs-dato + return today >= startDate && today <= endDate; } return dataItem.Active; }