Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX user notification for ticket assigned on creation #25866

Closed
wants to merge 21 commits into from
Closed
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions htdocs/ticket/class/ticket.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Copyright (C) 2019-2023 Frédéric France <[email protected]>
* Copyright (C) 2020 Laurent Destailleur <[email protected]>
* Copyright (C) 2023 Charlene Benke <[email protected]>
* Copyright (C) 2023 Benjamin Falière <[email protected]>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -509,7 +510,6 @@ public function create($user, $notrigger = 0)
$sql .= "fk_contract,";
$sql .= "origin_email,";
$sql .= "fk_user_create,";
$sql .= "fk_user_assign,";
$sql .= "email_msgid,";
$sql .= "email_date,";
$sql .= "subject,";
Expand All @@ -535,7 +535,6 @@ public function create($user, $notrigger = 0)
$sql .= " ".($this->fk_contract > 0 ? $this->db->escape($this->fk_contract) : "null").",";
$sql .= " ".(!isset($this->origin_email) ? 'NULL' : "'".$this->db->escape($this->origin_email)."'").",";
$sql .= " ".(!isset($this->fk_user_create) ? ($user->id > 0 ? $user->id : 'NULL') : ($this->fk_user_create > 0 ? $this->fk_user_create : 'NULL')).",";
$sql .= " ".($this->fk_user_assign > 0 ? $this->fk_user_assign : 'NULL').",";
$sql .= " ".(empty($this->email_msgid) ? 'NULL' : "'".$this->db->escape($this->email_msgid)."'").",";
$sql .= " ".(empty($this->email_date) ? 'NULL' : "'".$this->db->idate($this->email_date)."'").",";
$sql .= " ".(!isset($this->subject) ? 'NULL' : "'".$this->db->escape($this->subject)."'").",";
Expand Down Expand Up @@ -568,6 +567,13 @@ public function create($user, $notrigger = 0)
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX."ticket");
}

// Assign user if defined
BenjaminFlr marked this conversation as resolved.
Show resolved Hide resolved
if ($this->fk_user_assign > 0 && !$error) {
if ($this->assignUser($user, $this->fk_user_assign, $notrigger) < 0) {
$error++;
}
}

if (!$error && !empty($conf->global->TICKET_ADD_AUTHOR_AS_CONTACT)) {
// add creator as contributor
if ($this->add_contact($user->id, 'CONTRIBUTOR', 'internal') < 0) {
Expand Down