update เมื่อลบคนครองต้องไม่ปั้มชื่อลงประวัติคนครอง
This commit is contained in:
parent
332a96efb3
commit
8888d2f27c
2 changed files with 9 additions and 4 deletions
|
|
@ -3696,7 +3696,7 @@ export class PositionController extends Controller {
|
|||
}
|
||||
|
||||
if (dataMaster.orgRevision.orgRevisionIsCurrent) {
|
||||
await CreatePosMasterHistoryOfficer(dataMaster.id, request);
|
||||
await CreatePosMasterHistoryOfficer(dataMaster.id, request, "DELETE");
|
||||
}
|
||||
|
||||
let _profileId: string = "";
|
||||
|
|
@ -3715,6 +3715,8 @@ export class PositionController extends Controller {
|
|||
positionIsSelected: false,
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// //เช็คถ้า revision ปัจจุบันให้ปั๊มที่ profile
|
||||
// const chkRevision = await this.orgRevisionRepository.findOne({
|
||||
// where: { id: dataMaster.orgRevisionId },
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import { RequestWithUser } from "../middlewares/user";
|
|||
export async function CreatePosMasterHistoryOfficer(
|
||||
posMasterId: string,
|
||||
request: RequestWithUser | null,
|
||||
type?: string | null,
|
||||
): Promise<boolean> {
|
||||
try {
|
||||
await AppDataSource.transaction(async (manager) => {
|
||||
|
|
@ -42,9 +43,11 @@ export async function CreatePosMasterHistoryOfficer(
|
|||
? pm.positions.find((p) => p.positionIsSelected === true) ?? null
|
||||
: null;
|
||||
h.ancestorDNA = pm.ancestorDNA ? pm.ancestorDNA : _null;
|
||||
h.prefix = pm.current_holder?.prefix || _null;
|
||||
h.firstName = pm.current_holder?.firstName || _null;
|
||||
h.lastName = pm.current_holder?.lastName || _null;
|
||||
if(!type || type != "DELETE"){
|
||||
h.prefix = pm.current_holder?.prefix || _null;
|
||||
h.firstName = pm.current_holder?.firstName || _null;
|
||||
h.lastName = pm.current_holder?.lastName || _null;
|
||||
}
|
||||
h.posMasterNoPrefix = pm.posMasterNoPrefix ?? _null;
|
||||
h.posMasterNo = pm.posMasterNo ?? _null;
|
||||
h.posMasterNoSuffix = pm.posMasterNoSuffix ?? _null;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue