1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74
|
<?php
/**
* MantisBT plugin
*
* Copyright 2010-2011, Franck Villaume - Capgemini
* Copyright 2012, Franck Villaume - TrivialDev
* http://fusionforge.org
*
* This file is part of FusionForge. FusionForge is free software;
* you can redistribute it and/or modify it under the terms of the
* GNU General Public License as published by the Free Software
* Foundation; either version 2 of the Licence, or (at your option)
* any later version.
*
* FusionForge is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with FusionForge; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
global $mantisbt;
global $mantisbtConf;
global $username;
global $password;
global $group_id;
/* addVersion action page */
$version = getStringFromRequest('version');
if (!empty($version)) {
$versionStruct = array();
$versionStruct['name'] = $version;
$versionStruct['project_id'] = $mantisbtConf['id_mantisbt'];
$versionStruct['released'] = 0;
$versionStruct['description'] = getStringFromRequest('description');
$versionStruct['date_order'] = '';
try {
if (!isset($clientSOAP))
$clientSOAP = new SoapClient($mantisbtConf['url']."/api/soap/mantisconnect.php?wsdl", array('trace'=>true, 'exceptions'=>true));
$clientSOAP->__soapCall('mc_project_version_add', array("username" => $username, "password" => $password, "version" => $versionStruct));
// currently transverse is not implemented... need to rely on projects-hierarchy plugin.
// if (isset($_POST['transverse'])) {
// $listChild = $clientSOAP->__soapCall('mc_project_get_all_subprojects', array("username" => $username, "password" => $password, "project_id" => $idProjetMantis));
// foreach ($listChild as $key => $child) {
// $listVersions = $clientSOAP->__soapCall('mc_project_get_versions', array("username" => $username, "password" => $password, "project_id" => $child));
// $todo = 1;
// foreach ($listVersions as $key => $version ) {
// if ($version->name == $versionStruct['name'])
// $todo = 0;
// }
// if ($todo) {
// try {
// $versionStruct['project_id'] = $child;
// $clientSOAP->__soapCall('mc_project_version_add', array("username" => $username, "password" => $password, "version" => $versionStruct));
// } catch (SoapFault $soapFault) {
// $msg = _('Task failed')._(': ').$versionStruct['name'].' '.$soapFault->faultstring;
// session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($msg));
// }
// }
// }
// }
} catch (SoapFault $soapFault) {
$msg = _('Task failed')._(': ').$versionStruct['name'].' '.$soapFault->faultstring;
session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&error_msg='.urlencode($msg));
}
$feedback = _('Task succeeded.');
session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&feedback='.urlencode($feedback));
}
$warning_msg = _('Missing version.');
session_redirect('plugins/mantisbt/?type=admin&group_id='.$group_id.'&pluginname='.$mantisbt->name.'&warning_msg='.urlencode($warning_msg));
|