fix(fusion_clock): Photo Verification is now a real master switch (was ignored)
The global enable_photo_verification toggle only fed the portal get_settings flag; the actual writes ignored it — the NFC kiosk gated on nfc_photo_required and the portal on location.require_photo, so photos were captured even with the toggle OFF. Now it's the master: OFF => no photo captured/stored anywhere (NFC kiosk config + tap, and portal check-in); ON => per-location / NFC settings apply. Test + help text updated. Bump 3.16.0 -> 3.16.1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -308,8 +308,11 @@ class FusionClockAPI(http.Controller):
|
||||
'x_fclk_clock_source': source,
|
||||
}
|
||||
|
||||
# Photo verification
|
||||
if photo and location.require_photo:
|
||||
# Photo verification — only when the global toggle is on (master);
|
||||
# per-location require_photo refines it from there.
|
||||
enable_photo = request.env['ir.config_parameter'].sudo().get_param(
|
||||
'fusion_clock.enable_photo_verification', 'False') == 'True'
|
||||
if photo and enable_photo and location.require_photo:
|
||||
try:
|
||||
write_vals['x_fclk_checkin_photo'] = photo
|
||||
except Exception:
|
||||
|
||||
@@ -91,7 +91,8 @@ class FusionClockNfcKiosk(http.Controller):
|
||||
'company_logo_url': company_logo_url,
|
||||
'location_name': location.name if location else 'No location configured',
|
||||
'location_configured': bool(location),
|
||||
'photo_required': ICP.get_param('fusion_clock.nfc_photo_required', 'True') == 'True',
|
||||
'photo_required': (ICP.get_param('fusion_clock.enable_photo_verification', 'False') == 'True'
|
||||
and ICP.get_param('fusion_clock.nfc_photo_required', 'True') == 'True'),
|
||||
'debug_enabled': ICP.get_param('fusion_clock.nfc_kiosk_debug', 'False') == 'True',
|
||||
'sounds_enabled': ICP.get_param('fusion_clock.enable_sounds', 'True') == 'True',
|
||||
}
|
||||
@@ -289,10 +290,12 @@ class FusionClockNfcKiosk(http.Controller):
|
||||
if _is_debounced(normalized):
|
||||
return {'error': 'debounce'}
|
||||
|
||||
photo_required = ICP.get_param('fusion_clock.nfc_photo_required', 'True') == 'True'
|
||||
# Master switch: no photo capture/storage when global Photo Verification is off.
|
||||
photo_enabled = ICP.get_param('fusion_clock.enable_photo_verification', 'False') == 'True'
|
||||
photo_required = photo_enabled and ICP.get_param('fusion_clock.nfc_photo_required', 'True') == 'True'
|
||||
if photo_required and not photo_b64:
|
||||
return {'error': 'photo_required', 'message': 'Camera unavailable. Ask IT to check the kiosk.'}
|
||||
photo_bytes = _strip_data_url_prefix(photo_b64) if photo_b64 else b''
|
||||
photo_bytes = _strip_data_url_prefix(photo_b64) if (photo_enabled and photo_b64) else b''
|
||||
|
||||
company = request.env.company.sudo()
|
||||
location = company.x_fclk_nfc_kiosk_location_id
|
||||
|
||||
Reference in New Issue
Block a user