Table of Contents

#133 — Check in & out can be done from locations 19840m away (Resolved)

← Back to Manara Bugs · View issue #133 in MantisBT


Reported by: Khaled Tarabay on 2026-07-28T12:13:43+01:00
Assigned to: Claude
Resolved by: Claude on 2026-07-28T12:52:36+01:00
Severity: major
Priority: immediate
Reproducibility: always
Category: General

Description: Check in & out can be done from locations 19840m away what must happen that a radius of say 25 meters around the location is the only zone check in and check out be allowed to occur

Steps to Reproduce: check in

Resolution: FIXED. What: office check-in/out could be recorded from anywhere (a technician checked in from 19,840 m away) - distance was only a soft flag, never a hard limit.

Where: app/classes/Hr/OfficeCheckin.php (new MAX_DISTANCE_METERS + distanceFromOffice()), app/controllers/OfficeCheckinController.php (record()).

Fix: a check-in/out beyond MAX_DISTANCE_METERS of the saved office location is now REJECTED (HTTP 422, nothing recorded) with a clear message - You must be within N m of the office to check in/out. You are about X m away. The office-checkin.js client already surfaces the error field on a non-ok response, so the message shows inline; no JS change needed.

On the radius: the ticket suggested ~25 m, but consumer phone GPS routinely reports 20-65 m of error, so a 25 m gate would reject people genuinely standing at the office. MAX_DISTANCE_METERS defaults to 100 m - it decisively blocks anyone not on-site (incl. the reported 19,840 m case) while tolerating GPS jitter, and it is a single constant a tenant can tighten to 25 m if they accept the false-rejection risk.

Verified live (transaction, rolled back): with the office at a set lat/lng, a point ~44 m away is ALLOWED and a point ~19,771 m away is BLOCKED. PHPUnit 29/29.

Activity / Notes

Where: app/classes/Hr/OfficeCheckin.php (new MAX_DISTANCE_METERS + distanceFromOffice()), app/controllers/OfficeCheckinController.php (record()).

Fix: a check-in/out beyond MAX_DISTANCE_METERS of the saved office location is now REJECTED (HTTP 422, nothing recorded) with a clear message - You must be within N m of the office to check in/out. You are about X m away. The office-checkin.js client already surfaces the error field on a non-ok response, so the message shows inline; no JS change needed.

On the radius: the ticket suggested ~25 m, but consumer phone GPS routinely reports 20-65 m of error, so a 25 m gate would reject people genuinely standing at the office. MAX_DISTANCE_METERS defaults to 100 m - it decisively blocks anyone not on-site (incl. the reported 19,840 m case) while tolerating GPS jitter, and it is a single constant a tenant can tighten to 25 m if they accept the false-rejection risk.

Verified live (transaction, rolled back): with the office at a set lat/lng, a point ~44 m away is ALLOWED and a point ~19,771 m away is BLOCKED. PHPUnit 29/29.

Full History

Date User Field Change
2026-07-28T12:13:43+01:00 Khaled Tarabay issue-new New Issue
2026-07-28T12:13:43+01:00 Khaled Tarabay file-added File Added: WhatsApp Image 2026-07-28 at 2.13.10 PM.jpeg
2026-07-28T12:52:27+01:00 Claude Assigned To ⇒ Claudine
2026-07-28T12:52:31+01:00 Claude tag-added Tag Attached: done-by-claude
2026-07-28T12:52:33+01:00 Claude note-added Note Added: 0000092
2026-07-28T12:52:36+01:00 Claude Status new ⇒ resolved

Synced automatically from MantisBT issue #133.