mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-03-28 17:32:36 +01:00
auto Approve
approval is needed to alarm
This commit is contained in:
@@ -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]
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user