diff --git a/front/plugins/unifi_import/full_run.lock b/front/plugins/unifi_import/full_run.lock new file mode 100755 index 00000000..56a6051c --- /dev/null +++ b/front/plugins/unifi_import/full_run.lock @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/server/helper.py b/server/helper.py index 2fea5702..1bf2aaf7 100755 --- a/server/helper.py +++ b/server/helper.py @@ -463,7 +463,7 @@ def list_to_where(logical_operator, column_name, condition_operator, values_list """ if not values_list: - return "" # Return an empty string if the list is empty to avoid breaking the SQL condition. + return " AND 1=1 " # Return a conditioneitehr way if the list is empty to avoid breaking the SQL condition. # Replace {s-quote} with single quote in values_list values_list = [value.replace("{s-quote}", "'") for value in values_list] diff --git a/server/reporting.py b/server/reporting.py index 8b7212bf..d0c259eb 100755 --- a/server/reporting.py +++ b/server/reporting.py @@ -61,11 +61,10 @@ def get_notifications (db): mylog('verbose', ['[Notification] Included sections: ', sections ]) if 'new_devices' in sections: - # Compose New Devices Section + # Compose New Devices Section (no empty lines in SQL queries!) sqlQuery = f"""SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices WHERE eve_PendingAlertEmail = 1 - AND eve_EventType = 'New Device' - {get_setting_value('NTFPRCS_new_dev_condition').replace('{s-quote}',"'")} + AND eve_EventType = 'New Device' {get_setting_value('NTFPRCS_new_dev_condition').replace('{s-quote}',"'")} ORDER BY eve_DateTime""" mylog('debug', ['[Notification] new_devices SQL query: ', sqlQuery ]) @@ -133,11 +132,10 @@ def get_notifications (db): mylog('debug', ['[Notification] json_down_reconnected: ', json.dumps(json_down_reconnected) ]) if 'events' in sections: - # Compose Events Section + # Compose Events Section (no empty lines in SQL queries!) sqlQuery = f"""SELECT eve_MAC as MAC, eve_DateTime as Datetime, dev_LastIP as IP, eve_EventType as "Event Type", dev_Name as "Device name", dev_Comments as Comments FROM Events_Devices WHERE eve_PendingAlertEmail = 1 - AND eve_EventType IN ('Connected', 'Down Reconnected', 'Disconnected','IP Changed') - {get_setting_value('NTFPRCS_event_condition').replace('{s-quote}',"'")} + AND eve_EventType IN ('Connected', 'Down Reconnected', 'Disconnected','IP Changed') {get_setting_value('NTFPRCS_event_condition').replace('{s-quote}',"'")} ORDER BY eve_DateTime""" mylog('debug', ['[Notification] events SQL query: ', sqlQuery ])