Merge branch 'develop' of github.com:Frappet/bma-ehr-organization into develop

This commit is contained in:
kittapath 2024-09-18 19:18:26 +07:00
commit fbff094061

View file

@ -1117,13 +1117,7 @@ export class PositionController extends Controller {
let searchShortName3 = `CONCAT(orgChild3.orgChild3ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let searchShortName4 = `CONCAT(orgChild4.orgChild4ShortName,posMaster.posMasterNoPrefix,posMaster.posMasterNo,posMaster.posMasterNoSuffix)`;
let _data = await new permission().PermissionOrgList(request, "SYS_ORG");
let _child = 0;
if (_data.child4 && _data.child4.length > 0) _child = 4;
if (_data.child3 && _data.child3.length > 0) _child = 3;
if (_data.child2 && _data.child2.length > 0) _child = 2;
if (_data.child1 && _data.child1.length > 0) _child = 1;
if (body.type === 0) {
console.log("0");
typeCondition = {
orgRootId: body.id,
};
@ -1135,7 +1129,6 @@ export class PositionController extends Controller {
} else {
}
} else if (body.type === 1) {
console.log("1");
typeCondition = {
orgChild1Id: body.id,
};
@ -1147,7 +1140,6 @@ export class PositionController extends Controller {
} else {
}
} else if (body.type === 2) {
console.log("2");
typeCondition = {
orgChild2Id: body.id,
};
@ -1159,7 +1151,6 @@ export class PositionController extends Controller {
} else {
}
} else if (body.type === 3) {
console.log("3");
typeCondition = {
orgChild3Id: body.id,
};
@ -1171,7 +1162,6 @@ export class PositionController extends Controller {
} else {
}
} else if (body.type === 4) {
console.log("4");
typeCondition = {
orgChild4Id: body.id,
};
@ -1222,6 +1212,18 @@ export class PositionController extends Controller {
const revisionCondition = {
orgRevisionId: body.revisionId,
};
const chkRevision = await this.orgRevisionRepository.findOne({
where: { id: body.revisionId },
});
if (chkRevision != null && chkRevision.orgRevisionIsDraft == true)
_data = {
root: null,
child1: null,
child2: null,
child3: null,
child4: null,
privilege: "OWNER",
};
const conditions = [
{
...checkChildConditions,
@ -1233,7 +1235,6 @@ export class PositionController extends Controller {
: { posMasterNo: Like(`%${body.keyword}%`) })),
},
];
let [posMaster, total] = await AppDataSource.getRepository(PosMaster)
.createQueryBuilder("posMaster")
.leftJoinAndSelect("posMaster.orgRoot", "orgRoot")