This commit is contained in:
parent
b000e8b531
commit
7a6cf119bd
3 changed files with 12 additions and 9 deletions
|
|
@ -4565,7 +4565,7 @@ export class CommandController extends Controller {
|
||||||
orgChild3Ref = curPosMaster?.orgChild3 ?? null;
|
orgChild3Ref = curPosMaster?.orgChild3 ?? null;
|
||||||
orgChild4Ref = curPosMaster?.orgChild4 ?? null;
|
orgChild4Ref = curPosMaster?.orgChild4 ?? null;
|
||||||
if (curPosMaster) {
|
if (curPosMaster) {
|
||||||
await CreatePosMasterHistoryEmployee(curPosMaster.id, req);
|
await CreatePosMasterHistoryEmployee(curPosMaster.id, req, "DELETE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -5792,7 +5792,7 @@ export class CommandController extends Controller {
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (curPosMaster) {
|
if (curPosMaster) {
|
||||||
await CreatePosMasterHistoryEmployee(curPosMaster.id, req);
|
await CreatePosMasterHistoryEmployee(curPosMaster.id, req, "DELETE");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
||||||
|
|
|
||||||
|
|
@ -5784,7 +5784,7 @@ export class ProfileEmployeeController extends Controller {
|
||||||
await this.profileRepo.save(profile);
|
await this.profileRepo.save(profile);
|
||||||
if (requestBody.isLeave == true) {
|
if (requestBody.isLeave == true) {
|
||||||
if (orgRevisionRef) {
|
if (orgRevisionRef) {
|
||||||
await CreatePosMasterHistoryEmployee(orgRevisionRef.id, request);
|
await CreatePosMasterHistoryEmployee(orgRevisionRef.id, request, "DELETE");
|
||||||
}
|
}
|
||||||
await removeProfileInOrganize(profile.id, "EMPLOYEE");
|
await removeProfileInOrganize(profile.id, "EMPLOYEE");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -137,6 +137,7 @@ export async function CreatePosMasterHistoryOfficer(
|
||||||
export async function CreatePosMasterHistoryEmployee(
|
export async function CreatePosMasterHistoryEmployee(
|
||||||
posMasterId: string,
|
posMasterId: string,
|
||||||
request: RequestWithUser | null,
|
request: RequestWithUser | null,
|
||||||
|
type?: string | null,
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
try {
|
try {
|
||||||
await AppDataSource.transaction(async (manager) => {
|
await AppDataSource.transaction(async (manager) => {
|
||||||
|
|
@ -167,15 +168,17 @@ export async function CreatePosMasterHistoryEmployee(
|
||||||
? pm.positions.find((p) => p.positionIsSelected === true) ?? null
|
? pm.positions.find((p) => p.positionIsSelected === true) ?? null
|
||||||
: null;
|
: null;
|
||||||
h.ancestorDNA = pm.ancestorDNA;
|
h.ancestorDNA = pm.ancestorDNA;
|
||||||
h.prefix = pm.current_holder?.prefix || _null;
|
if (!type || type != "DELETE") {
|
||||||
h.firstName = pm.current_holder?.firstName || _null;
|
h.prefix = pm.current_holder?.prefix || _null;
|
||||||
h.lastName = pm.current_holder?.lastName || _null;
|
h.firstName = pm.current_holder?.firstName || _null;
|
||||||
|
h.lastName = pm.current_holder?.lastName || _null;
|
||||||
|
h.position = selectedPosition?.positionName ?? _null;
|
||||||
|
h.posType = selectedPosition?.posType?.posTypeName ?? _null;
|
||||||
|
h.posLevel = selectedPosition?.posLevel?.posLevelName ?? _null;
|
||||||
|
}
|
||||||
h.posMasterNoPrefix = pm.posMasterNoPrefix ?? _null;
|
h.posMasterNoPrefix = pm.posMasterNoPrefix ?? _null;
|
||||||
h.posMasterNo = pm.posMasterNo ?? _null;
|
h.posMasterNo = pm.posMasterNo ?? _null;
|
||||||
h.posMasterNoSuffix = pm.posMasterNoSuffix ?? _null;
|
h.posMasterNoSuffix = pm.posMasterNoSuffix ?? _null;
|
||||||
h.position = selectedPosition?.positionName ?? _null;
|
|
||||||
h.posType = selectedPosition?.posType?.posTypeName ?? _null;
|
|
||||||
h.posLevel = selectedPosition?.posLevel?.posLevelName ?? _null;
|
|
||||||
h.shortName =
|
h.shortName =
|
||||||
[
|
[
|
||||||
pm.orgChild4?.orgChild4ShortName,
|
pm.orgChild4?.orgChild4ShortName,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue