chore(apc): ensure apc ident format after discussion with Massente
This commit is contained in:
parent
326ca71875
commit
dd137da665
@ -144,11 +144,13 @@ templateLatex =
|
|||||||
PlainLogo -> tPlain
|
PlainLogo -> tPlain
|
||||||
Plain -> tPlain
|
Plain -> tPlain
|
||||||
|
|
||||||
paperKind :: LetterKind -> Text
|
paperKind :: LetterKind -> Text -- Muss genau 5 Zeichen haben!
|
||||||
paperKind Din5008 = "a4logo"
|
paperKind PinLetter = "a4pin" -- Pin-Brief
|
||||||
paperKind PinLetter = "a4pin" -- "a4pinp"
|
paperKind Plain = "a4wht" -- Ohne Logo
|
||||||
paperKind Plain = "a4plain" -- "a4emty"
|
paperKind Din5008 = "a4log" -- Mit Logo
|
||||||
paperKind PlainLogo = "a4logo"
|
paperKind PlainLogo = "a4log"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -160,7 +162,7 @@ paperKind PlainLogo = "a4logo"
|
|||||||
---------------
|
---------------
|
||||||
|
|
||||||
apcIdentSeparator :: Text
|
apcIdentSeparator :: Text
|
||||||
apcIdentSeparator = "___"
|
apcIdentSeparator = Text.take 3 "___" -- must always have length 3
|
||||||
|
|
||||||
data PrintJobIdentification = PrintJobIdentification
|
data PrintJobIdentification = PrintJobIdentification
|
||||||
{ pjiName :: Text
|
{ pjiName :: Text
|
||||||
@ -173,17 +175,22 @@ data PrintJobIdentification = PrintJobIdentification
|
|||||||
}
|
}
|
||||||
deriving (Eq, Show)
|
deriving (Eq, Show)
|
||||||
|
|
||||||
-- | create an identifier for printing with apc; which must always be place in the same position for all letters, printed in white on white
|
-- | create an identifier for printing with apc; which must always be place with the same length; exept for the last part which may be of variable length
|
||||||
-- Note that all letters to the same UUID within 24h are collated in one envelope
|
-- this is printed in white on white at the exact same position on the page
|
||||||
|
-- Note: that all letters to the same UUID within 24h are collated in one envelope
|
||||||
|
-- Example: 9ad8de3f-0a7e-ede5-bd8b-6d0ed85c1049-f___a4pin___230322-10___lms-stuvwxyz
|
||||||
mkApcIdent :: CryptoUUIDUser -> Char -> LetterKind -> Text -> Text -> Text
|
mkApcIdent :: CryptoUUIDUser -> Char -> LetterKind -> Text -> Text -> Text
|
||||||
mkApcIdent uuid envelope lk tnow apcAck = Text.filter apcAcceptedChars $ Text.intercalate apcIdentSeparator
|
mkApcIdent uuid envelope lk tnow apcAck = Text.filter apcAcceptedChars $ Text.intercalate apcIdentSeparator
|
||||||
[ tshow (ciphertext uuid) <> Text.cons '-' (Text.singleton envelope)
|
[ ensureLength 38 $ tshow (ciphertext uuid) <> Text.cons '-' (Text.singleton envelope)
|
||||||
, paperKind lk
|
, ensureLength 5 $ paperKind lk
|
||||||
, tnow
|
, ensureLength 9 tnow
|
||||||
, apcAck
|
, apcAck -- length may be arbitrary, thus far was always 12
|
||||||
]
|
]
|
||||||
|
where
|
||||||
-- | Character allowed to be included in the APC identifier string printed in white in the header of all printed letters
|
ensureLength :: Int -> Text -> Text
|
||||||
|
ensureLength n = Text.take n . Text.justifyLeft n 'x'
|
||||||
|
|
||||||
|
-- | Character allowed to be included in the APC identifier string printed in white in the header of all printed letters, must not contain ',' nor ';'
|
||||||
apcAcceptedChars :: Char -> Bool
|
apcAcceptedChars :: Char -> Bool
|
||||||
apcAcceptedChars '-' = True
|
apcAcceptedChars '-' = True
|
||||||
apcAcceptedChars '_' = True
|
apcAcceptedChars '_' = True
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user