From e7eeb3e34da25a3033f4361f3c5c5a0e8f753c5c Mon Sep 17 00:00:00 2001 From: harid Date: Wed, 17 Jun 2026 17:14:52 +0700 Subject: [PATCH] fix #2570 --- src/controllers/ProfileChangeNameController.ts | 8 ++++---- src/controllers/ProfileChangeNameEmployeeController.ts | 8 ++++---- .../ProfileChangeNameEmployeeTempController.ts | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/controllers/ProfileChangeNameController.ts b/src/controllers/ProfileChangeNameController.ts index 69de3557..22f147b8 100644 --- a/src/controllers/ProfileChangeNameController.ts +++ b/src/controllers/ProfileChangeNameController.ts @@ -114,8 +114,8 @@ export class ProfileChangeNameController extends Controller { // profile.prefix = body.prefix ?? profile.prefix; //old profile.rank = body.rank ?? profile.rank; // profile.prefixMain = profile.rank ?? profile.prefix; // old - profile.prefixMain = profile.prefix; - profile.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefix; + profile.prefixMain = body.prefix ?? profile.prefix; + profile.prefix = body.rank && body.rank.length > 0 ? body.rank : body.prefix ?? profile.prefix; await this.profileRepository.save(profile, { data: req }); setLogDataDiff(req, { before, after: profile }); @@ -190,8 +190,8 @@ export class ProfileChangeNameController extends Controller { // profile.prefix = body.prefix ?? profile.prefix; //old profile.rank = body.rank ?? profile.rank; // profile.prefixMain = profile.rank ?? profile.prefix; // old - profile.prefixMain = profile.prefix; - profile.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefix; + profile.prefixMain = body.prefix ?? profile.prefix; + profile.prefix = body.rank && body.rank.length > 0 ? body.rank : body.prefix ?? profile.prefix; await this.profileRepository.save(profile, { data: req }); setLogDataDiff(req, { before: before_profile, after: profile }); } diff --git a/src/controllers/ProfileChangeNameEmployeeController.ts b/src/controllers/ProfileChangeNameEmployeeController.ts index 35e14022..a632e718 100644 --- a/src/controllers/ProfileChangeNameEmployeeController.ts +++ b/src/controllers/ProfileChangeNameEmployeeController.ts @@ -120,8 +120,8 @@ export class ProfileChangeNameEmployeeController extends Controller { // profile.prefix = body.prefix ?? profile.prefix; //old profile.rank = body.rank ?? profile.rank; // profile.prefixMain = profile.rank ?? profile.prefix; // old - profile.prefixMain = profile.prefix; - profile.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefix; + profile.prefixMain = body.prefix ?? profile.prefix; + profile.prefix = body.rank && body.rank.length > 0 ? body.rank : body.prefix ?? profile.prefix; await this.profileEmployeeRepo.save(profile, { data: req }); setLogDataDiff(req, { before, after: profile }); @@ -196,8 +196,8 @@ export class ProfileChangeNameEmployeeController extends Controller { // profile.prefix = body.prefix ?? profile.prefix; //old profile.rank = body.rank ?? profile.rank; // profile.prefixMain = profile.rank ?? profile.prefix; // old - profile.prefixMain = profile.prefix; - profile.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefix; + profile.prefixMain = body.prefix ?? profile.prefix; + profile.prefix = body.rank && body.rank.length > 0 ? body.rank : body.prefix ?? profile.prefix; await this.profileEmployeeRepo.save(profile); } diff --git a/src/controllers/ProfileChangeNameEmployeeTempController.ts b/src/controllers/ProfileChangeNameEmployeeTempController.ts index 465a7354..86c6b352 100644 --- a/src/controllers/ProfileChangeNameEmployeeTempController.ts +++ b/src/controllers/ProfileChangeNameEmployeeTempController.ts @@ -111,8 +111,8 @@ export class ProfileChangeNameEmployeeTempController extends Controller { // profile.prefix = body.prefix ?? profile.prefix; //old profile.rank = body.rank ?? profile.rank; // profile.prefixMain = profile.rank ?? profile.prefix; // old - profile.prefixMain = profile.prefix; - profile.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefix; + profile.prefixMain = body.prefix ?? profile.prefix; + profile.prefix = body.rank && body.rank.length > 0 ? body.rank : body.prefix ?? profile.prefix; await this.profileEmployeeRepo.save(profile, { data: req }); setLogDataDiff(req, { before, after: profile }); @@ -184,8 +184,8 @@ export class ProfileChangeNameEmployeeTempController extends Controller { // profile.prefix = body.prefix ?? profile.prefix; //old profile.rank = body.rank ?? profile.rank; // profile.prefixMain = profile.rank ?? profile.prefix; // old - profile.prefixMain = profile.prefix; - profile.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefix; + profile.prefixMain = body.prefix ?? profile.prefix; + profile.prefix = body.rank && body.rank.length > 0 ? body.rank : body.prefix ?? profile.prefix; await this.profileEmployeeRepo.save(profile); }