diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 2347207e..16560b12 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -5628,7 +5628,7 @@ export class ProfileEmployeeController extends Controller { orgChild3: orgChild3Ref?.orgChild3Name, orgChild4: orgChild4Ref?.orgChild4Name, commandYear: new Date().getFullYear() + 543, - commandDateSign: new Date(), + // commandDateSign: new Date(), commandDateAffect: new Date(), commandCode: "16", commandName: "พ้นจากราชการ", @@ -5641,6 +5641,7 @@ export class ProfileEmployeeController extends Controller { lastUpdateFullName: request.user.name, createdAt: new Date(), lastUpdatedAt: new Date(), + remark: "ถึงแก่กรรม", }; delete data.id; @@ -5655,12 +5656,9 @@ export class ProfileEmployeeController extends Controller { profile.isLeave = requestBody.isLeave; profile.leaveReason = requestBody.leaveReason; profile.dateLeave = requestBody.dateLeave; - if (requestBody.isLeave == true) { - await removeProfileInOrganize(profile.id, "EMPLOYEE"); - } - profile.position = _null; - profile.posLevelId = _null; - profile.posTypeId = _null; + // profile.position = _null; + // profile.posLevelId = _null; + // profile.posTypeId = _null; if (profile.keycloak != null) { const delUserKeycloak = await deleteUser(profile.keycloak); if (delUserKeycloak) { @@ -5669,10 +5667,11 @@ export class ProfileEmployeeController extends Controller { profile.isActive = false; } } - profile.leaveType = "RETIRE_DECEASED"; await this.profileRepo.save(profile); - + if (requestBody.isLeave == true) { + await removeProfileInOrganize(profile.id, "EMPLOYEE"); + } return new HttpSuccess(); } diff --git a/src/controllers/ProfileEmployeeTempController.ts b/src/controllers/ProfileEmployeeTempController.ts index 78a7e665..af81df62 100644 --- a/src/controllers/ProfileEmployeeTempController.ts +++ b/src/controllers/ProfileEmployeeTempController.ts @@ -3317,7 +3317,7 @@ export class ProfileEmployeeTempController extends Controller { orgChild3: orgChild3Ref?.orgChild3Name, orgChild4: orgChild4Ref?.orgChild4Name, commandYear: new Date().getFullYear() + 543, - commandDateSign: new Date(), + // commandDateSign: new Date(), commandDateAffect: new Date(), commandCode: "16", commandName: "พ้นจากราชการ", @@ -3330,6 +3330,7 @@ export class ProfileEmployeeTempController extends Controller { lastUpdateFullName: request.user.name, createdAt: new Date(), lastUpdatedAt: new Date(), + remark: "ถึงแก่กรรม", }; delete data.id; @@ -3344,14 +3345,10 @@ export class ProfileEmployeeTempController extends Controller { profile.isLeave = requestBody.isLeave; profile.leaveReason = requestBody.leaveReason; profile.dateLeave = requestBody.dateLeave; - if (requestBody.isLeave == true) { - await removeProfileInOrganize(profile.id, "EMPLOYEE"); - } - profile.leaveType = "RETIRE_DECEASED"; - profile.position = _null; - profile.posLevelId = _null; - profile.posTypeId = _null; + // profile.position = _null; + // profile.posLevelId = _null; + // profile.posTypeId = _null; if (profile.keycloak != null) { const delUserKeycloak = await deleteUser(profile.keycloak); if (delUserKeycloak) { @@ -3361,7 +3358,9 @@ export class ProfileEmployeeTempController extends Controller { } } await this.profileRepo.save(profile); - + if (requestBody.isLeave == true) { + await removeProfileInOrganize(profile.id, "EMPLOYEE"); + } return new HttpSuccess(); }