diff --git a/src/controllers/ProfileChangeNameController.ts b/src/controllers/ProfileChangeNameController.ts index 69de3557..8eea3a9e 100644 --- a/src/controllers/ProfileChangeNameController.ts +++ b/src/controllers/ProfileChangeNameController.ts @@ -115,7 +115,7 @@ export class ProfileChangeNameController extends Controller { 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.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefixMain; await this.profileRepository.save(profile, { data: req }); setLogDataDiff(req, { before, after: profile }); @@ -191,7 +191,7 @@ export class ProfileChangeNameController extends Controller { 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.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefixMain; 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..6e28c477 100644 --- a/src/controllers/ProfileChangeNameEmployeeController.ts +++ b/src/controllers/ProfileChangeNameEmployeeController.ts @@ -121,7 +121,7 @@ export class ProfileChangeNameEmployeeController extends Controller { 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.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefixMain; await this.profileEmployeeRepo.save(profile, { data: req }); setLogDataDiff(req, { before, after: profile }); @@ -197,7 +197,7 @@ export class ProfileChangeNameEmployeeController extends Controller { 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.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefixMain; await this.profileEmployeeRepo.save(profile); } diff --git a/src/controllers/ProfileChangeNameEmployeeTempController.ts b/src/controllers/ProfileChangeNameEmployeeTempController.ts index 465a7354..05dd9312 100644 --- a/src/controllers/ProfileChangeNameEmployeeTempController.ts +++ b/src/controllers/ProfileChangeNameEmployeeTempController.ts @@ -112,7 +112,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller { 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.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefixMain; await this.profileEmployeeRepo.save(profile, { data: req }); setLogDataDiff(req, { before, after: profile }); @@ -185,7 +185,7 @@ export class ProfileChangeNameEmployeeTempController extends Controller { 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.prefix = profile.rank && profile.rank.length > 0 ? profile.rank : profile.prefixMain; await this.profileEmployeeRepo.save(profile); } diff --git a/src/controllers/ProfileController.ts b/src/controllers/ProfileController.ts index c6f1b68c..42b322d3 100644 --- a/src/controllers/ProfileController.ts +++ b/src/controllers/ProfileController.ts @@ -5801,8 +5801,7 @@ export class ProfileController extends Controller { Object.assign(record, body); record.dateRetireLaw = calculateRetireLaw(record.birthDate); record.prefixMain = record.prefix; - // record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefixMain; - record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefix; + record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefixMain; record.createdUserId = request.user.sub; record.createdFullName = request.user.name; record.createdAt = new Date(); diff --git a/src/controllers/ProfileEmployeeController.ts b/src/controllers/ProfileEmployeeController.ts index 61efbdb7..59f9e91d 100644 --- a/src/controllers/ProfileEmployeeController.ts +++ b/src/controllers/ProfileEmployeeController.ts @@ -2415,7 +2415,7 @@ export class ProfileEmployeeController extends Controller { Object.assign(record, body); record.dateRetireLaw = calculateRetireLaw(record.birthDate); record.prefixMain = record.prefix; - record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefix; + record.prefix = record.rank && record.rank.length > 0 ? record.rank : record.prefixMain; record.createdUserId = request.user.sub; record.createdFullName = request.user.name; record.createdAt = new Date();