The Correspondencia module is Corpen’s document routing and tracking engine. It handles the full lifecycle of both inbound documents (radicados) and outbound official communications (oficios de salida), organized around configurable workflow processes and document retention rules. Every action in the module—creating a radicado, assigning a process, closing a file—is written to a persistent audit trail. The module is accessible underDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/corpentunida-org/corpen/llms.txt
Use this file to discover all available pages before exploring further.
/correspondencia and requires the auth middleware on all routes.
Sub-resource Overview
| Route prefix | Resource | Purpose |
|---|---|---|
correspondencias | CorrespondenciaController | Inbound correspondence CRUD (radicados) |
comunicaciones-salida | ComunicacionSalidaController | Outbound official communications with auto folio generation |
trds | TrdController | Document retention table (Tabla de Retención Documental) entries |
plantillas | PlantillaController | Letter/document templates |
flujos | FlujoDeTrabajoController | Workflow definitions (groupings for processes) |
procesos | ProcesoController | Process steps within a workflow; user assignments; state permissions |
notificaciones | NotificacionController | Notification records with read-marking |
estados | CorrEstadoController | State master data for correspondence records |
medios-recepcion | MedioRecepcionController | Reception media types (e.g., email, physical mail) |
correspondencias-procesos | CorrespondenciaProcesoController | Process tracking history per radicado with marcarNotificado |
tablero | CorrespondenciaController::tablero | KPI dashboard: total, overdue, pending, finalized |
Full Route Reference
Database Tables
The module uses the following tables, all prefixed withcorr_:
| Table | Purpose |
|---|---|
corr_correspondencia | Inbound radicado records |
corr_comunicaciones_salida | Outbound oficios |
corr_trd | Retention table entries |
corr_flujo_de_trabajo | Workflow definitions |
corr_procesos | Process steps |
corr_procesos_users | User–process assignments (pivot) |
corr_estados | State catalog |
corr_estados_procesos | State permissions per process |
corr_plantillas | Document templates |
corr_notificaciones | Notification records |
corr_medio_recepcion | Reception media types |
corr_correspondencia_proceso | Per-radicado process tracking history |
Inbound Correspondence Handling Workflow
Create the radicado
Navigate to The attached file (up to 50 MB) is stored on S3 at
GET /correspondencia/correspondencias/create. The form auto-populates the next id_radicado by incrementing the current maximum. Fill in the required fields and submit.corpentunida/correspondencia/rad{id_radicado}_{timestamp}.{ext}. The path is stored as a JSON array in documento_arc, enabling multiple file accumulation on subsequent edits.Review TRD deadline
Open the radicado’s detail view at
GET /correspondencia/correspondencias/{id}. The view calculates the retention deadline using Carbon::parse($correspondencia->fecha_solicitud)->addYears($trd->tiempo_gestion) and displays the remaining interval. Use the AJAX endpoint GET /correspondencia/ajax/trds-por-flujo/{flujo_id} to load available TRDs dynamically when the flujo selector changes.Assign to a workflow process
From the detail view, select one of the available
Proceso steps associated with the radicado’s workflow. The process panel loads user assignments and permitted states from corr_procesos_users and corr_estados_procesos.Add process tracking entry
Create a
correspondencias-procesos record to document the action taken. After creation, call POST /correspondencia/correspondencias-procesos/{id}/marcar-notificado to flag the entry as notified.Add files on update
Editing a radicado (
PUT /correspondencia/correspondencias/{id}) appends new attachments to the existing JSON array without overwriting history. The finalizado boolean flag closes the record; the audit message is updated to FIN CORRESPONDENCIA ID {radicado}.Outbound Communications and PDF
The outbound communication PDF is rendered as an interactive web preview (not a forced download).
ComunicacionSalidaController::descargarPdf() loads a background JPEG (resources/views/correspondencia/comunicaciones_salida/fondo_de_pdf.jpg) and the signer’s digital signature image from S3, both converted to Base64 strings before being passed to the Blade view. This avoids CORS issues when rendering external images in the browser. If S3 is unreachable, the preview renders without the signature rather than returning a 500 error.POST /correspondencia/comunicaciones-salida, the controller auto-generates the folio number in the format OF-{YYYY}-{XXXX} by padding the next sequential ID:
estado_envio values are: Generado, Enviado por Email, Notificado Físicamente.
The digital signature image is stored on S3 at the firmas/ path. Only radicados that do not already have an associated ComunicacionSalida record are shown in the creation form’s select.
Document Retention Tables (TRD)
Each TRD entry maps aserie_documental (documentary series) to a flujo_id and defines two retention periods:
tiempo_gestion deadline is computed via CarbonInterval::instance(now()->diff($limite)) and surfaced in the UI.
Process Management
Processes are the individual workflow steps that route correspondence. EachProceso belongs to a FlujoDeTrabajo, has a tiempo_respuesta_dias field, and supports both user assignment and state permissions.
- Assign a user
- Remove a user
- Save a state permission
- Get process users (AJAX)
syncWithoutDetaching on the usuarios() many-to-many, so re-assigning a previously removed user reactivates them (activo = 1) without duplicating the pivot row.Dashboard KPIs
The tablero atGET /correspondencia/tablero computes four KPI counts from the filtered dataset:
GET /correspondencia/tablero/pdf) streams a DomPDF A4 landscape document with the same filters applied. Access to both the tablero and its PDF is gated by the candirect:correspondencia.usuario.admin middleware.