# Event Activity Logging & Daily Digest

**Date:** 2026-03-02
**Status:** Approved

## Problem

Event management actions in portal.cgi (employer-facing), event_sponsor_manager.cgi (admin), and index.cgi (admin workflow) leave no audit trail. There is no visibility into which employers are actively preparing for events and which are silent.

## Solution

### 1. Activity Logging

Instrument all three CGI scripts with `logEvent()` calls using the existing `employer_history` table. All event entries use `event_summary` prefixed with `Event:` for easy filtering.

A thin helper `logEventActivity($employer_id, $actor, $summary, $detail, $ccdbh)` in `events.pl` wraps `logEvent()` to enforce the prefix convention.

#### Portal.cgi (employer actions)

| Action | event_summary | event (details) |
|--------|---------------|-----------------|
| Save attendee | Event: Booth Rep | Added booth rep: Name (Title) |
| Delete attendee | Event: Booth Rep | Removed booth rep: Name |
| Upload file | Event: Upload | Uploaded: filename.pdf |
| Delete upload | Event: Upload | Deleted upload: filename.png |
| Save config | Event: Config | Updated booth configuration |
| Save shipping | Event: Shipping | Updated shipping info |
| Confirm logistics | Event: Logistics | Confirmed logistics for event |

Actor = employer contact name/email from portal auth context.

#### event_sponsor_manager.cgi (admin actions)

| Action | event_summary | event (details) |
|--------|---------------|-----------------|
| Send reminder | Event: Reminder | Sent reminder to employer_name |
| Bulk reminder | Event: Reminder | Sent bulk reminders to N employers |
| Generate token | Event: Portal | Generated portal access token |
| Generate social | Event: Social | Generated social graphic for Name |
| Send social | Event: Social | Emailed social graphic to Name |
| Send instructions | Event: Instructions | Sent materials request to employer_name |

Actor = $ENV{REMOTE_USER}.

#### index.cgi (admin workflow)

| Action | event_summary | event (details) |
|--------|---------------|-----------------|
| Approve landing page | Event: Landing Page | Approved landing page |
| Deactivate landing page | Event: Landing Page | Deactivated landing page |
| Send sourcing profiles | Event: Sourcing | Sent sourcing assignment to sourcer |

Actor = $ENV{REMOTE_USER}.

### 2. Daily Digest Cron

**File:** `crons/staff/event_activity_digest.pl`
**Schedule:** Daily at 7am
**Recipient:** core@hbcuconnect.com

**Email sections:**
1. Active Events Quick Links — event name, date, type, link to event_sponsor_manager.cgi?cid=X
2. Yesterday's Activity — grouped by event, then employer, individual action items
3. Stale Employers — employers with no activity in 3+ days on active events

**Data sources:**
- `employer_history` WHERE `event_summary LIKE 'Event:%'` AND `tstamp >= yesterday`
- `resume_recommendation_clients` for active events (event_date >= today or within last 7 days)

## Files Touched

- `events/events.pl` — add `logEventActivity()` helper
- `events/portal.cgi` — add logging to 7 employer actions
- `events/event_sponsor_manager.cgi` — add logging to ~10 admin actions
- `events/index.cgi` — add logging to workflow actions
- `crons/staff/event_activity_digest.pl` — new daily digest cron
- crontab — add 7am entry
