Build Research & Evidence
This guide is written from the module's own source. This page maps each documented behaviour to the file that implements it, so you can verify anything or dig deeper.
Controllers
| File | Responsibility |
|---|---|
controllers/CompanyTag.php | Every authenticated screen & endpoint — dashboard, settings, allocation, template library/builder, generation, registry & lifecycle. |
controllers/Idverify.php | Public (guest) QR verification; sessionless tenant switch; minimal status only. |
Libraries
| File | Responsibility |
|---|---|
libraries/Id_format.php | Pure ID-format token engine — parse / validate (exactly one {SEQ}) / render / example / period key. |
libraries/Id_template_schema.php | Field catalogue + validate / sanitise / clamp / canonicalise / checksum a template definition (security-critical). |
libraries/Id_card_renderer.php | Renders a definition + merge data into front/back PNGs and a CR80 PDF (GD/Intervention, QR & barcode). |
libraries/CardMaker.php | The classic fixed-layout card export (legacy). |
Models
| File | Responsibility |
|---|---|
models/Idstudio_sequence_model.php | Atomic reserve() (row-locked) — non-overlapping ID ranges. |
models/Idstudio_template_model.php | Template lifecycle — create / get-with-version / save-draft (forks on published) / publish / duplicate / archive. |
models/Idstudio_template_version_model.php | Immutable version rows + next version number. |
models/Idstudio_job_model.php | Generation jobs + idempotency lookup. |
models/Idstudio_tag_model.php | Registry queries, unique serial, create tag, lifecycle (print/issue/revoke), effective status, timeline, expire, prune. |
models/Idstudio_model.php | Cross-cutting employee/job_idnum queries (counts, existence, column length). |
models/Id_template_model.php | Legacy background-image templates. |
Views, jobs, migrations & config
- Views —
views/company_tag/idstudio/:_nav,dashboard,settings,allocate,templates,builder(+_builder_js/_builder_styles),generate,registry,tag_detail,revoke_modal,verify. - Cron —
jobs/ExpireIdstudioTagsJob.php(daily expire + artifact prune). - Migrations —
migrations/…_create_idstudio_tables.php(idempotent, reversible). - Config —
config/{module_config,permissions,menu,default_menu,routes,system_logs}.php. - Tests —
tests/CompanyTagTest.php(run viaphp erpat module:test CompanyTag).
How the build was verified
Alongside the module test suite, the ID Studio backend was checked against a live database:
- Atomic allocation hands out non-overlapping, monotonic ID ranges.
- The template schema drops invalid elements, clamps coordinates and strips unsafe backgrounds; checksums are stable and order-independent.
- The renderer produces valid 1011×638 PNGs (all element types) and a valid PDF.
- Unique constraints on the job idempotency key and the tag serial hold; lifecycle transitions and bidirectional replace lineage behave as documented.
????
The single item not yet exercised is a full click-through in a live browser — the surfaces are
code-complete and database-verified, but a hands-on smoke test of the whole build → publish →
generate → issue/revoke → scan flow is the recommended final check.