case 4494
This commit is contained in:
@@ -14,6 +14,10 @@ See the [upgrade instructions](ops-upgrade.md) section of this manual for detail
|
||||
|
||||
- App: Additional improvements to web app local error logging in certain conditions
|
||||
|
||||
#### Fixed
|
||||
|
||||
- Server: Fix for issue occasionally causing error saving duplicated Work order, Quote, PM with attachments selected
|
||||
|
||||
### AyaNova 8.0.39 (2023-03-17)
|
||||
|
||||
#### Added
|
||||
|
||||
@@ -224,7 +224,7 @@ namespace AyaNova.Biz
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//DUPLICATE ATTACHMENTS TO NEW OBJECT
|
||||
//
|
||||
internal static async Task DuplicateAttachments(AyaTypeId aSource, AyaTypeId aDest, AyContext ct)
|
||||
internal static async Task DuplicateAttachments(AyaTypeId aSource, AyaTypeId aDest, long attachedByUserId, AyContext ct)
|
||||
{
|
||||
var sources = await ct.FileAttachment.AsNoTracking()
|
||||
.Where(z => z.AttachToAType == aSource.AType && z.AttachToObjectId == aSource.ObjectId)
|
||||
@@ -233,7 +233,19 @@ namespace AyaNova.Biz
|
||||
{
|
||||
foreach (var src in sources)
|
||||
{
|
||||
ct.FileAttachment.Add(new FileAttachment { AttachToObjectId = aDest.ObjectId, AttachToAType = aDest.AType, StoredFileName = src.StoredFileName, DisplayFileName = src.DisplayFileName, ContentType = src.ContentType, LastModified = src.LastModified, Notes = src.Notes, Exists = src.Exists, Size = src.Size });
|
||||
ct.FileAttachment.Add(new FileAttachment
|
||||
{
|
||||
AttachToObjectId = aDest.ObjectId,
|
||||
AttachToAType = aDest.AType,
|
||||
StoredFileName = src.StoredFileName,
|
||||
DisplayFileName = src.DisplayFileName,
|
||||
ContentType = src.ContentType,
|
||||
LastModified = src.LastModified,
|
||||
Notes = src.Notes,
|
||||
Exists = src.Exists,
|
||||
Size = src.Size,
|
||||
AttachedByUserId=attachedByUserId//
|
||||
});
|
||||
}
|
||||
await ct.SaveChangesAsync();
|
||||
}
|
||||
|
||||
@@ -151,7 +151,7 @@ namespace AyaNova.Biz
|
||||
if (newObject.GenCopyAttachmentsFrom != null && !newObject.GenCopyAttachmentsFrom.IsEmpty)
|
||||
{
|
||||
//copy attachment from existing object
|
||||
await AttachmentBiz.DuplicateAttachments(newObject.GenCopyAttachmentsFrom, new AyaTypeId(AyaType.PM, newObject.Id), ct);
|
||||
await AttachmentBiz.DuplicateAttachments(newObject.GenCopyAttachmentsFrom, new AyaTypeId(AyaType.PM, newObject.Id), this.UserId, ct);
|
||||
newObject.GenCopyAttachmentsFrom = null;//so it doesn't get returned
|
||||
}
|
||||
await PMHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
|
||||
@@ -155,7 +155,7 @@ namespace AyaNova.Biz
|
||||
if (newObject.GenCopyAttachmentsFrom != null && !newObject.GenCopyAttachmentsFrom.IsEmpty)
|
||||
{
|
||||
//copy attachment from existing object
|
||||
await AttachmentBiz.DuplicateAttachments(newObject.GenCopyAttachmentsFrom, new AyaTypeId(AyaType.Quote, newObject.Id), ct);
|
||||
await AttachmentBiz.DuplicateAttachments(newObject.GenCopyAttachmentsFrom, new AyaTypeId(AyaType.Quote, newObject.Id), this.UserId, ct);
|
||||
newObject.GenCopyAttachmentsFrom = null;//so it doesn't get returned
|
||||
}
|
||||
await QuoteHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace AyaNova.Biz
|
||||
if (newObject.GenCopyAttachmentsFrom != null && !newObject.GenCopyAttachmentsFrom.IsEmpty)
|
||||
{
|
||||
//copy attachment from existing object
|
||||
await AttachmentBiz.DuplicateAttachments(newObject.GenCopyAttachmentsFrom, new AyaTypeId(AyaType.WorkOrder, newObject.Id), ct);
|
||||
await AttachmentBiz.DuplicateAttachments(newObject.GenCopyAttachmentsFrom, new AyaTypeId(AyaType.WorkOrder, newObject.Id), this.UserId, ct);
|
||||
newObject.GenCopyAttachmentsFrom = null;//so it doesn't get returned
|
||||
}
|
||||
await WorkOrderHandlePotentialNotificationEvent(AyaEvent.Created, newObject);
|
||||
|
||||
Reference in New Issue
Block a user