fix: stop Tahesab imports from stealing links between shared-mobile customers

List all Tahesab customers in one paginated table with a page-size picker instead of 2000-code pages.
This commit is contained in:
2026-10-20 12:00:11 +03:30
parent c1b38e1737
commit adb63447ca
2 changed files with 100 additions and 177 deletions
@@ -548,12 +548,15 @@ export class TahesabPersonLinkService {
},
});
} else {
// اگر موبایل تکراری است → همان شخص؛ نام قبلی حفظ و نام ته‌حساب جایگزین
// اگر موبایل تکراری است → همان شخص؛ نام قبلی حفظ و نام ته‌حساب جایگزین.
// شخصی که روی همین اتصال به کد دیگری لینک است کنار گذاشته می‌شود؛
// وگرنه upsert لینک، کد قبلی را جابه‌جا و آن مشتری را دوباره «واردنشده» می‌کند.
const byMobile = mobile
? await this.prisma.person.findFirst({
where: {
organizationId,
OR: [{ mobile }, { phone: mobile }],
accountingLinks: { none: { connectionId: dto.connectionId } },
},
})
: null;