hotfix#2476
All checks were successful
Build & Deploy on Dev / build (push) Successful in 1m1s

This commit is contained in:
Adisak 2026-05-08 12:13:36 +07:00
parent 34759d26a7
commit 09fd606b86

View file

@ -1475,6 +1475,9 @@ export class PositionController extends Controller {
if (posMaster.orgRevision?.orgRevisionIsCurrent == true && !posMaster.isSit) {
const _position = requestBody.positions.find((p) => p.positionIsSelected == true);
if (_position) {
const _posExecutive = _position.posExecutiveId
? await this.posExecutiveRepository.findOne({ where: { id: _position.posExecutiveId } })
: null;
const current_holderId: any = posMaster.current_holderId;
const _profile = await this.profileRepository.findOne({
where: { id: current_holderId },
@ -1484,7 +1487,7 @@ export class PositionController extends Controller {
_profile.posTypeId = _position.posTypeId;
_profile.posLevelId = _position.posLevelId;
_profile.positionField = _position.posDictField ?? _null;
_profile.posExecutive = _position.posExecutiveId ?? _null;
_profile.posExecutive = _posExecutive?.posExecutiveName ?? _null;
_profile.positionArea = _position.posDictArea ?? _null;
_profile.positionExecutiveField = _position.posDictExecutiveField ?? _null;
await this.profileRepository.save(_profile);
@ -2418,7 +2421,7 @@ export class PositionController extends Controller {
? _data.child1[0] != null
? "posMaster.orgChild1Id IN (:...child1)"
: // : `posMaster.orgChild1Id is ${_data.privilege == "PARENT" ? "not null" : "null"}`
`posMaster.orgChild1Id is null`
`posMaster.orgChild1Id is null`
: "1=1",
{ child1: _data.child1 },
)
@ -2980,50 +2983,50 @@ export class PositionController extends Controller {
const type0LastPosMasterNo =
requestBody.type == 0
? await this.posMasterRepository.find({
where: {
orgRootId: requestBody.id,
orgChild1Id: IsNull(),
},
})
where: {
orgRootId: requestBody.id,
orgChild1Id: IsNull(),
},
})
: [];
const type1LastPosMasterNo =
requestBody.type == 1
? await this.posMasterRepository.find({
where: {
orgChild1Id: requestBody.id,
orgChild2Id: IsNull(),
},
})
where: {
orgChild1Id: requestBody.id,
orgChild2Id: IsNull(),
},
})
: [];
const type2LastPosMasterNo =
requestBody.type == 2
? await this.posMasterRepository.find({
where: {
orgChild2Id: requestBody.id,
orgChild3Id: IsNull(),
},
})
where: {
orgChild2Id: requestBody.id,
orgChild3Id: IsNull(),
},
})
: [];
const type3LastPosMasterNo =
requestBody.type == 3
? await this.posMasterRepository.find({
where: {
orgChild3Id: requestBody.id,
orgChild4Id: IsNull(),
},
})
where: {
orgChild3Id: requestBody.id,
orgChild4Id: IsNull(),
},
})
: [];
const type4LastPosMasterNo =
requestBody.type == 4
? await this.posMasterRepository.find({
where: {
orgChild4Id: requestBody.id,
},
})
where: {
orgChild4Id: requestBody.id,
},
})
: [];
const allLastPosMasterNo = [