Catch empty attributes in completeCollaborators
This commit is contained in:
parent
3f413a885f
commit
4c67ac5986
@ -261,26 +261,34 @@ export default class CollaboratorService extends AbstractService {
|
||||
|
||||
if (process.processData.office) {
|
||||
const office: any = (await OfficeService.getOfficeByUid(process.processData.office.uid)).processData;
|
||||
process.processData.office = {
|
||||
uid: office.uid,
|
||||
idNot: office.idNot,
|
||||
crpcen: office.crpcen,
|
||||
name: office.name,
|
||||
office_status: office.office_status
|
||||
};
|
||||
if (office) {
|
||||
process.processData.office = {
|
||||
uid: office.uid,
|
||||
idNot: office.idNot,
|
||||
crpcen: office.crpcen,
|
||||
name: office.name,
|
||||
office_status: office.office_status
|
||||
};
|
||||
|
||||
if (progressCallback) {
|
||||
progressiveProcess.processData.office = process.processData.office;
|
||||
progressCallback(JSON.parse(JSON.stringify(progressiveProcess)));
|
||||
if (progressCallback) {
|
||||
progressiveProcess.processData.office = process.processData.office;
|
||||
progressCallback(JSON.parse(JSON.stringify(progressiveProcess)));
|
||||
}
|
||||
} else {
|
||||
console.error('Office not found');
|
||||
}
|
||||
}
|
||||
|
||||
if (process.processData.role) {
|
||||
const role: any = (await RoleService.getRoleByUid(process.processData.role.uid)).processData;
|
||||
process.processData.role = {
|
||||
uid: role.uid,
|
||||
name: role.name
|
||||
};
|
||||
if (!role) {
|
||||
console.error('Role not found');
|
||||
} else {
|
||||
process.processData.role = {
|
||||
uid: role.uid,
|
||||
name: role.name
|
||||
};
|
||||
}
|
||||
|
||||
if (progressCallback) {
|
||||
progressiveProcess.processData.role = process.processData.role;
|
||||
@ -290,16 +298,20 @@ export default class CollaboratorService extends AbstractService {
|
||||
|
||||
if (process.processData.office_role) {
|
||||
const officeRole: any = (await OfficeRoleService.getOfficeRoleByUid(process.processData.office_role.uid)).processData;
|
||||
process.processData.office_role = {
|
||||
uid: officeRole.uid,
|
||||
name: officeRole.name,
|
||||
rules: officeRole.rules?.map((rule: any) => {
|
||||
return {
|
||||
uid: rule.uid,
|
||||
name: rule.name
|
||||
};
|
||||
})
|
||||
};
|
||||
if (!officeRole) {
|
||||
console.error('Office role not found');
|
||||
} else {
|
||||
process.processData.office_role = {
|
||||
uid: officeRole.uid,
|
||||
name: officeRole.name,
|
||||
rules: officeRole.rules?.map((rule: any) => {
|
||||
return {
|
||||
uid: rule.uid,
|
||||
name: rule.name
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
if (progressCallback) {
|
||||
progressiveProcess.processData.office_role = process.processData.office_role;
|
||||
|
Loading…
x
Reference in New Issue
Block a user