diff --git a/config.template b/config.template index cb6e2ff..2e61b63 100644 --- a/config.template +++ b/config.template @@ -269,6 +269,10 @@ eAlertBroadcastCh = enabled = False checklist_db = data/checklist.db reverse_in_out = False +# Auto approve new checklists +auto_approve = True +# Check-in reminder interval is 5min +# Checkin broadcast interface and channel is emergency_handler interface and channel # Inventory and Point of Sale System [inventory] diff --git a/modules/checklist.py b/modules/checklist.py index 5306ef5..f7f1cd8 100644 --- a/modules/checklist.py +++ b/modules/checklist.py @@ -3,7 +3,7 @@ import sqlite3 from modules.log import logger -from modules.settings import checklist_db, reverse_in_out, bbs_ban_list, bbs_admin_list +from modules.settings import checklist_db, reverse_in_out, bbs_ban_list, bbs_admin_list, checklist_auto_approve import time trap_list_checklist = ("checkin", "checkout", "checklist", "approvecl", "denycl",) @@ -31,20 +31,21 @@ def initialize_checklist_database(): def checkin(name, date, time, location, notes): location = ", ".join(map(str, location)) - # checkin a user + # Auto-approve if setting is enabled + approved_value = 1 if checklist_auto_approve else 0 conn = sqlite3.connect(checklist_db) c = conn.cursor() try: c.execute( - "INSERT INTO checkin (checkin_name, checkin_date, checkin_time, location, checkin_notes, removed, approved) VALUES (?, ?, ?, ?, ?, 0, 0)", - (name, date, time, location, notes) + "INSERT INTO checkin (checkin_name, checkin_date, checkin_time, location, checkin_notes, removed, approved) VALUES (?, ?, ?, ?, ?, 0, ?)", + (name, date, time, location, notes, approved_value) ) except sqlite3.OperationalError as e: if "no such table" in str(e): initialize_checklist_database() c.execute( - "INSERT INTO checkin (checkin_name, checkin_date, checkin_time, location, checkin_notes, removed, approved) VALUES (?, ?, ?, ?, ?, 0, 0)", - (name, date, time, location, notes) + "INSERT INTO checkin (checkin_name, checkin_date, checkin_time, location, checkin_notes, removed, approved) VALUES (?, ?, ?, ?, ?, 0, ?)", + (name, date, time, location, notes, approved_value) ) else: raise diff --git a/modules/settings.py b/modules/settings.py index 9c1ebcb..87c54a0 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -373,6 +373,7 @@ try: checklist_enabled = config['checklist'].getboolean('enabled', False) checklist_db = config['checklist'].get('checklist_db', 'data/checklist.db') reverse_in_out = config['checklist'].getboolean('reverse_in_out', False) + checklist_auto_approve = config['checklist'].getboolean('auto_approve', True) # default True # qrz hello qrz_hello_enabled = config['qrz'].getboolean('enabled', False)