PACKAGE FL1 - FORCED LOGOUT = NORMAL DAY, NO OVERTIME

Purpose
- If a staff member forgets to clock out and the system force-closes the session, the session must not generate overtime.
- Forced logout should create a normal day only.

Core rule
- Forced logout close time = clock-in time + normal work minutes + remaining lunch deduction minutes.
- Default fallback normal work minutes = 480 minutes / 8 hours.
- Lunch minutes come from the staff Payroll / Lunch Rule.
- Working lunch already used that day reduces the remaining lunch deduction.

Examples
1) Staff setup = 8h normal work + 60m lunch, no working lunch
   forced span = 480 + 60 = 540 minutes
   report deducts 60m lunch
   worked = 480 minutes / 8h
   overtime = 0

2) Staff setup = 8h normal work + 60m lunch, 13m working lunch
   forced span = 480 + 47 = 527 minutes
   report deducts 47m lunch
   worked = 480 minutes / 8h
   overtime = 0

3) Staff setup = 8h normal work + 60m lunch, 60m working lunch
   forced span = 480 + 0 = 480 minutes
   report deducts 0m lunch
   worked = 480 minutes / 8h
   overtime = 0

Files
- /cron/auto-close-sessions.php
- /api/auto-close-sessions.php
- /sql/verify-fl1-forced-logout-normal-day-no-ot.sql
- /README-FL1.txt

Extract inside
- /home/uent/public_html

Cron
Use this every 5 minutes:
php /home/uent/public_html/cron/auto-close-sessions.php

Manual run / browser test
https://uent.co.za/api/auto-close-sessions.php?secret=westcoast-fl1-2026

What this overwrites
- /cron/auto-close-sessions.php
- /api/auto-close-sessions.php

Important
- This does not affect normal staff clock-out.
- It only affects open sessions that have reached their normal-day forced close time or stale sessions left open into the next date.
- It marks forced sessions with:
  closed_by_type = auto
  close_reason = Forced logout: normal day only, no overtime
  clock_out_status = FORCED_NORMAL_DAY
  when those columns exist.

Verification
Run:
/sql/verify-fl1-forced-logout-normal-day-no-ot.sql
