Delete objects according to state machine
the following aims to give rules for deleting main objects : person, contract and part
PERSON
A person can be deleted if some conditions are met. The deletion (physical or not) will depend on the status of the person.
CONDITIONS
it is not contained in another person. For instance a natural person can be member of union => If contained, return no deletion possible.
it is not part of a contract. E.g. a person can have a bank account (contract) => If part of a contract, return no deletion possible
it has no accounting entries related. A supplier can be stand alone, without any contract but can have accounting entries => If has entries, return no deletion possible
STATUS
Once conditions above have been checked, the deletion will take place according to the status
DRAFT: the record can be removed from the DBACTIVE: no physical deletion possible. The status of the person will be set to :ARCHIVED
DIAGRAM
CONTRACT
BANK CONTRACT
A bank contract can be deleted if some conditions are met, and also depending on the status of the contract.
note : a bank contract never triggers change of person status- CONDITIONS : the bank contract must NOT be used in another contract (e.g. in a rental contract)
- STATUS : a physical deletion (only) can occur only if status is :
DRAFT
LEGAL REPRESENTANT CONTRACT (04/2021 : old version, to be updated)
a legal representant contract can always be deleted
note : a legal representant contract never triggers change of person status (as of april 2021)
- RENTAL DELEGATE CONTRACT (04/2021 : old version, to be updated)
- RENTAL CONTRACT (04/2021 : old version, to be updated)