diff --git a/CHANGELOG.md b/CHANGELOG.md index 051d868a2..c0a7de2f3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines. +## [26.6.0](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v26.5.14...v26.6.0) (2022-11-18) + + +### Features + +* **footer:** add link to source code ([5a88d5c](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/commit/5a88d5c41f39a45147b049985d2f59cf70daddec)) +* **implementation:** add paragraph about license (AGPL-3.0-or-later) ([d4b341b](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/commit/d4b341ba259e710a142d813ede83c209fe2fe45a)) + ## [26.5.14](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v26.5.13...v26.5.14) (2022-11-06) ## [26.5.13](https://gitlab2.rz.ifi.lmu.de/uni2work/uni2work/compare/v26.5.12...v26.5.13) (2022-11-03) diff --git a/messages/uniworx/utils/navigation/menu/de-de-formal.msg b/messages/uniworx/utils/navigation/menu/de-de-formal.msg index e5aee3da3..803e46860 100644 --- a/messages/uniworx/utils/navigation/menu/de-de-formal.msg +++ b/messages/uniworx/utils/navigation/menu/de-de-formal.msg @@ -139,8 +139,10 @@ MenuLmsDirectUpload: Direkter Upload MenuLmsDirectDownload: Direkter Download MenuLmsFake: Testnutzer generieren -MenuAvs: Schnittstelle AVS -MenuLdap: Schnittstelle LDAP +MenuSap: SAP Schnittstelle + +MenuAvs: AVS Schnittstelle +MenuLdap: LDAP Schnittstelle MenuApc: Druckerei MenuPrintSend: Manueller Briefversand MenuPrintDownload: Brief herunterladen diff --git a/messages/uniworx/utils/navigation/menu/en-eu.msg b/messages/uniworx/utils/navigation/menu/en-eu.msg index b70a400fd..73f58d1f3 100644 --- a/messages/uniworx/utils/navigation/menu/en-eu.msg +++ b/messages/uniworx/utils/navigation/menu/en-eu.msg @@ -140,6 +140,8 @@ MenuLmsDirectUpload: Direct Upload MenuLmsDirectDownload: Direct Download MenuLmsFake: Generate test users +MenuSap: SAP Interface + MenuAvs: AVS Interface MenuLdap: LDAP Interface MenuApc: Printing diff --git a/messages/uniworx/utils/site_layout/de-de-formal.msg b/messages/uniworx/utils/site_layout/de-de-formal.msg index 5d02a1567..61b10dd1a 100644 --- a/messages/uniworx/utils/site_layout/de-de-formal.msg +++ b/messages/uniworx/utils/site_layout/de-de-formal.msg @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2022 Gregor Kleen ,Winnie Ros +# SPDX-FileCopyrightText: 2022 Gregor Kleen ,Sarah Vaupel ,Winnie Ros # # SPDX-License-Identifier: AGPL-3.0-or-later @@ -56,3 +56,4 @@ ErrorResponseTitleInvalidArgs invalidArgs@Texts: Anfrage-Nachricht enthielt ung ErrorResponseTitleNotAuthenticated: Anfrage benötigt Authentifizierung ErrorResponseTitlePermissionDenied permissionDenied@Text: Mangelnde Authorisierung ErrorResponseTitleBadMethod requestMethod@Method: HTTP-Methode nicht unterstützt +Uni2workSource: Quellcode diff --git a/messages/uniworx/utils/site_layout/en-eu.msg b/messages/uniworx/utils/site_layout/en-eu.msg index 7adc2540c..50358068d 100644 --- a/messages/uniworx/utils/site_layout/en-eu.msg +++ b/messages/uniworx/utils/site_layout/en-eu.msg @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2022 Sarah Vaupel ,Winnie Ros +# SPDX-FileCopyrightText: 2022 Sarah Vaupel ,Sarah Vaupel ,Winnie Ros # # SPDX-License-Identifier: AGPL-3.0-or-later @@ -56,3 +56,4 @@ ErrorResponseTitleInvalidArgs invalidArgs: Request contained invalid arguments ErrorResponseTitleNotAuthenticated: Request requires authentication ErrorResponseTitlePermissionDenied permissionDenied: Permission denied ErrorResponseTitleBadMethod requestMethod: HTTP-method not supported +Uni2workSource: Source code diff --git a/nix/docker/demo-version.json b/nix/docker/demo-version.json index 4e82c2a0c..10ad06c7c 100644 --- a/nix/docker/demo-version.json +++ b/nix/docker/demo-version.json @@ -1,3 +1,3 @@ { - "version": "26.5.14" + "version": "26.6.0" } diff --git a/nix/docker/version.json b/nix/docker/version.json index 4e82c2a0c..10ad06c7c 100644 --- a/nix/docker/version.json +++ b/nix/docker/version.json @@ -1,3 +1,3 @@ { - "version": "26.5.14" + "version": "26.6.0" } diff --git a/package-lock.json b/package-lock.json index 27e65b089..85e41e099 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "uni2work", - "version": "26.5.14", + "version": "26.6.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 9f897ae0c..ee81377b5 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "uni2work", - "version": "26.5.14", + "version": "26.6.0", "description": "", "keywords": [], "author": "", diff --git a/package.yaml b/package.yaml index 80e83121b..762b9fd12 100644 --- a/package.yaml +++ b/package.yaml @@ -1,5 +1,5 @@ name: uniworx -version: 26.5.14 +version: 26.6.0 dependencies: - base - yesod diff --git a/routes b/routes index 8c3fb21f3..a2ebbe640 100644 --- a/routes +++ b/routes @@ -280,9 +280,10 @@ -- !/*{CI FilePath} CryptoFileNameDispatchR GET !free -- Disabled until preliminary check for valid cID exists -- for users -/qualification QualificationAllR GET !free -- TODO repurpose -/qualification/#SchoolId QualificationSchoolR GET !free -- TODO repurpose -/qualification/#SchoolId/#QualificationShorthand QualificationR GET !free -- TODO repurpose +/qualification QualificationAllR GET !free -- TODO repurpose +/qualification/#SchoolId QualificationSchoolR GET !free -- TODO repurpose +/qualification/#SchoolId/#QualificationShorthand QualificationR GET -- TODO repurpose +/qualification/#SchoolId/#QualificationShorthand/sap/direct QualificationSAPDirectR GET !free -- TODO should not be free! -- OSIS CSV Export Demo /lms LmsAllR GET POST !free -- TODO verify that this is ok /lms/#SchoolId LmsSchoolR GET !free -- TODO verify that this is ok diff --git a/src/Application.hs b/src/Application.hs index 6ae224457..8858ecf9c 100644 --- a/src/Application.hs +++ b/src/Application.hs @@ -155,6 +155,7 @@ import Handler.Error import Handler.Upload import Handler.Qualification import Handler.LMS +import Handler.SAP import Handler.PrintCenter import Handler.ApiDocs import Handler.Swagger diff --git a/src/Foundation/Navigation.hs b/src/Foundation/Navigation.hs index 317f9080f..ed2f7634d 100644 --- a/src/Foundation/Navigation.hs +++ b/src/Foundation/Navigation.hs @@ -162,6 +162,7 @@ breadcrumb (QualificationSchoolR ssh ) = useRunDB . maybeT (i18nCru breadcrumb (QualificationR ssh qsh) =useRunDB . maybeT (i18nCrumb MsgBreadcrumbCourse . Just $ QualificationSchoolR ssh) $ do guardM . lift . existsBy $ SchoolQualificationShort ssh qsh return (CI.original qsh, Just $ QualificationSchoolR ssh) +breadcrumb (QualificationSAPDirectR ssh qsh) = i18nCrumb MsgMenuSap $ Just $ QualificationR ssh qsh breadcrumb LmsAllR = i18nCrumb MsgMenuLms Nothing breadcrumb (LmsSchoolR ssh ) = useRunDB . maybeT (i18nCrumb MsgBreadcrumbSchool . Just $ SchoolListR) $ do -- redirect only, used in other breadcrumbs diff --git a/src/Handler/LMS/Result.hs b/src/Handler/LMS/Result.hs index d6c152c91..be5ac16f4 100644 --- a/src/Handler/LMS/Result.hs +++ b/src/Handler/LMS/Result.hs @@ -277,7 +277,7 @@ postLmsResultDirectR sid qsh = do $logWarnS "LMS" $ "Result upload failed parsing: " <> tshow e return (badRequest400, "Exception: " <> tshow e) Right nr -> do - let msg = "Success. LMS Result upload file " <> fileName file <> " containing " <> tshow nr <> " rows for file " <> fhead + let msg = "Success. LMS Result upload file " <> fileName file <> " containing " <> tshow nr <> " rows for " <> fhead <> ". " $logInfoS "LMS" msg when (nr > 0) $ queueDBJob $ JobLmsResults qid return (ok200, msg) diff --git a/src/Handler/LMS/Userlist.hs b/src/Handler/LMS/Userlist.hs index 3a9c83de4..0104f7eb0 100644 --- a/src/Handler/LMS/Userlist.hs +++ b/src/Handler/LMS/Userlist.hs @@ -273,7 +273,7 @@ postLmsUserlistDirectR sid qsh = do $logWarnS "LMS" $ "Userlist upload failed parsing: " <> tshow e return (badRequest400, "Exception: " <> tshow e) Right nr -> do - let msg = "Success. LMS Userlist upload file " <> fileName file <> " containing " <> tshow nr <> " rows for file " <> fhead + let msg = "Success. LMS Userlist upload file " <> fileName file <> " containing " <> tshow nr <> " rows for " <> fhead <> ". " $logInfoS "LMS" msg when (nr > 0) $ queueDBJob $ JobLmsUserlist qid return (ok200, msg) diff --git a/src/Handler/LMS/Users.hs b/src/Handler/LMS/Users.hs index e942cde35..28ca2613e 100644 --- a/src/Handler/LMS/Users.hs +++ b/src/Handler/LMS/Users.hs @@ -181,8 +181,11 @@ getLmsUsersDirectR sid qsh = do } csvOpts = def { csvFormat = fmtOpts } csvSheetName <- csvFilenameLmsUser qsh + let nr = length lms_users + msg = "Success. LMS Users download file " <> csvSheetName <> " containing " <> tshow nr <> " rows" + $logInfoS "LMS" msg addHeader "Content-Disposition" $ "attachment; filename=\"" <> csvSheetName <> "\"" - csvRenderedToTypedContentWith csvOpts csvSheetName csvRendered + csvRenderedToTypedContentWith csvOpts csvSheetName csvRendered -- direct Download see: -- https://ersocon.net/blog/2017/2/22/creating-csv-files-in-yesod \ No newline at end of file diff --git a/src/Handler/SAP.hs b/src/Handler/SAP.hs new file mode 100644 index 000000000..567e7fd21 --- /dev/null +++ b/src/Handler/SAP.hs @@ -0,0 +1,105 @@ +-- SPDX-FileCopyrightText: 2022 Steffen Jost +-- +-- SPDX-License-Identifier: AGPL-3.0-or-later + +{-# LANGUAGE TypeApplications #-} + +module Handler.SAP + ( getQualificationSAPDirectR + ) + where + +import Import + +import Handler.Utils +import Handler.Utils.Csv + +import qualified Data.CaseInsensitive as CI +import qualified Data.Csv as Csv +import qualified Database.Esqueleto.Experimental as Ex -- needs TypeApplications Lang-Pragma +-- import qualified Database.Esqueleto.Legacy as E +import qualified Database.Esqueleto.Utils as E + + +data SapUserTableCsv = SapUserTableCsv -- for csv export only + { csvSUTpersonalNummer :: Text + , csvSUTqualifikation :: Text + , csvSUTgültigVon :: Day + , csvSUTgültigBis :: Day + -- , csvSUTsupendiertBis :: Maybe Day + , csvSUTausprägung :: Text + } + deriving (Show, Generic) +makeLenses_ ''SapUserTableCsv + +sapUserTableCsvHeader :: Csv.Header +sapUserTableCsvHeader = Csv.header + [ "PersonalNummer" + , "Qualifikation" + , "GültigVon" + , "GültigBis" + -- , "SupendiertBis" + , "Ausprägung" + ] + +instance ToNamedRecord SapUserTableCsv where + toNamedRecord SapUserTableCsv{..} = Csv.namedRecord + [ "PersonalNummer" Csv..= csvSUTpersonalNummer + , "Qualifikation" Csv..= csvSUTqualifikation + , "GültigVon" Csv..= csvSUTgültigVon + , "GültigBis" Csv..= csvSUTgültigBis + -- , "SupendiertBis" Csv..= csvSUTsupendiertBis + , "Ausprägung" Csv..= csvSUTausprägung + ] + +sapRes2csv :: Text -> (Ex.Value (Maybe Text), Ex.Value Day, Ex.Value Day) -> SapUserTableCsv +sapRes2csv qsh ( Ex.unValue -> Just persNo + , Ex.unValue -> firstHeld + , Ex.unValue -> validUntil + -- , Ex.unValue -> blocked + ) = + SapUserTableCsv -- for csv export only + { csvSUTpersonalNummer = persNo + , csvSUTqualifikation = qsh + , csvSUTgültigVon = firstHeld + , csvSUTgültigBis = validUntil + -- , csvSUTsupendiertBis = blocked + , csvSUTausprägung = "J" + } +sapRes2csv _ _ = error "SAP CSV export failed: filtered query returned user without internal personal number." + +getQualificationSAPDirectR :: SchoolId -> QualificationShorthand -> Handler TypedContent +getQualificationSAPDirectR sid qsh = do + qualUsers <- runDB $ do + qid <- getKeyBy404 $ SchoolQualificationShort sid qsh + Ex.select $ do + (qualUser Ex.:& user) <- + Ex.from $ Ex.table @QualificationUser `Ex.innerJoin` Ex.table @User + `Ex.on` (\(qualUser Ex.:& user) -> qualUser Ex.^. QualificationUserUser Ex.==. user Ex.^. UserId) + Ex.where_ $ (Ex.val qid Ex.==. qualUser Ex.^. QualificationUserQualification) + Ex.&&. E.isJust (user Ex.^. UserCompanyPersonalNumber) + return + ( user Ex.^. UserCompanyPersonalNumber + , qualUser Ex.^. QualificationUserFirstHeld + , qualUser Ex.^. QualificationUserValidUntil + -- , qualUser Ex.^. QualificationUserBlockedDue + ) + now <- liftIO getCurrentTime + fdate <- formatTime' "%Y%m%d_%H-%M" now + let qshOrg = CI.original qsh + sidOrg = CI.original $ unSchoolKey sid + csvRendered = toCsvRendered sapUserTableCsvHeader $ sapRes2csv qshOrg <$> qualUsers + fmtOpts = def { csvIncludeHeader = True + , csvDelimiter = ',' + , csvUseCrLf = True + } + csvOpts = def { csvFormat = fmtOpts } + csvSheetName = "fradrive_" <> sidOrg <> "_" <> qshOrg <> "_" <> fdate <> ".csv" + nr = length qualUsers + msg = "Qualification download file " <> csvSheetName <> " containing " <> tshow nr <> " rows" + $logInfoS "SAP" msg + addHeader "Content-Disposition" $ "attachment; filename=\"" <> csvSheetName <> "\"" + csvRenderedToTypedContentWith csvOpts csvSheetName csvRendered + +-- direct Download see: +-- https://ersocon.net/blog/2017/2/22/creating-csv-files-in-yesod \ No newline at end of file diff --git a/templates/i18n/implementation/de-de-formal.hamlet b/templates/i18n/implementation/de-de-formal.hamlet index 7850b47ba..cb4f84f95 100644 --- a/templates/i18n/implementation/de-de-formal.hamlet +++ b/templates/i18n/implementation/de-de-formal.hamlet @@ -39,3 +39,14 @@ $# SPDX-License-Identifier: AGPL-3.0-or-later
  • Winnie Ros
  • Sarah Vaupel
  • Wolfgang Witt + +

    + Uni2work ist freie Software.
    + Der Quellcode der Uni2work-Software steht unter der # + + GNU Affero General Public License (AGPL) in der Version 3.0 oder neuer + . +
    + Der Quellcode der Uni2work-Software ist über folgenden Link öffentlich verfügbar: # +
    + https://gitlab.com/fradrive/fradrive diff --git a/templates/i18n/implementation/en-eu.hamlet b/templates/i18n/implementation/en-eu.hamlet index 59223c920..1d4df3702 100644 --- a/templates/i18n/implementation/en-eu.hamlet +++ b/templates/i18n/implementation/en-eu.hamlet @@ -38,3 +38,14 @@ $# SPDX-License-Identifier: AGPL-3.0-or-later

  • Winnie Ros
  • Sarah Vaupel
  • Wolfgang Witt + +

    + Uni2work is free software.
    + The source code of the Uni2work software is licensed under the # +
    + GNU Affero General Public License (AGPL) in the version 3.0 or later + . +
    + The source code of the Uni2work software is publicly available via the following link: # +
    + https://gitlab.com/fradrive/fradrive diff --git a/templates/widgets/footer/footer.hamlet b/templates/widgets/footer/footer.hamlet index 52f33d21e..87cb86588 100644 --- a/templates/widgets/footer/footer.hamlet +++ b/templates/widgets/footer/footer.hamlet @@ -8,3 +8,6 @@ $# SPDX-License-Identifier: AGPL-3.0-or-later