[FE][Certs] Fixes #16: Reject cert generation if a custom label is missing
This commit is contained in:
parent
a97690c518
commit
1feeb70af8
@ -177,9 +177,17 @@ export function generateCert(person: Person, register: Register, coursesMap: {[c
|
||||
const personFullName = `${person.person_names} ${person.person_paternal_surname} ${person.person_maternal_surname}`;
|
||||
|
||||
// Manage custom label
|
||||
const certCustomLabel = register.register_custom_label === 1
|
||||
? ""
|
||||
: customLabelsMap()[register.register_custom_label]?.custom_label_value ?? "";
|
||||
let certCustomLabel = "";
|
||||
if (register.register_custom_label === 1) {
|
||||
certCustomLabel = "";
|
||||
} else {
|
||||
const customLabel = customLabelsMap()[register.register_custom_label];
|
||||
if (customLabel === undefined) {
|
||||
alert(`Error. No se encontró la denominación con id ${register.register_custom_label}`);
|
||||
return;
|
||||
}
|
||||
certCustomLabel = customLabel.custom_label_value;
|
||||
}
|
||||
|
||||
const certCode = register.register_is_preview ? "0000" : register.register_code.toString().padStart(4, "0");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user