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.
|
||||
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!
|
||||
UserPostLastUpdate: Postadresse zuletzt geändert
|
||||
|
||||
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.
|
||||
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!
|
||||
UserPostLastUpdate: Last postal address change
|
||||
|
||||
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
|
||||
pinPassword Text Maybe -- used to encrypt pins within emails
|
||||
postAddress StoredMarkup Maybe
|
||||
postLastUpdate UTCTime Maybe -- record postal address updates
|
||||
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
|
||||
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
|
||||
, 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
|
||||
, userPostLastUpdate = Nothing
|
||||
, userPinPassword = Nothing -- must be derived via AVS
|
||||
, userPrefersPostal = userDefaultPrefersPostal
|
||||
, ..
|
||||
|
||||
@ -112,6 +112,7 @@ fakeQualificationUsers (Entity qid Qualification{qualificationRefreshWithin}) (u
|
||||
userCompanyPersonalNumber = Nothing
|
||||
userCompanyDepartment = Nothing
|
||||
userPostAddress = postalAddress
|
||||
userPostLastUpdate = Nothing
|
||||
userPinPassword = Just "tomatenmarmelade"
|
||||
in User{..}
|
||||
|
||||
|
||||
@ -441,8 +441,11 @@ serveProfileR (uid, user@User{..}) = do
|
||||
((res,formWidget), formEnctype) <- runFormPost . validateForm (validateSettings user) . identifyForm ProfileSettings $ makeSettingForm settingsTemplate
|
||||
|
||||
formResult res $ \SettingsForm{..} -> do
|
||||
now <- liftIO getCurrentTime
|
||||
runDBJobs $ do
|
||||
update uid $
|
||||
[ UserDisplayEmail =. stgDisplayEmail | userDisplayEmail == stgDisplayEmail ] ++ -- SJ asks: what does this line achieve?
|
||||
[ UserPostLastUpdate =. Just now | userPostAddress /= stgPostAddress ] ++
|
||||
[ UserDisplayName =. stgDisplayName
|
||||
, UserMaxFavourites =. stgMaxFavourites
|
||||
, UserMaxFavouriteTerms =. stgMaxFavouriteTerms
|
||||
@ -459,7 +462,7 @@ serveProfileR (uid, user@User{..}) = do
|
||||
, UserPrefersPostal =. stgPrefersPostal
|
||||
, UserExamOfficeGetSynced =. (stgExamOfficeSettings & eosettingsGetSynced)
|
||||
, UserExamOfficeGetLabels =. (stgExamOfficeSettings & eosettingsGetLabels)
|
||||
] ++ [ UserDisplayEmail =. stgDisplayEmail | userDisplayEmail == stgDisplayEmail ]
|
||||
]
|
||||
updateFavourites Nothing
|
||||
when (stgDisplayEmail /= userDisplayEmail) $ do
|
||||
queueDBJob $ JobChangeUserDisplayEmail uid stgDisplayEmail
|
||||
|
||||
@ -443,7 +443,9 @@ upsertAvsUserById api = do
|
||||
oldCards <- selectList [UserAvsCardPersonId ==. api] []
|
||||
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
|
||||
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
|
||||
unlessM (exists [UserAvsCardCardNo ==. getFullCardNo pCard]) $ do
|
||||
let oldPins = Just . personCard2pin . userAvsCardCard . entityVal <$> oldCards
|
||||
|
||||
@ -92,6 +92,7 @@ addNewUser AddUserData{..} = do
|
||||
, userCompanyPersonalNumber = audFPersonalNumber
|
||||
, userCompanyDepartment = audFDepartment
|
||||
, userPostAddress = audPostAddress
|
||||
, userPostLastUpdate = Nothing
|
||||
, userPrefersPostal = audPrefersPostal
|
||||
, userPinPassword = audPinPassword
|
||||
, userMatrikelnummer = audMatriculation
|
||||
|
||||
@ -48,6 +48,11 @@ $# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
_{MsgAdminUserPostAddress}
|
||||
<dd .deflist__dd>
|
||||
#{addr}
|
||||
$maybe postUpdate <- userPostLastUpdate
|
||||
<dt .deflist__dt>
|
||||
_{MsgUserPostLastUpdate}
|
||||
<dd .deflist__dd>
|
||||
^{formatTimeW SelFormatDateTime postUpdate}
|
||||
<dt .deflist__dt>
|
||||
_{MsgTableEmail}
|
||||
<dd .deflist__dd>
|
||||
|
||||
@ -105,6 +105,7 @@ fillDb = do
|
||||
, userCompanyDepartment = Nothing
|
||||
, userPinPassword = Nothing
|
||||
, userPostAddress = Nothing
|
||||
, userPostLastUpdate = Nothing
|
||||
, userPrefersPostal = False
|
||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||
@ -144,6 +145,7 @@ fillDb = do
|
||||
, userCompanyDepartment = Nothing
|
||||
, userPinPassword = Nothing
|
||||
, userPostAddress = Nothing
|
||||
, userPostLastUpdate = Nothing
|
||||
, userPrefersPostal = False
|
||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||
@ -189,6 +191,7 @@ fillDb = do
|
||||
, userCompanyDepartment = Just "AVN-AR2"
|
||||
, userPinPassword = Nothing
|
||||
, userPostAddress = Nothing
|
||||
, userPostLastUpdate = Nothing
|
||||
, userPrefersPostal = True
|
||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||
@ -228,6 +231,7 @@ fillDb = do
|
||||
, userCompanyDepartment = Nothing
|
||||
, userPinPassword = Nothing
|
||||
, userPostAddress = Nothing
|
||||
, userPostLastUpdate = Nothing
|
||||
, userPrefersPostal = False
|
||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||
@ -267,6 +271,7 @@ fillDb = do
|
||||
, userCompanyDepartment = Nothing
|
||||
, userPinPassword = Nothing
|
||||
, userPostAddress = Nothing
|
||||
, userPostLastUpdate = Nothing
|
||||
, userPrefersPostal = False
|
||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||
@ -306,6 +311,7 @@ fillDb = do
|
||||
, userCompanyDepartment = Nothing
|
||||
, userPinPassword = Nothing
|
||||
, userPostAddress = Nothing
|
||||
, userPostLastUpdate = Nothing
|
||||
, userPrefersPostal = False
|
||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||
@ -345,6 +351,7 @@ fillDb = do
|
||||
, userCompanyDepartment = Nothing
|
||||
, userPinPassword = Nothing
|
||||
, userPostAddress = Nothing
|
||||
, userPostLastUpdate = Nothing
|
||||
, userPrefersPostal = False
|
||||
, userExamOfficeGetSynced = False
|
||||
, userExamOfficeGetLabels = True
|
||||
@ -414,6 +421,7 @@ fillDb = do
|
||||
, userCompanyDepartment = Nothing
|
||||
, userPinPassword = Nothing
|
||||
, userPostAddress = Nothing
|
||||
, userPostLastUpdate = Nothing
|
||||
, userPrefersPostal = False
|
||||
, userExamOfficeGetSynced = userDefaultExamOfficeGetSynced
|
||||
, userExamOfficeGetLabels = userDefaultExamOfficeGetLabels
|
||||
|
||||
Loading…
Reference in New Issue
Block a user