FIX Ticket - Duplicate field project when we create ticket from project

This commit is contained in:
Alexandre SPANGARO 2021-10-30 22:49:32 +02:00
parent 181991ee47
commit 54b81312b5
2 changed files with 26 additions and 17 deletions

View File

@ -2,10 +2,11 @@
/* Copyright (C) 2013-2015 Jean-François FERRY <hello@librethic.io> /* Copyright (C) 2013-2015 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr> * Copyright (C) 2019 Frédéric France <frederic.france@netlogic.fr>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
@ -351,13 +352,14 @@ class FormTicket
} }
} }
if (!empty($conf->projet->enabled) && !$this->ispublic) if($subelement != 'project') {
{ if (!empty($conf->projet->enabled) && !$this->ispublic) {
$formproject = new FormProjets($this->db); $formproject = new FormProjets($this->db);
print '<tr><td><label for="project"><span class="">' . $langs->trans("Project") . '</span></label></td><td>'; print '<tr><td><label for="project"><span class="">' . $langs->trans("Project") . '</span></label></td><td>';
print $formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500'); print $formproject->select_projects(-1, GETPOST('projectid', 'int'), 'projectid', 0, 0, 1, 1, 0, 0, 0, '', 0, 0, 'maxwidth500');
print '</td></tr>'; print '</td></tr>';
} }
}
// Attached files // Attached files
if (!empty($this->withfile)) { if (!empty($this->withfile)) {

View File

@ -2,6 +2,7 @@
/* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io> /* Copyright (C) 2013-2016 Jean-François FERRY <hello@librethic.io>
* Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr> * Copyright (C) 2016 Christophe Battarel <christophe@altairis.fr>
* Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2018 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2021 Alexandre Spangaro <aspangaro@open-dsi.fr>
* *
* This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
@ -192,9 +193,15 @@ if (empty($reshook)) {
$result = $object->add_contact($contactid, GETPOST("type"), 'external'); $result = $object->add_contact($contactid, GETPOST("type"), 'external');
} }
// altairis: link ticket to project // Link ticket to project
if (GETPOST('projectid') > 0) { if(GETPOST('origin', 'alpha') == 'projet') {
$object->setProject(GETPOST('projectid')); $projectid = GETPOST('originid', 'int');
} else {
$projectid = GETPOST('projectid', 'int');
}
if ($projectid > 0) {
$object->setProject($projectid);
} }
// Auto assign user // Auto assign user