Auto-commit local changes before build (2026-01-08 14:05:43) #65

Merged
ivooskamp merged 1 commits from v20260108-30-customer-delete-ticket-remark-scopes into main 2026-01-13 11:26:03 +01:00
3 changed files with 17 additions and 2 deletions

View File

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

View File

@ -100,9 +100,15 @@ def customers_delete(customer_id: int):
customer = Customer.query.get_or_404(customer_id)
try:
# Prevent FK violations on older schemas and keep jobs for historical reporting.
# Prevent FK violations and keep historical reporting intact.
# 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,6 +29,15 @@
- 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