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
|
||||
Plain -> tPlain
|
||||
|
||||
paperKind :: LetterKind -> Text
|
||||
paperKind Din5008 = "a4logo"
|
||||
paperKind PinLetter = "a4pin" -- "a4pinp"
|
||||
paperKind Plain = "a4plain" -- "a4emty"
|
||||
paperKind PlainLogo = "a4logo"
|
||||
paperKind :: LetterKind -> Text -- Muss genau 5 Zeichen haben!
|
||||
paperKind PinLetter = "a4pin" -- Pin-Brief
|
||||
paperKind Plain = "a4wht" -- Ohne Logo
|
||||
paperKind Din5008 = "a4log" -- Mit Logo
|
||||
paperKind PlainLogo = "a4log"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@ -160,7 +162,7 @@ paperKind PlainLogo = "a4logo"
|
||||
---------------
|
||||
|
||||
apcIdentSeparator :: Text
|
||||
apcIdentSeparator = "___"
|
||||
apcIdentSeparator = Text.take 3 "___" -- must always have length 3
|
||||
|
||||
data PrintJobIdentification = PrintJobIdentification
|
||||
{ pjiName :: Text
|
||||
@ -173,17 +175,22 @@ data PrintJobIdentification = PrintJobIdentification
|
||||
}
|
||||
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
|
||||
-- Note that all letters to the same UUID within 24h are collated in one envelope
|
||||
-- | 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
|
||||
-- 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 uuid envelope lk tnow apcAck = Text.filter apcAcceptedChars $ Text.intercalate apcIdentSeparator
|
||||
[ tshow (ciphertext uuid) <> Text.cons '-' (Text.singleton envelope)
|
||||
, paperKind lk
|
||||
, tnow
|
||||
, apcAck
|
||||
mkApcIdent uuid envelope lk tnow apcAck = Text.filter apcAcceptedChars $ Text.intercalate apcIdentSeparator
|
||||
[ ensureLength 38 $ tshow (ciphertext uuid) <> Text.cons '-' (Text.singleton envelope)
|
||||
, ensureLength 5 $ paperKind lk
|
||||
, ensureLength 9 tnow
|
||||
, apcAck -- length may be arbitrary, thus far was always 12
|
||||
]
|
||||
|
||||
-- | Character allowed to be included in the APC identifier string printed in white in the header of all printed letters
|
||||
where
|
||||
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 '-' = True
|
||||
apcAcceptedChars '_' = True
|
||||
|
||||
Loading…
Reference in New Issue
Block a user