# ChangeLog – Scan Station Module

All notable changes to this module are documented here.

---

## [1.4.0] – 2026-04-05

### Added
- **Per-user today stats** — MO card right column shows `Me (today)`: confirmed ✅ and scrap ⚠️ counts for the logged-in user on the current MO (net of reverses); auto-refreshes after every Confirm / Scrap / Reverse
- **Shift badge** — pill next to operator name in header and in downtime bar showing current user's shift (e.g. `Fixed Early`), sourced from `options_shift` user extrafield
- **Shift code on downtime** — `shift_code` column added to `llx_planning_downtime`; filled automatically from user's shift extrafield when logging downtime from ScanStation
- **Manager override right** (`scanstation->override`, ID 999104003) — allows team leaders to confirm past batch qty limit
- **Over-batch guard** — `confirm` action blocks confirmation when `qty_done + qty > batch_qty`; users without override right see an error; managers see a custom confirmation modal
- Dynamic cache buster on CSS and JS includes (`filemtime()`)

### Changed
- **Report Scrap UX overhaul**: Qty field removed; LOG SCRAP button disabled until at least one piece pill **and** a reason are selected; piece selection drives quantity automatically
- `refreshMoStats()` now called after Scrap and Reverse in addition to Confirm
- `clearPanel()` now resets Me (today) cell and hides it

### Fixed
- Me stats correctly subtract `reverse_confirm`/`reverse` from confirmed count and `reverse_scrap` from scrap count
- Me (today) cell hidden on CLEAR and workstation change
- `refreshMoStats()` missing after LOG SCRAP

---

## [1.1.1] – 2026-03-25

### Fixed
- Suppress software keyboard popup on mobile after camera QR scan — `skipFocus` flag prevents `$qty.focus()` from triggering when scan came from camera
- Detect plain HTTP origin and show actionable `chrome://flags` instruction (camera is HTTPS-only in Chrome)
- Improve camera permission error messages with step-by-step instructions per error type
- Camera button click no longer triggers scan input focus / keyboard on mobile
- Replace `html5-qrcode` library with **native `getUserMedia` + `jsQR`** — eliminates unexpected file picker / UI injections on mobile Chrome
- Hide residual `html5-qrcode` internal UI elements (file input, picker button)
- Camera start timing: `setTimeout` for DOM render + explicit `qr-reader` dimensions to prevent `NotFoundError` on first open

---

## [1.1.0] – 2026-03-25

### Added
- **Camera QR scanning** — 📷 button opens rear camera; video frames decoded by `jsQR`; auto-submits on QR detect
- `jsqr.min.js` and `html5-qrcode.min.js` self-hosted under `js/` (no CDN dependency)
- Camera region UI: video preview, canvas overlay, Stop button

---

## [1.0.0] – 2026-03-25

### Added
- `scan_station.php` — kiosk UI: workstation selector, barcode input, MO info card, operation selector, qty counter, Confirm and Scrap buttons, recent scans log
- `ajax/scan_action.php` — AJAX endpoint with four actions:
  - `lookup` — parse `MO:{id}|JOB:{job}|ENTITY:{entity}` QR format + fallback ref lookup → return MO info + operations
  - `confirm` — write confirmed operation to `llx_mrp_mo_optracking` **and** `llx_scanstation_log`
  - `scrap` — log scrap event (qty + note) to `llx_scanstation_log`
  - `get_log` — return last N scans for the recent-scans panel (default 5, configurable via `SCANSTATION_SHOW_LAST_N`)
- `core/modules/modScanStation.class.php` — module descriptor, permissions (`scanstation->use`)
- `sql/llx_scanstation_log.sql` — scan audit trail table
- `sql/uninstall.sql`
- `admin/setup.php` — admin configuration page
- `css/scanstation.css` — tablet-optimized kiosk styles
- 30-second idle refocus timer — scan input refocuses automatically after inactivity
- Session-persistent workstation selection via `set_ws` action
- `scanstation_task.md` — full task plan with Phase 2 / Phase 3 specifications
