chore(letter): implement course qualification letter (wip)
This commit is contained in:
parent
45daa5820e
commit
a827f46f0f
@ -13,6 +13,7 @@ import Import
|
|||||||
|
|
||||||
import Handler.Utils
|
import Handler.Utils
|
||||||
import Handler.Utils.Csv
|
import Handler.Utils.Csv
|
||||||
|
import Handler.Utils.Profile
|
||||||
|
|
||||||
-- import qualified Data.CaseInsensitive as CI
|
-- import qualified Data.CaseInsensitive as CI
|
||||||
import qualified Data.Csv as Csv
|
import qualified Data.Csv as Csv
|
||||||
@ -56,11 +57,11 @@ instance ToNamedRecord SapUserTableCsv where
|
|||||||
-- | 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)
|
-- | 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
|
-- 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 :: [(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
|
sapRes2csv l = [ res | (Ex.Value pn@(Just persNo), Ex.Value firstHeld, Ex.Value validUntil, Ex.Value (Just sapId)) <- l
|
||||||
, let persNoAsInt = readMay persNo
|
-- , let persNoAsInt = readMay =<< persNo -- also see Handler.Utils.Profile.validFraportPersonalNumber
|
||||||
, persNoAsInt >= Just (10000::Int) -- filter E-accounts for SAP export
|
-- , persNoAsInt >= Just (10000::Int) -- filter E-accounts for SAP export
|
||||||
, persNoAsInt <= Just (99999::Int) -- filter E-accounts for SAP export
|
-- , persNoAsInt <= Just (99999::Int) -- filter E-accounts for SAP export
|
||||||
, let res = SapUserTableCsv
|
, let res = SapUserTableCsv
|
||||||
{ csvSUTpersonalNummer = persNo
|
{ csvSUTpersonalNummer = persNo
|
||||||
, csvSUTqualifikation = sapId
|
, csvSUTqualifikation = sapId
|
||||||
, csvSUTgültigVon = firstHeld
|
, csvSUTgültigVon = firstHeld
|
||||||
@ -68,6 +69,7 @@ sapRes2csv l = [ res | (Ex.Value (Just persNo), Ex.Value firstHeld, Ex.Value val
|
|||||||
-- , csvSUTsupendiertBis = blocked
|
-- , csvSUTsupendiertBis = blocked
|
||||||
, csvSUTausprägung = "J"
|
, csvSUTausprägung = "J"
|
||||||
}
|
}
|
||||||
|
, validFraportPersonalNumber pn
|
||||||
]
|
]
|
||||||
|
|
||||||
-- | Deliver all employess with a successful LDAP synch within the last 3 months
|
-- | Deliver all employess with a successful LDAP synch within the last 3 months
|
||||||
|
|||||||
@ -5,12 +5,10 @@
|
|||||||
-- TODO: why is this Handler.Utils.Profile instead of Utils.Profile?
|
-- TODO: why is this Handler.Utils.Profile instead of Utils.Profile?
|
||||||
-- TODO: consider merging with Handler.Utils.Users?
|
-- TODO: consider merging with Handler.Utils.Users?
|
||||||
module Handler.Utils.Profile
|
module Handler.Utils.Profile
|
||||||
( checkDisplayName
|
( validDisplayName, checkDisplayName, fixDisplayName
|
||||||
, validDisplayName
|
|
||||||
, fixDisplayName
|
|
||||||
, validPostAddress
|
, validPostAddress
|
||||||
, validEmail, validEmail'
|
, validEmail, validEmail', pickValidEmail, pickValidEmail'
|
||||||
, pickValidEmail, pickValidEmail'
|
, validFraportPersonalNumber
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Import.NoFoundation
|
import Import.NoFoundation
|
||||||
@ -103,4 +101,11 @@ pickValidEmail' :: UserEmail -> UserEmail -> Maybe UserEmail
|
|||||||
pickValidEmail' x y
|
pickValidEmail' x y
|
||||||
| validEmail' x = Just x
|
| validEmail' x = Just x
|
||||||
| validEmail' y = Just y
|
| validEmail' y = Just y
|
||||||
| otherwise = Nothing
|
| otherwise = Nothing
|
||||||
|
|
||||||
|
validFraportPersonalNumber :: Maybe Text -> Bool
|
||||||
|
validFraportPersonalNumber Nothing = False
|
||||||
|
validFraportPersonalNumber (Just t)
|
||||||
|
| (Just pn) <- readMay t
|
||||||
|
= pn >= (10000::Int) && pn <= (99999::Int) -- used to filter for SAP export
|
||||||
|
| otherwise = False
|
||||||
|
|||||||
@ -15,6 +15,7 @@ module Model.Types.DateTime
|
|||||||
|
|
||||||
import Import.NoModel
|
import Import.NoModel
|
||||||
|
|
||||||
|
import qualified Data.Set as Set
|
||||||
import Data.Ratio ((%))
|
import Data.Ratio ((%))
|
||||||
import qualified Data.Text as Text
|
import qualified Data.Text as Text
|
||||||
-- import Data.Either.Combinators (maybeToRight, mapLeft)
|
-- import Data.Either.Combinators (maybeToRight, mapLeft)
|
||||||
@ -206,3 +207,16 @@ derivePersistFieldJSON ''Occurrences
|
|||||||
|
|
||||||
|
|
||||||
nullaryPathPiece ''DayOfWeek camelToPathPiece
|
nullaryPathPiece ''DayOfWeek camelToPathPiece
|
||||||
|
|
||||||
|
|
||||||
|
-- | Get bounds for an Occurrences
|
||||||
|
-- TODO: unfinished function, only works for a few selected cases yet
|
||||||
|
occurrencesBounds :: Occurrences -> (Maybe Day, Maybe Day)
|
||||||
|
occurrencesBounds Occurrences{occurrencesScheduled=scd} | notNull scd = (Nothing, Nothing) -- TODO: case is not yet implemented
|
||||||
|
occurrencesBounds Occurrences{occurrencesExceptions=exc} = (Set.lookupMin occDays, Set.lookupMax occDays)
|
||||||
|
where
|
||||||
|
occDays = Set.foldr getOccDays mempty exc
|
||||||
|
|
||||||
|
getOccDays :: OccurrenceException -> Set Day -> Set Day
|
||||||
|
getOccDays ExceptNoOccur{} acc = acc -- TODO: this case ignores ExceptNoOccur for now!
|
||||||
|
getOccDays ExceptOccur{exceptDay} acc = Set.insert exceptDay acc
|
||||||
|
|||||||
@ -128,6 +128,9 @@ makeClassyFor_ ''LmsResult
|
|||||||
makeClassyFor_ ''UserAvs
|
makeClassyFor_ ''UserAvs
|
||||||
makeClassyFor_ ''UserAvsCard
|
makeClassyFor_ ''UserAvsCard
|
||||||
|
|
||||||
|
makeClassyFor_ ''UserCompany
|
||||||
|
makeLenses_ ''Company
|
||||||
|
|
||||||
_entityKey :: Getter (Entity record) (Key record)
|
_entityKey :: Getter (Entity record) (Key record)
|
||||||
-- ^ Not a `Lens'` for safety
|
-- ^ Not a `Lens'` for safety
|
||||||
_entityKey = to entityKey
|
_entityKey = to entityKey
|
||||||
|
|||||||
@ -47,6 +47,7 @@ import Jobs.Handler.SendNotification.Utils
|
|||||||
|
|
||||||
import Utils.Print.Letters
|
import Utils.Print.Letters
|
||||||
import Utils.Print.RenewQualification
|
import Utils.Print.RenewQualification
|
||||||
|
import Utils.Print.CourseCertificate
|
||||||
|
|
||||||
|
|
||||||
-- import Model.Types.Markup -- TODO-QSV: should this module be moved accordingly?
|
-- import Model.Types.Markup -- TODO-QSV: should this module be moved accordingly?
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
-- SPDX-FileCopyrightText: 2022 Steffen Jost <jost@tcs.ifi.lmu.de>
|
-- SPDX-FileCopyrightText: 2023 Steffen Jost <jost@tcs.ifi.lmu.de>
|
||||||
--
|
--
|
||||||
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
-- SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
|
|||||||
@ -8,8 +8,51 @@ date: 11.11.1111
|
|||||||
...
|
...
|
||||||
$if(is-de)$
|
$if(is-de)$
|
||||||
|
|
||||||
|
# Teilnahmebescheinigung
|
||||||
|
|
||||||
|
## $participant$
|
||||||
|
|
||||||
|
$if(fra-number)$
|
||||||
|
### $fra-number$ $fra-department$
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
$if(company)$
|
||||||
|
### $company$
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
Hat
|
||||||
|
$if(course-begin)$
|
||||||
|
von $course-begin$ bis $course-end$
|
||||||
|
$endif$
|
||||||
|
an der Veranstaltung
|
||||||
|
|
||||||
|
## $course-name$
|
||||||
|
|
||||||
|
der Fahrerausbildung der Fraport AG teilgenommen.
|
||||||
|
|
||||||
|
$if(course-content)$
|
||||||
|
### Inhalte:
|
||||||
|
|
||||||
|
$course-content$
|
||||||
|
$endif$
|
||||||
|
|
||||||
|
Mit Aushändigung der Teilnahmebescheinigung wird der erfolgreiche Abschluss des Kurses bestätigt.
|
||||||
|
Dieses Zertifikat wurde maschinell erstellt.
|
||||||
|
|
||||||
|
|
||||||
|
Frankfurt am Main, $date$
|
||||||
|
|
||||||
|
Fraport College
|
||||||
|
|
||||||
<!-- deutsche version -->
|
<!-- deutsche version -->
|
||||||
|
|
||||||
$else$
|
$else$
|
||||||
|
|
||||||
<!-- english version -->
|
<!-- english version -->
|
||||||
|
|
||||||
|
# Certificate of attendance
|
||||||
|
|
||||||
|
**English version is not yet implemened.**
|
||||||
|
TODO
|
||||||
|
|
||||||
|
$endif$
|
||||||
Loading…
Reference in New Issue
Block a user