5 * Copyright 2010-2011, Franck Villaume - Capgemini
6 * Copyright 2012, Franck Villaume - TrivialDev
7 * http://fusionforge.org
9 * This file is part of FusionForge. FusionForge is free software;
10 * you can redistribute it and/or modify it under the terms of the
11 * GNU General Public License as published by the Free Software
12 * Foundation; either version 2 of the Licence, or (at your option)
15 * FusionForge is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with FusionForge; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
34 $defect['category'] = getStringFromRequest('categorie');
35 $defect['project']['id'] = $mantisbtConf['id_mantisbt'];
38 $clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
39 $listSeverities = $clientSOAP->__soapCall('mc_enum_severities', array("username" => $username, "password" => $password));
40 $listReproducibilities = $clientSOAP->__soapCall('mc_enum_reproducibilities', array("username" => $username, "password" => $password));
41 $listUsers = $clientSOAP->__soapCall('mc_project_get_users', array("username" => $username, "password" => $password, "project_id" => $mantisbtConf['id_mantisbt'], "acces" => 10));
42 $listViewStates = $clientSOAP->__soapCall('mc_enum_view_states', array("username" => $username, "password" => $password));
43 $listPriorities = $clientSOAP->__soapCall('mc_enum_priorities', array("username" => $username, "password" => $password));
44 $listResolutions= $clientSOAP->__soapCall('mc_enum_resolutions', array("username" => $username, "password" => $password));
45 $listStatus= $clientSOAP->__soapCall('mc_enum_status', array("username" => $username, "password" => $password));
46 } catch (SoapFault $soapFault) {
47 $error_msg = _('Task failed')._(': ').$soapFault->faultstring;
48 session_redirect('plugins/mantisbt/?type='.$type.'&group_id='.$group_id.'&pluginname=mantisbt&view=viewIssues&error_msg='.urlencode($feedback));
50 foreach($listSeverities as $key => $severity){
51 if (getStringFromRequest('severite') == $severity->name){
52 $defect['severity']['id'] = $severity->id;
53 $defect['severity']['name'] = $severity->name;
58 foreach($listReproducibilities as $key => $reproducibility){
59 if (getStringFromRequest('reproductibilite') == $reproducibility->name){
60 $defect['reproducibility']['id'] = $reproducibility->id;
61 $defect['reproducibility']['name'] = $reproducibility->name;
66 foreach($listUsers as $key => $mantisuser){
67 if ($username == $mantisuser->name){
68 $defect['reporter']['id'] = $mantisuser->id;
69 $defect['reporter']['name'] = $mantisuser->name;
70 $defect['reporter']['email'] = $mantisuser->email;
75 foreach($listViewStates as $key => $viewState){
76 if ($viewState->id == 10){
77 $defect['view_state']['id'] = $viewState->id;
78 $defect['view_state']['name'] = $viewState->name;
83 if (getStringFromRequest('handler') != ''){
84 $listUsers = $clientSOAP->__soapCall('mc_project_get_users', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis, "acces" => 10));
85 foreach($listUsers as $key => $mantisuser){
86 if (getStringFromRequest('handler') == $mantisuser->name){
87 $defect['handler']['id'] = $mantisuser->id;
88 $defect['handler']['name'] = $mantisuser->name;
89 $defect['handler']['email'] = $mantisuser->email;
95 foreach($listPriorities as $key => $priority){
96 if (getStringFromRequest('priorite') == $priority->name){
97 $defect['priority']['id'] = $priority->id;
98 $defect['priority']['name'] = $priority->name;
103 foreach($listResolutions as $key => $resolution){
104 if ($resolution->id == 10){
105 $defect['resolution']['id'] = $resolution->id;
106 $defect['resolution']['name'] = $resolution->name;
111 foreach($listStatus as $key => $status){
112 if ($status->id == 10){ // status nouveau
113 $defect['status']['id'] = $status->id;
114 $defect['status']['name'] = $status->name;
119 $defect['description'] = getStringFromRequest('description');
120 $defect['summary'] = getStringFromRequest('resume');
121 $defect['additional_information'] = getStringFromRequest('informations');
122 $defect['version'] = getStringFromRequest('version');
125 $newIdBug = $clientSOAP->__soapCall('mc_issue_add', array("username" => $username, "password" => $password, "issue" => $defect));
126 $feedback = _('Ticket '.$newIdBug.' created successfully.');
127 session_redirect('plugins/mantisbt/?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&idBug='.$newIdBug.'&view=viewIssue&feedback='.urlencode($feedback));
128 } catch (SoapFault $soapFault) {
129 $error_msg = _('Task failed')._(': ').$soapFault->faultstring;
130 session_redirect('plugins/mantisbt/?type='.$type.'&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($error_msg));