27 lines
987 B
TypeScript
27 lines
987 B
TypeScript
/**
|
|
* Une facture hors abonnement doit être validée BAP avant l'export de son PDF
|
|
* d'origine. Les abonnements ne suivent pas le circuit BAP.
|
|
*/
|
|
export function requiresBapBeforeOriginalPdfExport(input: {
|
|
isSubscription?: number | boolean | null;
|
|
bapValidated?: number | boolean | null;
|
|
}): boolean {
|
|
const isSubscription = input.isSubscription === 1 || input.isSubscription === true;
|
|
const isBapValidated = input.bapValidated === 1 || input.bapValidated === true;
|
|
|
|
return !isSubscription && !isBapValidated;
|
|
}
|
|
|
|
/**
|
|
* Signale un export historique réalisé avant la validation BAP. Ce cas est
|
|
* conservé pour l'audit, mais l'interface doit rendre la régularisation BAP
|
|
* possible et explicite.
|
|
*/
|
|
export function wasExportedBeforeBap(input: {
|
|
exportStatus?: string | null;
|
|
isSubscription?: number | boolean | null;
|
|
bapValidated?: number | boolean | null;
|
|
}): boolean {
|
|
return input.exportStatus === "exported" && requiresBapBeforeOriginalPdfExport(input);
|
|
}
|