From 2cef1f1b7694e69d44cf9b9438ab83a0ba20419d Mon Sep 17 00:00:00 2001 From: AdisakKanthawilang Date: Fri, 23 Feb 2024 11:40:08 +0700 Subject: [PATCH] fix update salary preriod --- src/controllers/SalaryPeriodController.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/controllers/SalaryPeriodController.ts b/src/controllers/SalaryPeriodController.ts index 7c16e5f..7cc0be5 100644 --- a/src/controllers/SalaryPeriodController.ts +++ b/src/controllers/SalaryPeriodController.ts @@ -101,12 +101,13 @@ export class SalaryPeriodController extends Controller { const chk_period = await this.salaryPeriodRepository.findOne({ where: { period: requestBody.period, + id: Not(id), effectiveDate: Between(startOfYear, endOfYear) }, }); if (chk_period) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทผังปี "+ requestBody.effectiveDate.getFullYear() +" ซ้ำ"); + throw new HttpError(HttpStatusCode.NOT_FOUND, "ประเภทผังปี "+ (requestBody.effectiveDate.getFullYear()+543) +" ซ้ำ"); } chk_SalaryPeriod.period = requestBody.period.toUpperCase();