This commit is contained in:
parent
09fd606b86
commit
cf3ef00b7f
2 changed files with 28 additions and 4 deletions
|
|
@ -4543,9 +4543,7 @@ export class CommandController extends Controller {
|
|||
profile.lastUpdateUserId = req.user.sub;
|
||||
profile.lastUpdateFullName = req.user.name;
|
||||
profile.lastUpdatedAt = new Date();
|
||||
if (item.isLeave == true) {
|
||||
await removeProfileInOrganize(profile.id, "EMPLOYEE");
|
||||
}
|
||||
// บันทึกประวัติก่อนลบตำแหน่ง
|
||||
const clearProfile = await checkCommandType(String(item.commandId));
|
||||
const curRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
||||
|
|
@ -4574,6 +4572,14 @@ export class CommandController extends Controller {
|
|||
orgChild2Ref = curPosMaster?.orgChild2 ?? null;
|
||||
orgChild3Ref = curPosMaster?.orgChild3 ?? null;
|
||||
orgChild4Ref = curPosMaster?.orgChild4 ?? null;
|
||||
if (curPosMaster) {
|
||||
await CreatePosMasterHistoryEmployee(curPosMaster.id, req);
|
||||
}
|
||||
}
|
||||
|
||||
// ลบตำแหน่ง
|
||||
if (item.isLeave == true) {
|
||||
await removeProfileInOrganize(profile.id, "EMPLOYEE");
|
||||
}
|
||||
|
||||
if (clearProfile.status) {
|
||||
|
|
@ -5817,6 +5823,21 @@ export class CommandController extends Controller {
|
|||
_profile.leaveDate = item.commandDateAffect ?? _null;
|
||||
_profile.leaveType = exceptClear.LeaveType ?? _null;
|
||||
} else {
|
||||
// บันทึกประวัติก่อนลบตำแหน่ง
|
||||
const curRevision = await this.orgRevisionRepo.findOne({
|
||||
where: { orgRevisionIsCurrent: true, orgRevisionIsDraft: false },
|
||||
});
|
||||
if (curRevision) {
|
||||
const curPosMaster = await this.employeePosMasterRepository.findOne({
|
||||
where: {
|
||||
current_holderId: _profile.id,
|
||||
orgRevisionId: curRevision.id,
|
||||
},
|
||||
});
|
||||
if (curPosMaster) {
|
||||
await CreatePosMasterHistoryEmployee(curPosMaster.id, req);
|
||||
}
|
||||
}
|
||||
await removeProfileInOrganize(_profile.id, "EMPLOYEE");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue