diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index 0cceaf4..c08c963 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -332,6 +332,7 @@ export class SalaryPeriodController extends Controller { where: { id: _salaryProfile.salaryOrg.id, }, + relations: { salaryProfiles: true }, }); if (salaryOrg != null) { const totalProfile = Extension.sumObjectValues(salaryOrg.salaryProfiles, "amount"); @@ -608,6 +609,7 @@ export class SalaryPeriodController extends Controller { where: { id: _salaryProfile.salaryOrg.id, }, + relations: { salaryProfiles: true }, }); if (salaryOrg != null) { const totalProfile = Extension.sumObjectValues(salaryOrg.salaryProfiles, "amount"); @@ -725,6 +727,7 @@ export class SalaryPeriodController extends Controller { where: { id: _salaryProfile.salaryOrg.id, }, + relations: { salaryProfiles: true }, }); if (salaryOrg != null) { const totalProfile = Extension.sumObjectValues(salaryOrg.salaryProfiles, "amount"); @@ -1032,6 +1035,7 @@ export class SalaryPeriodController extends Controller { where: { id: _salaryProfile.salaryOrg.id, }, + relations: { salaryProfiles: true }, }); if (salaryOrg != null) { const totalProfile = Extension.sumObjectValues(salaryOrg.salaryProfiles, "amount"); @@ -1460,6 +1464,7 @@ export class SalaryPeriodController extends Controller { where: { id: _salaryProfile.salaryOrg.id, }, + relations: { salaryProfiles: true }, }); if (salaryOrg != null) { const totalProfile = Extension.sumObjectValues(salaryOrg.salaryProfiles, "amount"); @@ -2086,7 +2091,7 @@ export class SalaryPeriodController extends Controller { if (salaryOrgNew != null) { let salaryProfileNew = Object.assign(new SalaryProfile(), profile); - delete profile.id; + delete salaryProfileNew.id; salaryProfileNew.salaryOrgId = salaryOrgNew.id; salaryProfileNew.revisionId = salaryPeriod.revisionId; salaryProfileNew.createdUserId = request.user.sub; @@ -2131,6 +2136,7 @@ export class SalaryPeriodController extends Controller { if (salaryOrgNew != null) { let salaryProfileNew = Object.assign(new SalaryProfileEmployee(), profile); + delete salaryProfileNew.id; salaryProfileNew.salaryOrgId = salaryOrgNew.id; salaryProfileNew.revisionId = salaryPeriod.revisionId; salaryProfileNew.createdUserId = request.user.sub; @@ -2368,8 +2374,6 @@ export class SalaryPeriodController extends Controller { const current = new Date(); let salaryPeriod: any; let request: any; - // request = express.request; - // console.log("request: ", request); if (current.getDate() == 1 && current.getMonth() == 2) { salaryPeriod = await this.salaryPeriodRepository.findOne({ where: { @@ -2577,6 +2581,7 @@ export class SalaryPeriodController extends Controller { if (salaryOrgNew != null) { let salaryProfileNew = Object.assign(new SalaryProfile(), profile); + delete salaryProfileNew.id; salaryProfileNew.salaryOrgId = salaryOrgNew.id; salaryProfileNew.revisionId = salaryPeriod.revisionId; salaryProfileNew.createdUserId = request.user.sub; @@ -2621,6 +2626,7 @@ export class SalaryPeriodController extends Controller { if (salaryOrgNew != null) { let salaryProfileNew = Object.assign(new SalaryProfileEmployee(), profile); + delete salaryProfileNew.id; salaryProfileNew.salaryOrgId = salaryOrgNew.id; salaryProfileNew.revisionId = salaryPeriod.revisionId; salaryProfileNew.createdUserId = request.user.sub; diff --git a/src/controllers/SalaryPeriodEmployeeController.ts b/src/controllers/SalaryPeriodEmployeeController.ts index 5aa28d5..d9e929c 100644 --- a/src/controllers/SalaryPeriodEmployeeController.ts +++ b/src/controllers/SalaryPeriodEmployeeController.ts @@ -294,6 +294,7 @@ export class SalaryPeriodEmployeeController extends Controller { where: { id: _salaryProfile.salaryOrg.id, }, + relations: { salaryProfiles: true }, }); if (salaryOrg != null) { const totalProfile = Extension.sumObjectValues(salaryOrg.salaryProfiles, "amount"); @@ -742,6 +743,7 @@ export class SalaryPeriodEmployeeController extends Controller { where: { id: _salaryProfile.salaryOrg.id, }, + relations: { salaryProfiles: true }, }); if (salaryOrg != null) { const totalProfile = Extension.sumObjectValues(salaryOrg.salaryProfiles, "amount"); @@ -860,6 +862,7 @@ export class SalaryPeriodEmployeeController extends Controller { where: { id: _salaryProfile.salaryOrg.id, }, + relations: { salaryProfiles: true }, }); if (salaryOrg != null) { const totalProfile = Extension.sumObjectValues(salaryOrg.salaryProfiles, "amount"); @@ -1342,6 +1345,7 @@ export class SalaryPeriodEmployeeController extends Controller { where: { id: _salaryProfile.salaryOrg.id, }, + relations: { salaryProfiles: true }, }); if (salaryOrg != null) { const totalProfile = Extension.sumObjectValues(salaryOrg.salaryProfiles, "amount"); @@ -1995,6 +1999,7 @@ export class SalaryPeriodEmployeeController extends Controller { where: { id: _salaryProfile.salaryOrg.id, }, + relations: { salaryProfiles: true }, }); if (salaryOrg != null) { const totalProfile = Extension.sumObjectValues(salaryOrg.salaryProfiles, "amount");