Advance quote to Sent status when approval link sent via SMS
The SMS path was sending the message but never updating QuoteStatusId or SentDate, leaving the quote in Draft. Now mirrors the email send path: transitions Draft → Sent and stamps SentDate on first send only. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -3361,6 +3361,19 @@ public class QuotesController : Controller
|
||||
tokenChanged = true;
|
||||
}
|
||||
|
||||
// Advance quote to Sent status when it is still in Draft — mirrors what the email send path does.
|
||||
var companyId = _tenantContext.GetCurrentCompanyId() ?? 0;
|
||||
var statuses = await _lookupCache.GetQuoteStatusLookupsAsync(companyId);
|
||||
var sentStatus = statuses.FirstOrDefault(s => s.StatusCode == "SENT");
|
||||
var draftStatus = statuses.FirstOrDefault(s => s.StatusCode == "DRAFT");
|
||||
|
||||
if (sentStatus != null && quote.QuoteStatusId == (draftStatus?.Id ?? 0))
|
||||
{
|
||||
quote.QuoteStatusId = sentStatus.Id;
|
||||
quote.SentDate ??= DateTime.UtcNow;
|
||||
tokenChanged = true; // ensure a save happens
|
||||
}
|
||||
|
||||
if (tokenChanged)
|
||||
{
|
||||
await _unitOfWork.Quotes.UpdateAsync(quote);
|
||||
|
||||
Reference in New Issue
Block a user