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.
31 /* addVersion action page */
32 $version = getStringFromRequest('version');
33 if (!empty($version)) {
34 $versionStruct = array();
35 $versionStruct['name'] = $version;
36 $versionStruct['project_id'] = $mantisbtConf['id_mantisbt'];
37 $versionStruct['released'] = 0;
38 $versionStruct['description'] = getStringFromRequest('description');
39 $versionStruct['date_order'] = '';
41 if (!isset($clientSOAP))
42 $clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
44 $clientSOAP->__soapCall('mc_project_version_add', array("username" => $username, "password" => $password, "version" => $versionStruct));
45 // currently transverse is not implemented... need to rely on projects-hierarchy plugin.
46 // if (isset($_POST['transverse'])) {
47 // $listChild = $clientSOAP->__soapCall('mc_project_get_all_subprojects', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis));
48 // foreach ($listChild as $key => $child) {
49 // $listVersions = $clientSOAP->__soapCall('mc_project_get_versions', array("username" => $username, "password" => $password, "project_id" => $child));
51 // foreach ($listVersions as $key => $version ) {
52 // if ($version->name == $versionStruct['name'])
57 // $versionStruct['project_id'] = $child;
58 // $clientSOAP->__soapCall('mc_project_version_add', array("username" => $username, "password" => $password, "version" => $versionStruct));
59 // } catch (SoapFault $soapFault) {
60 // $msg = _('Task failed')._(': ').$versionStruct['name'].' '.$soapFault->faultstring;
61 // session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($msg));
66 } catch (SoapFault $soapFault) {
67 $msg = _('Task failed')._(': ').$versionStruct['name'].' '.$soapFault->faultstring;
68 session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($msg));
70 $feedback = _('Task succeeded.');
71 session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&feedback='.urlencode($feedback));
73 $warning_msg = _('Missing version.');
74 session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&warning_msg='.urlencode($warning_msg));