Use contact name in activity if set

This commit is contained in:
Hillel Coren 2023-04-25 10:07:18 +03:00
parent 7f0c3570d4
commit 6f9f8246b7
1 changed files with 9 additions and 14 deletions

View File

@ -935,21 +935,16 @@ abstract class ActivityEntity
kActivityViewPurchaseOrder,
kActivityAcceptPurchaseOrder,
].contains(activityTypeId)) {
activity = activity.replaceFirst(
':contact',
(vendorContact?.fullName ?? '').isNotEmpty
? vendorContact.fullName
: (vendor?.name ?? '').isNotEmpty
? vendor.name
: user?.fullName ?? '');
final name = (vendorContact?.fullName ?? '').isNotEmpty
? vendorContact.fullName + ' - ' + (vendor?.name ?? '')
: (vendor?.name ?? '');
activity = activity.replaceFirst(':contact', name);
} else {
activity = activity.replaceFirst(
':contact',
(clientContact?.fullName ?? '').isNotEmpty
? clientContact.fullName
: (client?.displayName ?? '').isNotEmpty
? client.displayName
: user?.fullName ?? '');
final name = (clientContact?.fullName ?? '').isNotEmpty
? clientContact.fullName +
((client?.name ?? '').isNotEmpty ? ' - ' + client.name : '')
: (client?.displayName ?? '');
activity = activity.replaceFirst(':contact', name);
}
activity = activity.replaceFirst(
':payment', payment?.transactionReferenceOrNumber ?? '');