chore(avs): log postal address changes
This commit is contained in:
parent
d21d66781d
commit
01cc46c6e4
@ -41,6 +41,7 @@ PostAddress: Postalische Adresse
|
|||||||
PostAddressTip: Mindestens eine Zeile mit Straße und Hausnummer und eine Zeile mit Postleitzahl und Ort. Kein Empfängername, denn dieser wird später automatisch hinzugefügt.
|
PostAddressTip: Mindestens eine Zeile mit Straße und Hausnummer und eine Zeile mit Postleitzahl und Ort. Kein Empfängername, denn dieser wird später automatisch hinzugefügt.
|
||||||
UserPostalInvalid: Postadresse muss mindestens eine Zeile mit Straße und Hausnummer und eine separate Zeile mit Postleitzahl und Ort enthalten!
|
UserPostalInvalid: Postadresse muss mindestens eine Zeile mit Straße und Hausnummer und eine separate Zeile mit Postleitzahl und Ort enthalten!
|
||||||
UserPrefersPostalInvalid: Entweder postalische Benachrichtigungen deaktivieren oder eine Postadresse angeben!
|
UserPrefersPostalInvalid: Entweder postalische Benachrichtigungen deaktivieren oder eine Postadresse angeben!
|
||||||
|
UserPostLastUpdate: Postadresse zuletzt geändert
|
||||||
|
|
||||||
FormNotifications: Benachrichtigungen
|
FormNotifications: Benachrichtigungen
|
||||||
|
|
||||||
|
|||||||
@ -41,6 +41,7 @@ PostAddress: Postal address
|
|||||||
PostAddressTip: Should contain at least one line with street and house number and another line featuring zip code and town. Omit a recipient name, since it will be added later.
|
PostAddressTip: Should contain at least one line with street and house number and another line featuring zip code and town. Omit a recipient name, since it will be added later.
|
||||||
UserPostalInvalid: Postal address must have at least one line with street and house number and another with zip code and town!
|
UserPostalInvalid: Postal address must have at least one line with street and house number and another with zip code and town!
|
||||||
UserPrefersPostalInvalid: Either deactivate postal notification or supply a valid postal address!
|
UserPrefersPostalInvalid: Either deactivate postal notification or supply a valid postal address!
|
||||||
|
UserPostLastUpdate: Last postal address change
|
||||||
|
|
||||||
FormNotifications: Notifications
|
FormNotifications: Notifications
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,7 @@ User json -- Each Uni2work user has a corresponding row in this table; create
|
|||||||
companyDepartment Text Maybe -- thus we store such information for ease of reference directly, if available
|
companyDepartment Text Maybe -- thus we store such information for ease of reference directly, if available
|
||||||
pinPassword Text Maybe -- used to encrypt pins within emails
|
pinPassword Text Maybe -- used to encrypt pins within emails
|
||||||
postAddress StoredMarkup Maybe
|
postAddress StoredMarkup Maybe
|
||||||
|
postLastUpdate UTCTime Maybe -- record postal address updates
|
||||||
prefersPostal Bool default=false -- user prefers letters by post instead of email
|
prefersPostal Bool default=false -- user prefers letters by post instead of email
|
||||||
examOfficeGetSynced Bool default=true -- whether synced status should be displayed for exam results by default
|
examOfficeGetSynced Bool default=true -- whether synced status should be displayed for exam results by default
|
||||||
examOfficeGetLabels Bool default=true -- whether labels should be displayed for exam results by default
|
examOfficeGetLabels Bool default=true -- whether labels should be displayed for exam results by default
|
||||||
|
|||||||
@ -291,6 +291,7 @@ decodeUser now UserDefaultConf{..} upsertMode ldapData = do
|
|||||||
, userDisplayEmail = userEmail
|
, userDisplayEmail = userEmail
|
||||||
, userMatrikelnummer = Nothing -- not known from LDAP, must be derived from REST interface to AVS TODO
|
, userMatrikelnummer = Nothing -- not known from LDAP, must be derived from REST interface to AVS TODO
|
||||||
, userPostAddress = Nothing -- not known from LDAP, must be derived from REST interface to AVS TODO
|
, userPostAddress = Nothing -- not known from LDAP, must be derived from REST interface to AVS TODO
|
||||||
|
, userPostLastUpdate = Nothing
|
||||||
, userPinPassword = Nothing -- must be derived via AVS
|
, userPinPassword = Nothing -- must be derived via AVS
|
||||||
, userPrefersPostal = userDefaultPrefersPostal
|
, userPrefersPostal = userDefaultPrefersPostal
|
||||||
, ..
|
, ..
|
||||||
|
|||||||
@ -112,6 +112,7 @@ fakeQualificationUsers (Entity qid Qualification{qualificationRefreshWithin}) (u
|
|||||||
userCompanyPersonalNumber = Nothing
|
userCompanyPersonalNumber = Nothing
|
||||||
userCompanyDepartment = Nothing
|
userCompanyDepartment = Nothing
|
||||||
userPostAddress = postalAddress
|
userPostAddress = postalAddress
|
||||||
|
userPostLastUpdate = Nothing
|
||||||
userPinPassword = Just "tomatenmarmelade"
|
userPinPassword = Just "tomatenmarmelade"
|
||||||
in User{..}
|
in User{..}
|
||||||
|
|
||||||
|
|||||||
@ -441,8 +441,11 @@ serveProfileR (uid, user@User{..}) = do
|
|||||||
((res,formWidget), formEnctype) <- runFormPost . validateForm (validateSettings user) . identifyForm ProfileSettings $ makeSettingForm settingsTemplate
|
((res,formWidget), formEnctype) <- runFormPost . validateForm (validateSettings user) . identifyForm ProfileSettings $ makeSettingForm settingsTemplate
|
||||||
|
|
||||||
formResult res $ \SettingsForm{..} -> do
|
formResult res $ \SettingsForm{..} -> do
|
||||||
|
now <- liftIO getCurrentTime
|
||||||
runDBJobs $ do
|
runDBJobs $ do
|
||||||
update uid $
|
update uid $
|
||||||
|
[ UserDisplayEmail =. stgDisplayEmail | userDisplayEmail == stgDisplayEmail ] ++ -- SJ asks: what does this line achieve?
|
||||||
|
[ UserPostLastUpdate =. Just now | userPostAddress /= stgPostAddress ] ++
|
||||||
[ UserDisplayName =. stgDisplayName
|
[ UserDisplayName =. stgDisplayName
|
||||||
, UserMaxFavourites =. stgMaxFavourites
|
, UserMaxFavourites =. stgMaxFavourites
|
||||||
, UserMaxFavouriteTerms =. stgMaxFavouriteTerms
|
, UserMaxFavouriteTerms =. stgMaxFavouriteTerms
|
||||||
@ -459,7 +462,7 @@ serveProfileR (uid, user@User{..}) = do
|
|||||||
, UserPrefersPostal =. stgPrefersPostal
|
, UserPrefersPostal =. stgPrefersPostal
|
||||||
, UserExamOfficeGetSynced =. (stgExamOfficeSettings & eosettingsGetSynced)
|
, UserExamOfficeGetSynced =. (stgExamOfficeSettings & eosettingsGetSynced)
|
||||||
, UserExamOfficeGetLabels =. (stgExamOfficeSettings & eosettingsGetLabels)
|
, UserExamOfficeGetLabels =. (stgExamOfficeSettings & eosettingsGetLabels)
|
||||||
] ++ [ UserDisplayEmail =. stgDisplayEmail | userDisplayEmail == stgDisplayEmail ]
|
]
|
||||||
updateFavourites Nothing
|
updateFavourites Nothing
|
||||||
when (stgDisplayEmail /= userDisplayEmail) $ do
|
when (stgDisplayEmail /= userDisplayEmail) $ do
|
||||||
queueDBJob $ JobChangeUserDisplayEmail uid stgDisplayEmail
|
queueDBJob $ JobChangeUserDisplayEmail uid stgDisplayEmail
|
||||||
|
|||||||
@ -443,7 +443,9 @@ upsertAvsUserById api = do
|
|||||||
oldCards <- selectList [UserAvsCardPersonId ==. api] []
|
oldCards <- selectList [UserAvsCardPersonId ==. api] []
|
||||||
let oldAddrs = Set.fromList $ mapMaybe (maybeCompanyAddress . userAvsCardCard . entityVal) oldCards
|
let oldAddrs = Set.fromList $ mapMaybe (maybeCompanyAddress . userAvsCardCard . entityVal) oldCards
|
||||||
unless (maybe True (`Set.member` oldAddrs) mbCoFirmAddr) $ do -- update postal address, unless the exact address had been seen before
|
unless (maybe True (`Set.member` oldAddrs) mbCoFirmAddr) $ do -- update postal address, unless the exact address had been seen before
|
||||||
updateWhere [UserId ==. uid] [UserPostAddress =. userFirmAddr]
|
encRecipient :: CryptoUUIDUser <- encrypt uid
|
||||||
|
$logInfoS "AVS" $ "Postal address updated for" <> tshow encRecipient
|
||||||
|
updateWhere [UserId ==. uid] [UserPostAddress =. userFirmAddr, UserPostLastUpdate =. Just now]
|
||||||
whenIsJust pinCard $ \pCard -> -- update pin, but only if it was unset or set to the value of an old card
|
whenIsJust pinCard $ \pCard -> -- update pin, but only if it was unset or set to the value of an old card
|
||||||
unlessM (exists [UserAvsCardCardNo ==. getFullCardNo pCard]) $ do
|
unlessM (exists [UserAvsCardCardNo ==. getFullCardNo pCard]) $ do
|
||||||
let oldPins = Just . personCard2pin . userAvsCardCard . entityVal <$> oldCards
|
let oldPins = Just . personCard2pin . userAvsCardCard . entityVal <$> oldCards
|
||||||
|
|||||||
@ -92,6 +92,7 @@ addNewUser AddUserData{..} = do
|
|||||||
, userCompanyPersonalNumber = audFPersonalNumber
|
, userCompanyPersonalNumber = audFPersonalNumber
|
||||||
, userCompanyDepartment = audFDepartment
|
, userCompanyDepartment = audFDepartment
|
||||||
, userPostAddress = audPostAddress
|
, userPostAddress = audPostAddress
|
||||||
|
, userPostLastUpdate = Nothing
|
||||||
, userPrefersPostal = audPrefersPostal
|
, userPrefersPostal = audPrefersPostal
|
||||||
, userPinPassword = audPinPassword
|
, userPinPassword = audPinPassword
|
||||||
, userMatrikelnummer = audMatriculation
|
, userMatrikelnummer = audMatriculation
|
||||||
|
|||||||
@ -48,6 +48,11 @@ $# SPDX-License-Identifier: AGPL-3.0-or-later
|
|||||||
_{MsgAdminUserPostAddress}
|
_{MsgAdminUserPostAddress}
|
||||||
<dd .deflist__dd>
|
<dd .deflist__dd>
|
||||||
#{addr}
|
#{addr}
|
||||||
|
$maybe postUpdate <- userPostLastUpdate
|
||||||
|
<dt .deflist__dt>
|
||||||
|
_{MsgUserPostLastUpdate}
|
||||||
|
<dd .deflist__dd>
|
||||||
|
^{formatTimeW SelFormatDateTime postUpdate}
|
||||||
<dt .deflist__dt>
|
<dt .deflist__dt>
|
||||||
_{MsgTableEmail}
|
_{MsgTableEmail}
|
||||||
<dd .deflist__dd>
|
<dd .deflist__dd>
|
||||||
|
|||||||
@ -105,6 +105,7 @@ fillDb = do
|
|||||||
, userCompanyDepartment = Nothing
|
, userCompanyDepartment = Nothing
|
||||||
, userPinPassword = Nothing
|
, userPinPassword = Nothing
|
||||||
, userPostAddress = Nothing
|
, userPostAddress = Nothing
|
||||||
|
, userPostLastUpdate = Nothing
|
||||||
, userPrefersPostal = False
|
, userPrefersPostal = False
|
||||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||||
@ -144,6 +145,7 @@ fillDb = do
|
|||||||
, userCompanyDepartment = Nothing
|
, userCompanyDepartment = Nothing
|
||||||
, userPinPassword = Nothing
|
, userPinPassword = Nothing
|
||||||
, userPostAddress = Nothing
|
, userPostAddress = Nothing
|
||||||
|
, userPostLastUpdate = Nothing
|
||||||
, userPrefersPostal = False
|
, userPrefersPostal = False
|
||||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||||
@ -189,6 +191,7 @@ fillDb = do
|
|||||||
, userCompanyDepartment = Just "AVN-AR2"
|
, userCompanyDepartment = Just "AVN-AR2"
|
||||||
, userPinPassword = Nothing
|
, userPinPassword = Nothing
|
||||||
, userPostAddress = Nothing
|
, userPostAddress = Nothing
|
||||||
|
, userPostLastUpdate = Nothing
|
||||||
, userPrefersPostal = True
|
, userPrefersPostal = True
|
||||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||||
@ -228,6 +231,7 @@ fillDb = do
|
|||||||
, userCompanyDepartment = Nothing
|
, userCompanyDepartment = Nothing
|
||||||
, userPinPassword = Nothing
|
, userPinPassword = Nothing
|
||||||
, userPostAddress = Nothing
|
, userPostAddress = Nothing
|
||||||
|
, userPostLastUpdate = Nothing
|
||||||
, userPrefersPostal = False
|
, userPrefersPostal = False
|
||||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||||
@ -267,6 +271,7 @@ fillDb = do
|
|||||||
, userCompanyDepartment = Nothing
|
, userCompanyDepartment = Nothing
|
||||||
, userPinPassword = Nothing
|
, userPinPassword = Nothing
|
||||||
, userPostAddress = Nothing
|
, userPostAddress = Nothing
|
||||||
|
, userPostLastUpdate = Nothing
|
||||||
, userPrefersPostal = False
|
, userPrefersPostal = False
|
||||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||||
@ -306,6 +311,7 @@ fillDb = do
|
|||||||
, userCompanyDepartment = Nothing
|
, userCompanyDepartment = Nothing
|
||||||
, userPinPassword = Nothing
|
, userPinPassword = Nothing
|
||||||
, userPostAddress = Nothing
|
, userPostAddress = Nothing
|
||||||
|
, userPostLastUpdate = Nothing
|
||||||
, userPrefersPostal = False
|
, userPrefersPostal = False
|
||||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||||
@ -345,6 +351,7 @@ fillDb = do
|
|||||||
, userCompanyDepartment = Nothing
|
, userCompanyDepartment = Nothing
|
||||||
, userPinPassword = Nothing
|
, userPinPassword = Nothing
|
||||||
, userPostAddress = Nothing
|
, userPostAddress = Nothing
|
||||||
|
, userPostLastUpdate = Nothing
|
||||||
, userPrefersPostal = False
|
, userPrefersPostal = False
|
||||||
, userExamOfficeGetSynced = False
|
, userExamOfficeGetSynced = False
|
||||||
, userExamOfficeGetLabels = True
|
, userExamOfficeGetLabels = True
|
||||||
@ -414,6 +421,7 @@ fillDb = do
|
|||||||
, userCompanyDepartment = Nothing
|
, userCompanyDepartment = Nothing
|
||||||
, userPinPassword = Nothing
|
, userPinPassword = Nothing
|
||||||
, userPostAddress = Nothing
|
, userPostAddress = Nothing
|
||||||
|
, userPostLastUpdate = Nothing
|
||||||
, userPrefersPostal = False
|
, userPrefersPostal = False
|
||||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user