เก็บประวัติ

This commit is contained in:
mamoss 2025-09-03 23:50:45 +07:00
parent a1c8874925
commit 16622b4768
4 changed files with 28 additions and 12 deletions

View file

@ -2024,7 +2024,7 @@ export class EmployeeTempPositionController extends Controller {
await new permission().PermissionDelete(request, "SYS_ORG_TEMP");
const dataMaster = await this.employeeTempPosMasterRepository.findOne({
where: { id: id },
relations: ["positions"],
relations: ["positions", "orgRevision"],
});
if (!dataMaster) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่งนี้");
@ -2057,6 +2057,9 @@ export class EmployeeTempPositionController extends Controller {
positionIsSelected: false,
});
});
if (dataMaster.orgRevision.orgRevisionIsCurrent) {
await CreatePosMasterHistoryEmployeeTemp(dataMaster.id, request);
}
return new HttpSuccess();
}
@ -2187,7 +2190,6 @@ export class EmployeeTempPositionController extends Controller {
await CreatePosMasterHistoryEmployeeTemp(posMasterOld.id, request);
}
await this.employeeTempPosMasterRepository.save(posMaster);
await CreatePosMasterHistoryEmployeeTemp(posMaster.id, request);
const positionNew = await this.employeePositionRepository.findOne({
where: {
@ -2208,6 +2210,7 @@ export class EmployeeTempPositionController extends Controller {
await this.profileRepository.save(profile);
await this.employeePositionRepository.save(positionNew);
}
await CreatePosMasterHistoryEmployeeTemp(posMaster.id, request);
return new HttpSuccess();
}