Search bar on notifications page and alerts-widget not working

The search bar is no longer working on the alerts widget and notifications page. There seems to be some kind of SQL-error. I am running the latest release with the following versions:

LibreNMS | 1.69-7-g845916bd7
DB Schema | 2020_07_27_00522_alter_devices_snmp_algo_columns (188)
PHP | 7.4.3
Python | 3.8.5
MySQL | 10.3.22-MariaDB-1ubuntu1
RRDTool | 1.7.2
SNMP | NET-SNMP 5.8

SQL-error:

[2020-11-06 14:20:42] production.ERROR: SQLSTATE[23000]: Integrity constraint violation: 1052 Column ‘timestamp’ in where clause is ambiguous (SQL: SELECT alerts., devices.hostname, devices.sysName, devices.os, devices.hardware, locations.location, alert_rules.rule, alert_rules.name, alert_rules.severity FROM alerts LEFT JOIN devices ON alerts.device_id=devices.device_id LEFT JOIN locations ON devices.location_id = locations.id RIGHT JOIN alert_rules ON alerts.rule_id=alert_rules.id WHERE devices.disabled = 0 AND alerts.state!=0 AND (timestamp LIKE %SWITCH-1% OR rule LIKE %SWITCH-1% OR name LIKE %SWITCH-1% OR hostname LIKE %SWITCH-1% OR sysName LIKE %SWITCH-1%) ORDER BY timestamp DESC LIMIT 0,50) (SQL: SELECT alerts., devices.hostname, devices.sysName, devices.os, devices.hardware, locations.location, alert_rules.rule, alert_rules.name, alert_rules.severity FROM alerts LEFT JOIN devices ON alerts.device_id=devices.device_id LEFT JOIN locations ON devices.location_id = locations.id RIGHT JOIN alert_rules ON alerts.rule_id=alert_rules.id WHERE devices.disabled = 0 AND alerts.state!=0 AND (timestamp LIKE %SWITCH-1% OR rule LIKE %SWITCH-1% OR name LIKE %SWITCH-1% OR hostname LIKE %SWITCH-1% OR sysName LIKE %SWITCH-1%) ORDER BY timestamp DESC LIMIT 0,50)#0 /opt/librenms/includes/html/table/alerts.inc.php(110): dbFetchRows()

After some quick and dirty workaround, I got some functionality back by modifying the line:

To:
$where .= ’ AND (alerts.timestamp LIKE ? OR rule LIKE ? OR name LIKE ? OR hostname LIKE ? OR sysName LIKE ?)’;

Obviously this is not the best solution and I might have missed some other possible issues here.

Created a PR for this