2012-01-25 Sergio Martin <sergio.martin@artica.es>
* include/functions_incidents.php operation/integria_incidents/incident.incident.php operation/integria_incidents/incident.php: Fixed some bugs of the Integria IMS integration git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@5422 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f
This commit is contained in:
parent
dddee2d983
commit
40675f1e59
|
@ -1,3 +1,10 @@
|
|||
2012-01-25 Sergio Martin <sergio.martin@artica.es>
|
||||
|
||||
* include/functions_incidents.php
|
||||
operation/integria_incidents/incident.incident.php
|
||||
operation/integria_incidents/incident.php: Fixed some bugs
|
||||
of the Integria IMS integration
|
||||
|
||||
2012-01-25 Junichi Satoh <junichi@rworks.jp>
|
||||
|
||||
* godmode/menu.php, godmode/alerts/alert_special_days.php,
|
||||
|
|
|
@ -442,7 +442,7 @@ function incidents_call_api($url, $postparameters = false) {
|
|||
* @return array A Json encoded array with xml content.
|
||||
*/
|
||||
function incidents_xml_to_array($xml) {
|
||||
$xmlObj = simplexml_load_string($xml);
|
||||
$xmlObj = simplexml_load_string($xml, null, LIBXML_NOCDATA);
|
||||
return json_decode(json_encode($xmlObj), true);
|
||||
}
|
||||
|
||||
|
|
|
@ -48,6 +48,10 @@ if (isset ($result_users['id_user'])) {
|
|||
$users[$usr] = $usr;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$users[$config['id_user']] = $config['id_user'];
|
||||
|
||||
}
|
||||
if(!isset($result['id_incidencia'])) {
|
||||
$result['titulo'] = '';
|
||||
$result['sla_disabled'] = 0;
|
||||
|
@ -124,7 +128,7 @@ if(isset($result['id_incidencia'])) {
|
|||
echo "</form>";
|
||||
}
|
||||
else {
|
||||
echo "<form method='post' action=''>";
|
||||
echo "<form method='post' action='index.php?login=1&sec=incidencias&sec2=operation/integria_incidents/incident&tab=incident'>";
|
||||
html_print_table($table);
|
||||
html_print_submit_button(__('Create'), 'submit_button');
|
||||
html_print_input_hidden('tab', 'incident');
|
||||
|
|
|
@ -30,6 +30,48 @@ $id_incident = get_parameter('id_incident', 0);
|
|||
// We choose a strange token to use texts with commas, etc.
|
||||
$token = ';,;';
|
||||
|
||||
$update_incident = get_parameter('update_incident', 0);
|
||||
|
||||
$integria_api = $config['integria_url']."/include/api.php?return_type=xml&user=".$config['id_user']."&pass=".$config['integria_api_password'];
|
||||
|
||||
if($update_incident == 1) {
|
||||
$values[0] = $id_incident;
|
||||
$values[1] = str_replace(" ", "%20", io_safe_output(get_parameter('title')));
|
||||
$values[2] = str_replace(" ", "%20", io_safe_output(get_parameter('description')));
|
||||
$values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('epilog')));
|
||||
$values[4] = get_parameter('group');
|
||||
$values[5] = get_parameter('priority');
|
||||
$values[6] = get_parameter('source');
|
||||
$values[7] = get_parameter('resolution');
|
||||
$values[8] = get_parameter('status');
|
||||
$values[9] = get_parameter('creator', get_parameter('creator_fix'));
|
||||
|
||||
$params = implode($token, $values);
|
||||
|
||||
$url = $integria_api."&op=update_incident&token=".$token."¶ms=".$params;
|
||||
// Call the integria API
|
||||
$result = incidents_call_api($url);
|
||||
}
|
||||
|
||||
$create_incident = get_parameter('create_incident', 0);
|
||||
|
||||
if($create_incident == 1) {
|
||||
$values[0] = str_replace(" ", "%20", io_safe_output(get_parameter('title')));
|
||||
$values[1] = get_parameter('group');
|
||||
$values[2] = get_parameter('priority');
|
||||
$values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('description')));
|
||||
$values[4] = $config['integria_inventory'];
|
||||
|
||||
$params = implode($token, $values);
|
||||
|
||||
$url = $integria_api."&op=create_incident&token=".$token."¶ms=".$params;
|
||||
|
||||
// Call the integria API
|
||||
$result = incidents_xml_to_array(incidents_call_api($url));
|
||||
|
||||
$id_incident = $result['data'];
|
||||
}
|
||||
|
||||
// Header
|
||||
if($tab == 'list' || $tab == 'editor') {
|
||||
$buttons = array(
|
||||
|
@ -70,46 +112,6 @@ $buttons[$tab]['active'] = true;
|
|||
|
||||
ui_print_page_header (__('Incident management'), "images/book_edit.png", false, "", false, $buttons);
|
||||
|
||||
$update_incident = get_parameter('update_incident', 0);
|
||||
|
||||
$integria_api = $config['integria_url']."/include/api.php?return_type=xml&user=".$config['id_user']."&pass=".$config['integria_api_password'];
|
||||
|
||||
if($update_incident == 1) {
|
||||
$values[0] = $id_incident;
|
||||
$values[1] = str_replace(" ", "%20", io_safe_output(get_parameter('title')));
|
||||
$values[2] = str_replace(" ", "%20", io_safe_output(get_parameter('description')));
|
||||
$values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('epilog')));
|
||||
$values[4] = get_parameter('group');
|
||||
$values[5] = get_parameter('priority');
|
||||
$values[6] = get_parameter('source');
|
||||
$values[7] = get_parameter('resolution');
|
||||
$values[8] = get_parameter('status');
|
||||
$values[9] = get_parameter('creator', get_parameter('creator_fix'));
|
||||
|
||||
$params = implode($token, $values);
|
||||
|
||||
$url = $integria_api."&op=update_incident&token=".$token."¶ms=".$params;
|
||||
// Call the integria API
|
||||
$result = incidents_call_api($url);
|
||||
}
|
||||
|
||||
$create_incident = get_parameter('create_incident', 0);
|
||||
|
||||
if($create_incident == 1) {
|
||||
$values[0] = str_replace(" ", "%20", io_safe_output(get_parameter('title')));
|
||||
$values[1] = get_parameter('group');
|
||||
$values[2] = get_parameter('priority');
|
||||
$values[3] = str_replace(" ", "%20", io_safe_output(get_parameter('description')));
|
||||
$values[4] = $config['integria_inventory'];
|
||||
|
||||
$params = implode($token, $values);
|
||||
|
||||
$url = $integria_api."&op=create_incident&token=".$token."¶ms=".$params;
|
||||
|
||||
// Call the integria API
|
||||
$result = incidents_call_api($url);
|
||||
}
|
||||
|
||||
$attach_file = get_parameter('attach_file', 0);
|
||||
|
||||
if($attach_file == 1) {
|
||||
|
|
Loading…
Reference in New Issue