Compare commits

..

No commits in common. "60bfbbe2b8100b26cf2a689cb2f86e4c9e3bc0b8" and "52873047d647eea1bfc5408b8d3f10fa39005dd3" have entirely different histories.

3 changed files with 2 additions and 17 deletions

View File

@ -1 +1 @@
v20260108-30-customer-delete-ticket-remark-scopes
v20260108-29-inbox-attachment-body-fallback

View File

@ -100,15 +100,9 @@ def customers_delete(customer_id: int):
customer = Customer.query.get_or_404(customer_id)
try:
# Prevent FK violations and keep historical reporting intact.
# Prevent FK violations on older schemas and keep jobs for historical reporting.
# Jobs are not deleted when removing a customer; they are simply unlinked.
Job.query.filter_by(customer_id=customer.id).update({"customer_id": None})
# Ticket/remark scoping rows can reference customers directly (FK),
# so remove those links first to allow the customer to be deleted.
TicketScope.query.filter_by(customer_id=customer.id).delete(synchronize_session=False)
RemarkScope.query.filter_by(customer_id=customer.id).delete(synchronize_session=False)
db.session.delete(customer)
db.session.commit()
flash("Customer deleted.", "success")

View File

@ -29,15 +29,6 @@
- Add legacy fallback in the Inbox message detail API: when stored bodies are empty/whitespace, extract the first HTML attachment from EML and render it.
- Improve Inbox iframe rendering: if the returned content is a full HTML document (common for report attachments), render it directly instead of wrapping it.
---
## v20260108-29-customer-delete-ticket-remark-scopes
- Updated customer deletion logic to allow removal of customers that have linked tickets or remarks.
- Added explicit cleanup of related TicketScope and RemarkScope records before deleting the customer.
- Ensured jobs linked to the customer are safely unassigned to prevent foreign key constraint errors.
- Prevented deletion failures caused by existing ticket and remark relationships.
================================================================================================================================================
## v0.1.18