76
.github/ISSUE_TEMPLATE/bug_report.md
vendored
76
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -1,38 +1,38 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Describe the bug**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behavior:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behavior**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**Desktop (please complete the following information):**
|
||||
- OS: [e.g. iOS]
|
||||
- Browser [e.g. chrome, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Smartphone (please complete the following information):**
|
||||
- Device: [e.g. iPhone6]
|
||||
- OS: [e.g. iOS8.1]
|
||||
- Browser [e.g. stock browser, safari]
|
||||
- Version [e.g. 22]
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
|
||||
40
.github/ISSUE_TEMPLATE/feature_request.md
vendored
40
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@@ -1,20 +1,20 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
<?php
|
||||
if (strpos($_SERVER['PHP_SELF'], "asynchronousdatas.php")) {
|
||||
$AJAX_INCLUDE = 1;
|
||||
define('GLPI_ROOT', '../../..');
|
||||
include (GLPI_ROOT."/inc/includes.php");
|
||||
Html::header_nocache();
|
||||
}
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
die("Can not access directly to this file");
|
||||
}
|
||||
|
||||
include_once dirname(__FILE__)."/../inc/crontaskaction.class.php";
|
||||
if (isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS') {
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Methods: POST");
|
||||
header("Access-Control-Allow-Headers: Content-Type");
|
||||
} else {
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Content-Type: application/json; charset=UTF-8");
|
||||
|
||||
if (isset($_SERVER['REQUEST_METHOD'])) {
|
||||
switch ($_SERVER['REQUEST_METHOD']) {
|
||||
case 'POST' :
|
||||
$request_body = file_get_contents('php://input');
|
||||
$datas = json_decode($request_body, true);
|
||||
|
||||
$asyncdata = new PluginProcessmakerCrontaskaction;
|
||||
if (isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA) {
|
||||
$initialdatas = json_decode($asyncdata->fields['postdata'], true);
|
||||
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] );
|
||||
$postdata = json_encode($initialdatas, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
|
||||
$asyncdata->update( [ 'id' => $datas['id'], 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'postdata' => $postdata ] );
|
||||
$ret = [ 'code' => '0', 'message' => 'Done' ];
|
||||
} else {
|
||||
$ret = [ 'code' => '2', 'message' => 'Case is not existing, or state is not WAITING_DATA' ];
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
$ret = [ 'code' => '1', 'message' => 'Method '.$_SERVER['REQUEST_METHOD'].' not supported' ];
|
||||
}
|
||||
|
||||
echo json_encode( $ret, JSON_HEX_APOS | JSON_HEX_QUOT );
|
||||
|
||||
}
|
||||
}
|
||||
<?php
|
||||
if (strpos($_SERVER['PHP_SELF'], "asynchronousdatas.php")) {
|
||||
$AJAX_INCLUDE = 1;
|
||||
define('GLPI_ROOT', '../../..');
|
||||
include (GLPI_ROOT."/inc/includes.php");
|
||||
Html::header_nocache();
|
||||
}
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
die("Can not access directly to this file");
|
||||
}
|
||||
|
||||
include_once dirname(__FILE__)."/../inc/crontaskaction.class.php";
|
||||
if (isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS') {
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Methods: POST");
|
||||
header("Access-Control-Allow-Headers: Content-Type");
|
||||
} else {
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Content-Type: application/json; charset=UTF-8");
|
||||
|
||||
if (isset($_SERVER['REQUEST_METHOD'])) {
|
||||
switch ($_SERVER['REQUEST_METHOD']) {
|
||||
case 'POST' :
|
||||
$request_body = file_get_contents('php://input');
|
||||
$datas = json_decode($request_body, true);
|
||||
|
||||
$asyncdata = new PluginProcessmakerCrontaskaction;
|
||||
if (isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA) {
|
||||
$initialdatas = json_decode($asyncdata->fields['postdata'], true);
|
||||
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] );
|
||||
$postdata = json_encode($initialdatas, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
|
||||
$asyncdata->update( [ 'id' => $datas['id'], 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'postdata' => $postdata ] );
|
||||
$ret = [ 'code' => '0', 'message' => 'Done' ];
|
||||
} else {
|
||||
$ret = [ 'code' => '2', 'message' => 'Case is not existing, or state is not WAITING_DATA' ];
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
$ret = [ 'code' => '1', 'message' => 'Method '.$_SERVER['REQUEST_METHOD'].' not supported' ];
|
||||
}
|
||||
|
||||
echo json_encode( $ret, JSON_HEX_APOS | JSON_HEX_QUOT );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,89 +1,89 @@
|
||||
<?php
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Original Author of file: Olivier Moron
|
||||
// Purpose of file: to return list of processes which can be started by end-user
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Direct access to file
|
||||
if (strpos($_SERVER['PHP_SELF'], "dropdownProcesses.php")) {
|
||||
include ("../../../inc/includes.php");
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
Html::header_nocache();
|
||||
}
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
die("Can not access directly to this file");
|
||||
}
|
||||
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
if (isset($_REQUEST["entity_restrict"])
|
||||
&& !is_array($_REQUEST["entity_restrict"])
|
||||
&& (substr($_REQUEST["entity_restrict"], 0, 1) === '[')
|
||||
&& (substr($_REQUEST["entity_restrict"], -1) === ']')) {
|
||||
$_REQUEST["entity_restrict"] = json_decode($_REQUEST["entity_restrict"]);
|
||||
$_REQUEST["entity_restrict"] = $_REQUEST["entity_restrict"][0];
|
||||
}
|
||||
|
||||
// Security
|
||||
if (!($item = getItemForItemtype($_REQUEST['itemtype']))) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$one_item = -1;
|
||||
if (isset($_POST['_one_id'])) {
|
||||
$one_item = $_POST['_one_id'];
|
||||
}
|
||||
// Count real items returned
|
||||
$count = 0;
|
||||
|
||||
if (!isset($_REQUEST['emptylabel']) || ($_REQUEST['emptylabel'] == '')) {
|
||||
$_REQUEST['emptylabel'] = Dropdown::EMPTY_VALUE;
|
||||
}
|
||||
|
||||
$search="";
|
||||
if (!empty($_REQUEST['searchText'])) {
|
||||
$search = ['LIKE', Search::makeTextSearchValue($_REQUEST['searchText'])];
|
||||
}
|
||||
|
||||
$processes = [];
|
||||
|
||||
// Empty search text : display first
|
||||
if (empty($_REQUEST['searchText'])) {
|
||||
if ($_REQUEST['display_emptychoice']) {
|
||||
if (($one_item < 0) || ($one_item == 0)) {
|
||||
array_push($processes, ['id' => 0,
|
||||
'text' => $_REQUEST['emptylabel']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$processall = (isset($_REQUEST['specific_tags']['process_restrict']) && !$_REQUEST['specific_tags']['process_restrict']);
|
||||
$count_cases_per_item = isset($_REQUEST['specific_tags']['count_cases_per_item']) ? $_REQUEST['specific_tags']['count_cases_per_item'] : [];
|
||||
|
||||
$result = PluginProcessmakerProcess::getSqlSearchResult(false, $search);
|
||||
|
||||
//if ($DB->numrows($result)) {
|
||||
// while ($data = $DB->fetch_array($result)) {
|
||||
//if ($result->numrows()) {
|
||||
foreach ($result as $data) {
|
||||
$process_entities = PluginProcessmakerProcess::getEntitiesForProfileByProcess($data["id"], $_SESSION['glpiactiveprofile']['id'], true);
|
||||
$can_add = $data['max_cases_per_item'] == 0 || !isset($count_cases_per_item[$data["id"]]) || $count_cases_per_item[$data["id"]] < $data['max_cases_per_item'];
|
||||
if ($processall
|
||||
|| ($data['maintenance'] != 1
|
||||
&& in_array( $_REQUEST["entity_restrict"], $process_entities)
|
||||
&& $can_add) ) {
|
||||
|
||||
array_push( $processes, ['id' => $data["id"],
|
||||
'text' => $data["name"]
|
||||
]);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
$ret['results'] = $processes;
|
||||
$ret['count'] = $count;
|
||||
echo json_encode($ret);
|
||||
<?php
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
// Original Author of file: Olivier Moron
|
||||
// Purpose of file: to return list of processes which can be started by end-user
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
// Direct access to file
|
||||
if (strpos($_SERVER['PHP_SELF'], "dropdownProcesses.php")) {
|
||||
include ("../../../inc/includes.php");
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
Html::header_nocache();
|
||||
}
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
die("Can not access directly to this file");
|
||||
}
|
||||
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
if (isset($_REQUEST["entity_restrict"])
|
||||
&& !is_array($_REQUEST["entity_restrict"])
|
||||
&& (substr($_REQUEST["entity_restrict"], 0, 1) === '[')
|
||||
&& (substr($_REQUEST["entity_restrict"], -1) === ']')) {
|
||||
$_REQUEST["entity_restrict"] = json_decode($_REQUEST["entity_restrict"]);
|
||||
$_REQUEST["entity_restrict"] = $_REQUEST["entity_restrict"][0];
|
||||
}
|
||||
|
||||
// Security
|
||||
if (!($item = getItemForItemtype($_REQUEST['itemtype']))) {
|
||||
exit();
|
||||
}
|
||||
|
||||
$one_item = -1;
|
||||
if (isset($_POST['_one_id'])) {
|
||||
$one_item = $_POST['_one_id'];
|
||||
}
|
||||
// Count real items returned
|
||||
$count = 0;
|
||||
|
||||
if (!isset($_REQUEST['emptylabel']) || ($_REQUEST['emptylabel'] == '')) {
|
||||
$_REQUEST['emptylabel'] = Dropdown::EMPTY_VALUE;
|
||||
}
|
||||
|
||||
$search="";
|
||||
if (!empty($_REQUEST['searchText'])) {
|
||||
$search = ['LIKE', Search::makeTextSearchValue($_REQUEST['searchText'])];
|
||||
}
|
||||
|
||||
$processes = [];
|
||||
|
||||
// Empty search text : display first
|
||||
if (empty($_REQUEST['searchText'])) {
|
||||
if ($_REQUEST['display_emptychoice']) {
|
||||
if (($one_item < 0) || ($one_item == 0)) {
|
||||
array_push($processes, ['id' => 0,
|
||||
'text' => $_REQUEST['emptylabel']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$processall = (isset($_REQUEST['specific_tags']['process_restrict']) && !$_REQUEST['specific_tags']['process_restrict']);
|
||||
$count_cases_per_item = isset($_REQUEST['specific_tags']['count_cases_per_item']) ? $_REQUEST['specific_tags']['count_cases_per_item'] : [];
|
||||
|
||||
$result = PluginProcessmakerProcess::getSqlSearchResult(false, $search);
|
||||
|
||||
//if ($DB->numrows($result)) {
|
||||
// while ($data = $DB->fetch_array($result)) {
|
||||
//if ($result->numrows()) {
|
||||
foreach ($result as $data) {
|
||||
$process_entities = PluginProcessmakerProcess::getEntitiesForProfileByProcess($data["id"], $_SESSION['glpiactiveprofile']['id'], true);
|
||||
$can_add = $data['max_cases_per_item'] == 0 || !isset($count_cases_per_item[$data["id"]]) || $count_cases_per_item[$data["id"]] < $data['max_cases_per_item'];
|
||||
if ($processall
|
||||
|| ($data['maintenance'] != 1
|
||||
&& in_array( $_REQUEST["entity_restrict"], $process_entities)
|
||||
&& $can_add) ) {
|
||||
|
||||
array_push( $processes, ['id' => $data["id"],
|
||||
'text' => $data["name"]
|
||||
]);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
$ret['results'] = $processes;
|
||||
$ret['count'] = $count;
|
||||
echo json_encode($ret);
|
||||
|
||||
@@ -1,68 +1,68 @@
|
||||
<?php
|
||||
|
||||
//// ----------------------------------------------------------------------
|
||||
//// Original Author of file: Olivier Moron
|
||||
//// Purpose of file: to return list of processes which can be started by end-user
|
||||
//// ----------------------------------------------------------------------
|
||||
|
||||
//// Direct access to file
|
||||
//if (strpos($_SERVER['PHP_SELF'], "dropdownTaskcategories.php")) {
|
||||
// include ("../../../inc/includes.php");
|
||||
// header("Content-Type: text/html; charset=UTF-8");
|
||||
// Html::header_nocache();
|
||||
//}
|
||||
|
||||
//if (!defined('GLPI_ROOT')) {
|
||||
// die("Can not access directly to this file");
|
||||
//}
|
||||
|
||||
|
||||
//Session::checkLoginUser();
|
||||
|
||||
|
||||
//// Security
|
||||
//if (!($item = getItemForItemtype($_REQUEST['itemtype']))) {
|
||||
// exit();
|
||||
//}
|
||||
|
||||
//$one_item = -1;
|
||||
//if (isset($_POST['_one_id'])) {
|
||||
// $one_item = $_POST['_one_id'];
|
||||
//}
|
||||
//// Count real items returned
|
||||
//$count = 0;
|
||||
|
||||
//if (!isset($_REQUEST['emptylabel']) || ($_REQUEST['emptylabel'] == '')) {
|
||||
// $_REQUEST['emptylabel'] = Dropdown::EMPTY_VALUE;
|
||||
//}
|
||||
|
||||
//$search="";
|
||||
//if (!empty($_REQUEST['searchText'])) {
|
||||
// $search = Search::makeTextSearch($_REQUEST['searchText']);
|
||||
//}
|
||||
|
||||
//$taskcategories = array();
|
||||
|
||||
//// Empty search text : display first
|
||||
//if (empty($_REQUEST['searchText'])) {
|
||||
// if ($_REQUEST['display_emptychoice']) {
|
||||
// if (($one_item < 0) || ($one_item == 0)) {
|
||||
// array_push($taskcategories, array('id' => 0,
|
||||
// 'text' => $_REQUEST['emptylabel']));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//$result = PluginProcessmakerTaskCategory::getSqlSearchResult(false, $search);
|
||||
|
||||
//if ($DB->numrows($result)) {
|
||||
// while ($data=$DB->fetch_array($result)) {
|
||||
// array_push( $taskcategories, array( 'id' => $data["id"],
|
||||
// 'text' => $data["name"] ));
|
||||
// $count++;
|
||||
// }
|
||||
//}
|
||||
|
||||
//$ret['results'] = $taskcategories;
|
||||
//$ret['count'] = $count;
|
||||
//echo json_encode($ret);
|
||||
<?php
|
||||
|
||||
//// ----------------------------------------------------------------------
|
||||
//// Original Author of file: Olivier Moron
|
||||
//// Purpose of file: to return list of processes which can be started by end-user
|
||||
//// ----------------------------------------------------------------------
|
||||
|
||||
//// Direct access to file
|
||||
//if (strpos($_SERVER['PHP_SELF'], "dropdownTaskcategories.php")) {
|
||||
// include ("../../../inc/includes.php");
|
||||
// header("Content-Type: text/html; charset=UTF-8");
|
||||
// Html::header_nocache();
|
||||
//}
|
||||
|
||||
//if (!defined('GLPI_ROOT')) {
|
||||
// die("Can not access directly to this file");
|
||||
//}
|
||||
|
||||
|
||||
//Session::checkLoginUser();
|
||||
|
||||
|
||||
//// Security
|
||||
//if (!($item = getItemForItemtype($_REQUEST['itemtype']))) {
|
||||
// exit();
|
||||
//}
|
||||
|
||||
//$one_item = -1;
|
||||
//if (isset($_POST['_one_id'])) {
|
||||
// $one_item = $_POST['_one_id'];
|
||||
//}
|
||||
//// Count real items returned
|
||||
//$count = 0;
|
||||
|
||||
//if (!isset($_REQUEST['emptylabel']) || ($_REQUEST['emptylabel'] == '')) {
|
||||
// $_REQUEST['emptylabel'] = Dropdown::EMPTY_VALUE;
|
||||
//}
|
||||
|
||||
//$search="";
|
||||
//if (!empty($_REQUEST['searchText'])) {
|
||||
// $search = Search::makeTextSearch($_REQUEST['searchText']);
|
||||
//}
|
||||
|
||||
//$taskcategories = array();
|
||||
|
||||
//// Empty search text : display first
|
||||
//if (empty($_REQUEST['searchText'])) {
|
||||
// if ($_REQUEST['display_emptychoice']) {
|
||||
// if (($one_item < 0) || ($one_item == 0)) {
|
||||
// array_push($taskcategories, array('id' => 0,
|
||||
// 'text' => $_REQUEST['emptylabel']));
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
//$result = PluginProcessmakerTaskCategory::getSqlSearchResult(false, $search);
|
||||
|
||||
//if ($DB->numrows($result)) {
|
||||
// while ($data=$DB->fetch_array($result)) {
|
||||
// array_push( $taskcategories, array( 'id' => $data["id"],
|
||||
// 'text' => $data["name"] ));
|
||||
// $count++;
|
||||
// }
|
||||
//}
|
||||
|
||||
//$ret['results'] = $taskcategories;
|
||||
//$ret['count'] = $count;
|
||||
//echo json_encode($ret);
|
||||
|
||||
@@ -1,40 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
if (strpos($_SERVER['PHP_SELF'], "dropdownTicketCategories.php")) {
|
||||
include ("../../../inc/includes.php");
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
Html::header_nocache();
|
||||
} else if (!defined('GLPI_ROOT')) {
|
||||
die("Sorry. You can't access this file directly");
|
||||
}
|
||||
|
||||
$opt['entity'] = $_POST["entity_restrict"] ?? -1;
|
||||
|
||||
if (isset($_POST["condition"])) {
|
||||
$opt['condition'] = $_POST["condition"];
|
||||
}
|
||||
|
||||
$currentcateg = new ITILCategory();
|
||||
$currentcateg->getFromDB($_POST['value']);
|
||||
|
||||
if ($_POST["type"]) {
|
||||
switch ($_POST['type']) {
|
||||
case Ticket::INCIDENT_TYPE :
|
||||
$opt['condition']['is_incident'] = '1';
|
||||
if ($currentcateg->getField('is_incident') == 1) {
|
||||
$opt['value'] = $_POST['value'];
|
||||
}
|
||||
break;
|
||||
|
||||
case Ticket::DEMAND_TYPE:
|
||||
$opt['condition']['is_request'] = '1';
|
||||
if ($currentcateg->getField('is_request') == 1) {
|
||||
$opt['value'] = $_POST['value'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ITILCategory::dropdown($opt);
|
||||
<?php
|
||||
/**
|
||||
*/
|
||||
|
||||
if (strpos($_SERVER['PHP_SELF'], "dropdownTicketCategories.php")) {
|
||||
include ("../../../inc/includes.php");
|
||||
header("Content-Type: text/html; charset=UTF-8");
|
||||
Html::header_nocache();
|
||||
} else if (!defined('GLPI_ROOT')) {
|
||||
die("Sorry. You can't access this file directly");
|
||||
}
|
||||
|
||||
$opt['entity'] = $_POST["entity_restrict"] ?? -1;
|
||||
|
||||
if (isset($_POST["condition"])) {
|
||||
$opt['condition'] = $_POST["condition"];
|
||||
}
|
||||
|
||||
$currentcateg = new ITILCategory();
|
||||
$currentcateg->getFromDB($_POST['value']);
|
||||
|
||||
if ($_POST["type"]) {
|
||||
switch ($_POST['type']) {
|
||||
case Ticket::INCIDENT_TYPE :
|
||||
$opt['condition']['is_incident'] = '1';
|
||||
if ($currentcateg->getField('is_incident') == 1) {
|
||||
$opt['value'] = $_POST['value'];
|
||||
}
|
||||
break;
|
||||
|
||||
case Ticket::DEMAND_TYPE:
|
||||
$opt['condition']['is_request'] = '1';
|
||||
if ($currentcateg->getField('is_request') == 1) {
|
||||
$opt['value'] = $_POST['value'];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
ITILCategory::dropdown($opt);
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<?php
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
@@ -1,87 +1,87 @@
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
$locCase = new PluginProcessmakerCase();
|
||||
|
||||
function glpi_processmaker_case_reload_page() {
|
||||
global $PM_SOAP;
|
||||
// now redirect to item form page
|
||||
$config = $PM_SOAP->config;
|
||||
echo "<html><body><script>";
|
||||
if (isset($config->fields['domain']) && $config->fields['domain'] != '') {
|
||||
echo "document.domain='{$config->fields['domain']}';";
|
||||
}
|
||||
echo "</script><input id='GLPI_FORCE_RELOAD' type='hidden' value='GLPI_FORCE_RELOAD'/></body></html>";
|
||||
}
|
||||
|
||||
|
||||
// check if it is from PM pages
|
||||
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'route' && isset( $_REQUEST['UID'] ) && isset( $_REQUEST['APP_UID'] ) && isset( $_REQUEST['__DynaformName__'] )) {
|
||||
// then get item id from DB
|
||||
if ($locCase->getFromGUID($_REQUEST['APP_UID'])) {
|
||||
$PM_SOAP->derivateCase($locCase, $_REQUEST);
|
||||
}
|
||||
glpi_processmaker_case_reload_page();
|
||||
|
||||
} else if (isset($_REQUEST['purge'])) {
|
||||
// delete case from case table, this will also delete the tasks
|
||||
if ($locCase->getFromDB($_REQUEST['id']) && $locCase->deleteCase()) {
|
||||
Session::addMessageAfterRedirect(__('Case has been deleted!', 'processmaker'), true, INFO);
|
||||
} else {
|
||||
Session::addMessageAfterRedirect(__('Unable to delete case!', 'processmaker'), true, ERROR);
|
||||
}
|
||||
// will redirect to item or to list if no item
|
||||
$locCase->redirectToList();
|
||||
|
||||
} else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'cancel') {
|
||||
// cancel case from PM
|
||||
$locCase = new PluginProcessmakerCase;
|
||||
$locCase->getFromDB($_POST['cases_id']);
|
||||
$resultPM = $PM_SOAP->cancelCase($locCase->fields['case_guid']);
|
||||
if ($resultPM->status_code === 0) {
|
||||
if ($locCase->cancelCase()) {
|
||||
Session::addMessageAfterRedirect(__('Case has been cancelled!', 'processmaker'), true, INFO);
|
||||
} else {
|
||||
Session::addMessageAfterRedirect(__('Unable to cancel case!', 'processmaker'), true, ERROR);
|
||||
}
|
||||
} else {
|
||||
Session::addMessageAfterRedirect(__('Unable to cancel case!', 'processmaker'), true, ERROR);
|
||||
}
|
||||
Html::back();
|
||||
} else if (isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && isset( $_REQUEST['form']['APP_UID'])) {
|
||||
// Claim task management
|
||||
// here we are in a Claim request
|
||||
$myCase = new PluginProcessmakerCase;
|
||||
if ($myCase->getFromGUID( $_REQUEST['form']['APP_UID'] )) {
|
||||
|
||||
$pmClaimCase = $PM_SOAP->claimCase($myCase->fields['case_guid'], $_REQUEST['DEL_INDEX'] );
|
||||
|
||||
// now manage tasks associated with item
|
||||
$PM_SOAP->claimTask($myCase->getID(), $_REQUEST['DEL_INDEX']);
|
||||
}
|
||||
glpi_processmaker_case_reload_page();
|
||||
|
||||
} else if (isset($_REQUEST['id']) && $_REQUEST['id'] > 0) {
|
||||
|
||||
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
|
||||
Html::helpHeader(__('Process cases', 'processmaker'), '', $_SESSION["glpiname"]);
|
||||
} else {
|
||||
Html::header(__('Process cases', 'processmaker'), $_SERVER['PHP_SELF'], "helpdesk", "PluginProcessmakerCase", "cases");
|
||||
}
|
||||
|
||||
if (!$PM_SOAP->config->fields['maintenance']) {
|
||||
if ($locCase->getFromDB($_REQUEST['id'])) {
|
||||
$locCase->display($_REQUEST);
|
||||
}
|
||||
} else {
|
||||
PluginProcessmakerProcessmaker::showUnderMaintenance();
|
||||
}
|
||||
|
||||
Html::footer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
$locCase = new PluginProcessmakerCase();
|
||||
|
||||
function glpi_processmaker_case_reload_page() {
|
||||
global $PM_SOAP;
|
||||
// now redirect to item form page
|
||||
$config = $PM_SOAP->config;
|
||||
echo "<html><body><script>";
|
||||
if (isset($config->fields['domain']) && $config->fields['domain'] != '') {
|
||||
echo "document.domain='{$config->fields['domain']}';";
|
||||
}
|
||||
echo "</script><input id='GLPI_FORCE_RELOAD' type='hidden' value='GLPI_FORCE_RELOAD'/></body></html>";
|
||||
}
|
||||
|
||||
|
||||
// check if it is from PM pages
|
||||
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'route' && isset( $_REQUEST['UID'] ) && isset( $_REQUEST['APP_UID'] ) && isset( $_REQUEST['__DynaformName__'] )) {
|
||||
// then get item id from DB
|
||||
if ($locCase->getFromGUID($_REQUEST['APP_UID'])) {
|
||||
$PM_SOAP->derivateCase($locCase, $_REQUEST);
|
||||
}
|
||||
glpi_processmaker_case_reload_page();
|
||||
|
||||
} else if (isset($_REQUEST['purge'])) {
|
||||
// delete case from case table, this will also delete the tasks
|
||||
if ($locCase->getFromDB($_REQUEST['id']) && $locCase->deleteCase()) {
|
||||
Session::addMessageAfterRedirect(__('Case has been deleted!', 'processmaker'), true, INFO);
|
||||
} else {
|
||||
Session::addMessageAfterRedirect(__('Unable to delete case!', 'processmaker'), true, ERROR);
|
||||
}
|
||||
// will redirect to item or to list if no item
|
||||
$locCase->redirectToList();
|
||||
|
||||
} else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'cancel') {
|
||||
// cancel case from PM
|
||||
$locCase = new PluginProcessmakerCase;
|
||||
$locCase->getFromDB($_POST['cases_id']);
|
||||
$resultPM = $PM_SOAP->cancelCase($locCase->fields['case_guid']);
|
||||
if ($resultPM->status_code === 0) {
|
||||
if ($locCase->cancelCase()) {
|
||||
Session::addMessageAfterRedirect(__('Case has been cancelled!', 'processmaker'), true, INFO);
|
||||
} else {
|
||||
Session::addMessageAfterRedirect(__('Unable to cancel case!', 'processmaker'), true, ERROR);
|
||||
}
|
||||
} else {
|
||||
Session::addMessageAfterRedirect(__('Unable to cancel case!', 'processmaker'), true, ERROR);
|
||||
}
|
||||
Html::back();
|
||||
} else if (isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && isset( $_REQUEST['form']['APP_UID'])) {
|
||||
// Claim task management
|
||||
// here we are in a Claim request
|
||||
$myCase = new PluginProcessmakerCase;
|
||||
if ($myCase->getFromGUID( $_REQUEST['form']['APP_UID'] )) {
|
||||
|
||||
$pmClaimCase = $PM_SOAP->claimCase($myCase->fields['case_guid'], $_REQUEST['DEL_INDEX'] );
|
||||
|
||||
// now manage tasks associated with item
|
||||
$PM_SOAP->claimTask($myCase->getID(), $_REQUEST['DEL_INDEX']);
|
||||
}
|
||||
glpi_processmaker_case_reload_page();
|
||||
|
||||
} else if (isset($_REQUEST['id']) && $_REQUEST['id'] > 0) {
|
||||
|
||||
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
|
||||
Html::helpHeader(__('Process cases', 'processmaker'), '', $_SESSION["glpiname"]);
|
||||
} else {
|
||||
Html::header(__('Process cases', 'processmaker'), $_SERVER['PHP_SELF'], "helpdesk", "PluginProcessmakerCase", "cases");
|
||||
}
|
||||
|
||||
if (!$PM_SOAP->config->fields['maintenance']) {
|
||||
if ($locCase->getFromDB($_REQUEST['id'])) {
|
||||
$locCase->display($_REQUEST);
|
||||
}
|
||||
} else {
|
||||
PluginProcessmakerProcessmaker::showUnderMaintenance();
|
||||
}
|
||||
|
||||
Html::footer();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,34 +1,34 @@
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
Plugin::load('processmaker', true); // ???
|
||||
|
||||
if (!isset($_REQUEST["id"])) {
|
||||
$_REQUEST["id"] = "";
|
||||
}
|
||||
|
||||
$PluginCaselink = new PluginProcessmakerCaselink();
|
||||
|
||||
if (isset($_REQUEST["update"])) {
|
||||
$PluginCaselink->check($_REQUEST['id'], UPDATE);
|
||||
$PluginCaselink->update($_REQUEST);
|
||||
Html::back();
|
||||
} else if (isset($_REQUEST['add'])) {
|
||||
$PluginCaselink->check($_REQUEST['id'], UPDATE);
|
||||
$PluginCaselink->add($_REQUEST);
|
||||
Html::back();
|
||||
} else if (isset($_REQUEST['purge'])) {
|
||||
$PluginCaselink->check($_REQUEST['id'], PURGE);
|
||||
$PluginCaselink->delete($_REQUEST, true);
|
||||
$PluginCaselink->redirectToList();
|
||||
} else {
|
||||
|
||||
Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "tools", "PluginProcessmakerMenu", "caselinks");
|
||||
|
||||
$PluginCaselink->display($_REQUEST);
|
||||
|
||||
Html::footer();
|
||||
}
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
Plugin::load('processmaker', true); // ???
|
||||
|
||||
if (!isset($_REQUEST["id"])) {
|
||||
$_REQUEST["id"] = "";
|
||||
}
|
||||
|
||||
$PluginCaselink = new PluginProcessmakerCaselink();
|
||||
|
||||
if (isset($_REQUEST["update"])) {
|
||||
$PluginCaselink->check($_REQUEST['id'], UPDATE);
|
||||
$PluginCaselink->update($_REQUEST);
|
||||
Html::back();
|
||||
} else if (isset($_REQUEST['add'])) {
|
||||
$PluginCaselink->check($_REQUEST['id'], UPDATE);
|
||||
$PluginCaselink->add($_REQUEST);
|
||||
Html::back();
|
||||
} else if (isset($_REQUEST['purge'])) {
|
||||
$PluginCaselink->check($_REQUEST['id'], PURGE);
|
||||
$PluginCaselink->delete($_REQUEST, true);
|
||||
$PluginCaselink->redirectToList();
|
||||
} else {
|
||||
|
||||
Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "tools", "PluginProcessmakerMenu", "caselinks");
|
||||
|
||||
$PluginCaselink->display($_REQUEST);
|
||||
|
||||
Html::footer();
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "tools", "PluginProcessmakerMenu", "caselinks");
|
||||
|
||||
if (Session::haveRightsOr("plugin_processmaker_config", [READ, UPDATE])) {
|
||||
|
||||
Search::show('PluginProcessmakerCaselink');
|
||||
|
||||
} else {
|
||||
Html::displayRightError();
|
||||
}
|
||||
Html::footer();
|
||||
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "tools", "PluginProcessmakerMenu", "caselinks");
|
||||
|
||||
if (Session::haveRightsOr("plugin_processmaker_config", [READ, UPDATE])) {
|
||||
|
||||
Search::show('PluginProcessmakerCaselink');
|
||||
|
||||
} else {
|
||||
Html::displayRightError();
|
||||
}
|
||||
Html::footer();
|
||||
|
||||
|
||||
@@ -1,21 +1,21 @@
|
||||
<?php
|
||||
|
||||
include ( "../../../inc/includes.php");
|
||||
|
||||
$config = new PluginProcessmakerConfig();
|
||||
if (isset($_POST["update"])) {
|
||||
$config->check($_POST['id'], UPDATE);
|
||||
|
||||
// save
|
||||
$config->update($_POST);
|
||||
|
||||
|
||||
Html::back();
|
||||
|
||||
} else if (isset($_POST["refresh"])) {
|
||||
$config->refresh($_POST); // used to refresh process list, task category list
|
||||
Html::back();
|
||||
}
|
||||
|
||||
Html::redirect($CFG_GLPI["root_doc"]."/front/config.form.php?forcetab=".
|
||||
urlencode('PluginProcessmakerConfig$1'));
|
||||
<?php
|
||||
|
||||
include ( "../../../inc/includes.php");
|
||||
|
||||
$config = new PluginProcessmakerConfig();
|
||||
if (isset($_POST["update"])) {
|
||||
$config->check($_POST['id'], UPDATE);
|
||||
|
||||
// save
|
||||
$config->update($_POST);
|
||||
|
||||
|
||||
Html::back();
|
||||
|
||||
} else if (isset($_POST["refresh"])) {
|
||||
$config->refresh($_POST); // used to refresh process list, task category list
|
||||
Html::back();
|
||||
}
|
||||
|
||||
Html::redirect($CFG_GLPI["root_doc"]."/front/config.form.php?forcetab=".
|
||||
urlencode('PluginProcessmakerConfig$1'));
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
Plugin::load('processmaker', true); // ???
|
||||
|
||||
if (!isset($_REQUEST["id"])) {
|
||||
$_REQUEST["id"] = "";
|
||||
}
|
||||
|
||||
$PluginProcess = new PluginProcessmakerProcess();
|
||||
|
||||
if (isset($_REQUEST["update"])) {
|
||||
$PluginProcess->check($_REQUEST['id'], UPDATE);
|
||||
$PluginProcess->update($_REQUEST);
|
||||
Html::back();
|
||||
|
||||
} else if (isset($_REQUEST["refreshtask"])) {
|
||||
$PluginProcess->check($_REQUEST['id'], UPDATE);
|
||||
$PluginProcess->refreshTasks($_REQUEST);
|
||||
Html::back();
|
||||
|
||||
} else {
|
||||
|
||||
Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "tools", "PluginProcessmakerMenu", "processes");
|
||||
|
||||
$PluginProcess->display($_REQUEST);
|
||||
|
||||
Html::footer();
|
||||
}
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
Plugin::load('processmaker', true); // ???
|
||||
|
||||
if (!isset($_REQUEST["id"])) {
|
||||
$_REQUEST["id"] = "";
|
||||
}
|
||||
|
||||
$PluginProcess = new PluginProcessmakerProcess();
|
||||
|
||||
if (isset($_REQUEST["update"])) {
|
||||
$PluginProcess->check($_REQUEST['id'], UPDATE);
|
||||
$PluginProcess->update($_REQUEST);
|
||||
Html::back();
|
||||
|
||||
} else if (isset($_REQUEST["refreshtask"])) {
|
||||
$PluginProcess->check($_REQUEST['id'], UPDATE);
|
||||
$PluginProcess->refreshTasks($_REQUEST);
|
||||
Html::back();
|
||||
|
||||
} else {
|
||||
|
||||
Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "tools", "PluginProcessmakerMenu", "processes");
|
||||
|
||||
$PluginProcess->display($_REQUEST);
|
||||
|
||||
Html::footer();
|
||||
}
|
||||
|
||||
@@ -1,23 +1,23 @@
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "tools", "PluginProcessmakerMenu", "processes");
|
||||
|
||||
if (Session::haveRightsOr("plugin_processmaker_config", [READ, UPDATE])) {
|
||||
$process=new PluginProcessmakerProcess();
|
||||
|
||||
if (isset( $_REQUEST['refresh'] ) && Session::haveRight("plugin_processmaker_config", UPDATE)) {
|
||||
$process->refresh();
|
||||
Html::back();
|
||||
}
|
||||
|
||||
$process->title();
|
||||
|
||||
Search::show('PluginProcessmakerProcess');
|
||||
|
||||
} else {
|
||||
Html::displayRightError();
|
||||
}
|
||||
Html::footer();
|
||||
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "tools", "PluginProcessmakerMenu", "processes");
|
||||
|
||||
if (Session::haveRightsOr("plugin_processmaker_config", [READ, UPDATE])) {
|
||||
$process=new PluginProcessmakerProcess();
|
||||
|
||||
if (isset( $_REQUEST['refresh'] ) && Session::haveRight("plugin_processmaker_config", UPDATE)) {
|
||||
$process->refresh();
|
||||
Html::back();
|
||||
}
|
||||
|
||||
$process->title();
|
||||
|
||||
Search::show('PluginProcessmakerProcess');
|
||||
|
||||
} else {
|
||||
Html::displayRightError();
|
||||
}
|
||||
Html::footer();
|
||||
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Session::checkCentralAccess();
|
||||
|
||||
$right = new PluginProcessmakerProcess_Profile();
|
||||
|
||||
if (isset($_POST["add"])) {
|
||||
|
||||
$right->check(-1, UPDATE, $_POST);
|
||||
$right->add($_POST);
|
||||
Html::back();
|
||||
}
|
||||
|
||||
Html::displayErrorAndDie("lost");
|
||||
<?php
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Session::checkCentralAccess();
|
||||
|
||||
$right = new PluginProcessmakerProcess_Profile();
|
||||
|
||||
if (isset($_POST["add"])) {
|
||||
|
||||
$right->check(-1, UPDATE, $_POST);
|
||||
$right->add($_POST);
|
||||
Html::back();
|
||||
}
|
||||
|
||||
Html::displayErrorAndDie("lost");
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* casechangelog short summary.
|
||||
*
|
||||
* casechangelog description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCasechangelog extends CommonDBTM {
|
||||
|
||||
static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI, $PM_SOAP;
|
||||
|
||||
$rand = rand();
|
||||
|
||||
$caseHistoryURL = $PM_SOAP->serverURL."/cases/ajaxListener?action=changeLogHistory&rand=$rand";
|
||||
|
||||
$PM_SOAP->echoDomain();
|
||||
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.js'></script>"; //?rand=$rand'
|
||||
|
||||
$iframe = "<iframe
|
||||
id='caseiframe-caseChangeLogHistory'
|
||||
style='border: none;'
|
||||
width='100%'
|
||||
src='$caseHistoryURL'
|
||||
onload=\"onOtherFrameLoad( 'caseChangeLogHistory', 'caseiframe-caseChangeLogHistory', 'body', 0 );\">
|
||||
</iframe>";
|
||||
|
||||
$PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand);
|
||||
|
||||
}
|
||||
|
||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||
return __('Change log', 'processmaker');
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* casechangelog short summary.
|
||||
*
|
||||
* casechangelog description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCasechangelog extends CommonDBTM {
|
||||
|
||||
static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI, $PM_SOAP;
|
||||
|
||||
$rand = rand();
|
||||
|
||||
$caseHistoryURL = $PM_SOAP->serverURL."/cases/ajaxListener?action=changeLogHistory&rand=$rand";
|
||||
|
||||
$PM_SOAP->echoDomain();
|
||||
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.js'></script>"; //?rand=$rand'
|
||||
|
||||
$iframe = "<iframe
|
||||
id='caseiframe-caseChangeLogHistory'
|
||||
style='border: none;'
|
||||
width='100%'
|
||||
src='$caseHistoryURL'
|
||||
onload=\"onOtherFrameLoad( 'caseChangeLogHistory', 'caseiframe-caseChangeLogHistory', 'body', 0 );\">
|
||||
</iframe>";
|
||||
|
||||
$PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand);
|
||||
|
||||
}
|
||||
|
||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||
return __('Change log', 'processmaker');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,86 +1,86 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PluginProcessmakerCasemap short summary.
|
||||
*
|
||||
* casemap description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCasedynaform extends CommonDBTM {
|
||||
|
||||
static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI, $PM_SOAP;
|
||||
|
||||
$config = $PM_SOAP->config;
|
||||
$rand = rand();
|
||||
|
||||
$proj = new PluginProcessmakerProcess;
|
||||
$proj->getFromDB($case->fields['plugin_processmaker_processes_id']);
|
||||
|
||||
$PM_SOAP->echoDomain();
|
||||
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.js'></script>"; //?rand=$rand'
|
||||
|
||||
echo "<script type='text/javascript'>
|
||||
var historyGridListChangeLogGlobal = { viewIdHistory: '', viewIdDin: '', viewDynaformName: '', idHistory: '' } ;
|
||||
var ActionTabFrameGlobal = { tabData: '', tabName: '', tabTitle: '' } ;
|
||||
function urldecode(url) {
|
||||
return decodeURIComponent(url.replace(/\+/g, ' '));
|
||||
}
|
||||
function addTabPanel(name, title, html){
|
||||
//debugger ;
|
||||
var loctabs = $('#tabspanel').next('div[id^=tabs]');
|
||||
if( !loctabs[0].children[name] ) { // panel is not yet existing, create one
|
||||
if( loctabs.find('a[href=\"#'+name+'\"]').length == 0 ) {
|
||||
loctabs.find('ul').append( '<li><a href=\'#' + name + '\'>' + title + '</a></li>' );
|
||||
}
|
||||
$.ajax( { url: '".$PM_SOAP->serverURL."/cases/cases_Open?sid=".$PM_SOAP->getPMSessionID()."&APP_UID={$case->fields['case_guid']}&DEL_INDEX=1&action=TO_DO&glpi_init_case=1&glpi_domain={$config->fields['domain']}',
|
||||
xhrFields: { withCredentials: true },
|
||||
cache: false,
|
||||
crossDomain: true,
|
||||
success: function(jqXHR) {
|
||||
//debugger;
|
||||
loctabs.append( '<div id=\'' + name + '\'>' + html + '</div>');
|
||||
loctabs.tabs('refresh'); // to show the panel
|
||||
var tabIndex = loctabs.find('a[href=\"#'+name+'\"]').parent().index();
|
||||
loctabs.tabs( 'option', 'active', tabIndex) ; // to activate it
|
||||
} });
|
||||
} else { // only activate it
|
||||
var tabIndex = loctabs.find('a[href=\"#'+name+'\"]').parent().index();
|
||||
loctabs.tabs( 'option', 'active', tabIndex) ; // to activate it
|
||||
}
|
||||
}
|
||||
var Actions = { tabFrame: function( actionToDo ) {
|
||||
//debugger ;
|
||||
if( actionToDo.search( '^historyDynaformGridPreview' ) == 0 ) {
|
||||
actionToDo = actionToDo.replace('_', '$') ;
|
||||
var act = actionToDo.replace( '$', '&DYN_UID=') ;
|
||||
addTabPanel( actionToDo,
|
||||
ActionTabFrameGlobal.tabTitle,
|
||||
'<iframe id=\'caseiframe-' + actionToDo + '\' style=\'border: none;\' onload=\'onOtherFrameLoad( \"'+actionToDo+'\", \"caseiframe-' + actionToDo + '\", \"form\", 0 );\' width=\'100%\' src=\'".$PM_SOAP->serverURL."/cases/casesHistoryDynaformPage_Ajax?actionAjax=' + act + '&rand=$rand\' ></iframe>'
|
||||
);
|
||||
}
|
||||
}
|
||||
} ;
|
||||
</script>";
|
||||
|
||||
$caseURL = $PM_SOAP->serverURL."/cases/casesHistoryDynaformPage_Ajax?actionAjax=historyDynaformPage&rand=$rand";
|
||||
|
||||
$iframe = "<iframe
|
||||
id='caseiframe-historyDynaformPage'
|
||||
style='border: none;'
|
||||
width='100%'
|
||||
src='$caseURL'
|
||||
onload=\"onOtherFrameLoad( 'historyDynaformPage', 'caseiframe-historyDynaformPage', 'body', 0 );\">
|
||||
</iframe>";
|
||||
|
||||
$PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand);
|
||||
|
||||
}
|
||||
|
||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||
return __('Dynaforms', 'processmaker');
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PluginProcessmakerCasemap short summary.
|
||||
*
|
||||
* casemap description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCasedynaform extends CommonDBTM {
|
||||
|
||||
static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI, $PM_SOAP;
|
||||
|
||||
$config = $PM_SOAP->config;
|
||||
$rand = rand();
|
||||
|
||||
$proj = new PluginProcessmakerProcess;
|
||||
$proj->getFromDB($case->fields['plugin_processmaker_processes_id']);
|
||||
|
||||
$PM_SOAP->echoDomain();
|
||||
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.js'></script>"; //?rand=$rand'
|
||||
|
||||
echo "<script type='text/javascript'>
|
||||
var historyGridListChangeLogGlobal = { viewIdHistory: '', viewIdDin: '', viewDynaformName: '', idHistory: '' } ;
|
||||
var ActionTabFrameGlobal = { tabData: '', tabName: '', tabTitle: '' } ;
|
||||
function urldecode(url) {
|
||||
return decodeURIComponent(url.replace(/\+/g, ' '));
|
||||
}
|
||||
function addTabPanel(name, title, html){
|
||||
//debugger ;
|
||||
var loctabs = $('#tabspanel').next('div[id^=tabs]');
|
||||
if( !loctabs[0].children[name] ) { // panel is not yet existing, create one
|
||||
if( loctabs.find('a[href=\"#'+name+'\"]').length == 0 ) {
|
||||
loctabs.find('ul').append( '<li><a href=\'#' + name + '\'>' + title + '</a></li>' );
|
||||
}
|
||||
$.ajax( { url: '".$PM_SOAP->serverURL."/cases/cases_Open?sid=".$PM_SOAP->getPMSessionID()."&APP_UID={$case->fields['case_guid']}&DEL_INDEX=1&action=TO_DO&glpi_init_case=1&glpi_domain={$config->fields['domain']}',
|
||||
xhrFields: { withCredentials: true },
|
||||
cache: false,
|
||||
crossDomain: true,
|
||||
success: function(jqXHR) {
|
||||
//debugger;
|
||||
loctabs.append( '<div id=\'' + name + '\'>' + html + '</div>');
|
||||
loctabs.tabs('refresh'); // to show the panel
|
||||
var tabIndex = loctabs.find('a[href=\"#'+name+'\"]').parent().index();
|
||||
loctabs.tabs( 'option', 'active', tabIndex) ; // to activate it
|
||||
} });
|
||||
} else { // only activate it
|
||||
var tabIndex = loctabs.find('a[href=\"#'+name+'\"]').parent().index();
|
||||
loctabs.tabs( 'option', 'active', tabIndex) ; // to activate it
|
||||
}
|
||||
}
|
||||
var Actions = { tabFrame: function( actionToDo ) {
|
||||
//debugger ;
|
||||
if( actionToDo.search( '^historyDynaformGridPreview' ) == 0 ) {
|
||||
actionToDo = actionToDo.replace('_', '$') ;
|
||||
var act = actionToDo.replace( '$', '&DYN_UID=') ;
|
||||
addTabPanel( actionToDo,
|
||||
ActionTabFrameGlobal.tabTitle,
|
||||
'<iframe id=\'caseiframe-' + actionToDo + '\' style=\'border: none;\' onload=\'onOtherFrameLoad( \"'+actionToDo+'\", \"caseiframe-' + actionToDo + '\", \"form\", 0 );\' width=\'100%\' src=\'".$PM_SOAP->serverURL."/cases/casesHistoryDynaformPage_Ajax?actionAjax=' + act + '&rand=$rand\' ></iframe>'
|
||||
);
|
||||
}
|
||||
}
|
||||
} ;
|
||||
</script>";
|
||||
|
||||
$caseURL = $PM_SOAP->serverURL."/cases/casesHistoryDynaformPage_Ajax?actionAjax=historyDynaformPage&rand=$rand";
|
||||
|
||||
$iframe = "<iframe
|
||||
id='caseiframe-historyDynaformPage'
|
||||
style='border: none;'
|
||||
width='100%'
|
||||
src='$caseURL'
|
||||
onload=\"onOtherFrameLoad( 'historyDynaformPage', 'caseiframe-historyDynaformPage', 'body', 0 );\">
|
||||
</iframe>";
|
||||
|
||||
$PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand);
|
||||
|
||||
}
|
||||
|
||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||
return __('Dynaforms', 'processmaker');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,38 +1,38 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* casehistory short summary.
|
||||
*
|
||||
* casehistory description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCasehistory extends CommonDBTM {
|
||||
static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI, $PM_SOAP;
|
||||
|
||||
$rand = rand();
|
||||
|
||||
$caseHistoryURL = $PM_SOAP->serverURL
|
||||
."/cases/ajaxListener?action=caseHistory&rand=$rand";
|
||||
|
||||
$PM_SOAP->echoDomain();
|
||||
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.js'></script>";
|
||||
|
||||
$iframe = "<iframe
|
||||
id='caseiframe-caseHistory'
|
||||
style='border: none;'
|
||||
width='100%'
|
||||
src='$caseHistoryURL'
|
||||
onload=\"onOtherFrameLoad( 'caseHistory', 'caseiframe-caseHistory', 'body', 0 );\">
|
||||
</iframe>";
|
||||
|
||||
$PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand);
|
||||
|
||||
}
|
||||
|
||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||
return __('History', 'processmaker');
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* casehistory short summary.
|
||||
*
|
||||
* casehistory description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCasehistory extends CommonDBTM {
|
||||
static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI, $PM_SOAP;
|
||||
|
||||
$rand = rand();
|
||||
|
||||
$caseHistoryURL = $PM_SOAP->serverURL
|
||||
."/cases/ajaxListener?action=caseHistory&rand=$rand";
|
||||
|
||||
$PM_SOAP->echoDomain();
|
||||
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.js'></script>";
|
||||
|
||||
$iframe = "<iframe
|
||||
id='caseiframe-caseHistory'
|
||||
style='border: none;'
|
||||
width='100%'
|
||||
src='$caseHistoryURL'
|
||||
onload=\"onOtherFrameLoad( 'caseHistory', 'caseiframe-caseHistory', 'body', 0 );\">
|
||||
</iframe>";
|
||||
|
||||
$PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand);
|
||||
|
||||
}
|
||||
|
||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||
return __('History', 'processmaker');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,285 +1,285 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PluginProcessmakerCaselink short summary.
|
||||
*
|
||||
* PluginProcessmakerCaselink description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCaselink extends CommonDBTM {
|
||||
|
||||
static function canCreate() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
static function canView() {
|
||||
return Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE]);
|
||||
}
|
||||
|
||||
static function canUpdate() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
static function canDelete() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
static function canPurge() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
function canUpdateItem() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
function canDeleteItem() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
function canPurgeItem() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
function maybeDeleted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
static function getTypeName($nb = 0) {
|
||||
if ($nb>1) {
|
||||
return __('Case-links', 'processmaker');
|
||||
}
|
||||
return __('Case-link', 'processmaker');
|
||||
}
|
||||
|
||||
function showForm ($ID, $options = ['candel'=>false]) {
|
||||
global $DB, $CFG_GLPI;
|
||||
|
||||
$options['candel'] = true;
|
||||
|
||||
$this->initForm($ID, $options);
|
||||
$this->showFormHeader($options);
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td>".__('Name')."</td><td>";
|
||||
echo "<input size='100' type='text' name='name' value='".Html::cleanInputText($this->fields["name"])."'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Active')."</td><td>";
|
||||
Dropdown::showYesNo("is_active", $this->fields["is_active"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Synchronous', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_synchronous", $this->fields["is_synchronous"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('External data', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_externaldata", $this->fields["is_externaldata"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Self', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_self", $this->fields["is_self"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Source task GUID', 'processmaker')."</td><td>";
|
||||
//PluginProcessmakerTaskCategory::dropdown(array('name' => 'plugin_processmaker_taskcategories_id_source',
|
||||
// 'display_emptychoice' => false,
|
||||
// 'value' => $this->fields['plugin_processmaker_taskcategories_id_source']));
|
||||
echo "<input size='100' type='text' name='sourcetask_guid' value='".$this->fields["sourcetask_guid"]."'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Target task GUID', 'processmaker')."</td><td>";
|
||||
//PluginProcessmakerTaskCategory::dropdown(array('name' => 'plugin_processmaker_taskcategories_id_target',
|
||||
// 'display_emptychoice' => false,
|
||||
// 'value' => $this->fields['plugin_processmaker_taskcategories_id_target']));
|
||||
echo "<input size='100' type='text' name='targettask_guid' value='".$this->fields["targettask_guid"]."'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Target process GUID', 'processmaker')."</td><td>";
|
||||
//Dropdown::show( 'PluginProcessmakerProcess', array('name' => 'plugin_processmaker_processes_id',
|
||||
// 'display_emptychoice' => true,
|
||||
// 'value' => $this->fields['plugin_processmaker_processes_id'],
|
||||
// 'condition' => 'is_active = 1'));
|
||||
echo "<input size='100' type='text' name='targetprocess_guid' value='".$this->fields["targetprocess_guid"]."'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td>".__('Target dynaform GUID', 'processmaker')."</td><td>";
|
||||
echo "<input size='100' type='text' name='targetdynaform_guid' value='".$this->fields["targetdynaform_guid"]."'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td>".__('Source condition', 'processmaker')."</td><td>";
|
||||
//echo "<input size='100' type='text' name='sourcecondition' value='".$this->fields["sourcecondition"]."'>";
|
||||
echo "<textarea cols='100' rows='3' name='sourcecondition' >".$this->fields["sourcecondition"]."</textarea>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Claim target task', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_targettoclaim", $this->fields["is_targettoclaim"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
//echo "<tr class='tab_bg_1'>";
|
||||
//echo "<td >".__('Reassign target task', 'processmaker')."</td><td>";
|
||||
//Dropdown::showYesNo("is_targettoreassign", $this->fields["is_targettoreassign"]);
|
||||
//echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Impersonate target task user', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_targettoimpersonate", $this->fields["is_targettoimpersonate"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td>".__('External application JSON config', 'processmaker')."</td><td>";
|
||||
echo "<textarea cols='100' rows='6' name='externalapplication' >".$this->fields["externalapplication"]."</textarea>";
|
||||
echo "</td></tr>";
|
||||
|
||||
$this->showFormButtons($options );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Summary of rawSearchOptions
|
||||
* @return mixed
|
||||
*/
|
||||
function rawSearchOptions() {
|
||||
$tab = [];
|
||||
|
||||
$tab[] = [
|
||||
'id' => 'common',
|
||||
'name' => __('ProcessMaker', 'processmaker')
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '1',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'name',
|
||||
'name' => __('Name'),
|
||||
'datatype' => 'itemlink',
|
||||
'itemlink_type' => 'PluginProcessmakerCaselink',
|
||||
'massiveaction' => false
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '8',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'is_active',
|
||||
'name' => __('Active'),
|
||||
'massiveaction' => true,
|
||||
'datatype' => 'bool'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '9',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'date_mod',
|
||||
'name' => __('Last update'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'datetime'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '10',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'is_externaldata',
|
||||
'name' => __('External data', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'bool'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '11',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'is_self',
|
||||
'name' => __('Self', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'bool'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '12',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'is_targettoclaim',
|
||||
'name' => __('Claim target task', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'bool'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '13',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'externalapplication',
|
||||
'name' => __('External application JSON config', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '14',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'sourcetask_guid',
|
||||
'name' => __('Source task GUID', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '15',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'targettask_guid',
|
||||
'name' => __('Target task GUID', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '16',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'targetdynaform_guid',
|
||||
'name' => __('Target dynaform GUID', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '17',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'targetprocess_guid',
|
||||
'name' => __('Target process GUID', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '18',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'sourcecondition',
|
||||
'name' => __('Source condition', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
return $tab;
|
||||
}
|
||||
|
||||
|
||||
function prepareInputForUpdate($input) {
|
||||
return Toolbox::unclean_cross_side_scripting_deep($input);
|
||||
}
|
||||
|
||||
|
||||
function prepareInputForAdd($input) {
|
||||
return Toolbox::unclean_cross_side_scripting_deep($input);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PluginProcessmakerCaselink short summary.
|
||||
*
|
||||
* PluginProcessmakerCaselink description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCaselink extends CommonDBTM {
|
||||
|
||||
static function canCreate() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
static function canView() {
|
||||
return Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE]);
|
||||
}
|
||||
|
||||
static function canUpdate() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
static function canDelete() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
static function canPurge() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
function canUpdateItem() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
function canDeleteItem() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
function canPurgeItem() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
function maybeDeleted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
static function getTypeName($nb = 0) {
|
||||
if ($nb>1) {
|
||||
return __('Case-links', 'processmaker');
|
||||
}
|
||||
return __('Case-link', 'processmaker');
|
||||
}
|
||||
|
||||
function showForm ($ID, $options = ['candel'=>false]) {
|
||||
global $DB, $CFG_GLPI;
|
||||
|
||||
$options['candel'] = true;
|
||||
|
||||
$this->initForm($ID, $options);
|
||||
$this->showFormHeader($options);
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td>".__('Name')."</td><td>";
|
||||
echo "<input size='100' type='text' name='name' value='".Html::cleanInputText($this->fields["name"])."'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Active')."</td><td>";
|
||||
Dropdown::showYesNo("is_active", $this->fields["is_active"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Synchronous', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_synchronous", $this->fields["is_synchronous"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('External data', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_externaldata", $this->fields["is_externaldata"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Self', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_self", $this->fields["is_self"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Source task GUID', 'processmaker')."</td><td>";
|
||||
//PluginProcessmakerTaskCategory::dropdown(array('name' => 'plugin_processmaker_taskcategories_id_source',
|
||||
// 'display_emptychoice' => false,
|
||||
// 'value' => $this->fields['plugin_processmaker_taskcategories_id_source']));
|
||||
echo "<input size='100' type='text' name='sourcetask_guid' value='".$this->fields["sourcetask_guid"]."'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Target task GUID', 'processmaker')."</td><td>";
|
||||
//PluginProcessmakerTaskCategory::dropdown(array('name' => 'plugin_processmaker_taskcategories_id_target',
|
||||
// 'display_emptychoice' => false,
|
||||
// 'value' => $this->fields['plugin_processmaker_taskcategories_id_target']));
|
||||
echo "<input size='100' type='text' name='targettask_guid' value='".$this->fields["targettask_guid"]."'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Target process GUID', 'processmaker')."</td><td>";
|
||||
//Dropdown::show( 'PluginProcessmakerProcess', array('name' => 'plugin_processmaker_processes_id',
|
||||
// 'display_emptychoice' => true,
|
||||
// 'value' => $this->fields['plugin_processmaker_processes_id'],
|
||||
// 'condition' => 'is_active = 1'));
|
||||
echo "<input size='100' type='text' name='targetprocess_guid' value='".$this->fields["targetprocess_guid"]."'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td>".__('Target dynaform GUID', 'processmaker')."</td><td>";
|
||||
echo "<input size='100' type='text' name='targetdynaform_guid' value='".$this->fields["targetdynaform_guid"]."'>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td>".__('Source condition', 'processmaker')."</td><td>";
|
||||
//echo "<input size='100' type='text' name='sourcecondition' value='".$this->fields["sourcecondition"]."'>";
|
||||
echo "<textarea cols='100' rows='3' name='sourcecondition' >".$this->fields["sourcecondition"]."</textarea>";
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Claim target task', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_targettoclaim", $this->fields["is_targettoclaim"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
//echo "<tr class='tab_bg_1'>";
|
||||
//echo "<td >".__('Reassign target task', 'processmaker')."</td><td>";
|
||||
//Dropdown::showYesNo("is_targettoreassign", $this->fields["is_targettoreassign"]);
|
||||
//echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Impersonate target task user', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_targettoimpersonate", $this->fields["is_targettoimpersonate"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td>".__('External application JSON config', 'processmaker')."</td><td>";
|
||||
echo "<textarea cols='100' rows='6' name='externalapplication' >".$this->fields["externalapplication"]."</textarea>";
|
||||
echo "</td></tr>";
|
||||
|
||||
$this->showFormButtons($options );
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Summary of rawSearchOptions
|
||||
* @return mixed
|
||||
*/
|
||||
function rawSearchOptions() {
|
||||
$tab = [];
|
||||
|
||||
$tab[] = [
|
||||
'id' => 'common',
|
||||
'name' => __('ProcessMaker', 'processmaker')
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '1',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'name',
|
||||
'name' => __('Name'),
|
||||
'datatype' => 'itemlink',
|
||||
'itemlink_type' => 'PluginProcessmakerCaselink',
|
||||
'massiveaction' => false
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '8',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'is_active',
|
||||
'name' => __('Active'),
|
||||
'massiveaction' => true,
|
||||
'datatype' => 'bool'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '9',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'date_mod',
|
||||
'name' => __('Last update'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'datetime'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '10',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'is_externaldata',
|
||||
'name' => __('External data', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'bool'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '11',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'is_self',
|
||||
'name' => __('Self', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'bool'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '12',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'is_targettoclaim',
|
||||
'name' => __('Claim target task', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'bool'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '13',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'externalapplication',
|
||||
'name' => __('External application JSON config', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '14',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'sourcetask_guid',
|
||||
'name' => __('Source task GUID', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '15',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'targettask_guid',
|
||||
'name' => __('Target task GUID', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '16',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'targetdynaform_guid',
|
||||
'name' => __('Target dynaform GUID', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '17',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'targetprocess_guid',
|
||||
'name' => __('Target process GUID', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
$tab[] = [
|
||||
'id' => '18',
|
||||
'table' => $this->getTable(),
|
||||
'field' => 'sourcecondition',
|
||||
'name' => __('Source condition', 'processmaker'),
|
||||
'massiveaction' => false,
|
||||
'datatype' => 'text'
|
||||
];
|
||||
|
||||
return $tab;
|
||||
}
|
||||
|
||||
|
||||
function prepareInputForUpdate($input) {
|
||||
return Toolbox::unclean_cross_side_scripting_deep($input);
|
||||
}
|
||||
|
||||
|
||||
function prepareInputForAdd($input) {
|
||||
return Toolbox::unclean_cross_side_scripting_deep($input);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PluginProcessmakerCaselinkaction short summary.
|
||||
*
|
||||
* PluginProcessmakerCaselinkaction description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCaselinkaction extends CommonDBTM {
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PluginProcessmakerCaselinkaction short summary.
|
||||
*
|
||||
* PluginProcessmakerCaselinkaction description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCaselinkaction extends CommonDBTM {
|
||||
}
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PluginProcessmakerCasemap short summary.
|
||||
*
|
||||
* casemap description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCasemap extends CommonDBTM {
|
||||
|
||||
static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI, $PM_SOAP;
|
||||
|
||||
$rand = rand();
|
||||
|
||||
$proj = new PluginProcessmakerProcess;
|
||||
$proj->getFromDB($case->fields['plugin_processmaker_processes_id']);
|
||||
$project_type = $proj->fields['project_type'];
|
||||
|
||||
$caseMapUrl = $PM_SOAP->serverURL.(
|
||||
$project_type=='bpmn' ?
|
||||
"/designer?prj_uid=".$proj->fields['process_guid']."&prj_readonly=true&app_uid=".$case->fields['case_guid']
|
||||
:
|
||||
"/cases/ajaxListener?action=processMap"
|
||||
)."&rand=$rand";
|
||||
|
||||
$PM_SOAP->echoDomain();
|
||||
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.js'></script>"; //?rand=$rand'
|
||||
|
||||
$iframe = "<iframe
|
||||
id='caseiframe-caseMap'
|
||||
style='border: none;' width='100%'
|
||||
src='$caseMapUrl'
|
||||
onload=\"onOtherFrameLoad( 'caseMap', 'caseiframe-caseMap', 'body', ".($project_type=='bpmn' ? "true" : "false" )." );\">
|
||||
</iframe>";
|
||||
|
||||
$PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand);
|
||||
|
||||
}
|
||||
|
||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||
return __('Map', 'processmaker');
|
||||
}
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PluginProcessmakerCasemap short summary.
|
||||
*
|
||||
* casemap description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerCasemap extends CommonDBTM {
|
||||
|
||||
static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI, $PM_SOAP;
|
||||
|
||||
$rand = rand();
|
||||
|
||||
$proj = new PluginProcessmakerProcess;
|
||||
$proj->getFromDB($case->fields['plugin_processmaker_processes_id']);
|
||||
$project_type = $proj->fields['project_type'];
|
||||
|
||||
$caseMapUrl = $PM_SOAP->serverURL.(
|
||||
$project_type=='bpmn' ?
|
||||
"/designer?prj_uid=".$proj->fields['process_guid']."&prj_readonly=true&app_uid=".$case->fields['case_guid']
|
||||
:
|
||||
"/cases/ajaxListener?action=processMap"
|
||||
)."&rand=$rand";
|
||||
|
||||
$PM_SOAP->echoDomain();
|
||||
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.js'></script>"; //?rand=$rand'
|
||||
|
||||
$iframe = "<iframe
|
||||
id='caseiframe-caseMap'
|
||||
style='border: none;' width='100%'
|
||||
src='$caseMapUrl'
|
||||
onload=\"onOtherFrameLoad( 'caseMap', 'caseiframe-caseMap', 'body', ".($project_type=='bpmn' ? "true" : "false" )." );\">
|
||||
</iframe>";
|
||||
|
||||
$PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand);
|
||||
|
||||
}
|
||||
|
||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||
return __('Map', 'processmaker');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PluginProcessmakerGlpikey short summary.
|
||||
*
|
||||
* PluginProcessmakerGlpikey description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerGlpikey extends GLPIKey {
|
||||
|
||||
protected $fields = [
|
||||
'glpi_plugin_processmaker_configs.pm_admin_passwd',
|
||||
'glpi_plugin_processmaker_configs.pm_dbserver_passwd',
|
||||
];
|
||||
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PluginProcessmakerGlpikey short summary.
|
||||
*
|
||||
* PluginProcessmakerGlpikey description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author MoronO
|
||||
*/
|
||||
class PluginProcessmakerGlpikey extends GLPIKey {
|
||||
|
||||
protected $fields = [
|
||||
'glpi_plugin_processmaker_configs.pm_admin_passwd',
|
||||
'glpi_plugin_processmaker_configs.pm_dbserver_passwd',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get fields
|
||||
*
|
||||
@@ -22,9 +22,9 @@ class PluginProcessmakerGlpikey extends GLPIKey {
|
||||
*/
|
||||
public function getFields() :array {
|
||||
return $this->fields;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate GLPI security key used for decryptable passwords
|
||||
* and update values in DB if necessary.
|
||||
@@ -43,6 +43,6 @@ class PluginProcessmakerGlpikey extends GLPIKey {
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,133 +1,133 @@
|
||||
<?php
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
die("Sorry. You can't access directly to this file");
|
||||
}
|
||||
|
||||
|
||||
class PluginProcessmakerProfile extends CommonDBTM {
|
||||
|
||||
/**
|
||||
* Summary of getAllRights
|
||||
* @return array[]
|
||||
*/
|
||||
static function getAllRights() {
|
||||
$rights = [
|
||||
['itemtype' => 'PluginProcessmakerConfig',
|
||||
'label' => __('Process configuration', 'processmaker'),
|
||||
'field' => 'plugin_processmaker_config',
|
||||
'rights' => [READ => __('Read'), UPDATE => __('Update')]],
|
||||
['itemtype' => 'PluginProcessmakerConfig',
|
||||
'label' => __('Cases', 'processmaker'),
|
||||
'field' => 'plugin_processmaker_case',
|
||||
'rights' => [READ => __('Read'), CANCEL => __('Cancel', 'processmaker'), DELETE => __('Delete'), ADHOC_REASSIGN => __('Ad Hoc user re-assign', 'processmaker')]]
|
||||
];
|
||||
|
||||
return $rights;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Summary of showForm
|
||||
* @param mixed $ID
|
||||
* @param mixed $openform
|
||||
* @param mixed $closeform
|
||||
* @return bool
|
||||
*/
|
||||
function showForm($ID = 0, $openform = true, $closeform = true) {
|
||||
|
||||
if (!Session::haveRight("profile", READ)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$canedit = Session::haveRight("profile", UPDATE);
|
||||
$prof = new Profile();
|
||||
if ($ID) {
|
||||
$prof->getFromDB($ID);
|
||||
}
|
||||
echo "<form action='".$prof->getFormURL()."' method='post'>";
|
||||
$rights = $this->getAllRights();
|
||||
$prof->displayRightsChoiceMatrix($rights, ['canedit' => $canedit,
|
||||
'default_class' => 'tab_bg_2',
|
||||
'title' => __('ProcessMaker', 'processmaker')]);
|
||||
|
||||
if ($canedit && $closeform) {
|
||||
echo "<div class='center'>";
|
||||
echo Html::hidden('id', ['value' => $ID]);
|
||||
echo Html::submit(_sx('button', 'Save'),
|
||||
['name' => 'update']);
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
||||
Html::closeForm();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary of createAdminAccess
|
||||
* @param mixed $ID
|
||||
*/
|
||||
static function createAdminAccess($ID) {
|
||||
self::addDefaultProfileInfos($ID, ['plugin_processmaker_config' => READ + UPDATE, 'plugin_processmaker_case' => READ + DELETE + CANCEL + ADHOC_REASSIGN], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary of getTabNameForItem
|
||||
* @param CommonGLPI $item
|
||||
* @param mixed $withtemplate
|
||||
* @return string|string[]
|
||||
*/
|
||||
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||
if ($item->getType()=='Profile') {
|
||||
return __('ProcessMaker', 'processmaker');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary of displayTabContentForItem
|
||||
* @param CommonGLPI $item
|
||||
* @param mixed $tabnum
|
||||
* @param mixed $withtemplate
|
||||
* @return bool
|
||||
*/
|
||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI;
|
||||
|
||||
if ($item->getType()=='Profile') {
|
||||
$ID = $item->getID();
|
||||
$prof = new self();
|
||||
self::addDefaultProfileInfos($ID,
|
||||
['plugin_processmaker_config' => 0,
|
||||
'plugin_processmaker_case' => 0
|
||||
]);
|
||||
|
||||
$prof->showForm($ID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $profile
|
||||
**/
|
||||
static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) {
|
||||
global $DB;
|
||||
$dbu = new DbUtils;
|
||||
$profileRight = new ProfileRight();
|
||||
foreach ($rights as $right => $value) {
|
||||
if ($dbu->countElementsInTable('glpi_profilerights', ['AND' => ['profiles_id' => $profiles_id, 'name' => $right]]) && $drop_existing) {
|
||||
$profileRight->deleteByCriteria(['profiles_id' => $profiles_id, 'name' => $right]);
|
||||
}
|
||||
if (!$dbu->countElementsInTable('glpi_profilerights', ['AND' => ['profiles_id' => $profiles_id, 'name' => $right]])) {
|
||||
$myright['profiles_id'] = $profiles_id;
|
||||
$myright['name'] = $right;
|
||||
$myright['rights'] = $value;
|
||||
$profileRight->add($myright);
|
||||
|
||||
//Add right to the current session
|
||||
$_SESSION['glpiactiveprofile'][$right] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
<?php
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
die("Sorry. You can't access directly to this file");
|
||||
}
|
||||
|
||||
|
||||
class PluginProcessmakerProfile extends CommonDBTM {
|
||||
|
||||
/**
|
||||
* Summary of getAllRights
|
||||
* @return array[]
|
||||
*/
|
||||
static function getAllRights() {
|
||||
$rights = [
|
||||
['itemtype' => 'PluginProcessmakerConfig',
|
||||
'label' => __('Process configuration', 'processmaker'),
|
||||
'field' => 'plugin_processmaker_config',
|
||||
'rights' => [READ => __('Read'), UPDATE => __('Update')]],
|
||||
['itemtype' => 'PluginProcessmakerConfig',
|
||||
'label' => __('Cases', 'processmaker'),
|
||||
'field' => 'plugin_processmaker_case',
|
||||
'rights' => [READ => __('Read'), CANCEL => __('Cancel', 'processmaker'), DELETE => __('Delete'), ADHOC_REASSIGN => __('Ad Hoc user re-assign', 'processmaker')]]
|
||||
];
|
||||
|
||||
return $rights;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Summary of showForm
|
||||
* @param mixed $ID
|
||||
* @param mixed $openform
|
||||
* @param mixed $closeform
|
||||
* @return bool
|
||||
*/
|
||||
function showForm($ID = 0, $openform = true, $closeform = true) {
|
||||
|
||||
if (!Session::haveRight("profile", READ)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$canedit = Session::haveRight("profile", UPDATE);
|
||||
$prof = new Profile();
|
||||
if ($ID) {
|
||||
$prof->getFromDB($ID);
|
||||
}
|
||||
echo "<form action='".$prof->getFormURL()."' method='post'>";
|
||||
$rights = $this->getAllRights();
|
||||
$prof->displayRightsChoiceMatrix($rights, ['canedit' => $canedit,
|
||||
'default_class' => 'tab_bg_2',
|
||||
'title' => __('ProcessMaker', 'processmaker')]);
|
||||
|
||||
if ($canedit && $closeform) {
|
||||
echo "<div class='center'>";
|
||||
echo Html::hidden('id', ['value' => $ID]);
|
||||
echo Html::submit(_sx('button', 'Save'),
|
||||
['name' => 'update']);
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
||||
Html::closeForm();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary of createAdminAccess
|
||||
* @param mixed $ID
|
||||
*/
|
||||
static function createAdminAccess($ID) {
|
||||
self::addDefaultProfileInfos($ID, ['plugin_processmaker_config' => READ + UPDATE, 'plugin_processmaker_case' => READ + DELETE + CANCEL + ADHOC_REASSIGN], true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary of getTabNameForItem
|
||||
* @param CommonGLPI $item
|
||||
* @param mixed $withtemplate
|
||||
* @return string|string[]
|
||||
*/
|
||||
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||
if ($item->getType()=='Profile') {
|
||||
return __('ProcessMaker', 'processmaker');
|
||||
}
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary of displayTabContentForItem
|
||||
* @param CommonGLPI $item
|
||||
* @param mixed $tabnum
|
||||
* @param mixed $withtemplate
|
||||
* @return bool
|
||||
*/
|
||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI;
|
||||
|
||||
if ($item->getType()=='Profile') {
|
||||
$ID = $item->getID();
|
||||
$prof = new self();
|
||||
self::addDefaultProfileInfos($ID,
|
||||
['plugin_processmaker_config' => 0,
|
||||
'plugin_processmaker_case' => 0
|
||||
]);
|
||||
|
||||
$prof->showForm($ID);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $profile
|
||||
**/
|
||||
static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) {
|
||||
global $DB;
|
||||
$dbu = new DbUtils;
|
||||
$profileRight = new ProfileRight();
|
||||
foreach ($rights as $right => $value) {
|
||||
if ($dbu->countElementsInTable('glpi_profilerights', ['AND' => ['profiles_id' => $profiles_id, 'name' => $right]]) && $drop_existing) {
|
||||
$profileRight->deleteByCriteria(['profiles_id' => $profiles_id, 'name' => $right]);
|
||||
}
|
||||
if (!$dbu->countElementsInTable('glpi_profilerights', ['AND' => ['profiles_id' => $profiles_id, 'name' => $right]])) {
|
||||
$myright['profiles_id'] = $profiles_id;
|
||||
$myright['name'] = $right;
|
||||
$myright['rights'] = $value;
|
||||
$profileRight->add($myright);
|
||||
|
||||
//Add right to the current session
|
||||
$_SESSION['glpiactiveprofile'][$right] = $value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* selfservicedraft short summary.
|
||||
*
|
||||
* selfservicedraft description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author morono
|
||||
*/
|
||||
class PluginProcessmakerSelfservicedraft extends CommonDBTM {
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
/**
|
||||
* selfservicedraft short summary.
|
||||
*
|
||||
* selfservicedraft description.
|
||||
*
|
||||
* @version 1.0
|
||||
* @author morono
|
||||
*/
|
||||
class PluginProcessmakerSelfservicedraft extends CommonDBTM {
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<?php
|
||||
|
||||
function processmaker_install() {
|
||||
global $DB;
|
||||
|
||||
// installation from scratch
|
||||
$DB->runFile(GLPI_ROOT . "/plugins/processmaker/install/mysql/processmaker-empty.sql");
|
||||
|
||||
// add configuration singleton
|
||||
$query = "INSERT INTO `glpi_plugin_processmaker_configs` (`id`) VALUES (1);";
|
||||
$DB->query( $query ) or die("error creating default record in glpi_plugin_processmaker_configs" . $DB->error());
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
function processmaker_install() {
|
||||
global $DB;
|
||||
|
||||
// installation from scratch
|
||||
$DB->runFile(GLPI_ROOT . "/plugins/processmaker/install/mysql/processmaker-empty.sql");
|
||||
|
||||
// add configuration singleton
|
||||
$query = "INSERT INTO `glpi_plugin_processmaker_configs` (`id`) VALUES (1);";
|
||||
$DB->query( $query ) or die("error creating default record in glpi_plugin_processmaker_configs" . $DB->error());
|
||||
|
||||
}
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
function update_3_2_8_to_3_2_9() {
|
||||
global $DB;
|
||||
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "db_version")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `db_version` VARCHAR(10) NULL;";
|
||||
$DB->query($query) or die("error adding db_version field to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
return '3.2.9';
|
||||
|
||||
}
|
||||
<?php
|
||||
|
||||
function update_3_2_8_to_3_2_9() {
|
||||
global $DB;
|
||||
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "db_version")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `db_version` VARCHAR(10) NULL;";
|
||||
$DB->query($query) or die("error adding db_version field to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
}
|
||||
|
||||
return '3.2.9';
|
||||
|
||||
}
|
||||
|
||||
@@ -1,199 +1,199 @@
|
||||
<?php
|
||||
|
||||
function update_3_2_9_to_3_3_0() {
|
||||
global $DB, $PM_DB; //, $PM_SOAP;
|
||||
|
||||
// to be sure
|
||||
$PM_DB = new PluginProcessmakerDB;
|
||||
|
||||
// Alter table plugin_processmaker_cases
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_cases", "plugin_processmaker_processes_id" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
ALTER `id` DROP DEFAULT;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 1" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
CHANGE COLUMN `id` `case_guid` VARCHAR(32) NOT NULL AFTER `items_id`;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 2" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
CHANGE COLUMN `case_num` `id` INT(11) NOT NULL FIRST,
|
||||
CHANGE COLUMN `itemtype` `itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket' AFTER `id`,
|
||||
ADD COLUMN `entities_id` INT(11) NOT NULL DEFAULT '0' AFTER `items_id`,
|
||||
ADD COLUMN `name` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `entities_id`,
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`,
|
||||
ADD COLUMN `plugin_processmaker_cases_id` INT(11) NOT NULL DEFAULT '0' AFTER `plugin_processmaker_processes_id`,
|
||||
DROP INDEX `items`,
|
||||
ADD INDEX `items` (`itemtype`, `items_id`),
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE INDEX `case_guid` (`case_guid`),
|
||||
ADD INDEX `plugin_processmaker_cases_id` (`plugin_processmaker_cases_id`),
|
||||
ADD INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`);";
|
||||
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 3 " . $DB->error());
|
||||
|
||||
// needs to set entities_id and name fields
|
||||
// for this needs to browse all cases and do a getCaseInfo for each and to get entities_id from itemtype(items_id)
|
||||
foreach ($DB->request(PluginProcessmakerCase::getTable()) as $row) {
|
||||
$tmp = new $row['itemtype'];
|
||||
$entities_id = 0;
|
||||
if ($tmp->getFromDB($row['items_id'])) {
|
||||
$entities_id = $tmp->fields['entities_id'];
|
||||
}
|
||||
foreach ($PM_DB->request("SELECT CON_VALUE FROM CONTENT WHERE CON_CATEGORY='APP_TITLE' AND CON_LANG='en' AND CON_ID='{$row['case_guid']}'") as $name) {
|
||||
// there is only one record :)
|
||||
$name = $PM_DB->escape($name['CON_VALUE']);
|
||||
$query = "UPDATE ".PluginProcessmakerCase::getTable()." SET `name` = '{$name}', `entities_id` = $entities_id WHERE `id` = {$row['id']};";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 4 " . $DB->error());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_processes_profiles", "plugin_processmaker_processes_id")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes_profiles`
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL DEFAULT '0' AFTER `id`,
|
||||
DROP INDEX `processes_id`,
|
||||
ADD INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`);";
|
||||
$DB->query($query) or die("error on glpi_plugin_processmaker_processes_profiles table when renaming processes_id into plugin_processmaker_processes_id " . $DB->error());
|
||||
|
||||
// must clean the table in case there would be duplicate entries for a process
|
||||
$query = "SELECT gpp.id, gpp.plugin_processmaker_processes_id, gpp.profiles_id, gpp.entities_id, MAX(gpp.is_recursive) AS is_recursive
|
||||
FROM glpi_plugin_processmaker_processes_profiles AS gpp
|
||||
GROUP BY gpp.plugin_processmaker_processes_id, gpp.profiles_id, gpp.entities_id
|
||||
HAVING COUNT(id) > 1;";
|
||||
|
||||
foreach ($DB->request($query) as $rec) {
|
||||
// there we have one rec per duplicates
|
||||
// so we may delete all records in the table, and a new one
|
||||
$del_query = "DELETE FROM glpi_plugin_processmaker_processes_profiles WHERE plugin_processmaker_processes_id=".$rec['plugin_processmaker_processes_id']."
|
||||
AND profiles_id = ".$rec['profiles_id']."
|
||||
AND entities_id = ".$rec['entities_id'].";";
|
||||
$DB->query($del_query) or die("error when deleting duplicated process_profiles in glpi_plugin_processmaker_processes_profiles table ". $DB->error());
|
||||
|
||||
$add_query = "INSERT INTO `glpi_plugin_processmaker_processes_profiles` (`id`, `plugin_processmaker_processes_id`, `profiles_id`, `entities_id`, `is_recursive`)
|
||||
VALUES (".$rec['id'].", ".$rec['plugin_processmaker_processes_id'].", ".$rec['profiles_id'].", ".$rec['entities_id'].", ".$rec['is_recursive'].");";
|
||||
$DB->query($add_query) or die("error when inserting singletons of duplicated process_profiles in glpi_plugin_processmaker_processes_profiles table ". $DB->error());
|
||||
}
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes_profiles`
|
||||
ADD UNIQUE INDEX `plugin_processmaker_processes_id_profiles_id_entities_id` (`plugin_processmaker_processes_id`, `profiles_id`, `entities_id`);";
|
||||
$DB->query($query) or die("error when adding new index on glpi_plugin_processmaker_processes_profiles table " . $DB->error());
|
||||
}
|
||||
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_tasks", "plugin_processmaker_cases_id" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
ALTER `itemtype` DROP DEFAULT;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_tasks table step 1" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
CHANGE COLUMN `itemtype` `itemtype` VARCHAR(32) NOT NULL AFTER `id`,
|
||||
ADD COLUMN `plugin_processmaker_cases_id` INT(11) NULL AFTER `case_id`,
|
||||
ADD COLUMN `plugin_processmaker_taskcategories_id` INT(11) NULL AFTER `plugin_processmaker_cases_id`,
|
||||
ADD COLUMN `del_thread` INT(11) NOT NULL AFTER `del_index`,
|
||||
ADD COLUMN `del_thread_status` VARCHAR(32) NOT NULL DEFAULT 'OPEN' AFTER `del_thread`,
|
||||
DROP INDEX `case_id`,
|
||||
ADD UNIQUE INDEX `tasks` (`plugin_processmaker_cases_id`, `del_index`),
|
||||
ADD INDEX `del_thread_status` (`del_thread_status`);";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_tasks table step 2" . $DB->error());
|
||||
|
||||
// transform case_id (=GUID) into plugin_processmaker_cases_id
|
||||
$query = "UPDATE `glpi_plugin_processmaker_tasks`
|
||||
LEFT JOIN `glpi_plugin_processmaker_cases` ON `glpi_plugin_processmaker_cases`.`case_guid` = `glpi_plugin_processmaker_tasks`.`case_id`
|
||||
SET `glpi_plugin_processmaker_tasks`.`plugin_processmaker_cases_id` = `glpi_plugin_processmaker_cases`.`id`;";
|
||||
$DB->query($query) or die("error transforming case_id into plugin_processmaker_cases_id in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
DROP COLUMN `case_id`;";
|
||||
$DB->query($query) or die("error deleting case_id column in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
|
||||
// set real thread status get it from APP_DELEGATION
|
||||
$query = "SELECT APP_UID, DEL_INDEX, DEL_THREAD, DEL_THREAD_STATUS FROM APP_DELEGATION WHERE DEL_THREAD_STATUS = 'CLOSED';";
|
||||
$locThreads = [];
|
||||
foreach ($PM_DB->request($query) as $thread) {
|
||||
$locThreads[$thread['APP_UID']][] = $thread;
|
||||
}
|
||||
$locCase = new PluginProcessmakerCase;
|
||||
foreach ($locThreads as $key => $threads) {
|
||||
// get GLPI case id
|
||||
$locCase->getFromGUID($key);
|
||||
$del_indexes = [];
|
||||
foreach ($threads as $thread) {
|
||||
$del_indexes[] = $thread['DEL_INDEX'];
|
||||
}
|
||||
$del_indexes = implode(", ", $del_indexes);
|
||||
$query = "UPDATE glpi_plugin_processmaker_tasks SET del_thread_status = 'CLOSED' WHERE plugin_processmaker_cases_id = {$locCase->getID()} AND del_index IN ($del_indexes)";
|
||||
$DB->query($query) or die("error updating del_thread_status in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
}
|
||||
|
||||
// set the plugin_processmaker_taskcategories_id
|
||||
$app_delegation = [];
|
||||
$query = "SELECT CONCAT(APPLICATION.APP_NUMBER, '-', APP_DELEGATION.DEL_INDEX) AS 'key', APP_DELEGATION.TAS_UID FROM APP_DELEGATION
|
||||
LEFT JOIN APPLICATION ON APPLICATION.APP_UID=APP_DELEGATION.APP_UID";
|
||||
foreach ($PM_DB->request($query) as $row) {
|
||||
$app_delegation[$row['key']]=$row['TAS_UID'];
|
||||
}
|
||||
|
||||
$taskcats = [];
|
||||
$query = "SELECT * FROM glpi_plugin_processmaker_taskcategories";
|
||||
foreach ($DB->request($query) as $row) {
|
||||
$taskcats[$row['pm_task_guid']] = $row['id'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM glpi_plugin_processmaker_tasks";
|
||||
foreach ($DB->request($query) as $row) {
|
||||
$key = $row['plugin_processmaker_cases_id']."-".$row['del_index'];
|
||||
if (isset($app_delegation[$key]) && isset($taskcats[$app_delegation[$key]])) {
|
||||
$DB->query("UPDATE glpi_plugin_processmaker_tasks SET plugin_processmaker_taskcategories_id={$taskcats[$app_delegation[$key]]} WHERE id={$row['id']}") or
|
||||
die("error updating plugin_processmaker_taskcategories_id in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
}
|
||||
}
|
||||
|
||||
$query = "UPDATE `glpi_tickettasks` SET `glpi_tickettasks`.`content` = REPLACE(`glpi_tickettasks`.`content`, '##ticket.url##_PluginProcessmakerCase\$processmakercases', '##processmakercase.url##')
|
||||
WHERE `glpi_tickettasks`.`content` LIKE '%##ticket.url##_PluginProcessmakerCase\$processmakercases%'";
|
||||
$DB->query($query) or die("error updating content field in glpi_tickettasks" . $DB->error());
|
||||
|
||||
}
|
||||
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_taskcategories", "is_subprocess" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||
ALTER `processes_id` DROP DEFAULT;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_taskcategories step 1" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL AFTER `id`,
|
||||
CHANGE COLUMN `start` `is_start` TINYINT(1) NOT NULL DEFAULT '0' AFTER `taskcategories_id`,
|
||||
ADD COLUMN `is_subprocess` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_active`,
|
||||
DROP INDEX `processes_id`,
|
||||
ADD INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`);";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_taskcategories step 2" . $DB->error());
|
||||
}
|
||||
|
||||
if ($DB->fieldExists("glpi_plugin_processmaker_users", "password" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||
DROP COLUMN `password`;
|
||||
";
|
||||
$DB->query($query) or die("error deleting password col from glpi_plugin_processmaker_users" . $DB->error());
|
||||
}
|
||||
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_crontaskactions", "plugin_processmaker_cases_id" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
ADD COLUMN `plugin_processmaker_cases_id` INT(11) DEFAULT '0' AFTER `plugin_processmaker_caselinks_id`;";
|
||||
$DB->query($query) or die("error adding plugin_processmaker_cases_id col into glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||
|
||||
// data migration
|
||||
// before the 3.3.0 release there was one and only one case per item
|
||||
$query ="UPDATE `glpi_plugin_processmaker_crontaskactions`
|
||||
LEFT JOIN `glpi_plugin_processmaker_cases` ON `glpi_plugin_processmaker_cases`.`itemtype` = `glpi_plugin_processmaker_crontaskactions`.`itemtype`
|
||||
AND `glpi_plugin_processmaker_cases`.`items_id` = `glpi_plugin_processmaker_crontaskactions`.`items_id`
|
||||
SET `glpi_plugin_processmaker_crontaskactions`.`plugin_processmaker_cases_id` = `glpi_plugin_processmaker_cases`.`id`;";
|
||||
$DB->query($query) or die("error migrating itemtype and items_id into a plugin_processmaker_cases_id col in glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||
// end of migration
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
DROP COLUMN `itemtype`,
|
||||
DROP COLUMN `items_id`;";
|
||||
$DB->query($query) or die("error deleting adding itemtype and items_id cols from glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||
}
|
||||
|
||||
return '3.3.0';
|
||||
}
|
||||
<?php
|
||||
|
||||
function update_3_2_9_to_3_3_0() {
|
||||
global $DB, $PM_DB; //, $PM_SOAP;
|
||||
|
||||
// to be sure
|
||||
$PM_DB = new PluginProcessmakerDB;
|
||||
|
||||
// Alter table plugin_processmaker_cases
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_cases", "plugin_processmaker_processes_id" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
ALTER `id` DROP DEFAULT;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 1" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
CHANGE COLUMN `id` `case_guid` VARCHAR(32) NOT NULL AFTER `items_id`;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 2" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||
CHANGE COLUMN `case_num` `id` INT(11) NOT NULL FIRST,
|
||||
CHANGE COLUMN `itemtype` `itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket' AFTER `id`,
|
||||
ADD COLUMN `entities_id` INT(11) NOT NULL DEFAULT '0' AFTER `items_id`,
|
||||
ADD COLUMN `name` MEDIUMTEXT NOT NULL DEFAULT '' AFTER `entities_id`,
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`,
|
||||
ADD COLUMN `plugin_processmaker_cases_id` INT(11) NOT NULL DEFAULT '0' AFTER `plugin_processmaker_processes_id`,
|
||||
DROP INDEX `items`,
|
||||
ADD INDEX `items` (`itemtype`, `items_id`),
|
||||
ADD PRIMARY KEY (`id`),
|
||||
ADD UNIQUE INDEX `case_guid` (`case_guid`),
|
||||
ADD INDEX `plugin_processmaker_cases_id` (`plugin_processmaker_cases_id`),
|
||||
ADD INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`);";
|
||||
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 3 " . $DB->error());
|
||||
|
||||
// needs to set entities_id and name fields
|
||||
// for this needs to browse all cases and do a getCaseInfo for each and to get entities_id from itemtype(items_id)
|
||||
foreach ($DB->request(PluginProcessmakerCase::getTable()) as $row) {
|
||||
$tmp = new $row['itemtype'];
|
||||
$entities_id = 0;
|
||||
if ($tmp->getFromDB($row['items_id'])) {
|
||||
$entities_id = $tmp->fields['entities_id'];
|
||||
}
|
||||
foreach ($PM_DB->request("SELECT CON_VALUE FROM CONTENT WHERE CON_CATEGORY='APP_TITLE' AND CON_LANG='en' AND CON_ID='{$row['case_guid']}'") as $name) {
|
||||
// there is only one record :)
|
||||
$name = $PM_DB->escape($name['CON_VALUE']);
|
||||
$query = "UPDATE ".PluginProcessmakerCase::getTable()." SET `name` = '{$name}', `entities_id` = $entities_id WHERE `id` = {$row['id']};";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 4 " . $DB->error());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_processes_profiles", "plugin_processmaker_processes_id")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes_profiles`
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL DEFAULT '0' AFTER `id`,
|
||||
DROP INDEX `processes_id`,
|
||||
ADD INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`);";
|
||||
$DB->query($query) or die("error on glpi_plugin_processmaker_processes_profiles table when renaming processes_id into plugin_processmaker_processes_id " . $DB->error());
|
||||
|
||||
// must clean the table in case there would be duplicate entries for a process
|
||||
$query = "SELECT gpp.id, gpp.plugin_processmaker_processes_id, gpp.profiles_id, gpp.entities_id, MAX(gpp.is_recursive) AS is_recursive
|
||||
FROM glpi_plugin_processmaker_processes_profiles AS gpp
|
||||
GROUP BY gpp.plugin_processmaker_processes_id, gpp.profiles_id, gpp.entities_id
|
||||
HAVING COUNT(id) > 1;";
|
||||
|
||||
foreach ($DB->request($query) as $rec) {
|
||||
// there we have one rec per duplicates
|
||||
// so we may delete all records in the table, and a new one
|
||||
$del_query = "DELETE FROM glpi_plugin_processmaker_processes_profiles WHERE plugin_processmaker_processes_id=".$rec['plugin_processmaker_processes_id']."
|
||||
AND profiles_id = ".$rec['profiles_id']."
|
||||
AND entities_id = ".$rec['entities_id'].";";
|
||||
$DB->query($del_query) or die("error when deleting duplicated process_profiles in glpi_plugin_processmaker_processes_profiles table ". $DB->error());
|
||||
|
||||
$add_query = "INSERT INTO `glpi_plugin_processmaker_processes_profiles` (`id`, `plugin_processmaker_processes_id`, `profiles_id`, `entities_id`, `is_recursive`)
|
||||
VALUES (".$rec['id'].", ".$rec['plugin_processmaker_processes_id'].", ".$rec['profiles_id'].", ".$rec['entities_id'].", ".$rec['is_recursive'].");";
|
||||
$DB->query($add_query) or die("error when inserting singletons of duplicated process_profiles in glpi_plugin_processmaker_processes_profiles table ". $DB->error());
|
||||
}
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes_profiles`
|
||||
ADD UNIQUE INDEX `plugin_processmaker_processes_id_profiles_id_entities_id` (`plugin_processmaker_processes_id`, `profiles_id`, `entities_id`);";
|
||||
$DB->query($query) or die("error when adding new index on glpi_plugin_processmaker_processes_profiles table " . $DB->error());
|
||||
}
|
||||
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_tasks", "plugin_processmaker_cases_id" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
ALTER `itemtype` DROP DEFAULT;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_tasks table step 1" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
CHANGE COLUMN `itemtype` `itemtype` VARCHAR(32) NOT NULL AFTER `id`,
|
||||
ADD COLUMN `plugin_processmaker_cases_id` INT(11) NULL AFTER `case_id`,
|
||||
ADD COLUMN `plugin_processmaker_taskcategories_id` INT(11) NULL AFTER `plugin_processmaker_cases_id`,
|
||||
ADD COLUMN `del_thread` INT(11) NOT NULL AFTER `del_index`,
|
||||
ADD COLUMN `del_thread_status` VARCHAR(32) NOT NULL DEFAULT 'OPEN' AFTER `del_thread`,
|
||||
DROP INDEX `case_id`,
|
||||
ADD UNIQUE INDEX `tasks` (`plugin_processmaker_cases_id`, `del_index`),
|
||||
ADD INDEX `del_thread_status` (`del_thread_status`);";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_tasks table step 2" . $DB->error());
|
||||
|
||||
// transform case_id (=GUID) into plugin_processmaker_cases_id
|
||||
$query = "UPDATE `glpi_plugin_processmaker_tasks`
|
||||
LEFT JOIN `glpi_plugin_processmaker_cases` ON `glpi_plugin_processmaker_cases`.`case_guid` = `glpi_plugin_processmaker_tasks`.`case_id`
|
||||
SET `glpi_plugin_processmaker_tasks`.`plugin_processmaker_cases_id` = `glpi_plugin_processmaker_cases`.`id`;";
|
||||
$DB->query($query) or die("error transforming case_id into plugin_processmaker_cases_id in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||
DROP COLUMN `case_id`;";
|
||||
$DB->query($query) or die("error deleting case_id column in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
|
||||
// set real thread status get it from APP_DELEGATION
|
||||
$query = "SELECT APP_UID, DEL_INDEX, DEL_THREAD, DEL_THREAD_STATUS FROM APP_DELEGATION WHERE DEL_THREAD_STATUS = 'CLOSED';";
|
||||
$locThreads = [];
|
||||
foreach ($PM_DB->request($query) as $thread) {
|
||||
$locThreads[$thread['APP_UID']][] = $thread;
|
||||
}
|
||||
$locCase = new PluginProcessmakerCase;
|
||||
foreach ($locThreads as $key => $threads) {
|
||||
// get GLPI case id
|
||||
$locCase->getFromGUID($key);
|
||||
$del_indexes = [];
|
||||
foreach ($threads as $thread) {
|
||||
$del_indexes[] = $thread['DEL_INDEX'];
|
||||
}
|
||||
$del_indexes = implode(", ", $del_indexes);
|
||||
$query = "UPDATE glpi_plugin_processmaker_tasks SET del_thread_status = 'CLOSED' WHERE plugin_processmaker_cases_id = {$locCase->getID()} AND del_index IN ($del_indexes)";
|
||||
$DB->query($query) or die("error updating del_thread_status in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
}
|
||||
|
||||
// set the plugin_processmaker_taskcategories_id
|
||||
$app_delegation = [];
|
||||
$query = "SELECT CONCAT(APPLICATION.APP_NUMBER, '-', APP_DELEGATION.DEL_INDEX) AS 'key', APP_DELEGATION.TAS_UID FROM APP_DELEGATION
|
||||
LEFT JOIN APPLICATION ON APPLICATION.APP_UID=APP_DELEGATION.APP_UID";
|
||||
foreach ($PM_DB->request($query) as $row) {
|
||||
$app_delegation[$row['key']]=$row['TAS_UID'];
|
||||
}
|
||||
|
||||
$taskcats = [];
|
||||
$query = "SELECT * FROM glpi_plugin_processmaker_taskcategories";
|
||||
foreach ($DB->request($query) as $row) {
|
||||
$taskcats[$row['pm_task_guid']] = $row['id'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM glpi_plugin_processmaker_tasks";
|
||||
foreach ($DB->request($query) as $row) {
|
||||
$key = $row['plugin_processmaker_cases_id']."-".$row['del_index'];
|
||||
if (isset($app_delegation[$key]) && isset($taskcats[$app_delegation[$key]])) {
|
||||
$DB->query("UPDATE glpi_plugin_processmaker_tasks SET plugin_processmaker_taskcategories_id={$taskcats[$app_delegation[$key]]} WHERE id={$row['id']}") or
|
||||
die("error updating plugin_processmaker_taskcategories_id in glpi_plugin_processmaker_tasks table" . $DB->error());
|
||||
}
|
||||
}
|
||||
|
||||
$query = "UPDATE `glpi_tickettasks` SET `glpi_tickettasks`.`content` = REPLACE(`glpi_tickettasks`.`content`, '##ticket.url##_PluginProcessmakerCase\$processmakercases', '##processmakercase.url##')
|
||||
WHERE `glpi_tickettasks`.`content` LIKE '%##ticket.url##_PluginProcessmakerCase\$processmakercases%'";
|
||||
$DB->query($query) or die("error updating content field in glpi_tickettasks" . $DB->error());
|
||||
|
||||
}
|
||||
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_taskcategories", "is_subprocess" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||
ALTER `processes_id` DROP DEFAULT;";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_taskcategories step 1" . $DB->error());
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL AFTER `id`,
|
||||
CHANGE COLUMN `start` `is_start` TINYINT(1) NOT NULL DEFAULT '0' AFTER `taskcategories_id`,
|
||||
ADD COLUMN `is_subprocess` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_active`,
|
||||
DROP INDEX `processes_id`,
|
||||
ADD INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`);";
|
||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_taskcategories step 2" . $DB->error());
|
||||
}
|
||||
|
||||
if ($DB->fieldExists("glpi_plugin_processmaker_users", "password" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||
DROP COLUMN `password`;
|
||||
";
|
||||
$DB->query($query) or die("error deleting password col from glpi_plugin_processmaker_users" . $DB->error());
|
||||
}
|
||||
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_crontaskactions", "plugin_processmaker_cases_id" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
ADD COLUMN `plugin_processmaker_cases_id` INT(11) DEFAULT '0' AFTER `plugin_processmaker_caselinks_id`;";
|
||||
$DB->query($query) or die("error adding plugin_processmaker_cases_id col into glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||
|
||||
// data migration
|
||||
// before the 3.3.0 release there was one and only one case per item
|
||||
$query ="UPDATE `glpi_plugin_processmaker_crontaskactions`
|
||||
LEFT JOIN `glpi_plugin_processmaker_cases` ON `glpi_plugin_processmaker_cases`.`itemtype` = `glpi_plugin_processmaker_crontaskactions`.`itemtype`
|
||||
AND `glpi_plugin_processmaker_cases`.`items_id` = `glpi_plugin_processmaker_crontaskactions`.`items_id`
|
||||
SET `glpi_plugin_processmaker_crontaskactions`.`plugin_processmaker_cases_id` = `glpi_plugin_processmaker_cases`.`id`;";
|
||||
$DB->query($query) or die("error migrating itemtype and items_id into a plugin_processmaker_cases_id col in glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||
// end of migration
|
||||
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
DROP COLUMN `itemtype`,
|
||||
DROP COLUMN `items_id`;";
|
||||
$DB->query($query) or die("error deleting adding itemtype and items_id cols from glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||
}
|
||||
|
||||
return '3.3.0';
|
||||
}
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
<?php
|
||||
|
||||
function update_3_3_0_to_3_3_1() {
|
||||
global $DB;
|
||||
|
||||
// Alter table glpi_plugin_processmaker_processes
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_processes", "is_change" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
ADD COLUMN `is_change` TINYINT(1) NOT NULL DEFAULT '0' AFTER `project_type`,
|
||||
ADD COLUMN `is_problem` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_change`,
|
||||
ADD COLUMN `is_incident` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_problem`,
|
||||
ADD COLUMN `is_request` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_incident`;";
|
||||
|
||||
$DB->query($query) or die("error adding is_change, etc... to glpi_plugin_processmaker_processes table" . $DB->error());
|
||||
|
||||
}
|
||||
|
||||
// Alter table glpi_plugin_processmaker_caselinks
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "is_targettoreassign" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||
ADD COLUMN `is_targettoreassign` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_targettoclaim`,
|
||||
ADD COLUMN `is_targettoimpersonate` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_targettoreassign`,
|
||||
ADD COLUMN `is_synchronous` TINYINT(1) NOT NULL DEFAULT '0' AFTER `externalapplication`;";
|
||||
|
||||
$DB->query($query) or die("error adding is_targettoreassign, etc... to glpi_plugin_processmaker_caselinks table" . $DB->error());
|
||||
|
||||
}
|
||||
|
||||
return '3.3.1';
|
||||
}
|
||||
<?php
|
||||
|
||||
function update_3_3_0_to_3_3_1() {
|
||||
global $DB;
|
||||
|
||||
// Alter table glpi_plugin_processmaker_processes
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_processes", "is_change" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
ADD COLUMN `is_change` TINYINT(1) NOT NULL DEFAULT '0' AFTER `project_type`,
|
||||
ADD COLUMN `is_problem` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_change`,
|
||||
ADD COLUMN `is_incident` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_problem`,
|
||||
ADD COLUMN `is_request` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_incident`;";
|
||||
|
||||
$DB->query($query) or die("error adding is_change, etc... to glpi_plugin_processmaker_processes table" . $DB->error());
|
||||
|
||||
}
|
||||
|
||||
// Alter table glpi_plugin_processmaker_caselinks
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "is_targettoreassign" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||
ADD COLUMN `is_targettoreassign` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_targettoclaim`,
|
||||
ADD COLUMN `is_targettoimpersonate` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_targettoreassign`,
|
||||
ADD COLUMN `is_synchronous` TINYINT(1) NOT NULL DEFAULT '0' AFTER `externalapplication`;";
|
||||
|
||||
$DB->query($query) or die("error adding is_targettoreassign, etc... to glpi_plugin_processmaker_caselinks table" . $DB->error());
|
||||
|
||||
}
|
||||
|
||||
return '3.3.1';
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
<?php
|
||||
|
||||
function update_3_3_1_to_3_3_8() {
|
||||
global $DB;
|
||||
|
||||
// Alter table glpi_plugin_processmaker_configs
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "ssl_verify" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `ssl_verify` TINYINT(1) NOT NULL DEFAULT '0' AFTER `maintenance`;";
|
||||
|
||||
$DB->query($query) or die("error adding ssl_verify to glpi_plugin_processmaker_configs table" . $DB->error());
|
||||
}
|
||||
|
||||
return '3.3.8';
|
||||
<?php
|
||||
|
||||
function update_3_3_1_to_3_3_8() {
|
||||
global $DB;
|
||||
|
||||
// Alter table glpi_plugin_processmaker_configs
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "ssl_verify" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `ssl_verify` TINYINT(1) NOT NULL DEFAULT '0' AFTER `maintenance`;";
|
||||
|
||||
$DB->query($query) or die("error adding ssl_verify to glpi_plugin_processmaker_configs table" . $DB->error());
|
||||
}
|
||||
|
||||
return '3.3.8';
|
||||
}
|
||||
@@ -1,30 +1,30 @@
|
||||
<?php
|
||||
|
||||
function update_3_3_8_to_3_4_9() {
|
||||
global $DB;
|
||||
|
||||
// Alter table glpi_plugin_processmaker_configs
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "max_cases_per_item" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `max_cases_per_item` INT(11) NOT NULL DEFAULT '0' AFTER `db_version`;";
|
||||
|
||||
$DB->query($query) or die("error adding max_cases_per_item to glpi_plugin_processmaker_configs table" . $DB->error());
|
||||
}
|
||||
|
||||
// Alter table glpi_plugin_processmaker_processes
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_processes", "maintenance" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
ADD COLUMN `maintenance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_request`;";
|
||||
|
||||
$DB->query($query) or die("error adding maintenance to glpi_plugin_processmaker_processes table" . $DB->error());
|
||||
}
|
||||
// Alter table glpi_plugin_processmaker_processes
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_processes", "max_cases_per_item" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
ADD COLUMN `max_cases_per_item` INT(11) NOT NULL DEFAULT '0' AFTER `maintenance`;";
|
||||
|
||||
$DB->query($query) or die("error adding max_cases_per_item to glpi_plugin_processmaker_processes table" . $DB->error());
|
||||
}
|
||||
|
||||
return '3.4.9';
|
||||
<?php
|
||||
|
||||
function update_3_3_8_to_3_4_9() {
|
||||
global $DB;
|
||||
|
||||
// Alter table glpi_plugin_processmaker_configs
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "max_cases_per_item" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `max_cases_per_item` INT(11) NOT NULL DEFAULT '0' AFTER `db_version`;";
|
||||
|
||||
$DB->query($query) or die("error adding max_cases_per_item to glpi_plugin_processmaker_configs table" . $DB->error());
|
||||
}
|
||||
|
||||
// Alter table glpi_plugin_processmaker_processes
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_processes", "maintenance" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
ADD COLUMN `maintenance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_request`;";
|
||||
|
||||
$DB->query($query) or die("error adding maintenance to glpi_plugin_processmaker_processes table" . $DB->error());
|
||||
}
|
||||
// Alter table glpi_plugin_processmaker_processes
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_processes", "max_cases_per_item" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||
ADD COLUMN `max_cases_per_item` INT(11) NOT NULL DEFAULT '0' AFTER `maintenance`;";
|
||||
|
||||
$DB->query($query) or die("error adding max_cases_per_item to glpi_plugin_processmaker_processes table" . $DB->error());
|
||||
}
|
||||
|
||||
return '3.4.9';
|
||||
}
|
||||
@@ -1,14 +1,14 @@
|
||||
<?php
|
||||
|
||||
function update_3_4_10_to_4_0_0() {
|
||||
global $DB;
|
||||
|
||||
// needs to change password encryption
|
||||
$pmglpikey = new PluginProcessmakerGlpikey;
|
||||
|
||||
if ($pmglpikey->migratePasswords()) {
|
||||
return '4.0.0';
|
||||
}
|
||||
|
||||
return false;
|
||||
<?php
|
||||
|
||||
function update_3_4_10_to_4_0_0() {
|
||||
global $DB;
|
||||
|
||||
// needs to change password encryption
|
||||
$pmglpikey = new PluginProcessmakerGlpikey;
|
||||
|
||||
if ($pmglpikey->migratePasswords()) {
|
||||
return '4.0.0';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php
|
||||
|
||||
function update_3_4_9_to_3_4_10() {
|
||||
global $DB;
|
||||
|
||||
// needs to change _update_ into _reassign_ in the events field of the glpi_notifications table
|
||||
|
||||
$query = "UPDATE `glpi_notifications` SET `event` = REPLACE( `event`, '_update_', '_reassign_') WHERE `event` LIKE '%_update_%' AND `itemtype` = 'PluginProcessmakerTask';";
|
||||
$DB->query($query) or die("error when updating event field in glpi_notifications" . $DB->error());
|
||||
|
||||
return '3.4.10';
|
||||
<?php
|
||||
|
||||
function update_3_4_9_to_3_4_10() {
|
||||
global $DB;
|
||||
|
||||
// needs to change _update_ into _reassign_ in the events field of the glpi_notifications table
|
||||
|
||||
$query = "UPDATE `glpi_notifications` SET `event` = REPLACE( `event`, '_update_', '_reassign_') WHERE `event` LIKE '%_update_%' AND `itemtype` = 'PluginProcessmakerTask';";
|
||||
$DB->query($query) or die("error when updating event field in glpi_notifications" . $DB->error());
|
||||
|
||||
return '3.4.10';
|
||||
}
|
||||
@@ -1,121 +1,121 @@
|
||||
|
||||
var oldHandler;
|
||||
var submitButton;
|
||||
var caseIFrame;
|
||||
|
||||
function onClickContinue(obj) {
|
||||
//debugger;
|
||||
contentDocument = caseIFrame.contentDocument;
|
||||
var txtAreaUserRequestSumUp = contentDocument.getElementById('form[UserRequestSumUp]');
|
||||
if ($("textarea[name='content']").val() == '') {
|
||||
if (txtAreaUserRequestSumUp) {
|
||||
tinymce.activeEditor.setContent($(txtAreaUserRequestSumUp).val().replace(/(\r\n)|(\r)|(\n)/g, '<br>'));
|
||||
} else {
|
||||
tinymce.activeEditor.setContent('_');
|
||||
}
|
||||
}
|
||||
|
||||
// call old handler if any
|
||||
//debugger;
|
||||
if (obj != undefined && oldHandler) {
|
||||
oldHandler(obj.target);
|
||||
}
|
||||
// hide the iFrame
|
||||
caseIFrame.style.visibility = 'hidden';
|
||||
|
||||
// trigger a click on the 'add' button of the ticket
|
||||
submitButton.click();
|
||||
}
|
||||
|
||||
|
||||
// used to find an element in a list and to hide it!
|
||||
function bGLPIHideElement(eltList, attribute, value) {
|
||||
var ret = false;
|
||||
for (var i = 0; i < eltList.length; i++) {
|
||||
var node = eltList[i];
|
||||
if (node.getAttribute(attribute) == value) {
|
||||
// hide the link
|
||||
node.style.display = 'none';
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function onLoadFrame( evt, caseId, delIndex, caseNumber, processName ) {
|
||||
var caseTimerCounter = 0;
|
||||
var redimIFrame = false;
|
||||
var bButtonContinue = false;
|
||||
var caseTimer = window.setInterval(function () {
|
||||
//debugger ;
|
||||
// look for caseiframe iFrame
|
||||
|
||||
caseIFrame = document.getElementById('caseiframe');
|
||||
|
||||
var contentDocument;
|
||||
try {
|
||||
contentDocument = caseIFrame.contentDocument;
|
||||
} catch (ex) {
|
||||
contentDocument = false;
|
||||
}
|
||||
if (caseIFrame != undefined && contentDocument) {
|
||||
var buttonContinue = contentDocument.getElementById('form[btnGLPISendRequest]');
|
||||
var linkList = contentDocument.getElementsByTagName('a');
|
||||
|
||||
if (!bButtonContinue && buttonContinue != undefined && linkList != undefined && linkList.length > 0) {
|
||||
bButtonContinue = true; //window.clearInterval(caseTimer); // to be sure that it will be done only one time
|
||||
// change action for the attached form and add some parameters
|
||||
//debugger;
|
||||
|
||||
bGLPIHideElement(linkList, 'href', 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN');
|
||||
|
||||
oldHandler = buttonContinue.onclick;
|
||||
buttonContinue.onclick = onClickContinue;
|
||||
|
||||
submitButton = $("input[name='add'][type=submit]")[0];
|
||||
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_action' value='routecase'/>");
|
||||
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_caseguid' value='" + caseId + "'/>");
|
||||
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_delindex' value='" + delIndex + "'/>");
|
||||
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_casenum' value='" + caseNumber + "'/>");
|
||||
|
||||
$("input[name='name'][type=text]")[0].value = processName;
|
||||
|
||||
}
|
||||
|
||||
// try to redim caseIFrame
|
||||
if (!redimIFrame) {
|
||||
redimIFrame = true; // to prevent several timer creation
|
||||
|
||||
// redim one time
|
||||
redimTaskFrame(caseIFrame);
|
||||
|
||||
// redim each second
|
||||
var redimFrameTimer = window.setInterval(function () {
|
||||
redimTaskFrame(caseIFrame);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
if ( caseTimerCounter > 3000 ) {
|
||||
window.clearInterval(caseTimer);
|
||||
} else {
|
||||
caseTimerCounter = caseTimerCounter + 1;
|
||||
}
|
||||
|
||||
}, 10);
|
||||
}
|
||||
|
||||
function redimTaskFrame(taskFrame) {
|
||||
var newHeight;
|
||||
try {
|
||||
//var locElt = locContentDocument.getElementsByTagName("table")[0];
|
||||
var locElt = taskFrame.contentDocument.getElementsByTagName("html")[0];
|
||||
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||
if (newHeight < 400) {
|
||||
newHeight = 400;
|
||||
}
|
||||
|
||||
taskFrame.height = newHeight;
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
var oldHandler;
|
||||
var submitButton;
|
||||
var caseIFrame;
|
||||
|
||||
function onClickContinue(obj) {
|
||||
//debugger;
|
||||
contentDocument = caseIFrame.contentDocument;
|
||||
var txtAreaUserRequestSumUp = contentDocument.getElementById('form[UserRequestSumUp]');
|
||||
if ($("textarea[name='content']").val() == '') {
|
||||
if (txtAreaUserRequestSumUp) {
|
||||
tinymce.activeEditor.setContent($(txtAreaUserRequestSumUp).val().replace(/(\r\n)|(\r)|(\n)/g, '<br>'));
|
||||
} else {
|
||||
tinymce.activeEditor.setContent('_');
|
||||
}
|
||||
}
|
||||
|
||||
// call old handler if any
|
||||
//debugger;
|
||||
if (obj != undefined && oldHandler) {
|
||||
oldHandler(obj.target);
|
||||
}
|
||||
// hide the iFrame
|
||||
caseIFrame.style.visibility = 'hidden';
|
||||
|
||||
// trigger a click on the 'add' button of the ticket
|
||||
submitButton.click();
|
||||
}
|
||||
|
||||
|
||||
// used to find an element in a list and to hide it!
|
||||
function bGLPIHideElement(eltList, attribute, value) {
|
||||
var ret = false;
|
||||
for (var i = 0; i < eltList.length; i++) {
|
||||
var node = eltList[i];
|
||||
if (node.getAttribute(attribute) == value) {
|
||||
// hide the link
|
||||
node.style.display = 'none';
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function onLoadFrame( evt, caseId, delIndex, caseNumber, processName ) {
|
||||
var caseTimerCounter = 0;
|
||||
var redimIFrame = false;
|
||||
var bButtonContinue = false;
|
||||
var caseTimer = window.setInterval(function () {
|
||||
//debugger ;
|
||||
// look for caseiframe iFrame
|
||||
|
||||
caseIFrame = document.getElementById('caseiframe');
|
||||
|
||||
var contentDocument;
|
||||
try {
|
||||
contentDocument = caseIFrame.contentDocument;
|
||||
} catch (ex) {
|
||||
contentDocument = false;
|
||||
}
|
||||
if (caseIFrame != undefined && contentDocument) {
|
||||
var buttonContinue = contentDocument.getElementById('form[btnGLPISendRequest]');
|
||||
var linkList = contentDocument.getElementsByTagName('a');
|
||||
|
||||
if (!bButtonContinue && buttonContinue != undefined && linkList != undefined && linkList.length > 0) {
|
||||
bButtonContinue = true; //window.clearInterval(caseTimer); // to be sure that it will be done only one time
|
||||
// change action for the attached form and add some parameters
|
||||
//debugger;
|
||||
|
||||
bGLPIHideElement(linkList, 'href', 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN');
|
||||
|
||||
oldHandler = buttonContinue.onclick;
|
||||
buttonContinue.onclick = onClickContinue;
|
||||
|
||||
submitButton = $("input[name='add'][type=submit]")[0];
|
||||
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_action' value='routecase'/>");
|
||||
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_caseguid' value='" + caseId + "'/>");
|
||||
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_delindex' value='" + delIndex + "'/>");
|
||||
submitButton.insertAdjacentHTML('beforebegin', "<input type='hidden' name='processmaker_casenum' value='" + caseNumber + "'/>");
|
||||
|
||||
$("input[name='name'][type=text]")[0].value = processName;
|
||||
|
||||
}
|
||||
|
||||
// try to redim caseIFrame
|
||||
if (!redimIFrame) {
|
||||
redimIFrame = true; // to prevent several timer creation
|
||||
|
||||
// redim one time
|
||||
redimTaskFrame(caseIFrame);
|
||||
|
||||
// redim each second
|
||||
var redimFrameTimer = window.setInterval(function () {
|
||||
redimTaskFrame(caseIFrame);
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
|
||||
if ( caseTimerCounter > 3000 ) {
|
||||
window.clearInterval(caseTimer);
|
||||
} else {
|
||||
caseTimerCounter = caseTimerCounter + 1;
|
||||
}
|
||||
|
||||
}, 10);
|
||||
}
|
||||
|
||||
function redimTaskFrame(taskFrame) {
|
||||
var newHeight;
|
||||
try {
|
||||
//var locElt = locContentDocument.getElementsByTagName("table")[0];
|
||||
var locElt = taskFrame.contentDocument.getElementsByTagName("html")[0];
|
||||
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||
if (newHeight < 400) {
|
||||
newHeight = 400;
|
||||
}
|
||||
|
||||
taskFrame.height = newHeight;
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
624
js/cases.js
624
js/cases.js
@@ -1,312 +1,312 @@
|
||||
//debugger;
|
||||
// To manage submits to case.front.php
|
||||
var GLPI_HTTP_CASE_FORM = window.location.href.replace(window.location.search, ''); //window.location.href.split('/', loc_split.length - 2).join('/') + '/plugins/processmaker/front/case.front.php'; // http://hostname/glpi/...
|
||||
// to manage reloads
|
||||
var GLPI_RELOAD_PARENT = window; //.location;
|
||||
var GLPI_DURING_RELOAD = false;
|
||||
|
||||
// used to find an element in a list and to hide it!
|
||||
function bGLPIHideElement(eltList, attribute, value) {
|
||||
var ret = false;
|
||||
for (var i = 0; i < eltList.length && !ret; i++) {
|
||||
var node = eltList[i];
|
||||
if (node.getAttribute(attribute) == value) {
|
||||
// hide the link
|
||||
node.style.display = 'none';
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
function displayOverlay() {
|
||||
//debugger;
|
||||
// don't use displayOverlay when submit input open new tab or update parent ( example: pdf generation )
|
||||
if (!($(this).is('input[type=submit]')
|
||||
&& $(this).parents('form').length > 0
|
||||
&& ($(this).parents('form').first().attr('target') == '_blank' || $(this).parents('form').first().attr('target') == '_parent'))) {
|
||||
$("<div class='ui-widget-overlay ui-front'></div>").appendTo("body");
|
||||
|
||||
var timer = window.setInterval(function () {
|
||||
var count = $('.ui-widget-overlay.ui-front').length;
|
||||
if (count == 2) {
|
||||
$($('.ui-widget-overlay.ui-front')[1]).remove();
|
||||
window.clearInterval(timer);
|
||||
}
|
||||
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onTaskFrameLoad(event, delIndex, hideClaimButton, csrf) {
|
||||
//alert("Loaded frame " + delIndex);
|
||||
//debugger;
|
||||
var taskFrameId = event.target.id; //"caseiframe-" + delIndex;
|
||||
var bShowHideNextStep = false; // not done yet!
|
||||
var bHideClaimCancelButton = false; // To manage 'Claim' button
|
||||
var taskFrameTimerCounter = 0;
|
||||
var redimIFrame = false;
|
||||
//debugger;
|
||||
var taskFrameTimer = window.setInterval(function () {
|
||||
try {
|
||||
var locContentDocument;
|
||||
var taskFrame = document.getElementById(taskFrameId);
|
||||
try {
|
||||
locContentDocument = taskFrame.contentDocument;
|
||||
} catch (ex) {
|
||||
locContentDocument = false;
|
||||
}
|
||||
if (taskFrame != undefined && locContentDocument != undefined) {
|
||||
// here we've caught the content of the iframe
|
||||
|
||||
// if task resumé, then hide the form part
|
||||
//debugger;
|
||||
//var form_resume = locContentDocument.getElementsByName('cases_Resume');
|
||||
//if (form_resume.length > 0 && form_resume[0].style.display != 'none') {
|
||||
// form_resume[0].style.display = 'none';
|
||||
//}
|
||||
|
||||
// then look if btnGLPISendRequest exists,
|
||||
var locElt = locContentDocument.getElementById('form[btnGLPISendRequest]');
|
||||
if (!bShowHideNextStep && locElt != undefined ) {
|
||||
var linkList = locContentDocument.getElementsByTagName('a');
|
||||
if (bGLPIHideElement(linkList, 'href', 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN')) {
|
||||
// the next step link is hidden
|
||||
|
||||
// if yes then change the link behind the button itself
|
||||
locElt.type = 'submit';
|
||||
locElt.onclick = null; // in order to force use of the action of form POST
|
||||
var formList = locContentDocument.getElementsByTagName('form');
|
||||
|
||||
// if yes then change the action of the form POST
|
||||
var node = formList[0]; // must have one element in list: in a dynaform there is one and only one HTML form
|
||||
node.setAttribute('actionBackup', node.action);
|
||||
var action = node.action.split('?');
|
||||
node.action = GLPI_HTTP_CASE_FORM + '?' + action[1] + '&DEL_INDEX=' + delIndex + '&action=route';
|
||||
|
||||
// add an element that will be the csrf data code for the POST
|
||||
//debugger;
|
||||
var csrfElt = document.createElement("input");
|
||||
csrfElt.setAttribute("type", "hidden");
|
||||
csrfElt.setAttribute("name", "_glpi_csrf_token");
|
||||
csrfElt.setAttribute("value", csrf);
|
||||
node.appendChild(csrfElt);
|
||||
} else {
|
||||
// then hide the button itself
|
||||
locElt.style.display = 'none';
|
||||
}
|
||||
|
||||
bShowHideNextStep = true;
|
||||
}
|
||||
|
||||
// Hide 'Cancel' button on 'Claim' form
|
||||
var cancelButton = locContentDocument.getElementById('form[BTN_CANCEL]');
|
||||
if (cancelButton != undefined && !bHideClaimCancelButton) {
|
||||
//debugger;
|
||||
cancelButton.style.display = 'none';
|
||||
// hides claim button if asked for
|
||||
if (hideClaimButton) {
|
||||
claimButton = locContentDocument.getElementById('form[BTN_CATCH]');
|
||||
claimButton.style.display = 'none';
|
||||
}
|
||||
// to manage Claim
|
||||
var formList = locContentDocument.getElementsByTagName('form');
|
||||
var node = formList[0]; // must have one element in list: in a dynaform there is one and only one HTML form
|
||||
node.setAttribute('actionBackup', node.action);
|
||||
|
||||
var action = node.action.split('?');
|
||||
//debugger;
|
||||
node.action = GLPI_HTTP_CASE_FORM + '?' + (action[1]?action[1]+'&':'') + 'DEL_INDEX=' + delIndex;
|
||||
// add an element that will be the csrf data code for the POST
|
||||
//debugger;
|
||||
var csrfElt = document.createElement("input");
|
||||
csrfElt.setAttribute("type", "hidden");
|
||||
csrfElt.setAttribute("name", "_glpi_csrf_token");
|
||||
csrfElt.setAttribute("value", csrf);
|
||||
node.appendChild(csrfElt);
|
||||
|
||||
bHideClaimCancelButton = true;
|
||||
// TODO
|
||||
//node.addEventListener('submit', showMask);
|
||||
}
|
||||
|
||||
// to force immediate reload of GLPI item form
|
||||
var forcedReload = locContentDocument.getElementById('GLPI_FORCE_RELOAD');
|
||||
if (forcedReload != undefined && !GLPI_DURING_RELOAD) {
|
||||
//showMask();
|
||||
GLPI_DURING_RELOAD = true; // to prevent double reload
|
||||
window.clearInterval(taskFrameTimer); // stop timer
|
||||
GLPI_RELOAD_PARENT.location.reload();
|
||||
}
|
||||
|
||||
// try to redim caseIFrame
|
||||
if (!redimIFrame) {
|
||||
redimTaskFrame(taskFrame, delIndex);
|
||||
var redimFrameTimer = window.setInterval(function () {
|
||||
redimTaskFrame(taskFrame, delIndex);
|
||||
}, 1000);
|
||||
|
||||
redimIFrame = true;
|
||||
}
|
||||
}
|
||||
|
||||
taskFrameTimerCounter = taskFrameTimerCounter + 1;
|
||||
|
||||
if (taskFrameTimerCounter > 3000 || bShowHideNextStep || bHideClaimCancelButton) { // either timeout or hiding is done
|
||||
window.clearInterval(taskFrameTimer);
|
||||
}
|
||||
|
||||
} catch (evt) {
|
||||
// nothing to do here for the moment
|
||||
}
|
||||
|
||||
}, 10);
|
||||
|
||||
}
|
||||
|
||||
function redimTaskFrame(taskFrame, delIndex) {
|
||||
var newHeight;
|
||||
try {
|
||||
//var locElt = locContentDocument.getElementsByTagName("table")[0];
|
||||
var locElt = taskFrame.contentDocument.getElementsByTagName("html")[0];
|
||||
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||
if (newHeight < 500) {
|
||||
newHeight = 500;
|
||||
}
|
||||
|
||||
taskFrame.height = newHeight;
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
//function onTaskFrameActivation(delIndex) {
|
||||
// var taskFrameId = "caseiframe-" + delIndex;
|
||||
// var taskFrameTimerCounter = 0;
|
||||
// var redimIFrame = false;
|
||||
|
||||
// var taskFrameTimer = window.setInterval(function () {
|
||||
// try {
|
||||
// var locContentDocument;
|
||||
// var taskFrame = document.getElementById(taskFrameId);
|
||||
|
||||
// if (taskFrame != undefined && taskFrame.contentDocument != undefined) {
|
||||
// // here we've caught the content of the iframe
|
||||
// locContentDocument = taskFrame.contentDocument;
|
||||
|
||||
// // try to redim caseIFrame
|
||||
// if (!redimIFrame) {
|
||||
// var newHeight;
|
||||
// var locElt = locContentDocument.getElementsByTagName("html")[0];
|
||||
// newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||
|
||||
// tabs.getItem('task-' + delIndex).setHeight(newHeight);
|
||||
// taskFrame.height = newHeight;
|
||||
// redimIFrame = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// taskFrameTimerCounter = taskFrameTimerCounter + 1;
|
||||
|
||||
// if (taskFrameTimerCounter > 3000 || redimIFrame) { // timeout
|
||||
// window.clearInterval(taskFrameTimer);
|
||||
// }
|
||||
|
||||
// } catch (evt) {
|
||||
// // nothing to do here for the moment
|
||||
// }
|
||||
|
||||
// }, 10);
|
||||
//}
|
||||
function clearClass(lociFrame) {
|
||||
|
||||
try {
|
||||
var locElt = lociFrame.contentDocument.getElementsByTagName('body')[0];
|
||||
if (locElt != undefined && locElt.className != '') {
|
||||
//debugger;
|
||||
locElt.className = '';
|
||||
|
||||
}
|
||||
} catch (ev) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function onOtherFrameLoad(tabPanelName, frameName, eltTagName, isMap3) {
|
||||
var otherFrameId = frameName;
|
||||
var otherFrameTimerCounter = 0;
|
||||
var redimIFrame = false;
|
||||
//debugger;
|
||||
if (isMap3 == undefined) {
|
||||
isMap3 = false;
|
||||
}
|
||||
|
||||
var otherFrameTimer = window.setInterval(function () {
|
||||
try {
|
||||
|
||||
var locContentDocument;
|
||||
var otherFrame = document.getElementById(otherFrameId);
|
||||
|
||||
if (otherFrame != undefined && otherFrame.contentDocument != undefined) {
|
||||
// here we've caught the content of the iframe
|
||||
clearClass(otherFrame);
|
||||
|
||||
locContentDocument = otherFrame.contentDocument;
|
||||
|
||||
// try to redim otherFrame
|
||||
// and tabPanel
|
||||
if (!redimIFrame) {
|
||||
var locElt;
|
||||
// isMap3 == true
|
||||
// map is bpmn
|
||||
// must look at div with special CSS class name to get newHeight and should change offset and size of parent div
|
||||
if (!isMap3) {
|
||||
if (tabPanelName == 'caseMap') {
|
||||
// locElt = locContentDocument.querySelectorAll('div.panel_content___processmaker')[0];
|
||||
locElt = locContentDocument.querySelectorAll('div.panel_containerWindow___processmaker')[0];
|
||||
locElt2 = locContentDocument.getElementById('pm_target');
|
||||
locElt2.style.height = locElt.clientHeight + 'px';
|
||||
} else {
|
||||
locElt = locContentDocument.getElementsByTagName(eltTagName)[0];
|
||||
}
|
||||
} else {
|
||||
locElt = locContentDocument.querySelectorAll('div.pmui-pmpool')[0];
|
||||
}
|
||||
if (locElt != undefined) {
|
||||
var newHeight;
|
||||
if (isMap3) {
|
||||
locElt.offsetParent.style.top = 0;
|
||||
locElt.offsetParent.style.width = locElt.offsetWidth + 10 + locElt.offsetLeft + 'px';
|
||||
locElt.offsetParent.style.height = locElt.offsetHeight + locElt.offsetTop + 'px';
|
||||
newHeight = (locElt.offsetHeight < 500 ? 500 : locElt.offsetHeight) + locElt.offsetParent.offsetTop + 30;
|
||||
} else {
|
||||
newHeight = (locElt.offsetHeight < 500 ? 500 : locElt.offsetHeight);
|
||||
}
|
||||
if (tabPanelName == 'caseMap') {
|
||||
// trick to force scrollbar to be shown
|
||||
locElt.offsetParent.style.overflow = 'visible';
|
||||
locElt.offsetParent.style.overflow = 'hidden';
|
||||
}
|
||||
if (locElt.scrollHeight && locElt.scrollHeight > newHeight) {
|
||||
newHeight = locElt.scrollHeight;
|
||||
}
|
||||
//NOT NEEDED WITH jQuery: tabs.getItem(tabPanelName).setHeight(newHeight);
|
||||
otherFrame.height = newHeight;
|
||||
redimIFrame = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
otherFrameTimerCounter = otherFrameTimerCounter + 1;
|
||||
|
||||
if (otherFrameTimerCounter > 3000 || redimIFrame) {
|
||||
window.clearInterval(otherFrameTimer);
|
||||
}
|
||||
|
||||
} catch (ev) {
|
||||
// nothing to do here for the moment
|
||||
}
|
||||
}, 10);
|
||||
|
||||
}
|
||||
//debugger;
|
||||
// To manage submits to case.front.php
|
||||
var GLPI_HTTP_CASE_FORM = window.location.href.replace(window.location.search, ''); //window.location.href.split('/', loc_split.length - 2).join('/') + '/plugins/processmaker/front/case.front.php'; // http://hostname/glpi/...
|
||||
// to manage reloads
|
||||
var GLPI_RELOAD_PARENT = window; //.location;
|
||||
var GLPI_DURING_RELOAD = false;
|
||||
|
||||
// used to find an element in a list and to hide it!
|
||||
function bGLPIHideElement(eltList, attribute, value) {
|
||||
var ret = false;
|
||||
for (var i = 0; i < eltList.length && !ret; i++) {
|
||||
var node = eltList[i];
|
||||
if (node.getAttribute(attribute) == value) {
|
||||
// hide the link
|
||||
node.style.display = 'none';
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
function displayOverlay() {
|
||||
//debugger;
|
||||
// don't use displayOverlay when submit input open new tab or update parent ( example: pdf generation )
|
||||
if (!($(this).is('input[type=submit]')
|
||||
&& $(this).parents('form').length > 0
|
||||
&& ($(this).parents('form').first().attr('target') == '_blank' || $(this).parents('form').first().attr('target') == '_parent'))) {
|
||||
$("<div class='ui-widget-overlay ui-front'></div>").appendTo("body");
|
||||
|
||||
var timer = window.setInterval(function () {
|
||||
var count = $('.ui-widget-overlay.ui-front').length;
|
||||
if (count == 2) {
|
||||
$($('.ui-widget-overlay.ui-front')[1]).remove();
|
||||
window.clearInterval(timer);
|
||||
}
|
||||
|
||||
}, 10);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function onTaskFrameLoad(event, delIndex, hideClaimButton, csrf) {
|
||||
//alert("Loaded frame " + delIndex);
|
||||
//debugger;
|
||||
var taskFrameId = event.target.id; //"caseiframe-" + delIndex;
|
||||
var bShowHideNextStep = false; // not done yet!
|
||||
var bHideClaimCancelButton = false; // To manage 'Claim' button
|
||||
var taskFrameTimerCounter = 0;
|
||||
var redimIFrame = false;
|
||||
//debugger;
|
||||
var taskFrameTimer = window.setInterval(function () {
|
||||
try {
|
||||
var locContentDocument;
|
||||
var taskFrame = document.getElementById(taskFrameId);
|
||||
try {
|
||||
locContentDocument = taskFrame.contentDocument;
|
||||
} catch (ex) {
|
||||
locContentDocument = false;
|
||||
}
|
||||
if (taskFrame != undefined && locContentDocument != undefined) {
|
||||
// here we've caught the content of the iframe
|
||||
|
||||
// if task resumé, then hide the form part
|
||||
//debugger;
|
||||
//var form_resume = locContentDocument.getElementsByName('cases_Resume');
|
||||
//if (form_resume.length > 0 && form_resume[0].style.display != 'none') {
|
||||
// form_resume[0].style.display = 'none';
|
||||
//}
|
||||
|
||||
// then look if btnGLPISendRequest exists,
|
||||
var locElt = locContentDocument.getElementById('form[btnGLPISendRequest]');
|
||||
if (!bShowHideNextStep && locElt != undefined ) {
|
||||
var linkList = locContentDocument.getElementsByTagName('a');
|
||||
if (bGLPIHideElement(linkList, 'href', 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN')) {
|
||||
// the next step link is hidden
|
||||
|
||||
// if yes then change the link behind the button itself
|
||||
locElt.type = 'submit';
|
||||
locElt.onclick = null; // in order to force use of the action of form POST
|
||||
var formList = locContentDocument.getElementsByTagName('form');
|
||||
|
||||
// if yes then change the action of the form POST
|
||||
var node = formList[0]; // must have one element in list: in a dynaform there is one and only one HTML form
|
||||
node.setAttribute('actionBackup', node.action);
|
||||
var action = node.action.split('?');
|
||||
node.action = GLPI_HTTP_CASE_FORM + '?' + action[1] + '&DEL_INDEX=' + delIndex + '&action=route';
|
||||
|
||||
// add an element that will be the csrf data code for the POST
|
||||
//debugger;
|
||||
var csrfElt = document.createElement("input");
|
||||
csrfElt.setAttribute("type", "hidden");
|
||||
csrfElt.setAttribute("name", "_glpi_csrf_token");
|
||||
csrfElt.setAttribute("value", csrf);
|
||||
node.appendChild(csrfElt);
|
||||
} else {
|
||||
// then hide the button itself
|
||||
locElt.style.display = 'none';
|
||||
}
|
||||
|
||||
bShowHideNextStep = true;
|
||||
}
|
||||
|
||||
// Hide 'Cancel' button on 'Claim' form
|
||||
var cancelButton = locContentDocument.getElementById('form[BTN_CANCEL]');
|
||||
if (cancelButton != undefined && !bHideClaimCancelButton) {
|
||||
//debugger;
|
||||
cancelButton.style.display = 'none';
|
||||
// hides claim button if asked for
|
||||
if (hideClaimButton) {
|
||||
claimButton = locContentDocument.getElementById('form[BTN_CATCH]');
|
||||
claimButton.style.display = 'none';
|
||||
}
|
||||
// to manage Claim
|
||||
var formList = locContentDocument.getElementsByTagName('form');
|
||||
var node = formList[0]; // must have one element in list: in a dynaform there is one and only one HTML form
|
||||
node.setAttribute('actionBackup', node.action);
|
||||
|
||||
var action = node.action.split('?');
|
||||
//debugger;
|
||||
node.action = GLPI_HTTP_CASE_FORM + '?' + (action[1]?action[1]+'&':'') + 'DEL_INDEX=' + delIndex;
|
||||
// add an element that will be the csrf data code for the POST
|
||||
//debugger;
|
||||
var csrfElt = document.createElement("input");
|
||||
csrfElt.setAttribute("type", "hidden");
|
||||
csrfElt.setAttribute("name", "_glpi_csrf_token");
|
||||
csrfElt.setAttribute("value", csrf);
|
||||
node.appendChild(csrfElt);
|
||||
|
||||
bHideClaimCancelButton = true;
|
||||
// TODO
|
||||
//node.addEventListener('submit', showMask);
|
||||
}
|
||||
|
||||
// to force immediate reload of GLPI item form
|
||||
var forcedReload = locContentDocument.getElementById('GLPI_FORCE_RELOAD');
|
||||
if (forcedReload != undefined && !GLPI_DURING_RELOAD) {
|
||||
//showMask();
|
||||
GLPI_DURING_RELOAD = true; // to prevent double reload
|
||||
window.clearInterval(taskFrameTimer); // stop timer
|
||||
GLPI_RELOAD_PARENT.location.reload();
|
||||
}
|
||||
|
||||
// try to redim caseIFrame
|
||||
if (!redimIFrame) {
|
||||
redimTaskFrame(taskFrame, delIndex);
|
||||
var redimFrameTimer = window.setInterval(function () {
|
||||
redimTaskFrame(taskFrame, delIndex);
|
||||
}, 1000);
|
||||
|
||||
redimIFrame = true;
|
||||
}
|
||||
}
|
||||
|
||||
taskFrameTimerCounter = taskFrameTimerCounter + 1;
|
||||
|
||||
if (taskFrameTimerCounter > 3000 || bShowHideNextStep || bHideClaimCancelButton) { // either timeout or hiding is done
|
||||
window.clearInterval(taskFrameTimer);
|
||||
}
|
||||
|
||||
} catch (evt) {
|
||||
// nothing to do here for the moment
|
||||
}
|
||||
|
||||
}, 10);
|
||||
|
||||
}
|
||||
|
||||
function redimTaskFrame(taskFrame, delIndex) {
|
||||
var newHeight;
|
||||
try {
|
||||
//var locElt = locContentDocument.getElementsByTagName("table")[0];
|
||||
var locElt = taskFrame.contentDocument.getElementsByTagName("html")[0];
|
||||
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||
if (newHeight < 500) {
|
||||
newHeight = 500;
|
||||
}
|
||||
|
||||
taskFrame.height = newHeight;
|
||||
} catch (e) {
|
||||
}
|
||||
}
|
||||
|
||||
//function onTaskFrameActivation(delIndex) {
|
||||
// var taskFrameId = "caseiframe-" + delIndex;
|
||||
// var taskFrameTimerCounter = 0;
|
||||
// var redimIFrame = false;
|
||||
|
||||
// var taskFrameTimer = window.setInterval(function () {
|
||||
// try {
|
||||
// var locContentDocument;
|
||||
// var taskFrame = document.getElementById(taskFrameId);
|
||||
|
||||
// if (taskFrame != undefined && taskFrame.contentDocument != undefined) {
|
||||
// // here we've caught the content of the iframe
|
||||
// locContentDocument = taskFrame.contentDocument;
|
||||
|
||||
// // try to redim caseIFrame
|
||||
// if (!redimIFrame) {
|
||||
// var newHeight;
|
||||
// var locElt = locContentDocument.getElementsByTagName("html")[0];
|
||||
// newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||
|
||||
// tabs.getItem('task-' + delIndex).setHeight(newHeight);
|
||||
// taskFrame.height = newHeight;
|
||||
// redimIFrame = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
// taskFrameTimerCounter = taskFrameTimerCounter + 1;
|
||||
|
||||
// if (taskFrameTimerCounter > 3000 || redimIFrame) { // timeout
|
||||
// window.clearInterval(taskFrameTimer);
|
||||
// }
|
||||
|
||||
// } catch (evt) {
|
||||
// // nothing to do here for the moment
|
||||
// }
|
||||
|
||||
// }, 10);
|
||||
//}
|
||||
function clearClass(lociFrame) {
|
||||
|
||||
try {
|
||||
var locElt = lociFrame.contentDocument.getElementsByTagName('body')[0];
|
||||
if (locElt != undefined && locElt.className != '') {
|
||||
//debugger;
|
||||
locElt.className = '';
|
||||
|
||||
}
|
||||
} catch (ev) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function onOtherFrameLoad(tabPanelName, frameName, eltTagName, isMap3) {
|
||||
var otherFrameId = frameName;
|
||||
var otherFrameTimerCounter = 0;
|
||||
var redimIFrame = false;
|
||||
//debugger;
|
||||
if (isMap3 == undefined) {
|
||||
isMap3 = false;
|
||||
}
|
||||
|
||||
var otherFrameTimer = window.setInterval(function () {
|
||||
try {
|
||||
|
||||
var locContentDocument;
|
||||
var otherFrame = document.getElementById(otherFrameId);
|
||||
|
||||
if (otherFrame != undefined && otherFrame.contentDocument != undefined) {
|
||||
// here we've caught the content of the iframe
|
||||
clearClass(otherFrame);
|
||||
|
||||
locContentDocument = otherFrame.contentDocument;
|
||||
|
||||
// try to redim otherFrame
|
||||
// and tabPanel
|
||||
if (!redimIFrame) {
|
||||
var locElt;
|
||||
// isMap3 == true
|
||||
// map is bpmn
|
||||
// must look at div with special CSS class name to get newHeight and should change offset and size of parent div
|
||||
if (!isMap3) {
|
||||
if (tabPanelName == 'caseMap') {
|
||||
// locElt = locContentDocument.querySelectorAll('div.panel_content___processmaker')[0];
|
||||
locElt = locContentDocument.querySelectorAll('div.panel_containerWindow___processmaker')[0];
|
||||
locElt2 = locContentDocument.getElementById('pm_target');
|
||||
locElt2.style.height = locElt.clientHeight + 'px';
|
||||
} else {
|
||||
locElt = locContentDocument.getElementsByTagName(eltTagName)[0];
|
||||
}
|
||||
} else {
|
||||
locElt = locContentDocument.querySelectorAll('div.pmui-pmpool')[0];
|
||||
}
|
||||
if (locElt != undefined) {
|
||||
var newHeight;
|
||||
if (isMap3) {
|
||||
locElt.offsetParent.style.top = 0;
|
||||
locElt.offsetParent.style.width = locElt.offsetWidth + 10 + locElt.offsetLeft + 'px';
|
||||
locElt.offsetParent.style.height = locElt.offsetHeight + locElt.offsetTop + 'px';
|
||||
newHeight = (locElt.offsetHeight < 500 ? 500 : locElt.offsetHeight) + locElt.offsetParent.offsetTop + 30;
|
||||
} else {
|
||||
newHeight = (locElt.offsetHeight < 500 ? 500 : locElt.offsetHeight);
|
||||
}
|
||||
if (tabPanelName == 'caseMap') {
|
||||
// trick to force scrollbar to be shown
|
||||
locElt.offsetParent.style.overflow = 'visible';
|
||||
locElt.offsetParent.style.overflow = 'hidden';
|
||||
}
|
||||
if (locElt.scrollHeight && locElt.scrollHeight > newHeight) {
|
||||
newHeight = locElt.scrollHeight;
|
||||
}
|
||||
//NOT NEEDED WITH jQuery: tabs.getItem(tabPanelName).setHeight(newHeight);
|
||||
otherFrame.height = newHeight;
|
||||
redimIFrame = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
otherFrameTimerCounter = otherFrameTimerCounter + 1;
|
||||
|
||||
if (otherFrameTimerCounter > 3000 || redimIFrame) {
|
||||
window.clearInterval(otherFrameTimer);
|
||||
}
|
||||
|
||||
} catch (ev) {
|
||||
// nothing to do here for the moment
|
||||
}
|
||||
}, 10);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
$(function () {
|
||||
$(document).ajaxComplete(function (event, jqXHR, ajaxOptions) {
|
||||
//debugger;
|
||||
var pattern = /##processmaker.*(##|...)/g;
|
||||
|
||||
$('tr.tab_bg_2 td a').each(function (index) {
|
||||
|
||||
var textToChange = $(this).text();
|
||||
var matches = textToChange.match(pattern);
|
||||
if (matches) {
|
||||
textToChange = textToChange.replace(pattern, '');
|
||||
if (!textToChange.trim().length>0) {
|
||||
var title = $(this).parent().prev().text();
|
||||
textToChange = title;
|
||||
}
|
||||
$(this).text(textToChange);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
$(function () {
|
||||
$(document).ajaxComplete(function (event, jqXHR, ajaxOptions) {
|
||||
//debugger;
|
||||
var pattern = /##processmaker.*(##|...)/g;
|
||||
|
||||
$('tr.tab_bg_2 td a').each(function (index) {
|
||||
|
||||
var textToChange = $(this).text();
|
||||
var matches = textToChange.match(pattern);
|
||||
if (matches) {
|
||||
textToChange = textToChange.replace(pattern, '');
|
||||
if (!textToChange.trim().length>0) {
|
||||
var title = $(this).parent().prev().text();
|
||||
textToChange = title;
|
||||
}
|
||||
$(this).text(textToChange);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,26 +1,26 @@
|
||||
<?php
|
||||
// Direct access to file
|
||||
if (strpos($_SERVER['PHP_SELF'], "processmaker/js/helpdesk.public.js.php")) {
|
||||
$AJAX_INCLUDE = 1;
|
||||
define('GLPI_ROOT', '../../..');
|
||||
include (GLPI_ROOT."/inc/includes.php");
|
||||
header("Content-type: application/javascript");
|
||||
Html::header_nocache();
|
||||
}
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
die("Can not access directly to this file");
|
||||
}
|
||||
|
||||
$config = PluginProcessmakerConfig::getInstance();
|
||||
if (!$config->fields['maintenance']) {
|
||||
echo "$(function () {
|
||||
// look if name='helpdeskform' is present. If yes replace the form.location
|
||||
var ahrefTI = '".$CFG_GLPI["root_doc"]."/plugins/processmaker/front/tracking.injector.php';
|
||||
var formLink = $(\"form[name='helpdeskform']\")[0];
|
||||
if (formLink != undefined) {
|
||||
formLink.action = ahrefTI;
|
||||
}
|
||||
});
|
||||
"; // end of echo
|
||||
}
|
||||
<?php
|
||||
// Direct access to file
|
||||
if (strpos($_SERVER['PHP_SELF'], "processmaker/js/helpdesk.public.js.php")) {
|
||||
$AJAX_INCLUDE = 1;
|
||||
define('GLPI_ROOT', '../../..');
|
||||
include (GLPI_ROOT."/inc/includes.php");
|
||||
header("Content-type: application/javascript");
|
||||
Html::header_nocache();
|
||||
}
|
||||
|
||||
if (!defined('GLPI_ROOT')) {
|
||||
die("Can not access directly to this file");
|
||||
}
|
||||
|
||||
$config = PluginProcessmakerConfig::getInstance();
|
||||
if (!$config->fields['maintenance']) {
|
||||
echo "$(function () {
|
||||
// look if name='helpdeskform' is present. If yes replace the form.location
|
||||
var ahrefTI = '".$CFG_GLPI["root_doc"]."/plugins/processmaker/front/tracking.injector.php';
|
||||
var formLink = $(\"form[name='helpdeskform']\")[0];
|
||||
if (formLink != undefined) {
|
||||
formLink.action = ahrefTI;
|
||||
}
|
||||
});
|
||||
"; // end of echo
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
$(function () {
|
||||
$(document).ajaxComplete(function (event, jqXHR, ajaxOptions) {
|
||||
//debugger;
|
||||
if (!$('input[type="checkbox"][value="PluginProcessmakerTask"]').is(':checked')) {
|
||||
$('input[type="checkbox"][value="PluginProcessmakerTask"]').trigger('click');
|
||||
}
|
||||
$('input[type="checkbox"][value="PluginProcessmakerTask"]').parents('li').first().hide();
|
||||
});
|
||||
$(function () {
|
||||
$(document).ajaxComplete(function (event, jqXHR, ajaxOptions) {
|
||||
//debugger;
|
||||
if (!$('input[type="checkbox"][value="PluginProcessmakerTask"]').is(':checked')) {
|
||||
$('input[type="checkbox"][value="PluginProcessmakerTask"]').trigger('click');
|
||||
}
|
||||
$('input[type="checkbox"][value="PluginProcessmakerTask"]').parents('li').first().hide();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user