diff --git a/server/AyaNova/biz/QuoteBiz.cs b/server/AyaNova/biz/QuoteBiz.cs index cf5ec31f..8c2a84d6 100644 --- a/server/AyaNova/biz/QuoteBiz.cs +++ b/server/AyaNova/biz/QuoteBiz.cs @@ -148,7 +148,12 @@ namespace AyaNova.Biz await transaction.CommitAsync(); if (populateViz) await QuotePopulateVizFields(newObject, true, false); - + if (newObject.GenCopyAttachmentsFrom != null && !newObject.GenCopyAttachmentsFrom.IsEmpty) + { + //copy attachment from existing object + await AttachmentBiz.DuplicateAttachments(newObject.GenCopyAttachmentsFrom, new AyaTypeId(AyaType.WorkOrder, newObject.Id), ct); + newObject.GenCopyAttachmentsFrom = null;//so it doesn't get returned + } await QuoteHandlePotentialNotificationEvent(AyaEvent.Created, newObject); return newObject; } @@ -3793,7 +3798,7 @@ namespace AyaNova.Biz return false; await PartBizActionsAsync(AyaEvent.Deleted, null, dbObject, transaction); ct.QuoteItemPart.Remove(dbObject); - await ct.SaveChangesAsync(); + await ct.SaveChangesAsync(); if (HasErrors) { await transaction.RollbackAsync(); @@ -4006,7 +4011,7 @@ namespace AyaNova.Biz } } - + //////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/server/AyaNova/models/Quote.cs b/server/AyaNova/models/Quote.cs index df08473d..e2e65227 100644 --- a/server/AyaNova/models/Quote.cs +++ b/server/AyaNova/models/Quote.cs @@ -30,7 +30,7 @@ namespace AyaNova.Models public DateTime? ValidUntil { get; set; } public DateTime? Submitted { get; set; } public DateTime? Approved { get; set; } - + //---- [Required] @@ -104,6 +104,9 @@ namespace AyaNova.Models [NotMapped] public bool UserCanViewLoanerCosts { get; set; } + [NotMapped, JsonProperty(NullValueHandling = NullValueHandling.Ignore)] + public AyaTypeId GenCopyAttachmentsFrom { get; set; }//INTERNAL, USED TO SIGNIFY ATTACHMENTS NEED TO BE COPIED ON SAVE + [NotMapped, JsonIgnore] public AyaType AyaType { get => AyaType.Quote; }