diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index 36be10f1..6a6988b9 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -7418,7 +7418,8 @@ export class ProfileController extends Controller { posNo: null, privacyCheckin: profile.privacyCheckin, privacyUser: profile.privacyUser, - privacyMgt : profile.privacyMgt + privacyMgt : profile.privacyMgt, + isDeputy: root?.isDeputy ?? false, // root?.orgRootShortName && posMaster?.posMasterNo // ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}` // : "", @@ -7590,7 +7591,8 @@ export class ProfileController extends Controller { posNo: null, privacyCheckin: profile.privacyCheckin, privacyUser: profile.privacyUser, - privacyMgt : profile.privacyMgt + privacyMgt : profile.privacyMgt, + isDeputy: root?.isDeputy ?? false, // root?.orgRootShortName && posMaster?.posMasterNo // ? `${root?.orgRootShortName} ${posMaster?.posMasterNo}` // : "", diff --git a/src/controllers/WorkflowController.ts b/src/controllers/WorkflowController.ts index 44e3716e..12688f80 100644 --- a/src/controllers/WorkflowController.ts +++ b/src/controllers/WorkflowController.ts @@ -53,6 +53,7 @@ export class WorkflowController extends Controller { posLevelName: string; posTypeName: string; fullName?: string | null; + isDeputy?: boolean | null; }, ) { // ขั้นที่ 1: ทำการค้นหา profile และ metaWorkflow แบบ parallel @@ -144,7 +145,13 @@ export class WorkflowController extends Controller { metaStates.find((metaState) => metaState.id === metaStateOp.metaStateId)?.order === state.order, ); - + // Task #2207 กรณีคนขอโอนอยู่ในสำนักปลัดกรุงเทพมหานคร + if (body.isDeputy && metaStateOp.operator == "PersonnelOfficer" && correspondingState?.order == 1) { + return; + } + else if (body.isDeputy && metaStateOp.operator == "Officer" && [1, 2].includes(correspondingState?.order as number)) { + metaStateOp.operator = "PersonnelOfficer" + } if (correspondingState) { const stateOperator = new StateOperator(); Object.assign(stateOperator, {