feat(contacts): keep Tahesab honorifics with person gender
Male and female names can store the title when requested, and Tahesab import and export use the same gender. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -9,6 +9,7 @@ import {
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { PrismaService } from '../../prisma/prisma.service';
|
||||
import { carryPreviousSource } from '../../contacts/person-source';
|
||||
import { applyPersonGenderTitle } from '@mento/shared';
|
||||
import { TahesabConnectionsService } from './connections.service';
|
||||
import {
|
||||
CreateInTahesabDto,
|
||||
@@ -573,9 +574,9 @@ export class TahesabPersonLinkService {
|
||||
}
|
||||
const name = pickName(row) || `مشتری تهحساب ${dto.moshtariCode}`;
|
||||
const tel = pickTel(row);
|
||||
const parts = name.trim().split(/\s+/);
|
||||
const firstName = parts[0] || name;
|
||||
const lastName = parts.slice(1).join(' ') || '—';
|
||||
const named = applyPersonGenderTitle({ firstName: name, lastName: '' });
|
||||
const firstName = named.firstName;
|
||||
const lastName = named.lastName;
|
||||
const mobile = tel || null;
|
||||
const sourceRef = String(dto.moshtariCode);
|
||||
|
||||
@@ -591,6 +592,8 @@ export class TahesabPersonLinkService {
|
||||
data: {
|
||||
firstName,
|
||||
lastName,
|
||||
gender: named.gender,
|
||||
showGenderInName: named.showGenderInName,
|
||||
...(nameChanged
|
||||
? {
|
||||
previousFirstName: prevFirst || null,
|
||||
@@ -631,6 +634,8 @@ export class TahesabPersonLinkService {
|
||||
data: {
|
||||
firstName,
|
||||
lastName,
|
||||
gender: named.gender,
|
||||
showGenderInName: named.showGenderInName,
|
||||
...(nameChanged
|
||||
? {
|
||||
previousFirstName: byMobile.firstName || null,
|
||||
@@ -650,6 +655,8 @@ export class TahesabPersonLinkService {
|
||||
organizationId,
|
||||
firstName,
|
||||
lastName,
|
||||
gender: named.gender,
|
||||
showGenderInName: named.showGenderInName,
|
||||
mobile,
|
||||
phone: mobile,
|
||||
notes: `واردشده از تهحساب (کد ${dto.moshtariCode})`,
|
||||
|
||||
Reference in New Issue
Block a user