Ensure removal of existing entries for identical department, lane, reg, and question before adding new objects in department_selfserve_vehicle_conditions_o

This commit is contained in:
Jeppe Bundgaard
2026-01-19 14:57:15 +01:00
parent da9ee98fb5
commit 67e27f67a4
@@ -53,6 +53,9 @@ class department_selfserve_vehicle_conditions_o extends db
$question = (int)$question;
$value = (bool)$value;
$customer_id = $customer_id !== null ? (int)$customer_id : null;
// Remove any existing entry for the same department, lane, reg and question
$sql = "DELETE FROM $this->table WHERE department = $department AND lane = $lane AND reg = '$reg' AND question = $question";
$db->query($sql);
// Add the object
$tmp_id = self::add_object([
'department' => $department,