From af0bf77d0d7cffdc7503ad9bba6de4e11fcc73f4 Mon Sep 17 00:00:00 2001 From: thomas-Ngr Date: Thu, 12 Oct 2023 15:38:05 +0200 Subject: [PATCH] fix duplicate ticket information (#26199) * FIX duplicate data on ticket creation: fk_user_create * Light code format on ticket/card.php --- htdocs/ticket/card.php | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/htdocs/ticket/card.php b/htdocs/ticket/card.php index 3c38b7fa6d1..90294c356ca 100755 --- a/htdocs/ticket/card.php +++ b/htdocs/ticket/card.php @@ -226,28 +226,32 @@ if (empty($reshook)) { $object->ref = $getRef; } - $object->fk_soc = $object->socid = GETPOST("socid", 'int') > 0 ? GETPOST("socid", 'int') : 0; - $object->subject = GETPOST("subject", 'alphanohtml'); - $object->message = GETPOST("message", 'restricthtml'); + $object->fk_soc = $object->socid = GETPOST("socid", 'int') > 0 ? GETPOST("socid", 'int') : 0; + $object->subject = GETPOST("subject", 'alphanohtml'); + $object->message = GETPOST("message", 'restricthtml'); - $object->type_code = GETPOST("type_code", 'alpha'); - $object->type_label = $langs->trans($langs->getLabelFromKey($db, $object->type_code, 'c_ticket_type', 'code', 'label')); - $object->category_code = GETPOST("category_code", 'alpha'); - $object->category_label = $langs->trans($langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label')); - $object->severity_code = GETPOST("severity_code", 'alpha'); - $object->severity_label = $langs->trans($langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label')); - $object->email_from = $user->email; - $object->origin_email = null; - $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); - $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1; - $fk_user_assign = GETPOST("fk_user_assign", 'int'); + $object->type_code = GETPOST("type_code", 'alpha'); + $object->type_label = $langs->trans($langs->getLabelFromKey($db, $object->type_code, 'c_ticket_type', 'code', 'label')); + $object->category_code = GETPOST("category_code", 'alpha'); + $object->category_label = $langs->trans($langs->getLabelFromKey($db, $object->category_code, 'c_ticket_category', 'code', 'label')); + $object->severity_code = GETPOST("severity_code", 'alpha'); + $object->severity_label = $langs->trans($langs->getLabelFromKey($db, $object->severity_code, 'c_ticket_severity', 'code', 'label')); + $object->fk_user_create = $user->id; + $object->email_from = $user->email; + $object->origin_email = null; + + $notifyTiers = GETPOST("notify_tiers_at_create", 'alpha'); + $object->notify_tiers_at_create = empty($notifyTiers) ? 0 : 1; + + $fk_user_assign = GETPOST("fk_user_assign", 'int'); if ($fk_user_assign > 0) { - $object->fk_user_assign = $fk_user_assign; - $object->status = $object::STATUS_ASSIGNED; + $object->fk_user_assign = $fk_user_assign; + $object->status = $object::STATUS_ASSIGNED; } - $object->fk_project = $projectid; - $object->fk_contract = GETPOST('fk_contract', 'int'); + $object->fk_project = $projectid; + $object->fk_contract = GETPOST('fk_contract', 'int'); + $id = $object->create($user); if ($id <= 0) {