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();