From 3406db1dfd7038bfc8a3122b138ec699278e77e1 Mon Sep 17 00:00:00 2001 From: Steffen Jost Date: Fri, 24 Feb 2023 16:09:28 +0100 Subject: [PATCH] chore(sap): filter internal personal numbers between 10000 and 99999 --- src/Handler/SAP.hs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Handler/SAP.hs b/src/Handler/SAP.hs index 7fd0bd7b0..b96838bad 100644 --- a/src/Handler/SAP.hs +++ b/src/Handler/SAP.hs @@ -53,11 +53,13 @@ instance ToNamedRecord SapUserTableCsv where , "Ausprägung" Csv..= csvSUTausprägung ] --- | Removes all personalNummer which are not numbers (i.e. excludes E-Accounts), which should not be returned by the query anyway (only qualfications with sap id and users with internal personnel number must be transmitted) +-- | Removes all personalNummer which are not numbers between 10000 and 99999 (also excludes E-Accounts), which should not be returned by the query anyway (only qualfications with sap id and users with internal personnel number must be transmitted) -- TODO: once temporary suspensions are implemented, a user must be transmitted to SAP in two rows: firstheld->suspensionFrom & suspensionTo->validTo sapRes2csv :: [(Ex.Value (Maybe Text), Ex.Value Day, Ex.Value Day, Ex.Value (Maybe Text))] -> [SapUserTableCsv] sapRes2csv l = [ res | (Ex.Value (Just persNo), Ex.Value firstHeld, Ex.Value validUntil, Ex.Value (Just sapId)) <- l - , readMay persNo > Just (0::Int) -- filter E-accounts for SAP export + , let persNoAsInt = readMay persNo + , persNoAsInt >= Just (10000::Int) -- filter E-accounts for SAP export + , persNoAsInt <= Just (99999::Int) -- filter E-accounts for SAP export , let res = SapUserTableCsv { csvSUTpersonalNummer = persNo , csvSUTqualifikation = sapId