Details
-
Type: Sub-task
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 4.3.0-b1
-
Component/s: Staff Interface
-
Labels:None
Description
The Order plugin needs to listen to the Clients.delete event handler. Orders related to the client need to be deleted. However, since the Order plugin does not maintain a direct reference to the client, but a derived one instead, the derivations should be removed, i.e.:
- Delete all `order_services` matching a `service_id` that no longer exists in the `services` table. If the record has already been deleted, as would be the case by the time this event is called, the service would have been deleted already, so we can remove our hanging records
- Similarly, delete all `orders` by `invoice_id` that no longer exists in the `invoices` table.