ticket system ensure status offen on self-assigned tickets

This commit is contained in:
OpenXE 2023-01-18 18:54:24 +01:00
parent d89c23ad0e
commit bb3a68042d

View File

@ -172,6 +172,16 @@ class Ticket {
return $erg; return $erg;
} }
// Ensure status 'offen' on self-assigned tickets
function ticket_set_self_assigned_status(array $ids) {
$sql = "UPDATE ticket SET status = 'offen'
WHERE
status = 'neu'
AND id IN (".implode(',',$ids).")
AND warteschlange IN (SELECT label FROM warteschlangen WHERE adresse = '".$this->app->User->GetAdresse()."')";
$this->app->DB->Update($sql);
}
function ticket_list() { function ticket_list() {
// Process multi action // Process multi action
@ -183,7 +193,7 @@ class Ticket {
if($selectedId > 0) { if($selectedId > 0) {
$selectedIds[] = $selectedId; $selectedIds[] = $selectedId;
} }
} }
$status = $this->app->Secure->GetPOST('status'); $status = $this->app->Secure->GetPOST('status');
$warteschlange = $this->app->Secure->GetPOST('warteschlange'); $warteschlange = $this->app->Secure->GetPOST('warteschlange');
@ -194,9 +204,10 @@ class Ticket {
} }
$sql .= " WHERE id IN (".implode(",",$selectedIds).")"; $sql .= " WHERE id IN (".implode(",",$selectedIds).")";
$this->app->DB->Update($sql); $this->app->DB->Update($sql);
$this->ticket_set_self_assigned_status($selectedIds);
} }
// List // List
@ -488,6 +499,9 @@ class Ticket {
$sql = "INSERT INTO ticket (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update; $sql = "INSERT INTO ticket (".$columns.") VALUES (".$values.") ON DUPLICATE KEY UPDATE ".$update;
$this->app->DB->Update($sql); $this->app->DB->Update($sql);
$id = $this->app->DB->GetInsertID(); $id = $this->app->DB->GetInsertID();
$this->ticket_set_self_assigned_status(array($id));
return($id); return($id);
} }