Recording and managing contracts – system description
Header and child tables of a contract, save steps and the value match, automatic numbering, content scope and deletion.
Customer and supplier contracts with lines, phases, phase-line allocation and deposit. Finalised module; the content scope is the contract's company_client_id.
Data model
Table names carry the installation's own prefix in the database.
| Table | Role |
|---|---|
contract | header: client, direction, partner, subject, number, currency, value, status |
contract_parties | parties with direction-based roles |
contract_item | lines (resolved from product / service) |
contract_phase, contract_phase_item | phases and phase-line allocation |
contract_deposit, contract_penalty, contract_document, contract_vehicle | deposit, penalty, document and vehicle rows |
doc, doc_link | documents shown in the list |
Process
- List: filters company group, company,
filter_client_id,filter_customer_id,filter_auto_renew,filter_certification_required,filter_data; scope to the content right's companies (getAllowedScopeValues); documents withdocument/documentlist, unlinking withedit. - Save: client and subject required; client in scope (
ownerInScope); where the price profile makes the header value meaningful (works or flat fee), the non-optional lines must total the value within ±0.01 (error_value_mismatch). addContract(): adds missing columns (ensureSchema), direction-based roles, automatic number (V-YYYY-NNNNcustomer,SZ-YYYY-NNNNsupplier, continuous per client), then writes parties, lines, phases, allocation and deposit (delete + rewrite).editContract()rewrites the child tables the same way.- Status: 0/1 (
setStatus). - Delete: ids outside the scope are skipped;
deleteContract()deletes the child rows, then the contract, physically.
Permissions
- Function rights:
list,edit(also the Add button), savecanSave(),delete,debug; searches:companysearch,partnersearch(list),productsearch,propertysearch,servicesearch(edit),groupcompanies. - Content scope:
contractInScope,ownerInScope.
Known limitations
- Deletion does not check referencing invoices.
- The keys
certify,export,invoiceand the BASE-classifiedstatusdeleteexist only in the catalogue; they have no endpoint.