Technical Reference: ZiveFirmy¶
Data Model¶
The module extends the Lead entity with the following fields:
companyName: Varchar, uses a custom view for autocomplete (utilizesAres/suggestendpoint).companySicCode: Varchar, trigger for data fetching. Custom viewzive-firmy:views/lead/fields/company-sic-code.employeeInfo: JsonObject, stores employee history.turnoverInfo: JsonObject, stores turnover history.
Fetching Logic¶
Trigger: Change of value in the companySicCode field on the client side.
- JavaScript view
company-sic-code.jsdetects the change. - Sends a GET request to
ZiveFirmy/lookup/{sicCode}. - Backend (
Api/ZiveFirmy.php) calls external APIhttps://api3.zivefirmy.cz/firmdata/. - Returns data on turnover and employees.
- JavaScript saves data into
employeeInfoandturnoverInfofields.
Dependencies¶
The module implicitly assumes the existence of the Ares/suggest endpoint for company name autocomplete, but for the data enrichment itself (employees/turnover), filling the ID in any way is sufficient.