Version 3.4.5
Compatibility with GLPI 9.2
This commit is contained in:
@@ -1,10 +1,9 @@
|
|||||||
# ProcessMaker plugin
|
# ProcessMaker plugin
|
||||||
|
|
||||||
GLPI plugin that provides an interface with ProcessMaker server (http://www.processmaker.com/).
|
GLPI plugin that provides an interface with a customized ProcessMaker server (https://github.com/tomolimo/processmaker-server).
|
||||||
|
|
||||||
Is currently compatible with GLPI 9.1 and 9.2
|
version 3.4.5 is compatible with GLPI 9.2 and needs ProcessMaker either 3.0.1.8-RE-1.12 (https://github.com/tomolimo/processmaker-server/releases/tag/3.0.1.8-RE-1.12) or 3.3.0-RE-1.0 (https://github.com/tomolimo/processmaker-server/releases/tag/3.3.0-RE-1.0)
|
||||||
|
|
||||||
Is currently compatible with ProcessMaker 3.0.1.8-RE-1.9 (see https://github.com/tomolimo/processmaker-server/releases/latest)
|
|
||||||
This plugin can run classic and bpmn processes
|
This plugin can run classic and bpmn processes
|
||||||
|
|
||||||
An IRC channel is available: #processmaker-glpi on https://webchat.freenode.net/
|
An IRC channel is available: #processmaker-glpi on https://webchat.freenode.net/
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if (strpos($_SERVER['PHP_SELF'],"asynchronousdatas.php")) {
|
if (strpos($_SERVER['PHP_SELF'], "asynchronousdatas.php")) {
|
||||||
$AJAX_INCLUDE = 1;
|
$AJAX_INCLUDE = 1;
|
||||||
define('GLPI_ROOT','../../..');
|
define('GLPI_ROOT', '../../..');
|
||||||
include (GLPI_ROOT."/inc/includes.php");
|
include (GLPI_ROOT."/inc/includes.php");
|
||||||
Html::header_nocache();
|
Html::header_nocache();
|
||||||
}
|
}
|
||||||
@@ -10,38 +10,38 @@ if (!defined('GLPI_ROOT')) {
|
|||||||
die("Can not access directly to this file");
|
die("Can not access directly to this file");
|
||||||
}
|
}
|
||||||
|
|
||||||
include_once dirname(__FILE__)."/../inc/crontaskaction.class.php" ;
|
include_once dirname(__FILE__)."/../inc/crontaskaction.class.php";
|
||||||
if( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS' ) {
|
if (isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS') {
|
||||||
header("Access-Control-Allow-Origin: *") ;
|
header("Access-Control-Allow-Origin: *");
|
||||||
header("Access-Control-Allow-Methods: POST");
|
header("Access-Control-Allow-Methods: POST");
|
||||||
header("Access-Control-Allow-Headers: Content-Type");
|
header("Access-Control-Allow-Headers: Content-Type");
|
||||||
} else {
|
} else {
|
||||||
header("Access-Control-Allow-Origin: *") ;
|
header("Access-Control-Allow-Origin: *");
|
||||||
header("Content-Type: application/json; charset=UTF-8");
|
header("Content-Type: application/json; charset=UTF-8");
|
||||||
|
|
||||||
if( isset($_SERVER['REQUEST_METHOD']) ) {
|
if (isset($_SERVER['REQUEST_METHOD'])) {
|
||||||
switch($_SERVER['REQUEST_METHOD']) {
|
switch ($_SERVER['REQUEST_METHOD']) {
|
||||||
case 'POST' :
|
case 'POST' :
|
||||||
$request_body = file_get_contents('php://input');
|
$request_body = file_get_contents('php://input');
|
||||||
$datas = json_decode($request_body, true);
|
$datas = json_decode($request_body, true);
|
||||||
|
|
||||||
$asyncdata = new PluginProcessmakerCrontaskaction ;
|
$asyncdata = new PluginProcessmakerCrontaskaction;
|
||||||
if( isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA ) {
|
if (isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA) {
|
||||||
$initialdatas = json_decode($asyncdata->fields['postdata'], true);
|
$initialdatas = json_decode($asyncdata->fields['postdata'], true);
|
||||||
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] ) ;
|
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] );
|
||||||
$postdata = json_encode($initialdatas, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
|
$postdata = json_encode($initialdatas, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
|
||||||
$asyncdata->update( array( 'id' => $datas['id'], 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'postdata' => $postdata ) ) ;
|
$asyncdata->update( [ 'id' => $datas['id'], 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'postdata' => $postdata ] );
|
||||||
$ret = array( 'code' => '0', 'message' => 'Done' );
|
$ret = [ 'code' => '0', 'message' => 'Done' ];
|
||||||
} else {
|
} else {
|
||||||
$ret = array( 'code' => '2', 'message' => 'Case is not existing, or state is not WAITING_DATA' );
|
$ret = [ 'code' => '2', 'message' => 'Case is not existing, or state is not WAITING_DATA' ];
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
$ret = array( 'code' => '1', 'message' => 'Method '.$_SERVER['REQUEST_METHOD'].' not supported' ) ;
|
$ret = [ 'code' => '1', 'message' => 'Method '.$_SERVER['REQUEST_METHOD'].' not supported' ];
|
||||||
}
|
}
|
||||||
|
|
||||||
echo json_encode( $ret, JSON_HEX_APOS | JSON_HEX_QUOT ) ;
|
echo json_encode( $ret, JSON_HEX_APOS | JSON_HEX_QUOT );
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,26 +48,28 @@ if (!empty($_REQUEST['searchText'])) {
|
|||||||
$search = Search::makeTextSearch($_REQUEST['searchText']);
|
$search = Search::makeTextSearch($_REQUEST['searchText']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$processes = array();
|
$processes = [];
|
||||||
|
|
||||||
// Empty search text : display first
|
// Empty search text : display first
|
||||||
if (empty($_REQUEST['searchText'])) {
|
if (empty($_REQUEST['searchText'])) {
|
||||||
if ($_REQUEST['display_emptychoice']) {
|
if ($_REQUEST['display_emptychoice']) {
|
||||||
if (($one_item < 0) || ($one_item == 0)) {
|
if (($one_item < 0) || ($one_item == 0)) {
|
||||||
array_push($processes, array('id' => 0,
|
array_push($processes, ['id' => 0,
|
||||||
'text' => $_REQUEST['emptylabel']));
|
'text' => $_REQUEST['emptylabel']]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$processall = (isset($_REQUEST['specific_tags']['process_restrict']) && !$_REQUEST['specific_tags']['process_restrict']);
|
||||||
|
|
||||||
$result = PluginProcessmakerProcess::getSqlSearchResult(false, $search);
|
$result = PluginProcessmakerProcess::getSqlSearchResult(false, $search);
|
||||||
|
|
||||||
if ($DB->numrows($result)) {
|
if ($DB->numrows($result)) {
|
||||||
while ($data = $DB->fetch_array($result)) {
|
while ($data = $DB->fetch_array($result)) {
|
||||||
$process_entities = PluginProcessmakerProcess::getEntitiesForProfileByProcess($data["id"], $_SESSION['glpiactiveprofile']['id'], true);
|
$process_entities = PluginProcessmakerProcess::getEntitiesForProfileByProcess($data["id"], $_SESSION['glpiactiveprofile']['id'], true);
|
||||||
if (in_array( $_REQUEST["entity_restrict"], $process_entities)) {
|
if ($processall || in_array( $_REQUEST["entity_restrict"], $process_entities)) {
|
||||||
array_push( $processes, array( 'id' => $data["id"],
|
array_push( $processes, [ 'id' => $data["id"],
|
||||||
'text' => $data["name"] ));
|
'text' => $data["name"] ]);
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ if (!defined('GLPI_ROOT')) {
|
|||||||
Session::checkLoginUser();
|
Session::checkLoginUser();
|
||||||
|
|
||||||
$PM_DB = new PluginProcessmakerDB;
|
$PM_DB = new PluginProcessmakerDB;
|
||||||
|
$dbu = new DbUtils;
|
||||||
|
|
||||||
if (!isset($_REQUEST['right'])) {
|
if (!isset($_REQUEST['right'])) {
|
||||||
$_REQUEST['right'] = "all";
|
$_REQUEST['right'] = "all";
|
||||||
@@ -33,7 +34,7 @@ if (!isset($_REQUEST['all'])) {
|
|||||||
$_REQUEST['all'] = 0;
|
$_REQUEST['all'] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$used = array();
|
$used = [];
|
||||||
|
|
||||||
if (isset($_REQUEST['used'])) {
|
if (isset($_REQUEST['used'])) {
|
||||||
$used = $_REQUEST['used'];
|
$used = $_REQUEST['used'];
|
||||||
@@ -64,13 +65,13 @@ if ($one_item < 0) {
|
|||||||
WHERE `glpi_users`.`id` = '$one_item';";
|
WHERE `glpi_users`.`id` = '$one_item';";
|
||||||
$result = $DB->query($query);
|
$result = $DB->query($query);
|
||||||
}
|
}
|
||||||
$users = array();
|
$users = [];
|
||||||
|
|
||||||
// Count real items returned
|
// Count real items returned
|
||||||
$count = 0;
|
$count = 0;
|
||||||
if ($DB->numrows($result)) {
|
if ($DB->numrows($result)) {
|
||||||
while ($data = $DB->fetch_assoc($result)) {
|
while ($data = $DB->fetch_assoc($result)) {
|
||||||
$users[$data["id"]] = formatUserName($data["id"], $data["name"], $data["realname"],
|
$users[$data["id"]] = $dbu->formatUserName($data["id"], $data["name"], $data["realname"],
|
||||||
$data["firstname"]);
|
$data["firstname"]);
|
||||||
$logins[$data["id"]] = $data["name"];
|
$logins[$data["id"]] = $data["name"];
|
||||||
}
|
}
|
||||||
@@ -82,17 +83,17 @@ if (!function_exists('dpuser_cmp')) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$datas = array();
|
$datas = [];
|
||||||
|
|
||||||
// Display first if empty search
|
// Display first if empty search
|
||||||
if ($_REQUEST['page'] == 1 && empty($_REQUEST['searchText'])) {
|
if ($_REQUEST['page'] == 1 && empty($_REQUEST['searchText'])) {
|
||||||
if (($one_item < 0) || ($one_item == 0)) {
|
if (($one_item < 0) || ($one_item == 0)) {
|
||||||
if ($_REQUEST['all'] == 0) {
|
if ($_REQUEST['all'] == 0) {
|
||||||
array_push($datas, array('id' => 0,
|
array_push($datas, ['id' => 0,
|
||||||
'text' => Dropdown::EMPTY_VALUE));
|
'text' => Dropdown::EMPTY_VALUE]);
|
||||||
} else if ($_REQUEST['all'] == 1) {
|
} else if ($_REQUEST['all'] == 1) {
|
||||||
array_push($datas, array('id' => 0,
|
array_push($datas, ['id' => 0,
|
||||||
'text' => __('All')));
|
'text' => __('All')]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,9 +102,9 @@ if (count($users)) {
|
|||||||
foreach ($users as $ID => $output) {
|
foreach ($users as $ID => $output) {
|
||||||
$title = sprintf('%1$s - %2$s', $output, $logins[$ID]);
|
$title = sprintf('%1$s - %2$s', $output, $logins[$ID]);
|
||||||
|
|
||||||
array_push($datas, array('id' => $ID,
|
array_push($datas, ['id' => $ID,
|
||||||
'text' => $output,
|
'text' => $output,
|
||||||
'title' => $title));
|
'title' => $title]);
|
||||||
$count++;
|
$count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ if (!defined('GLPI_ROOT')) {
|
|||||||
|
|
||||||
Session::checkLoginUser();
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
$PM_SOAP = new PluginProcessmakerProcessmaker; // not used in this context, just here to define the type of $PM_SOAP
|
||||||
$PM_DB = new PluginProcessmakerDB;
|
$PM_DB = new PluginProcessmakerDB;
|
||||||
$rand = rand();
|
$rand = rand();
|
||||||
|
|
||||||
@@ -32,7 +33,7 @@ echo "<input type='hidden' name='users_id' value='".$_REQUEST['users_id']."'>";
|
|||||||
echo "<input type='hidden' name='taskGuid' value='".$_REQUEST['taskGuid']."'>";
|
echo "<input type='hidden' name='taskGuid' value='".$_REQUEST['taskGuid']."'>";
|
||||||
echo "<input type='hidden' name='delThread' value='".$_REQUEST['delThread']."'>";
|
echo "<input type='hidden' name='delThread' value='".$_REQUEST['delThread']."'>";
|
||||||
|
|
||||||
PluginProcessmakerUser::dropdown( array('name' => 'users_id_recipient',
|
PluginProcessmakerUser::dropdown( ['name' => 'users_id_recipient',
|
||||||
'value' => $_REQUEST['users_id'],
|
'value' => $_REQUEST['users_id'],
|
||||||
'used' => [$_REQUEST['users_id']],
|
'used' => [$_REQUEST['users_id']],
|
||||||
'entity' => 0, //$item->fields["entities_id"], // not used, as any user can be assigned to any tasks
|
'entity' => 0, //$item->fields["entities_id"], // not used, as any user can be assigned to any tasks
|
||||||
@@ -40,7 +41,7 @@ PluginProcessmakerUser::dropdown( array('name' => 'users_id_recipient',
|
|||||||
'right' => 'all',
|
'right' => 'all',
|
||||||
'rand' => $rand,
|
'rand' => $rand,
|
||||||
'width' => '',
|
'width' => '',
|
||||||
'specific_tags' => array('taskGuid' => $_REQUEST['taskGuid'])));
|
'specific_tags' => ['taskGuid' => $_REQUEST['taskGuid']]]);
|
||||||
echo " ";
|
echo " ";
|
||||||
echo "<input type='submit' name='reassign' value='".__('Re-assign', 'processmaker')."' class='submit'>";
|
echo "<input type='submit' name='reassign' value='".__('Re-assign', 'processmaker')."' class='submit'>";
|
||||||
Html::closeForm(true);
|
Html::closeForm(true);
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
include_once ("../../../inc/includes.php");
|
include_once ("../../../inc/includes.php");
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
$locCase = new PluginProcessmakerCase();
|
$locCase = new PluginProcessmakerCase();
|
||||||
|
|
||||||
@@ -28,8 +29,7 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'route' && isset( $_REQ
|
|||||||
}
|
}
|
||||||
glpi_processmaker_case_reload_page();
|
glpi_processmaker_case_reload_page();
|
||||||
|
|
||||||
} else
|
} else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
|
||||||
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
|
|
||||||
// delete case from case table, this will also delete the tasks
|
// delete case from case table, this will also delete the tasks
|
||||||
if ($locCase->getFromDB($_POST['cases_id']) && $locCase->deleteCase()) {
|
if ($locCase->getFromDB($_POST['cases_id']) && $locCase->deleteCase()) {
|
||||||
Session::addMessageAfterRedirect(__('Case has been deleted!', 'processmaker'), true, INFO);
|
Session::addMessageAfterRedirect(__('Case has been deleted!', 'processmaker'), true, INFO);
|
||||||
@@ -39,8 +39,7 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
|
|||||||
// will redirect to item or to list if no item
|
// will redirect to item or to list if no item
|
||||||
$locCase->redirectToList();
|
$locCase->redirectToList();
|
||||||
|
|
||||||
} else
|
} else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'cancel') {
|
||||||
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'cancel') {
|
|
||||||
// cancel case from PM
|
// cancel case from PM
|
||||||
$locCase = new PluginProcessmakerCase;
|
$locCase = new PluginProcessmakerCase;
|
||||||
$locCase->getFromDB($_POST['cases_id']);
|
$locCase->getFromDB($_POST['cases_id']);
|
||||||
@@ -55,8 +54,7 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'cancel') {
|
|||||||
Session::addMessageAfterRedirect(__('Unable to cancel case!', 'processmaker'), true, ERROR);
|
Session::addMessageAfterRedirect(__('Unable to cancel case!', 'processmaker'), true, ERROR);
|
||||||
}
|
}
|
||||||
Html::back();
|
Html::back();
|
||||||
} else
|
} else if (isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && isset( $_REQUEST['form']['APP_UID'])) {
|
||||||
if (isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && isset( $_REQUEST['form']['APP_UID'])) {
|
|
||||||
// Claim task management
|
// Claim task management
|
||||||
// here we are in a Claim request
|
// here we are in a Claim request
|
||||||
$myCase = new PluginProcessmakerCase;
|
$myCase = new PluginProcessmakerCase;
|
||||||
@@ -69,8 +67,7 @@ if (isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && iss
|
|||||||
}
|
}
|
||||||
glpi_processmaker_case_reload_page();
|
glpi_processmaker_case_reload_page();
|
||||||
|
|
||||||
} else
|
} else if (isset($_REQUEST['id']) && $_REQUEST['id'] > 0) {
|
||||||
if (isset($_REQUEST['id']) && $_REQUEST['id'] > 0) {
|
|
||||||
|
|
||||||
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
|
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
|
||||||
Html::helpHeader(__('Process cases', 'processmaker'), '', $_SESSION["glpiname"]);
|
Html::helpHeader(__('Process cases', 'processmaker'), '', $_SESSION["glpiname"]);
|
||||||
|
|||||||
@@ -6,6 +6,18 @@ Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "helpdesk
|
|||||||
|
|
||||||
if (!$PM_SOAP->config->fields['maintenance']) {
|
if (!$PM_SOAP->config->fields['maintenance']) {
|
||||||
if (Session::haveRightsOr("plugin_processmaker_config", [READ, UPDATE])) {
|
if (Session::haveRightsOr("plugin_processmaker_config", [READ, UPDATE])) {
|
||||||
|
|
||||||
|
// force default sort to column id / DESC
|
||||||
|
if (empty($_SESSION['glpisearch']['PluginProcessmakerCase'])
|
||||||
|
|| isset($_GET["reset"])
|
||||||
|
|| !isset($_GET["sort"])
|
||||||
|
) {
|
||||||
|
$_SESSION['glpisearch']['PluginProcessmakerCase']['order'] = 'DESC';
|
||||||
|
$_SESSION['glpisearch']['PluginProcessmakerCase']['sort'] = '1';
|
||||||
|
if (isset($_GET["reset"])) {
|
||||||
|
unset($_GET['reset']);
|
||||||
|
}
|
||||||
|
}
|
||||||
Search::show('PluginProcessmakerCase');
|
Search::show('PluginProcessmakerCase');
|
||||||
} else {
|
} else {
|
||||||
Html::displayRightError();
|
Html::displayRightError();
|
||||||
|
|||||||
@@ -2,7 +2,9 @@
|
|||||||
|
|
||||||
include_once ("../../../inc/includes.php");
|
include_once ("../../../inc/includes.php");
|
||||||
|
|
||||||
Plugin::load('processmaker', true);
|
Session::checkLoginUser();
|
||||||
|
|
||||||
|
Plugin::load('processmaker', true); // ???
|
||||||
|
|
||||||
if (!isset($_REQUEST["id"])) {
|
if (!isset($_REQUEST["id"])) {
|
||||||
$_REQUEST["id"] = "";
|
$_REQUEST["id"] = "";
|
||||||
@@ -14,11 +16,11 @@ if (isset($_REQUEST["update"])) {
|
|||||||
$PluginCaselink->check($_REQUEST['id'], UPDATE);
|
$PluginCaselink->check($_REQUEST['id'], UPDATE);
|
||||||
$PluginCaselink->update($_REQUEST);
|
$PluginCaselink->update($_REQUEST);
|
||||||
Html::back();
|
Html::back();
|
||||||
} elseif (isset($_REQUEST['add'])) {
|
} else if (isset($_REQUEST['add'])) {
|
||||||
$PluginCaselink->check($_REQUEST['id'], UPDATE);
|
$PluginCaselink->check($_REQUEST['id'], UPDATE);
|
||||||
$PluginCaselink->add($_REQUEST);
|
$PluginCaselink->add($_REQUEST);
|
||||||
Html::back();
|
Html::back();
|
||||||
} elseif (isset($_REQUEST['purge'])) {
|
} else if (isset($_REQUEST['purge'])) {
|
||||||
$PluginCaselink->check($_REQUEST['id'], PURGE);
|
$PluginCaselink->check($_REQUEST['id'], PURGE);
|
||||||
$PluginCaselink->delete($_REQUEST, true);
|
$PluginCaselink->delete($_REQUEST, true);
|
||||||
$PluginCaselink->redirectToList();
|
$PluginCaselink->redirectToList();
|
||||||
|
|||||||
@@ -2,6 +2,8 @@
|
|||||||
|
|
||||||
include_once ("../../../inc/includes.php");
|
include_once ("../../../inc/includes.php");
|
||||||
|
|
||||||
|
Session::checkLoginUser();
|
||||||
|
|
||||||
Plugin::load('processmaker', true); // ???
|
Plugin::load('processmaker', true); // ???
|
||||||
|
|
||||||
if (!isset($_REQUEST["id"])) {
|
if (!isset($_REQUEST["id"])) {
|
||||||
|
|||||||
@@ -40,10 +40,10 @@ switch ($_POST["action"]) {
|
|||||||
}
|
}
|
||||||
} else { // the case is created before the ticket (used for post-only case creation before ticket creation)
|
} else { // the case is created before the ticket (used for post-only case creation before ticket creation)
|
||||||
$resultCase = $PM_SOAP->newCase( $_POST['plugin_processmaker_processes_id'],
|
$resultCase = $PM_SOAP->newCase( $_POST['plugin_processmaker_processes_id'],
|
||||||
array( 'GLPI_ITEM_CAN_BE_SOLVED' => 0,
|
[ 'GLPI_ITEM_CAN_BE_SOLVED' => 0,
|
||||||
'GLPI_SELFSERVICE_CREATED' => '1',
|
'GLPI_SELFSERVICE_CREATED' => '1',
|
||||||
'GLPI_ITEM_TYPE' => 'Ticket',
|
'GLPI_ITEM_TYPE' => 'Ticket',
|
||||||
'GLPI_URL' => $CFG_GLPI['url_base']) );
|
'GLPI_URL' => $CFG_GLPI['url_base']] );
|
||||||
if ($resultCase->status_code == 0) {
|
if ($resultCase->status_code == 0) {
|
||||||
// case is created
|
// case is created
|
||||||
// Must show it...
|
// Must show it...
|
||||||
@@ -87,54 +87,54 @@ switch ($_POST["action"]) {
|
|||||||
Session::addMessageAfterRedirect(__('Error re-assigning task: ', 'processmaker').$pmResponse->message, true, ERROR);
|
Session::addMessageAfterRedirect(__('Error re-assigning task: ', 'processmaker').$pmResponse->message, true, ERROR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Session::addMessageAfterRedirect(__('Task already assigned to this person!','processmaker'), true, ERROR);
|
Session::addMessageAfterRedirect(__('Task already assigned to this person!', 'processmaker'), true, ERROR);
|
||||||
}
|
}
|
||||||
//} else if (isset($_POST['delete'])) {
|
//} else if (isset($_POST['delete'])) {
|
||||||
// // delete case from case table, this will also delete the tasks
|
// // delete case from case table, this will also delete the tasks
|
||||||
// $locCase = new PluginProcessmakerCase;
|
// $locCase = new PluginProcessmakerCase;
|
||||||
// if ($locCase->getFromDB($_POST['cases_id']) && $locCase->deleteCase()) {
|
// if ($locCase->getFromDB($_POST['cases_id']) && $locCase->deleteCase()) {
|
||||||
// // request delete from pm itself
|
// // request delete from pm itself
|
||||||
// $PM_SOAP->login(true);
|
// $PM_SOAP->login(true);
|
||||||
|
|
||||||
// $resultPM = $PM_SOAP->deleteCase($locCase->fields['case_guid']);
|
// $resultPM = $PM_SOAP->deleteCase($locCase->fields['case_guid']);
|
||||||
|
|
||||||
// if ($resultPM->status_code == 0) {
|
// if ($resultPM->status_code == 0) {
|
||||||
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO);
|
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO);
|
||||||
// } else {
|
// } else {
|
||||||
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
|
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
|
||||||
// }
|
// }
|
||||||
// } else {
|
// } else {
|
||||||
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
|
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
|
||||||
// }
|
// }
|
||||||
//} else if (isset($_POST['cancel'])) {
|
//} else if (isset($_POST['cancel'])) {
|
||||||
// // cancel case from PM
|
// // cancel case from PM
|
||||||
// $locCase = new PluginProcessmakerCase;
|
// $locCase = new PluginProcessmakerCase;
|
||||||
// $locCase->getFromDB($_POST['cases_id']);
|
// $locCase->getFromDB($_POST['cases_id']);
|
||||||
// $resultPM = $PM_SOAP->cancelCase($locCase->fields['case_guid']); //, $_POST['plugin_processmaker_del_index'], $_POST['plugin_processmaker_users_id'] ) ;
|
// $resultPM = $PM_SOAP->cancelCase($locCase->fields['case_guid']); //, $_POST['plugin_processmaker_del_index'], $_POST['plugin_processmaker_users_id'] ) ;
|
||||||
// if ($resultPM->status_code === 0) {
|
// if ($resultPM->status_code === 0) {
|
||||||
// //$locCase = new PluginProcessmakerCase;
|
// //$locCase = new PluginProcessmakerCase;
|
||||||
// //$locCase->getFromDB($_POST['cases_id']);
|
// //$locCase->getFromDB($_POST['cases_id']);
|
||||||
// if ($locCase->cancelCase()) {
|
// if ($locCase->cancelCase()) {
|
||||||
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['cancelled'], true, INFO);
|
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['cancelled'], true, INFO);
|
||||||
// } else {
|
// } else {
|
||||||
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR);
|
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR);
|
||||||
// }
|
// }
|
||||||
// } else {
|
// } else {
|
||||||
// if ($resultPM->status_code == 100 && $locCase->deleteCase()) { // case is draft then delete it
|
// if ($resultPM->status_code == 100 && $locCase->deleteCase()) { // case is draft then delete it
|
||||||
// // request delete from pm itself
|
// // request delete from pm itself
|
||||||
// $PM_SOAP->login(true);
|
// $PM_SOAP->login(true);
|
||||||
|
|
||||||
// $resultPM = $PM_SOAP->deleteCase($locCase->fields['case_guid']);
|
// $resultPM = $PM_SOAP->deleteCase($locCase->fields['case_guid']);
|
||||||
|
|
||||||
// if ($resultPM->status_code == 0) {
|
// if ($resultPM->status_code == 0) {
|
||||||
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO);
|
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO);
|
||||||
// } else {
|
// } else {
|
||||||
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
|
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
|
||||||
// }
|
// }
|
||||||
// } else {
|
// } else {
|
||||||
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled']. " " . $resultPM->message, true, ERROR);
|
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled']. " " . $resultPM->message, true, ERROR);
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -18,16 +18,16 @@ function processMakerShowProcessList ($ID, $from_helpdesk) {
|
|||||||
$rand = rand();
|
$rand = rand();
|
||||||
echo "<form name= 'processmaker_form$rand' id='processmaker_form$rand' method='post' action='".Toolbox::getItemTypeFormURL("PluginProcessmakerProcessmaker")."'>";
|
echo "<form name= 'processmaker_form$rand' id='processmaker_form$rand' method='post' action='".Toolbox::getItemTypeFormURL("PluginProcessmakerProcessmaker")."'>";
|
||||||
echo "<div class='center'><table class='tab_cadre_fixehov'>";
|
echo "<div class='center'><table class='tab_cadre_fixehov'>";
|
||||||
echo "<tr><th colspan='2'>".__('Process - Case','processmaker')."</th></tr>";
|
echo "<tr><th colspan='2'>".__('Process - Case', 'processmaker')."</th></tr>";
|
||||||
|
|
||||||
echo "<tr class='tab_bg_2'><td class='right' colspan='1'>";
|
echo "<tr class='tab_bg_2'><td class='right' colspan='1'>";
|
||||||
_e('Select the process you want to add', 'processmaker');
|
echo __('Select the process you want to add', 'processmaker');
|
||||||
echo "<input type='hidden' name='action' value='newcase'>";
|
echo "<input type='hidden' name='action' value='newcase'>";
|
||||||
echo "<input type='hidden' name='id' value='-1'>";
|
echo "<input type='hidden' name='id' value='-1'>";
|
||||||
echo "<input type='hidden' name='itemtype' value='Ticket'>";
|
echo "<input type='hidden' name='itemtype' value='Ticket'>";
|
||||||
echo "<input type='hidden' name='itilcategories_id' value='".$_REQUEST['itilcategories_id']."'>";
|
echo "<input type='hidden' name='itilcategories_id' value='".$_REQUEST['itilcategories_id']."'>";
|
||||||
echo "<input type='hidden' name='type' value='".$_REQUEST['type']."'>";
|
echo "<input type='hidden' name='type' value='".$_REQUEST['type']."'>";
|
||||||
PluginProcessmakerProcess::dropdown( array( 'value' => 0, 'entity' => $_SESSION['glpiactive_entity'], 'name' => 'plugin_processmaker_processes_id' ));
|
PluginProcessmakerProcess::dropdown( [ 'value' => 0, 'entity' => $_SESSION['glpiactive_entity'], 'name' => 'plugin_processmaker_processes_id' ]);
|
||||||
echo "</td><td class='center'>";
|
echo "</td><td class='center'>";
|
||||||
echo "<input type='submit' name='additem' value='Start' class='submit'>";
|
echo "<input type='submit' name='additem' value='Start' class='submit'>";
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
@@ -44,7 +44,7 @@ function processMakerShowProcessList ($ID, $from_helpdesk) {
|
|||||||
* @param mixed $ID
|
* @param mixed $ID
|
||||||
* @param mixed $from_helpdesk
|
* @param mixed $from_helpdesk
|
||||||
*/
|
*/
|
||||||
function processMakerShowCase( $ID, $from_helpdesk ) {
|
function processMakerShowCase($ID, $from_helpdesk) {
|
||||||
global $CFG_GLPI, $PM_SOAP;
|
global $CFG_GLPI, $PM_SOAP;
|
||||||
|
|
||||||
$caseInfo = $PM_SOAP->getCaseInfo( $_REQUEST['case_guid'] );
|
$caseInfo = $PM_SOAP->getCaseInfo( $_REQUEST['case_guid'] );
|
||||||
@@ -101,10 +101,10 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
|
|||||||
$xpath = new DOMXPath($dom);
|
$xpath = new DOMXPath($dom);
|
||||||
|
|
||||||
// hide some fields
|
// hide some fields
|
||||||
$list = [ 'name', 'type', 'locations_id', 'itilcategories_id', 'items_id', 'add' ] ;
|
$list = [ 'name', 'type', 'locations_id', 'itilcategories_id', 'items_id', 'add' ];
|
||||||
$xpath_str = '//*[@name="'.implode( '"]/ancestor::tr[1] | //*[@name="', $list ).'"]/ancestor::tr[1]';
|
$xpath_str = '//*[@name="'.implode( '"]/ancestor::tr[1] | //*[@name="', $list ).'"]/ancestor::tr[1]';
|
||||||
$res = $xpath->query($xpath_str);
|
$res = $xpath->query($xpath_str);
|
||||||
foreach($res as $elt) {
|
foreach ($res as $elt) {
|
||||||
$elt->setAttribute( 'style', 'display:none;');
|
$elt->setAttribute( 'style', 'display:none;');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -123,12 +123,12 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
|
|||||||
|
|
||||||
// special case for content textarea which is in the same tr than the file upload
|
// special case for content textarea which is in the same tr than the file upload
|
||||||
$res = $xpath->query('//*[@name="content"]/ancestor::div[1] | //*[@name="content"]/ancestor::tr[1]/td[1]');
|
$res = $xpath->query('//*[@name="content"]/ancestor::div[1] | //*[@name="content"]/ancestor::tr[1]/td[1]');
|
||||||
foreach($res as $elt) {
|
foreach ($res as $elt) {
|
||||||
$elt->setAttribute( 'style', 'display:none;');
|
$elt->setAttribute( 'style', 'display:none;');
|
||||||
}
|
}
|
||||||
|
|
||||||
$res = $xpath->query('//*[@name="content"]/ancestor::td[1]');
|
$res = $xpath->query('//*[@name="content"]/ancestor::td[1]');
|
||||||
foreach($res as $elt) {
|
foreach ($res as $elt) {
|
||||||
// there should be only one td
|
// there should be only one td
|
||||||
$elt->setAttribute( 'colspan', '2');
|
$elt->setAttribute( 'colspan', '2');
|
||||||
}
|
}
|
||||||
@@ -148,11 +148,11 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
|
|||||||
$pmCaseUser = $caseInfo->currentUsers[0]; // by default
|
$pmCaseUser = $caseInfo->currentUsers[0]; // by default
|
||||||
$paramsURL = "DEL_INDEX={$pmCaseUser->delIndex}&action={$caseInfo->caseStatus}";
|
$paramsURL = "DEL_INDEX={$pmCaseUser->delIndex}&action={$caseInfo->caseStatus}";
|
||||||
|
|
||||||
$iframe->setAttribute('id', 'caseiframe' ) ;
|
$iframe->setAttribute('id', 'caseiframe' );
|
||||||
$iframe->setAttribute('onload', "onLoadFrame( event, '{$caseInfo->caseId}', {$pmCaseUser->delIndex}, {$caseInfo->caseNumber}, '{$caseInfo->processName}') ;" ) ;
|
$iframe->setAttribute('onload', "onLoadFrame( event, '{$caseInfo->caseId}', {$pmCaseUser->delIndex}, {$caseInfo->caseNumber}, '{$caseInfo->processName}') ;" );
|
||||||
$iframe->setAttribute('width', '100%' ) ;
|
$iframe->setAttribute('width', '100%' );
|
||||||
$iframe->setAttribute('style', 'border:none;' ) ;
|
$iframe->setAttribute('style', 'border:none;' );
|
||||||
$iframe->setAttribute('src', "{$PM_SOAP->serverURL}/cases/cases_Open?sid={$PM_SOAP->getPMSessionID()}&APP_UID={$caseInfo->caseId}&{$paramsURL}&rand=$rand&glpi_domain={$PM_SOAP->config->fields['domain']}" ) ;
|
$iframe->setAttribute('src', "{$PM_SOAP->serverURL}/cases/cases_Open?sid={$PM_SOAP->getPMSessionID()}&APP_UID={$caseInfo->caseId}&{$paramsURL}&rand=$rand&glpi_domain={$PM_SOAP->config->fields['domain']}" );
|
||||||
|
|
||||||
// set the width and the title of the first table th
|
// set the width and the title of the first table th
|
||||||
$th = $xpath->query('//*[@name="add"]/ancestor::table[1]/*/th[1]');
|
$th = $xpath->query('//*[@name="add"]/ancestor::table[1]/*/th[1]');
|
||||||
@@ -226,8 +226,8 @@ if (!Session::haveRight('ticket', CREATE)
|
|||||||
|
|
||||||
if (Session::haveRight('followup', TicketFollowup::SEEPUBLIC)
|
if (Session::haveRight('followup', TicketFollowup::SEEPUBLIC)
|
||||||
|| Session::haveRight('task', TicketTask::SEEPUBLIC)
|
|| Session::haveRight('task', TicketTask::SEEPUBLIC)
|
||||||
|| Session::haveRightsOr('ticketvalidation', array(TicketValidation::VALIDATEREQUEST,
|
|| Session::haveRightsOr('ticketvalidation', [TicketValidation::VALIDATEREQUEST,
|
||||||
TicketValidation::VALIDATEINCIDENT))) {
|
TicketValidation::VALIDATEINCIDENT])) {
|
||||||
Html::redirect($CFG_GLPI['root_doc']."/front/ticket.php");
|
Html::redirect($CFG_GLPI['root_doc']."/front/ticket.php");
|
||||||
|
|
||||||
} else if (Session::haveRight('reservation', ReservationItem::RESERVEANITEM)) {
|
} else if (Session::haveRight('reservation', ReservationItem::RESERVEANITEM)) {
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
// Original Author of file: MoronO
|
// Original Author of file: MoronO
|
||||||
// Purpose of file: mimic tracking.injector.php
|
// Purpose of file: mimic tracking.injector.php
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
if( isset( $_REQUEST['_glpi_csrf_token'] ) ) {
|
if (isset( $_REQUEST['_glpi_csrf_token'] )) {
|
||||||
define('GLPI_KEEP_CSRF_TOKEN', true) ;
|
define('GLPI_KEEP_CSRF_TOKEN', true);
|
||||||
}
|
}
|
||||||
$PM_POST = $_POST;
|
$PM_POST = $_POST;
|
||||||
$PM_REQUEST = $_REQUEST;
|
$PM_REQUEST = $_REQUEST;
|
||||||
@@ -24,7 +24,7 @@ if (empty($_POST) || count($_POST) == 0) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// here we are going to test if we must start a process
|
// here we are going to test if we must start a process
|
||||||
if( isset($_POST["_from_helpdesk"]) && $_POST["_from_helpdesk"] == 1
|
if (isset($_POST["_from_helpdesk"]) && $_POST["_from_helpdesk"] == 1
|
||||||
&& isset($_POST["type"]) //&& $_POST["type"] == Ticket::DEMAND_TYPE
|
&& isset($_POST["type"]) //&& $_POST["type"] == Ticket::DEMAND_TYPE
|
||||||
&& isset($_POST["itilcategories_id"])
|
&& isset($_POST["itilcategories_id"])
|
||||||
&& isset($_POST["entities_id"])) {
|
&& isset($_POST["entities_id"])) {
|
||||||
@@ -33,26 +33,26 @@ if( isset($_POST["_from_helpdesk"]) && $_POST["_from_helpdesk"] == 1
|
|||||||
// if not we will continue
|
// if not we will continue
|
||||||
// special case if RUMT plugin is enabled and no process is available and category is 'User Management' then must start RUMT.
|
// special case if RUMT plugin is enabled and no process is available and category is 'User Management' then must start RUMT.
|
||||||
|
|
||||||
$processList = PluginProcessmakerProcessmaker::getProcessesWithCategoryAndProfile( $_POST["itilcategories_id"], $_POST["type"], $_SESSION['glpiactiveprofile']['id'], $_POST["entities_id"] ) ;
|
$processList = PluginProcessmakerProcessmaker::getProcessesWithCategoryAndProfile( $_POST["itilcategories_id"], $_POST["type"], $_SESSION['glpiactiveprofile']['id'], $_POST["entities_id"] );
|
||||||
|
|
||||||
// currently only one process should be assigned to this itilcategory so this array should contain only one row
|
// currently only one process should be assigned to this itilcategory so this array should contain only one row
|
||||||
$processQt = count( $processList ) ;
|
$processQt = count( $processList );
|
||||||
if( $processQt == 1 ) {
|
if ($processQt == 1) {
|
||||||
$_POST['action']='newcase';
|
$_POST['action']='newcase';
|
||||||
$_POST['plugin_processmaker_processes_id'] = $processList[0]['id'];
|
$_POST['plugin_processmaker_processes_id'] = $processList[0]['id'];
|
||||||
include (GLPI_ROOT . "/plugins/processmaker/front/processmaker.form.php");
|
include (GLPI_ROOT . "/plugins/processmaker/front/processmaker.form.php");
|
||||||
die() ;
|
die();
|
||||||
} elseif( $processQt > 1 ) {
|
} else if ($processQt > 1) {
|
||||||
// in this case we should show the process dropdown selection
|
// in this case we should show the process dropdown selection
|
||||||
include (GLPI_ROOT . "/plugins/processmaker/front/processmaker.helpdesk.form.php");
|
include (GLPI_ROOT . "/plugins/processmaker/front/processmaker.helpdesk.form.php");
|
||||||
die() ;
|
die();
|
||||||
} else{
|
} else {
|
||||||
// in this case should start RUMT
|
// in this case should start RUMT
|
||||||
// if and only if itilcategories_id matches one of the 'User Management' categories
|
// if and only if itilcategories_id matches one of the 'User Management' categories
|
||||||
// could be done via ARBehviours or RUMT itself
|
// could be done via ARBehviours or RUMT itself
|
||||||
$userManagementCat = array( 100556, 100557, 100558 ) ;
|
$userManagementCat = [ 100556, 100557, 100558 ];
|
||||||
$plug = new Plugin ;
|
$plug = new Plugin;
|
||||||
if( $processQt == 0 && in_array( $_POST["itilcategories_id"], $userManagementCat) && $plug->isActivated('rayusermanagementticket' )) {
|
if ($processQt == 0 && in_array( $_POST["itilcategories_id"], $userManagementCat) && $plug->isActivated('rayusermanagementticket' )) {
|
||||||
Html::redirect($CFG_GLPI['root_doc']."/plugins/rayusermanagementticket/front/rayusermanagementticket.helpdesk.public.php");
|
Html::redirect($CFG_GLPI['root_doc']."/plugins/rayusermanagementticket/front/rayusermanagementticket.helpdesk.public.php");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
210
hook.php
210
hook.php
@@ -2,38 +2,16 @@
|
|||||||
|
|
||||||
include_once 'inc/processmaker.class.php';
|
include_once 'inc/processmaker.class.php';
|
||||||
|
|
||||||
if (!function_exists('arTableExists')) {
|
|
||||||
function arTableExists($table) {
|
|
||||||
global $DB;
|
|
||||||
if (method_exists( $DB, 'tableExists')) {
|
|
||||||
return $DB->tableExists($table);
|
|
||||||
} else {
|
|
||||||
return TableExists($table);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!function_exists('arFieldExists')) {
|
|
||||||
function arFieldExists($table, $field, $usecache = true) {
|
|
||||||
global $DB;
|
|
||||||
if (method_exists( $DB, 'fieldExists')) {
|
|
||||||
return $DB->fieldExists($table, $field, $usecache);
|
|
||||||
} else {
|
|
||||||
return FieldExists($table, $field, $usecache);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function plugin_processmaker_MassiveActions($type) {
|
function plugin_processmaker_MassiveActions($type) {
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case 'PluginProcessmakerProcess' :
|
case 'PluginProcessmakerProcess' :
|
||||||
if (plugin_processmaker_haveRight('config', UPDATE)) {
|
if (plugin_processmaker_haveRight('config', UPDATE)) {
|
||||||
return array('plugin_processmaker_taskrefresh' => __('Synchronize Task List', 'processmaker'));
|
return ['plugin_processmaker_taskrefresh' => __('Synchronize Task List', 'processmaker')];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'PluginProcessmakerProcess_Profile' :
|
case 'PluginProcessmakerProcess_Profile' :
|
||||||
if (plugin_processmaker_haveRight('config', UPDATE)) {
|
if (plugin_processmaker_haveRight('config', UPDATE)) {
|
||||||
return array('purge' => __('Delete permanently'));
|
return ['purge' => __('Delete permanently')];
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
//case 'PluginProcessmakerCase' :
|
//case 'PluginProcessmakerCase' :
|
||||||
@@ -42,7 +20,7 @@ function plugin_processmaker_MassiveActions($type) {
|
|||||||
// }
|
// }
|
||||||
//break;
|
//break;
|
||||||
}
|
}
|
||||||
return array();
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -113,8 +91,8 @@ function plugin_processmaker_MassiveActions($type) {
|
|||||||
* @return true or die!
|
* @return true or die!
|
||||||
*/
|
*/
|
||||||
function plugin_processmaker_install() {
|
function plugin_processmaker_install() {
|
||||||
|
global $DB;
|
||||||
if (!arTableExists("glpi_plugin_processmaker_cases")) {
|
if (!$DB->tableExists("glpi_plugin_processmaker_cases")) {
|
||||||
// new installation
|
// new installation
|
||||||
include_once(GLPI_ROOT."/plugins/processmaker/install/install.php");
|
include_once(GLPI_ROOT."/plugins/processmaker/install/install.php");
|
||||||
processmaker_install();
|
processmaker_install();
|
||||||
@@ -127,9 +105,9 @@ function plugin_processmaker_install() {
|
|||||||
|
|
||||||
// To be called for each task managed by the plugin
|
// To be called for each task managed by the plugin
|
||||||
// task in class
|
// task in class
|
||||||
CronTask::Register('PluginProcessmakerProcessmaker', 'pmusers', DAY_TIMESTAMP, array( 'state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL));
|
CronTask::Register('PluginProcessmakerProcessmaker', 'pmusers', DAY_TIMESTAMP, [ 'state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL]);
|
||||||
CronTask::Register('PluginProcessmakerProcessmaker', 'pmorphancases', DAY_TIMESTAMP, array('param' => 10, 'state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL));
|
CronTask::Register('PluginProcessmakerProcessmaker', 'pmorphancases', DAY_TIMESTAMP, ['param' => 10, 'state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL]);
|
||||||
CronTask::Register('PluginProcessmakerProcessmaker', 'pmtaskactions', MINUTE_TIMESTAMP, array('state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL));
|
CronTask::Register('PluginProcessmakerProcessmaker', 'pmtaskactions', MINUTE_TIMESTAMP, ['state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL]);
|
||||||
|
|
||||||
// required because autoload doesn't work for unactive plugin'
|
// required because autoload doesn't work for unactive plugin'
|
||||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/profile.class.php");
|
include_once(GLPI_ROOT."/plugins/processmaker/inc/profile.class.php");
|
||||||
@@ -148,7 +126,7 @@ function plugin_processmaker_uninstall() {
|
|||||||
|
|
||||||
function plugin_processmaker_getAddSearchOptions($itemtype) {
|
function plugin_processmaker_getAddSearchOptions($itemtype) {
|
||||||
|
|
||||||
$sopt = array();
|
$sopt = [];
|
||||||
// TODO add Change and Problem + other fields to the search
|
// TODO add Change and Problem + other fields to the search
|
||||||
if ($itemtype == 'Ticket') {
|
if ($itemtype == 'Ticket') {
|
||||||
$sopt[10001]['table'] = 'glpi_plugin_processmaker_cases';
|
$sopt[10001]['table'] = 'glpi_plugin_processmaker_cases';
|
||||||
@@ -179,7 +157,7 @@ function plugin_processmaker_getAddSearchOptions($itemtype) {
|
|||||||
return $sopt;
|
return $sopt;
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin_processmaker_addLeftJoin($type,$ref_table,$new_table,$linkfield,&$already_link_tables) {
|
function plugin_processmaker_addLeftJoin($type, $ref_table, $new_table, $linkfield, &$already_link_tables) {
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
|
||||||
@@ -208,8 +186,8 @@ function plugin_processmaker_addLeftJoin($type,$ref_table,$new_table,$linkfield,
|
|||||||
function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
|
function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
|
||||||
global $DB;//, $PM_SOAP;
|
global $DB;//, $PM_SOAP;
|
||||||
|
|
||||||
if (isset($_SESSION['glpiname'])) { // && $parm->getType() == 'Ticket') {
|
if (isset($_SESSION['glpiname'])) { // && $parm->getType() == 'Ticket') {
|
||||||
$locVar = array( );
|
$locVar = [ ];
|
||||||
foreach ($parm->input as $key => $val) {
|
foreach ($parm->input as $key => $val) {
|
||||||
switch ($key) {
|
switch ($key) {
|
||||||
case 'global_validation' :
|
case 'global_validation' :
|
||||||
@@ -218,7 +196,10 @@ function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
|
|||||||
case 'itilcategories_id' :
|
case 'itilcategories_id' :
|
||||||
$locVar[ 'GLPI_ITEM_ITIL_CATEGORY_ID' ] = $val;
|
$locVar[ 'GLPI_ITEM_ITIL_CATEGORY_ID' ] = $val;
|
||||||
break;
|
break;
|
||||||
case 'due_date' :
|
case 'date' :
|
||||||
|
$locVar[ 'GLPI_ITEM_OPENING_DATE' ] = $val;
|
||||||
|
break;
|
||||||
|
case 'time_to_resolve' :
|
||||||
$locVar[ 'GLPI_TICKET_DUE_DATE' ] = $val;
|
$locVar[ 'GLPI_TICKET_DUE_DATE' ] = $val;
|
||||||
$locVar[ 'GLPI_ITEM_DUE_DATE' ] = $val;
|
$locVar[ 'GLPI_ITEM_DUE_DATE' ] = $val;
|
||||||
break;
|
break;
|
||||||
@@ -239,7 +220,7 @@ function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
|
|||||||
$itemType = $parm->getType();
|
$itemType = $parm->getType();
|
||||||
|
|
||||||
$locCase = new PluginProcessmakerCase;
|
$locCase = new PluginProcessmakerCase;
|
||||||
foreach(PluginProcessmakerCase::getIDsFromItem($itemType, $itemId ) as $cases_id){
|
foreach (PluginProcessmakerCase::getIDsFromItem($itemType, $itemId ) as $cases_id) {
|
||||||
$locCase->getFromDB($cases_id);
|
$locCase->getFromDB($cases_id);
|
||||||
$locCase->sendVariables($locVar);
|
$locCase->sendVariables($locVar);
|
||||||
|
|
||||||
@@ -250,7 +231,6 @@ function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -270,73 +250,73 @@ function plugin_item_update_processmaker_satisfaction($parm) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
///**
|
||||||
* Summary of plugin_pre_item_purge_processmaker
|
// * Summary of plugin_pre_item_purge_processmaker
|
||||||
* @param mixed $parm is the object
|
// * @param mixed $parm is the object
|
||||||
*/
|
// */
|
||||||
function plugin_pre_item_purge_processmaker ( $parm ) {
|
//function plugin_pre_item_purge_processmaker ( $parm ) {
|
||||||
|
|
||||||
if ($parm->getType() == 'Ticket_User' && is_array( $parm->fields ) && isset( $parm->fields['type'] ) && $parm->fields['type'] == 2) {
|
// if ($parm->getType() == 'Ticket_User' && is_array( $parm->fields ) && isset( $parm->fields['type'] ) && $parm->fields['type'] == 2) {
|
||||||
$itemId = $parm->fields['tickets_id'];
|
// $itemId = $parm->fields['tickets_id'];
|
||||||
$itemType = 'Ticket';
|
// $itemType = 'Ticket';
|
||||||
$technicians = PluginProcessmakerProcessmaker::getItemUsers( $itemType, $itemId, 2 ); // 2 for technicians
|
// $technicians = PluginProcessmakerProcessmaker::getItemUsers( $itemType, $itemId, 2 ); // 2 for technicians
|
||||||
|
|
||||||
if (PluginProcessmakerCase::getIDFromItem($itemType, $itemId) && count($technicians) == 1) {
|
// if (PluginProcessmakerCase::getIDFromItem($itemType, $itemId) && count($technicians) == 1) {
|
||||||
$parm->input = null; // to cancel deletion of the last tech in the ticket
|
// $parm->input = null; // to cancel deletion of the last tech in the ticket
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
/**
|
///**
|
||||||
* Summary of plugin_item_purge_processmaker
|
// * Summary of plugin_item_purge_processmaker
|
||||||
* @param mixed $parm is the object
|
// * @param mixed $parm is the object
|
||||||
*/
|
// */
|
||||||
function plugin_item_purge_processmaker($parm) {
|
//function plugin_item_purge_processmaker($parm) {
|
||||||
global $DB, $PM_SOAP;
|
// global $DB, $PM_SOAP;
|
||||||
|
|
||||||
//$objects = ['Ticket', 'Change', 'Problem'];
|
// //$objects = ['Ticket', 'Change', 'Problem'];
|
||||||
$object_users = ['Ticket_User', 'Change_User', 'Problem_User'];
|
// $object_users = ['Ticket_User', 'Change_User', 'Problem_User'];
|
||||||
|
|
||||||
if (in_array($parm->getType(), $object_users) && is_array( $parm->fields ) && isset( $parm->fields['type'] ) && $parm->fields['type'] == 2) {
|
// if (in_array($parm->getType(), $object_users) && is_array( $parm->fields ) && isset( $parm->fields['type'] ) && $parm->fields['type'] == 2) {
|
||||||
|
|
||||||
// We just deleted a tech from this ticket then we must if needed "de-assign" the tasks assigned to this tech
|
// // We just deleted a tech from this ticket then we must if needed "de-assign" the tasks assigned to this tech
|
||||||
// and re-assign them to the first tech in the list !!!!
|
// // and re-assign them to the first tech in the list !!!!
|
||||||
|
|
||||||
$itemType = strtolower(explode('_', $parm->getType())[0]); // $parm->getType() returns 'Ticket_User';
|
// $itemType = strtolower(explode('_', $parm->getType())[0]); // $parm->getType() returns 'Ticket_User';
|
||||||
$itemId = $parm->fields[$itemType.'s_id'];
|
// $itemId = $parm->fields[$itemType.'s_id'];
|
||||||
$cases = PluginProcessmakerCase::getIDsFromItem($itemType, $itemId);
|
// $cases = PluginProcessmakerCase::getIDsFromItem($itemType, $itemId);
|
||||||
foreach ($cases as $cases_id) {
|
// foreach ($cases as $cases_id) {
|
||||||
// cases are existing for this item
|
// // cases are existing for this item
|
||||||
$locCase = new PluginProcessmakerCase;
|
// $locCase = new PluginProcessmakerCase;
|
||||||
if ($locCase->getFromDB($cases_id)) {
|
// if ($locCase->getFromDB($cases_id)) {
|
||||||
$technicians = PluginProcessmakerProcessmaker::getItemUsers($itemType, $itemId, CommonITILActor::ASSIGN);
|
// $technicians = PluginProcessmakerProcessmaker::getItemUsers($itemType, $itemId, CommonITILActor::ASSIGN);
|
||||||
|
|
||||||
$locVars = array( 'GLPI_TICKET_TECHNICIAN_GLPI_ID' => $technicians[0]['glpi_id'],
|
// $locVars = array( 'GLPI_TICKET_TECHNICIAN_GLPI_ID' => $technicians[0]['glpi_id'],
|
||||||
'GLPI_ITEM_TECHNICIAN_GLPI_ID' => $technicians[0]['glpi_id'],
|
// 'GLPI_ITEM_TECHNICIAN_GLPI_ID' => $technicians[0]['glpi_id'],
|
||||||
'GLPI_TICKET_TECHNICIAN_PM_ID' => $technicians[0]['pm_id'],
|
// 'GLPI_TICKET_TECHNICIAN_PM_ID' => $technicians[0]['pm_id'],
|
||||||
'GLPI_ITEM_TECHNICIAN_PM_ID' => $technicians[0]['pm_id']
|
// 'GLPI_ITEM_TECHNICIAN_PM_ID' => $technicians[0]['pm_id']
|
||||||
);
|
// );
|
||||||
|
|
||||||
// and we must find all tasks assigned to this former user and re-assigned them to new user (if any :))!
|
// // and we must find all tasks assigned to this former user and re-assigned them to new user (if any :))!
|
||||||
$caseInfo = $locCase->getCaseInfo( );
|
// $caseInfo = $locCase->getCaseInfo( );
|
||||||
if ($caseInfo !== false) {
|
// if ($caseInfo !== false) {
|
||||||
$locCase->sendVariables( $locVars);
|
// $locCase->sendVariables( $locVars);
|
||||||
// need to get info on the thread of the GLPI current user
|
// // need to get info on the thread of the GLPI current user
|
||||||
// we must retreive currentGLPI user from this array
|
// // we must retreive currentGLPI user from this array
|
||||||
$GLPICurrentPMUserId = PluginProcessmakerUser::getPMUserId( $parm->fields['users_id'] );
|
// $GLPICurrentPMUserId = PluginProcessmakerUser::getPMUserId( $parm->fields['users_id'] );
|
||||||
if (property_exists($caseInfo, 'currentUsers') && is_array( $caseInfo->currentUsers )) {
|
// if (property_exists($caseInfo, 'currentUsers') && is_array( $caseInfo->currentUsers )) {
|
||||||
foreach ($caseInfo->currentUsers as $caseUser) {
|
// foreach ($caseInfo->currentUsers as $caseUser) {
|
||||||
if ($caseUser->userId == $GLPICurrentPMUserId && in_array( $caseUser->delThreadStatus, array('DRAFT', 'OPEN', 'PAUSE' ) )) {
|
// if ($caseUser->userId == $GLPICurrentPMUserId && in_array( $caseUser->delThreadStatus, array('DRAFT', 'OPEN', 'PAUSE' ) )) {
|
||||||
$locCase->reassignCase($caseUser->delIndex, $caseUser->taskId, $caseUser->delThread, $parm->fields['users_id'], $technicians[0]['pm_id'] );
|
// $locCase->reassignCase($caseUser->delIndex, $caseUser->taskId, $caseUser->delThread, $parm->fields['users_id'], $technicians[0]['pm_id'] );
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
function plugin_processmaker_post_init() {
|
function plugin_processmaker_post_init() {
|
||||||
global $PM_DB, $PM_SOAP;
|
global $PM_DB, $PM_SOAP;
|
||||||
@@ -346,19 +326,19 @@ function plugin_processmaker_post_init() {
|
|||||||
if (!isset($PM_SOAP)) {
|
if (!isset($PM_SOAP)) {
|
||||||
$PM_SOAP = new PluginProcessmakerProcessmaker;
|
$PM_SOAP = new PluginProcessmakerProcessmaker;
|
||||||
// and default login is current running user if any
|
// and default login is current running user if any
|
||||||
if (Session::getLoginUserID() ) {
|
if (Session::getLoginUserID()) {
|
||||||
$PM_SOAP->login();
|
$PM_SOAP->login();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function plugin_processmaker_giveItem($itemtype,$ID,$data,$num) {
|
function plugin_processmaker_giveItem($itemtype, $ID, $data, $num) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function plugin_processmaker_change_profile($parm) {
|
function plugin_processmaker_change_profile() {
|
||||||
if ($_SESSION['glpiactiveprofile']['interface'] == "helpdesk") {
|
if ($_SESSION['glpiactiveprofile']['interface'] == "helpdesk") {
|
||||||
// must add the rights for simplified interface
|
// must add the rights for simplified interface
|
||||||
$_SESSION['glpiactiveprofile']['plugin_processmaker_case'] = READ;
|
$_SESSION['glpiactiveprofile']['plugin_processmaker_case'] = READ;
|
||||||
@@ -391,14 +371,14 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
foreach ($DB->request( 'glpi_plugin_processmaker_caselinks', "is_active = 1 AND sourcetask_guid='".$pmTaskCat->fields['pm_task_guid']."'") as $targetTask) {
|
foreach ($DB->request( 'glpi_plugin_processmaker_caselinks', "is_active = 1 AND sourcetask_guid='".$pmTaskCat->fields['pm_task_guid']."'") as $targetTask) {
|
||||||
|
|
||||||
// Must check the condition
|
// Must check the condition
|
||||||
$casevariables = array();
|
$casevariables = [];
|
||||||
|
|
||||||
$matches = array();
|
$matches = [];
|
||||||
if (preg_match_all( "/@@(\w+)/u", $targetTask['sourcecondition'], $matches )) {
|
if (preg_match_all( "/@@(\w+)/u", $targetTask['sourcecondition'], $matches )) {
|
||||||
$casevariables = $matches[1];
|
$casevariables = $matches[1];
|
||||||
}
|
}
|
||||||
|
|
||||||
$targetTask['targetactions'] = array(); // empty array by default
|
$targetTask['targetactions'] = []; // empty array by default
|
||||||
foreach ($DB->request( 'glpi_plugin_processmaker_caselinkactions', 'plugin_processmaker_caselinks_id = '.$targetTask['id']) as $actionvalue) {
|
foreach ($DB->request( 'glpi_plugin_processmaker_caselinkactions', 'plugin_processmaker_caselinks_id = '.$targetTask['id']) as $actionvalue) {
|
||||||
$targetTask['targetactions'][$actionvalue['name']] = $actionvalue['value'];
|
$targetTask['targetactions'][$actionvalue['name']] = $actionvalue['value'];
|
||||||
if (preg_match_all( "/@@(\w+)/u", $actionvalue['value'], $matches )) {
|
if (preg_match_all( "/@@(\w+)/u", $actionvalue['value'], $matches )) {
|
||||||
@@ -436,7 +416,7 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
// look at each linked ticket if a case is attached and then if a task like $val is TO_DO
|
// look at each linked ticket if a case is attached and then if a task like $val is TO_DO
|
||||||
// then will try to routeCase for each tasks in $val
|
// then will try to routeCase for each tasks in $val
|
||||||
|
|
||||||
$postdata = array();
|
$postdata = [];
|
||||||
foreach ($targetTask['targetactions'] as $action => $actionvalue) {
|
foreach ($targetTask['targetactions'] as $action => $actionvalue) {
|
||||||
$postdata['form'][$action] = eval( "return ".str_replace( array_keys($infoForTasks), $infoForTasks, $actionvalue)." ;" );
|
$postdata['form'][$action] = eval( "return ".str_replace( array_keys($infoForTasks), $infoForTasks, $actionvalue)." ;" );
|
||||||
}
|
}
|
||||||
@@ -446,7 +426,7 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
$postdata['DynaformRequiredFields'] = '[]';
|
$postdata['DynaformRequiredFields'] = '[]';
|
||||||
$postdata['form']['btnGLPISendRequest'] = 'submit';
|
$postdata['form']['btnGLPISendRequest'] = 'submit';
|
||||||
|
|
||||||
$externalapplicationparams = array();
|
$externalapplicationparams = [];
|
||||||
if ($externalapplication) {
|
if ($externalapplication) {
|
||||||
// must call curl
|
// must call curl
|
||||||
foreach ($externalapplication['params'] as $paramname => $variable) {
|
foreach ($externalapplication['params'] as $paramname => $variable) {
|
||||||
@@ -459,17 +439,6 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($targetTask['is_self']) {
|
if ($targetTask['is_self']) {
|
||||||
// MUST BE done on a add task hook, and not on an update task hook
|
|
||||||
|
|
||||||
//$query = "SELECT glpi_plugin_processmaker_cases.id, MAX(glpi_plugin_processmaker_tasks.del_index) AS del_index FROM glpi_tickettasks
|
|
||||||
// JOIN glpi_plugin_processmaker_taskcategories ON glpi_plugin_processmaker_taskcategories.taskcategories_id=glpi_tickettasks.taskcategories_id
|
|
||||||
// JOIN glpi_plugin_processmaker_cases ON glpi_plugin_processmaker_cases.processes_id=glpi_plugin_processmaker_taskcategories.processes_id
|
|
||||||
// RIGHT JOIN glpi_plugin_processmaker_tasks ON glpi_plugin_processmaker_tasks.items_id=glpi_tickettasks.id AND glpi_plugin_processmaker_tasks.case_id=glpi_plugin_processmaker_cases.id
|
|
||||||
// WHERE glpi_plugin_processmaker_taskcategories.pm_task_guid = '".$targetTask['targettask_guid']."' AND glpi_tickettasks.state = 1 AND glpi_tickettasks.tickets_id=".$parm->fields['tickets_id'] ;
|
|
||||||
|
|
||||||
//$res = $DB->query($query) ;
|
|
||||||
//if( $res && $DB->numrows($res) > 0 && $case=$DB->fetch_assoc($res) && isset($case['id']) && isset($case['del_index']) ) {
|
|
||||||
//foreach( $DB->request($query) as $case ) {
|
|
||||||
$taskCase = $PM_SOAP->taskCase( $srccase_guid );
|
$taskCase = $PM_SOAP->taskCase( $srccase_guid );
|
||||||
foreach ($taskCase as $task) {
|
foreach ($taskCase as $task) {
|
||||||
// search for target task guid
|
// search for target task guid
|
||||||
@@ -485,7 +454,7 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
$pmconfig = $PM_SOAP->config; //PluginProcessmakerConfig::getInstance();
|
$pmconfig = $PM_SOAP->config; //PluginProcessmakerConfig::getInstance();
|
||||||
|
|
||||||
$cronaction = new PluginProcessmakerCrontaskaction;
|
$cronaction = new PluginProcessmakerCrontaskaction;
|
||||||
$cronaction->add( array( 'plugin_processmaker_caselinks_id' => $targetTask['id'],
|
$cronaction->add( [ 'plugin_processmaker_caselinks_id' => $targetTask['id'],
|
||||||
'plugin_processmaker_cases_id' => $locCase->getID(),
|
'plugin_processmaker_cases_id' => $locCase->getID(),
|
||||||
//'itemtype' => $itemtype,
|
//'itemtype' => $itemtype,
|
||||||
//'items_id' => $parm->fields['tickets_id'],
|
//'items_id' => $parm->fields['tickets_id'],
|
||||||
@@ -494,7 +463,7 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
|
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
|
||||||
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
|
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
|
||||||
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
|
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
|
||||||
),
|
],
|
||||||
null,
|
null,
|
||||||
false);
|
false);
|
||||||
|
|
||||||
@@ -510,7 +479,7 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
|
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $externalapplicationparams);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $externalapplicationparams);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Content-Length: ' . strlen($externalapplicationparams)));
|
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Content-Length: ' . strlen($externalapplicationparams), 'Expect:']);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
|
||||||
|
|
||||||
//curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1 ) ;
|
//curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1 ) ;
|
||||||
@@ -538,7 +507,7 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
$postdata['DEL_INDEX'] = $case['del_index'];
|
$postdata['DEL_INDEX'] = $case['del_index'];
|
||||||
|
|
||||||
$cronaction = new PluginProcessmakerCrontaskaction;
|
$cronaction = new PluginProcessmakerCrontaskaction;
|
||||||
$cronaction->add( array( 'plugin_processmaker_caselinks_id' => $targetTask['id'],
|
$cronaction->add( [ 'plugin_processmaker_caselinks_id' => $targetTask['id'],
|
||||||
'plugin_processmaker_cases_id' => $locCase->getID(),
|
'plugin_processmaker_cases_id' => $locCase->getID(),
|
||||||
//'itemtype' => $itemtype,
|
//'itemtype' => $itemtype,
|
||||||
//'items_id' => $parm->fields['tickets_id'],
|
//'items_id' => $parm->fields['tickets_id'],
|
||||||
@@ -547,13 +516,18 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
|
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
|
||||||
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
|
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
|
||||||
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
|
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
|
||||||
),
|
],
|
||||||
null,
|
null,
|
||||||
false);
|
false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($targetTask['is_synchronous']) {
|
||||||
|
// must call PluginProcessmakerProcessmaker::cronPMTaskActions()
|
||||||
|
PluginProcessmakerProcessmaker::cronPMTaskActions();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
const COMPLETED = 'COMPLETED';
|
const COMPLETED = 'COMPLETED';
|
||||||
const CANCELLED = 'CANCELLED';
|
const CANCELLED = 'CANCELLED';
|
||||||
|
|
||||||
static function getTypeName($nb=0) {
|
static function getTypeName($nb = 0) {
|
||||||
return _n('Process case', 'Process cases', $nb, 'processmaker');
|
return _n('Process case', 'Process cases', $nb, 'processmaker');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -32,6 +32,10 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
// return Session::haveRightsOr('plugin_processmaker_case', [READ, UPDATE]);
|
// return Session::haveRightsOr('plugin_processmaker_case', [READ, UPDATE]);
|
||||||
//}
|
//}
|
||||||
|
|
||||||
|
//function canViewItem() {
|
||||||
|
// return Session::haveRightsOr('plugin_processmaker_case', READ);
|
||||||
|
//}
|
||||||
|
|
||||||
//static function canUpdate( ) {
|
//static function canUpdate( ) {
|
||||||
// return Session::haveRight('plugin_processmaker_config', UPDATE);
|
// return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||||
//}
|
//}
|
||||||
@@ -71,7 +75,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* @param mixed $withtemplate has template
|
* @param mixed $withtemplate has template
|
||||||
* @return array os strings
|
* @return array os strings
|
||||||
*/
|
*/
|
||||||
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
|
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||||
if ($item->getType() == __CLASS__) {
|
if ($item->getType() == __CLASS__) {
|
||||||
// get tab name for a case itself
|
// get tab name for a case itself
|
||||||
$tabname = __('Case', 'processmaker');
|
$tabname = __('Case', 'processmaker');
|
||||||
@@ -99,7 +103,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function getName($options = array()){
|
function getName($options = []) {
|
||||||
return $this->fields['name'];
|
return $this->fields['name'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,7 +132,8 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
*/
|
*/
|
||||||
static function getIDsFromItem($itemtype, $items_id) {
|
static function getIDsFromItem($itemtype, $items_id) {
|
||||||
$ret = [];
|
$ret = [];
|
||||||
foreach(getAllDatasFromTable( self::getTable(), "items_id=$items_id AND itemtype='$itemtype'") as $case) {
|
$dbu = new DbUtils;
|
||||||
|
foreach ($dbu->getAllDataFromTable( self::getTable(), "items_id=$items_id AND itemtype='$itemtype'") as $case) {
|
||||||
$ret[] = $case['id'];
|
$ret[] = $case['id'];
|
||||||
}
|
}
|
||||||
return $ret;
|
return $ret;
|
||||||
@@ -160,7 +165,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* @param mixed $vars
|
* @param mixed $vars
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function getVariables($vars=array()) {
|
function getVariables($vars = []) {
|
||||||
global $PM_SOAP;
|
global $PM_SOAP;
|
||||||
return $PM_SOAP->getVariables($this->fields['case_guid'], $vars);
|
return $PM_SOAP->getVariables($this->fields['case_guid'], $vars);
|
||||||
}
|
}
|
||||||
@@ -171,7 +176,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* @param mixed $vars
|
* @param mixed $vars
|
||||||
* @return A
|
* @return A
|
||||||
*/
|
*/
|
||||||
function sendVariables($vars = array()) {
|
function sendVariables($vars = []) {
|
||||||
global $PM_SOAP;
|
global $PM_SOAP;
|
||||||
return $PM_SOAP->sendVariables($this->fields['case_guid'], $vars);
|
return $PM_SOAP->sendVariables($this->fields['case_guid'], $vars);
|
||||||
}
|
}
|
||||||
@@ -182,7 +187,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* @param mixed $delIndex
|
* @param mixed $delIndex
|
||||||
* @return stdClass, a getCaseInfoResponse object, or false exception occured
|
* @return stdClass, a getCaseInfoResponse object, or false exception occured
|
||||||
*/
|
*/
|
||||||
function getCaseInfo($delIndex='') {
|
function getCaseInfo($delIndex = '') {
|
||||||
global $PM_SOAP;
|
global $PM_SOAP;
|
||||||
return $PM_SOAP->getCaseInfo($this->fields['case_guid'], $delIndex);
|
return $PM_SOAP->getCaseInfo($this->fields['case_guid'], $delIndex);
|
||||||
}
|
}
|
||||||
@@ -257,7 +262,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
|
|
||||||
PluginProcessmakerProcessmaker::addWatcher( $itilobject_itemtype, $glpi_task->fields[ $foreignkey ], $newTech );
|
PluginProcessmakerProcessmaker::addWatcher( $itilobject_itemtype, $glpi_task->fields[ $foreignkey ], $newTech );
|
||||||
|
|
||||||
$glpi_task->update( array( 'id' => $row['items_id'], $foreignkey => $glpi_task->fields[ $foreignkey ], 'users_id_tech' => $newTech ));
|
$glpi_task->update( [ 'id' => $row['items_id'], $foreignkey => $glpi_task->fields[ $foreignkey ], 'users_id_tech' => $newTech ]);
|
||||||
|
|
||||||
// then update the delIndex and delThread
|
// then update the delIndex and delThread
|
||||||
$query = "UPDATE glpi_plugin_processmaker_tasks SET del_index = $newDelIndex, del_thread = $newDelThread WHERE id={$row['id']}; ";
|
$query = "UPDATE glpi_plugin_processmaker_tasks SET del_index = $newDelIndex, del_thread = $newDelThread WHERE id={$row['id']}; ";
|
||||||
@@ -276,7 +281,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
$case_tasks = [];
|
$case_tasks = [];
|
||||||
$query = "SELECT `glpi_plugin_processmaker_tasks`.* FROM `glpi_plugin_processmaker_tasks`
|
$query = "SELECT `glpi_plugin_processmaker_tasks`.* FROM `glpi_plugin_processmaker_tasks`
|
||||||
WHERE `glpi_plugin_processmaker_tasks`.`plugin_processmaker_cases_id`={$this->getID()} AND `del_thread_status`='OPEN'";
|
WHERE `glpi_plugin_processmaker_tasks`.`plugin_processmaker_cases_id`={$this->getID()} AND `del_thread_status`='OPEN'";
|
||||||
foreach($DB->request($query) as $task) {
|
foreach ($DB->request($query) as $task) {
|
||||||
$case_tasks[$task['del_index']] = $task;
|
$case_tasks[$task['del_index']] = $task;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -295,7 +300,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
$query = "SELECT `DEL_INDEX`, `DEL_DELEGATE_DATE` FROM `APP_DELEGATION` WHERE `APP_UID`='{$caseInfo->caseId}'";
|
$query = "SELECT `DEL_INDEX`, `DEL_DELEGATE_DATE` FROM `APP_DELEGATION` WHERE `APP_UID`='{$caseInfo->caseId}'";
|
||||||
$tasks = [];
|
$tasks = [];
|
||||||
foreach($PM_DB->request($query) as $row){
|
foreach ($PM_DB->request($query) as $row) {
|
||||||
$tasks[$row['DEL_INDEX']] = $row['DEL_DELEGATE_DATE'];
|
$tasks[$row['DEL_INDEX']] = $row['DEL_DELEGATE_DATE'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -318,7 +323,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
<th>".__('Current user', 'processmaker')."</th>
|
<th>".__('Current user', 'processmaker')."</th>
|
||||||
<th>".__('Task delegation date', 'processmaker')."</th>
|
<th>".__('Task delegation date', 'processmaker')."</th>
|
||||||
</tr>";
|
</tr>";
|
||||||
foreach($caseInfo->currentUsers as $currentTask) {
|
foreach ($caseInfo->currentUsers as $currentTask) {
|
||||||
$case_url = $this->getLinkURL().'&forcetab=PluginProcessmakerTask$';
|
$case_url = $this->getLinkURL().'&forcetab=PluginProcessmakerTask$';
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
if (isset($case_tasks[$currentTask->delIndex])) {
|
if (isset($case_tasks[$currentTask->delIndex])) {
|
||||||
@@ -342,7 +347,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
} else {
|
} else {
|
||||||
echo "<td class='tab_bg_2'>".$currentTask->userName."</td>";
|
echo "<td class='tab_bg_2'>".$currentTask->userName."</td>";
|
||||||
}
|
}
|
||||||
echo "<td class='tab_bg_2'>".$tasks[$currentTask->delIndex]."</td>";
|
echo "<td class='tab_bg_2'>".Html::convDateTime($tasks[$currentTask->delIndex])."</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -368,7 +373,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* @param mixed $caseInfo
|
* @param mixed $caseInfo
|
||||||
* @param mixed $showparenturl
|
* @param mixed $showparenturl
|
||||||
*/
|
*/
|
||||||
function showShort($caseInfo, $showparenturl=false) {
|
function showShort($caseInfo, $showparenturl = false) {
|
||||||
|
|
||||||
echo "<div class='center'>";
|
echo "<div class='center'>";
|
||||||
echo "<table style='margin-bottom: 0px' class='tab_cadre_fixe'>";
|
echo "<table style='margin-bottom: 0px' class='tab_cadre_fixe'>";
|
||||||
@@ -397,7 +402,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
|
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
echo "<td class='tab_bg_2'>".$caseInfo->processName."</td>";
|
echo "<td class='tab_bg_2'>".$caseInfo->processName."</td>";
|
||||||
if ($showparenturl){
|
if ($showparenturl) {
|
||||||
echo "<td class='tab_bg_2'>".$this->getLink()."</td>";
|
echo "<td class='tab_bg_2'>".$this->getLink()."</td>";
|
||||||
} else {
|
} else {
|
||||||
echo "<td class='tab_bg_2'>".$caseInfo->caseName."</td>";
|
echo "<td class='tab_bg_2'>".$caseInfo->caseName."</td>";
|
||||||
@@ -406,8 +411,8 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
echo "<td class='tab_bg_2'>".self::getStatus($caseInfo->caseStatus)."</td>";
|
echo "<td class='tab_bg_2'>".self::getStatus($caseInfo->caseStatus)."</td>";
|
||||||
echo "<td class='tab_bg_2'>".$caseInfo->caseId."</td>";
|
echo "<td class='tab_bg_2'>".$caseInfo->caseId."</td>";
|
||||||
echo "<td class='tab_bg_2'>".$caseInfo->caseCreatorUserName."</td>";
|
echo "<td class='tab_bg_2'>".$caseInfo->caseCreatorUserName."</td>";
|
||||||
echo "<td class='tab_bg_2'>".$caseInfo->createDate."</td>";
|
echo "<td class='tab_bg_2'>".Html::convDateTime($caseInfo->createDate)."</td>";
|
||||||
echo "<td class='tab_bg_2'>".$caseInfo->updateDate."</td>";
|
echo "<td class='tab_bg_2'>".Html::convDateTime($caseInfo->updateDate)."</td>";
|
||||||
//echo "<td class='tab_bg_2'>".$caseInfo->????."</td>";
|
//echo "<td class='tab_bg_2'>".$caseInfo->????."</td>";
|
||||||
echo "</tr>";
|
echo "</tr>";
|
||||||
|
|
||||||
@@ -447,8 +452,9 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
} else {
|
} else {
|
||||||
if ($caseUser->userId == '') { // task to be claimed
|
if ($caseUser->userId == '') { // task to be claimed
|
||||||
$tbctasks[] = $caseUser;
|
$tbctasks[] = $caseUser;
|
||||||
} else
|
} else {
|
||||||
$infotasks[] = $caseUser;
|
$infotasks[] = $caseUser;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -469,7 +475,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* @param mixed $tabnum
|
* @param mixed $tabnum
|
||||||
* @param mixed $withtemplate
|
* @param mixed $withtemplate
|
||||||
*/
|
*/
|
||||||
static function showCaseInfoTab(CommonGLPI $case, $tabnum=1, $withtemplate=0) {
|
static function showCaseInfoTab(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||||
// echo 'The idea is to show here the GLPI ITIL item to which it is linked, and to give a resume of the current case status, and to give possibility to delete or cancel the case.';
|
// echo 'The idea is to show here the GLPI ITIL item to which it is linked, and to give a resume of the current case status, and to give possibility to delete or cancel the case.';
|
||||||
|
|
||||||
echo "<table style='margin-bottom: 0px' class='tab_cadre_fixe'>";
|
echo "<table style='margin-bottom: 0px' class='tab_cadre_fixe'>";
|
||||||
@@ -572,8 +578,8 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
";
|
";
|
||||||
$result = $DB->query($query);
|
$result = $DB->query($query);
|
||||||
|
|
||||||
$cases = array();
|
$cases = [];
|
||||||
$used = array();
|
$used = [];
|
||||||
if ($numrows = $DB->numrows($result)) {
|
if ($numrows = $DB->numrows($result)) {
|
||||||
while ($data = $DB->fetch_assoc($result)) {
|
while ($data = $DB->fetch_assoc($result)) {
|
||||||
$cases[$data['id']] = $data;
|
$cases[$data['id']] = $data;
|
||||||
@@ -581,11 +587,11 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$columns = array('pname' => __('Process', 'processmaker'),
|
$columns = ['pname' => __('Process', 'processmaker'),
|
||||||
'name' => __('Title', 'processmaker'),
|
'name' => __('Title', 'processmaker'),
|
||||||
'status' => __('Status', 'processmaker'),
|
'status' => __('Status', 'processmaker'),
|
||||||
'sub' => __('Sub-case of', 'processmaker')
|
'sub' => __('Sub-case of', 'processmaker')
|
||||||
);
|
];
|
||||||
|
|
||||||
// check if item is not solved nor closed
|
// check if item is not solved nor closed
|
||||||
if ($canupdate
|
if ($canupdate
|
||||||
@@ -602,7 +608,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
echo "<tr class='tab_bg_2'><th colspan='3'>".__('Add a new case', 'processmaker')."</th></tr>";
|
echo "<tr class='tab_bg_2'><th colspan='3'>".__('Add a new case', 'processmaker')."</th></tr>";
|
||||||
|
|
||||||
echo "<tr class='tab_bg_2'><td class='tab_bg_2'>";
|
echo "<tr class='tab_bg_2'><td class='tab_bg_2'>";
|
||||||
_e('Select the process you want to add', 'processmaker');
|
echo __('Select the process you want to add', 'processmaker');
|
||||||
echo "</td><td class='tab_bg_2'>";
|
echo "</td><td class='tab_bg_2'>";
|
||||||
if ($itemtype == 'Ticket') {
|
if ($itemtype == 'Ticket') {
|
||||||
$is_itemtype = "AND is_incident=1";
|
$is_itemtype = "AND is_incident=1";
|
||||||
@@ -618,7 +624,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
'condition' => "is_active=1 $is_itemtype"
|
'condition' => "is_active=1 $is_itemtype"
|
||||||
]);
|
]);
|
||||||
echo "</td><td class='tab_bg_2'>";
|
echo "</td><td class='tab_bg_2'>";
|
||||||
echo "<input type='submit' name='additem' value='"._sx('button','Add')."' class='submit'>";
|
echo "<input type='submit' name='additem' value='"._sx('button', 'Add')."' class='submit'>";
|
||||||
echo "</td></tr></table>";
|
echo "</td></tr></table>";
|
||||||
Html::closeForm();
|
Html::closeForm();
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
@@ -627,8 +633,8 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
echo "<div class='spaced'>";
|
echo "<div class='spaced'>";
|
||||||
if ($canupdate && $numrows) {
|
if ($canupdate && $numrows) {
|
||||||
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
|
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
|
||||||
$massiveactionparams = array('num_displayed' => $numrows,
|
$massiveactionparams = ['num_displayed' => $numrows,
|
||||||
'container' => 'mass'.__CLASS__.$rand);
|
'container' => 'mass'.__CLASS__.$rand];
|
||||||
Html::showMassiveActions($massiveactionparams);
|
Html::showMassiveActions($massiveactionparams);
|
||||||
}
|
}
|
||||||
echo "<table class='tab_cadre_fixehov'>";
|
echo "<table class='tab_cadre_fixehov'>";
|
||||||
@@ -716,7 +722,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* @param mixed $tabnum
|
* @param mixed $tabnum
|
||||||
* @param mixed $withtemplate
|
* @param mixed $withtemplate
|
||||||
*/
|
*/
|
||||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
|
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||||
global $PM_SOAP;
|
global $PM_SOAP;
|
||||||
|
|
||||||
if ($item->getType() == __CLASS__) {
|
if ($item->getType() == __CLASS__) {
|
||||||
@@ -741,7 +747,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* will delete all tasks associated with this case from the item
|
* will delete all tasks associated with this case from the item
|
||||||
* @return true if tasks have been deleted from associated item and from case table
|
* @return true if tasks have been deleted from associated item and from case table
|
||||||
*/
|
*/
|
||||||
private function deleteTasks( ) {
|
private function deleteTasks() {
|
||||||
global $DB;
|
global $DB;
|
||||||
$ret = false;
|
$ret = false;
|
||||||
|
|
||||||
@@ -761,7 +767,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* will delete case and all tasks associated with this case from the item
|
* will delete case and all tasks associated with this case from the item
|
||||||
* @return true if case and tasks have been deleted from associated item and from case table
|
* @return true if case and tasks have been deleted from associated item and from case table
|
||||||
*/
|
*/
|
||||||
function deleteCase( ) {
|
function deleteCase() {
|
||||||
return $this->delete(['id' => $this->getID()]);
|
return $this->delete(['id' => $this->getID()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -772,7 +778,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* BEWARE that this will only be done when case is in TO_DO status
|
* BEWARE that this will only be done when case is in TO_DO status
|
||||||
* @return true if tasks have been deleted from associated item and from case table
|
* @return true if tasks have been deleted from associated item and from case table
|
||||||
*/
|
*/
|
||||||
private function cancelTasks( ) {
|
private function cancelTasks() {
|
||||||
global $DB;
|
global $DB;
|
||||||
$ret = false;
|
$ret = false;
|
||||||
|
|
||||||
@@ -793,13 +799,13 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* BEWARE that this will only be done when case is in TO_DO status
|
* BEWARE that this will only be done when case is in TO_DO status
|
||||||
* @return true if case and tasks have been cancelled or marked from associated item and from case table
|
* @return true if case and tasks have been cancelled or marked from associated item and from case table
|
||||||
*/
|
*/
|
||||||
function cancelCase( ) {
|
function cancelCase() {
|
||||||
global $DB;
|
global $DB;
|
||||||
$ret = false;
|
$ret = false;
|
||||||
|
|
||||||
if (isset($this->fields['case_status']) && $this->fields['case_status'] == "TO_DO") {
|
if (isset($this->fields['case_status']) && $this->fields['case_status'] == "TO_DO") {
|
||||||
if ($this->cancelTasks()) {
|
if ($this->cancelTasks()) {
|
||||||
if ($this->update( array( 'id' => $this->getID(), 'case_status' => 'CANCELLED' ) )) {
|
if ($this->update( [ 'id' => $this->getID(), 'case_status' => 'CANCELLED' ] )) {
|
||||||
$ret=true;
|
$ret=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -861,7 +867,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
//}
|
//}
|
||||||
|
|
||||||
$front_page = "/plugins/processmaker/front";
|
$front_page = "/plugins/processmaker/front";
|
||||||
$menu = array();
|
$menu = [];
|
||||||
$menu['title'] = self::getTypeName(Session::getPluralNumber());
|
$menu['title'] = self::getTypeName(Session::getPluralNumber());
|
||||||
$menu['page'] = "$front_page/case.php";
|
$menu['page'] = "$front_page/case.php";
|
||||||
$menu['links']['search'] = PluginProcessmakerCase::getSearchURL(false);
|
$menu['links']['search'] = PluginProcessmakerCase::getSearchURL(false);
|
||||||
@@ -880,15 +886,15 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
if (Session::haveRightsOr("config", [READ, UPDATE])) {
|
if (Session::haveRightsOr("config", [READ, UPDATE])) {
|
||||||
$menu['options'][$option]['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
|
$menu['options'][$option]['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
|
||||||
}
|
}
|
||||||
switch( $itemtype ) {
|
switch ($itemtype) {
|
||||||
case 'PluginProcessmakerCase':
|
case 'PluginProcessmakerCase':
|
||||||
//if ($itemtype::canCreate()) {
|
//if ($itemtype::canCreate()) {
|
||||||
//$menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
|
//$menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
|
||||||
//}
|
//}
|
||||||
break ;
|
break;
|
||||||
default :
|
default :
|
||||||
$menu['options'][$option]['page'] = PluginProcessmakerProcess::getSearchURL(false);
|
$menu['options'][$option]['page'] = PluginProcessmakerProcess::getSearchURL(false);
|
||||||
break ;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -902,48 +908,75 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* @param array $options
|
* @param array $options
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
static function getSpecificValueToDisplay($field, $values, array $options=array()) {
|
static function getSpecificValueToDisplay($field, $values, array $options = []) {
|
||||||
|
global $PM_DB;
|
||||||
if (!is_array($values)) {
|
if (!is_array($values)) {
|
||||||
$values = array($field => $values);
|
$values = [$field => $values];
|
||||||
}
|
}
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
case 'id':
|
case 'id':
|
||||||
$locCase = new self;
|
if (isset($options['searchopt']['processmaker_cases'])) {
|
||||||
|
switch ($options['searchopt']['processmaker_cases']) {
|
||||||
//$ret = $locCase->add(['id' => 300, 'itemtype' => 'Ticket', 'items_id' => 252108, 'case_guid' => 'azertyuiop', 'case_num' => -12] );
|
case 'creation_date':
|
||||||
$locCase->getFromDB($values['id']);
|
$res = $PM_DB->query('SELECT * FROM APPLICATION WHERE APP_NUMBER = '.$values['id']);
|
||||||
return $locCase->getLink();
|
if ($res->num_rows > 0) {
|
||||||
|
$row = $PM_DB->fetch_assoc($res);
|
||||||
case 'items_id':
|
return Html::convDateTime($row['APP_CREATE_DATE']);
|
||||||
switch ($field) {
|
}
|
||||||
case 8:
|
//$locCase = new self;
|
||||||
default:
|
//$locCase->getFromDB($values['id']);
|
||||||
// show an item link
|
//$caseInfo = $locCase->getCaseInfo();
|
||||||
$item = new $values['itemtype'];
|
//return Html::convDateTime($caseInfo->createDate);
|
||||||
$item->getFromDB($values['items_id']);
|
break;
|
||||||
return $item->getLink(['forceid' => 1]);
|
case 'update_date':
|
||||||
case 9:
|
$res = $PM_DB->query('SELECT * FROM APPLICATION WHERE APP_NUMBER = '.$values['id']);
|
||||||
// show item entity
|
if ($res->num_rows > 0) {
|
||||||
$item = new $values['itemtype'];
|
$row = $PM_DB->fetch_assoc($res);
|
||||||
$item->getFromDB($values['items_id']);
|
return Html::convDateTime($row['APP_UPDATE_DATE']);
|
||||||
$entity = new Entity;
|
}
|
||||||
$entity->getFromDB($item->fields['entities_id']);
|
//$locCase = new self;
|
||||||
return $entity->getLink(['complete' => 1]);
|
//$locCase->getFromDB($values['id']);
|
||||||
|
//$caseInfo = $locCase->getCaseInfo();
|
||||||
|
//return Html::convDateTime($caseInfo->updateDate);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
return '-';
|
||||||
|
case 'items_id':
|
||||||
|
// show an item link
|
||||||
|
$item = new $values['itemtype'];
|
||||||
|
$item->getFromDB($values['items_id']);
|
||||||
|
return $item->getLink(['forceid' => 1]);
|
||||||
|
|
||||||
case 'case_status':
|
case 'case_status':
|
||||||
return self::getStatus($values['case_status']);
|
return self::getStatus($values['case_status']);
|
||||||
|
|
||||||
|
case 'itemtype':
|
||||||
|
return self::getItemtype($values['itemtype']);
|
||||||
|
|
||||||
|
case 'plugin_processmaker_processes_id':
|
||||||
|
$item = new PluginProcessmakerProcess;
|
||||||
|
$item->getFromDB($values['plugin_processmaker_processes_id']);
|
||||||
|
return $item->getLink();
|
||||||
|
|
||||||
|
case 'plugin_processmaker_cases_id':
|
||||||
|
if ($values['plugin_processmaker_cases_id'] != 0) {
|
||||||
|
$locSCase = new self;
|
||||||
|
$locSCase->getFromDB($values['plugin_processmaker_cases_id']);
|
||||||
|
return $locSCase->getLink(['forceid' => 1]);
|
||||||
|
}
|
||||||
|
return '-';
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return parent::getSpecificValueToDisplay($field, $values, $options);
|
return parent::getSpecificValueToDisplay($field, $values, $options);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static function getSpecificValueToSelect($field, $name='', $values='', array $options=array()) {
|
static function getSpecificValueToSelect($field, $name = '', $values = '', array $options = []) {
|
||||||
|
|
||||||
if (!is_array($values)) {
|
if (!is_array($values)) {
|
||||||
$values = array($field => $values);
|
$values = [$field => $values];
|
||||||
}
|
}
|
||||||
$options['display'] = false;
|
$options['display'] = false;
|
||||||
|
|
||||||
@@ -952,6 +985,15 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
$options['name'] = $name;
|
$options['name'] = $name;
|
||||||
$options['value'] = $values[$field];
|
$options['value'] = $values[$field];
|
||||||
return self::dropdownStatus($options);
|
return self::dropdownStatus($options);
|
||||||
|
case 'itemtype':
|
||||||
|
$options['name'] = $name;
|
||||||
|
$options['value'] = $values[$field];
|
||||||
|
return self::dropdownItemtype($options);
|
||||||
|
case 'plugin_processmaker_processes_id':
|
||||||
|
$options['name'] = $name;
|
||||||
|
$options['value'] = $values[$field];
|
||||||
|
$options['specific_tags'] = ['process_restrict' => 0];
|
||||||
|
return PluginProcessmakerProcess::dropdown($options);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return parent::getSpecificValueToSelect($field, $name, $values, $options);
|
return parent::getSpecificValueToSelect($field, $name, $values, $options);
|
||||||
@@ -959,7 +1001,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static function dropdownStatus(array $options=array()) {
|
static function dropdownStatus(array $options = []) {
|
||||||
|
|
||||||
$p['name'] = 'case_status';
|
$p['name'] = 'case_status';
|
||||||
$p['value'] = self::TO_DO;
|
$p['value'] = self::TO_DO;
|
||||||
@@ -990,17 +1032,16 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static function getAllStatusArray($withmetaforsearch=false) {
|
static function getAllStatusArray($withmetaforsearch = false) {
|
||||||
|
|
||||||
$tab = array(self::DRAFT => _x('case_status', 'Draft', 'processmaker'),
|
$tab = [self::DRAFT => _x('case_status', 'Draft', 'processmaker'),
|
||||||
self::TO_DO => _x('case_status', 'To do', 'processmaker'),
|
self::TO_DO => _x('case_status', 'To do', 'processmaker'),
|
||||||
self::COMPLETED => _x('case_status', 'Completed', 'processmaker'),
|
self::COMPLETED => _x('case_status', 'Completed', 'processmaker'),
|
||||||
self::CANCELLED => _x('case_status', 'Cancelled', 'processmaker'));
|
self::CANCELLED => _x('case_status', 'Cancelled', 'processmaker')];
|
||||||
|
|
||||||
return $tab;
|
return $tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static function getStatus($value) {
|
static function getStatus($value) {
|
||||||
|
|
||||||
$tab = static::getAllStatusArray(true);
|
$tab = static::getAllStatusArray(true);
|
||||||
@@ -1008,12 +1049,61 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
return (isset($tab[$value]) ? $tab[$value] : $value);
|
return (isset($tab[$value]) ? $tab[$value] : $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static function dropdownItemtype(array $options = []) {
|
||||||
|
|
||||||
|
$p['name'] = 'itemtype';
|
||||||
|
$p['value'] = 'Ticket';
|
||||||
|
$p['showtype'] = 'normal';
|
||||||
|
$p['display'] = true;
|
||||||
|
|
||||||
|
if (is_array($options) && count($options)) {
|
||||||
|
foreach ($options as $key => $val) {
|
||||||
|
$p[$key] = $val;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch ($p['showtype']) {
|
||||||
|
//case 'allowed' :
|
||||||
|
// $tab = static::getAllowedStatusArray($p['value']);
|
||||||
|
// break;
|
||||||
|
|
||||||
|
case 'search' :
|
||||||
|
$tab = static::getAllItemtypeArray(true);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default :
|
||||||
|
$tab = static::getAllItemtypeArray(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return Dropdown::showFromArray($p['name'], $tab, $p);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static function getAllItemtypeArray($withmetaforsearch = false) {
|
||||||
|
|
||||||
|
$tab = ['Change' => Change::getTypeName(1),
|
||||||
|
'Ticket' => Ticket::getTypeName(1),
|
||||||
|
'Problem' => Problem::getTypeName(1)
|
||||||
|
];
|
||||||
|
|
||||||
|
return $tab;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static function getItemtype($value) {
|
||||||
|
$tab = static::getAllItemtypeArray(true);
|
||||||
|
// Return $value if not defined
|
||||||
|
return (isset($tab[$value]) ? $tab[$value] : $value);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Summary of getSearchOptions
|
* Summary of getSearchOptions
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function getSearchOptions() {
|
function getSearchOptions() {
|
||||||
$tab = array();
|
$tab = [];
|
||||||
|
|
||||||
$tab['common'] = __('Process cases', 'processmaker');
|
$tab['common'] = __('Process cases', 'processmaker');
|
||||||
|
|
||||||
@@ -1031,18 +1121,19 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
$tab[2]['searchtype'] = 'contains';
|
$tab[2]['searchtype'] = 'contains';
|
||||||
$tab[2]['massiveaction'] = false;
|
$tab[2]['massiveaction'] = false;
|
||||||
|
|
||||||
$tab[3]['table'] = PluginProcessmakerProcess::getTable();
|
$tab[3]['table'] = self::getTable();
|
||||||
$tab[3]['field'] = 'name';
|
$tab[3]['field'] = 'plugin_processmaker_processes_id';
|
||||||
$tab[3]['name'] = __('Process', 'processmaker');
|
$tab[3]['name'] = __('Process', 'processmaker');
|
||||||
$tab[3]['datatype'] = 'itemlink';
|
$tab[3]['datatype'] = 'specific';
|
||||||
|
$tab[3]['searchtype'] = ['contains', 'equals', 'notequals'];
|
||||||
$tab[3]['massiveaction'] = false;
|
$tab[3]['massiveaction'] = false;
|
||||||
|
|
||||||
|
$tab[7]['table'] = self::getTable();
|
||||||
//$tab[7]['table'] = self::getTable();
|
$tab[7]['field'] = 'itemtype';
|
||||||
//$tab[7]['field'] = 'itemtype';
|
$tab[7]['name'] = __('Item type', 'processmaker');
|
||||||
//$tab[7]['name'] = __('Item type', 'processmaker');
|
$tab[7]['massiveaction'] = false;
|
||||||
//$tab[7]['massiveaction'] = false;
|
$tab[7]['datatype'] = 'specific';
|
||||||
//$tab[7]['datatype'] = 'text';
|
$tab[7]['searchtype'] = ['contains', 'equals', 'notequals'];
|
||||||
|
|
||||||
$tab[8]['table'] = self::getTable();
|
$tab[8]['table'] = self::getTable();
|
||||||
$tab[8]['field'] = 'items_id';
|
$tab[8]['field'] = 'items_id';
|
||||||
@@ -1064,18 +1155,37 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
$tab[10]['searchtype'] = ['contains', 'equals', 'notequals'];
|
$tab[10]['searchtype'] = ['contains', 'equals', 'notequals'];
|
||||||
$tab[10]['massiveaction'] = false;
|
$tab[10]['massiveaction'] = false;
|
||||||
|
|
||||||
|
|
||||||
$tab[14]['table'] = self::getTable();
|
$tab[14]['table'] = self::getTable();
|
||||||
$tab[14]['field'] = 'plugin_processmaker_cases_id';
|
$tab[14]['field'] = 'plugin_processmaker_cases_id';
|
||||||
$tab[14]['name'] = __('Sub-case of', 'processmaker');
|
$tab[14]['name'] = __('Sub-case of', 'processmaker');
|
||||||
$tab[14]['datatype'] = 'itemlink';
|
$tab[14]['datatype'] = 'specific';
|
||||||
|
//$tab[14]['searchtype'] = ['contains', 'equals', 'notequals'];
|
||||||
$tab[14]['massiveaction'] = false;
|
$tab[14]['massiveaction'] = false;
|
||||||
|
$tab[14]['nosearch'] = true;
|
||||||
|
|
||||||
|
$tab[16]['table'] = self::getTable();
|
||||||
|
$tab[16]['field'] = 'id';
|
||||||
|
$tab[16]['name'] = __('Creation date', 'processmaker');
|
||||||
|
$tab[16]['datatype'] = 'specific';
|
||||||
|
//$tab[16]['searchtype'] = ['contains', 'equals', 'notequals'];
|
||||||
|
$tab[16]['massiveaction'] = false;
|
||||||
|
$tab[16]['nosearch'] = true;
|
||||||
|
$tab[16]['processmaker_cases'] = 'creation_date';
|
||||||
|
|
||||||
|
$tab[18]['table'] = self::getTable();
|
||||||
|
$tab[18]['field'] = 'id';
|
||||||
|
$tab[18]['name'] = __('Last update date', 'processmaker');
|
||||||
|
$tab[18]['datatype'] = 'specific';
|
||||||
|
// $tab[18]['searchtype'] = ['contains', 'equals', 'notequals'];
|
||||||
|
$tab[18]['massiveaction'] = false;
|
||||||
|
$tab[18]['nosearch'] = true;
|
||||||
|
$tab[18]['processmaker_cases'] = 'update_date';
|
||||||
|
|
||||||
return $tab;
|
return $tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function showForm ($ID, $options=array('candel'=>false)) {
|
function showForm ($ID, $options = ['candel'=>false]) {
|
||||||
//global $DB, $CFG_GLPI, $LANG;
|
//global $DB, $CFG_GLPI, $LANG;
|
||||||
|
|
||||||
$options['candel'] = true;
|
$options['candel'] = true;
|
||||||
@@ -1149,7 +1259,6 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
//echo "<textarea cols='100' rows='6' name='externalapplication' >".$this->fields["externalapplication"]."</textarea>";
|
//echo "<textarea cols='100' rows='6' name='externalapplication' >".$this->fields["externalapplication"]."</textarea>";
|
||||||
//echo "</td></tr>";
|
//echo "</td></tr>";
|
||||||
|
|
||||||
|
|
||||||
$this->showFormButtons($options );
|
$this->showFormButtons($options );
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1160,10 +1269,10 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
function defineTabs($options=array()) {
|
function defineTabs($options = []) {
|
||||||
|
|
||||||
// $ong = array('empty' => $this->getTypeName(1));
|
// $ong = array('empty' => $this->getTypeName(1));
|
||||||
$ong = array();
|
$ong = [];
|
||||||
//$this->addDefaultFormTab($ong);
|
//$this->addDefaultFormTab($ong);
|
||||||
|
|
||||||
$this->addStandardTab('PluginProcessmakerTask', $ong, $options);
|
$this->addStandardTab('PluginProcessmakerTask', $ong, $options);
|
||||||
@@ -1200,8 +1309,9 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
$PM_SOAP->login(true);
|
$PM_SOAP->login(true);
|
||||||
if ($this->deleteTasks() && $this->deleteCronTaskActions() && $PM_SOAP->deleteCase($this->fields['case_guid'])->status_code == 0) {
|
if ($this->deleteTasks() && $this->deleteCronTaskActions() && $PM_SOAP->deleteCase($this->fields['case_guid'])->status_code == 0) {
|
||||||
$ret = true;
|
$ret = true;
|
||||||
|
$dbu = new DbUtils;
|
||||||
// then must delete any sub-processes (sub-cases)
|
// then must delete any sub-processes (sub-cases)
|
||||||
foreach(getAllDatasFromTable(self::getTable(), "`plugin_processmaker_cases_id` = ".$this->getID()) as $row){
|
foreach ($dbu->getAllDataFromTable(self::getTable(), "`plugin_processmaker_cases_id` = ".$this->getID()) as $row) {
|
||||||
$tmp = new self;
|
$tmp = new self;
|
||||||
$tmp->fields = $row;
|
$tmp->fields = $row;
|
||||||
$ret &= $tmp->delete(['id' => $row['id']]);
|
$ret &= $tmp->delete(['id' => $row['id']]);
|
||||||
@@ -1215,7 +1325,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
|||||||
* Summary of deleteCronTaskActions
|
* Summary of deleteCronTaskActions
|
||||||
* Will delete any cron task actions taht are linked to current case
|
* Will delete any cron task actions taht are linked to current case
|
||||||
*/
|
*/
|
||||||
function deleteCronTaskActions( ) {
|
function deleteCronTaskActions() {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
$query = "DELETE FROM `glpi_plugin_processmaker_crontaskactions` WHERE `plugin_processmaker_cases_id` = ".$this->getID();
|
$query = "DELETE FROM `glpi_plugin_processmaker_crontaskactions` WHERE `plugin_processmaker_cases_id` = ".$this->getID();
|
||||||
|
|||||||
@@ -10,7 +10,7 @@
|
|||||||
*/
|
*/
|
||||||
class PluginProcessmakerCasedynaform extends CommonDBTM {
|
class PluginProcessmakerCasedynaform extends CommonDBTM {
|
||||||
|
|
||||||
static function displayTabContentForItem(CommonGLPI $case, $tabnum=1, $withtemplate=0) {
|
static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||||
global $CFG_GLPI, $PM_SOAP;
|
global $CFG_GLPI, $PM_SOAP;
|
||||||
|
|
||||||
$config = $PM_SOAP->config;
|
$config = $PM_SOAP->config;
|
||||||
@@ -21,7 +21,6 @@ class PluginProcessmakerCasedynaform extends CommonDBTM {
|
|||||||
|
|
||||||
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.js'></script>"; //?rand=$rand'
|
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.js'></script>"; //?rand=$rand'
|
||||||
|
|
||||||
|
|
||||||
echo "<script type='text/javascript'>
|
echo "<script type='text/javascript'>
|
||||||
var historyGridListChangeLogGlobal = { viewIdHistory: '', viewIdDin: '', viewDynaformName: '', idHistory: '' } ;
|
var historyGridListChangeLogGlobal = { viewIdHistory: '', viewIdDin: '', viewDynaformName: '', idHistory: '' } ;
|
||||||
var ActionTabFrameGlobal = { tabData: '', tabName: '', tabTitle: '' } ;
|
var ActionTabFrameGlobal = { tabData: '', tabName: '', tabTitle: '' } ;
|
||||||
@@ -36,7 +35,10 @@ class PluginProcessmakerCasedynaform extends CommonDBTM {
|
|||||||
loctabs.find('ul').append( '<li><a href=\'#' + name + '\'>' + title + '</a></li>' );
|
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']}',
|
$.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']}',
|
||||||
complete: function() {
|
xhrFields: { withCredentials: true },
|
||||||
|
cache: false,
|
||||||
|
crossDomain: true,
|
||||||
|
success: function(jqXHR) {
|
||||||
//debugger;
|
//debugger;
|
||||||
loctabs.append( '<div id=\'' + name + '\'>' + html + '</div>');
|
loctabs.append( '<div id=\'' + name + '\'>' + html + '</div>');
|
||||||
loctabs.tabs('refresh'); // to show the panel
|
loctabs.tabs('refresh'); // to show the panel
|
||||||
@@ -72,11 +74,11 @@ class PluginProcessmakerCasedynaform extends CommonDBTM {
|
|||||||
onload=\"onOtherFrameLoad( 'historyDynaformPage', 'caseiframe-historyDynaformPage', 'body', 0 );\">
|
onload=\"onOtherFrameLoad( 'historyDynaformPage', 'caseiframe-historyDynaformPage', 'body', 0 );\">
|
||||||
</iframe>";
|
</iframe>";
|
||||||
|
|
||||||
$PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand) ;
|
$PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0){
|
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||||
return __('Dynaforms', 'processmaker');
|
return __('Dynaforms', 'processmaker');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,11 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
|||||||
return Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE]);
|
return Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function canUpdate( ) {
|
static function canUpdate() {
|
||||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function canDelete( ) {
|
static function canDelete() {
|
||||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,14 +46,14 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function getTypeName($nb=0) {
|
static function getTypeName($nb = 0) {
|
||||||
if ($nb>1) {
|
if ($nb>1) {
|
||||||
return __('Case-links', 'processmaker');
|
return __('Case-links', 'processmaker');
|
||||||
}
|
}
|
||||||
return __('Case-link', 'processmaker');
|
return __('Case-link', 'processmaker');
|
||||||
}
|
}
|
||||||
|
|
||||||
function showForm ($ID, $options=array('candel'=>false)) {
|
function showForm ($ID, $options = ['candel'=>false]) {
|
||||||
global $DB, $CFG_GLPI;
|
global $DB, $CFG_GLPI;
|
||||||
|
|
||||||
$options['candel'] = true;
|
$options['candel'] = true;
|
||||||
@@ -71,6 +71,11 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
|||||||
Dropdown::showYesNo("is_active", $this->fields["is_active"]);
|
Dropdown::showYesNo("is_active", $this->fields["is_active"]);
|
||||||
echo "</td></tr>";
|
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 "<tr class='tab_bg_1'>";
|
||||||
echo "<td >".__('External data', 'processmaker')."</td><td>";
|
echo "<td >".__('External data', 'processmaker')."</td><td>";
|
||||||
Dropdown::showYesNo("is_externaldata", $this->fields["is_externaldata"]);
|
Dropdown::showYesNo("is_externaldata", $this->fields["is_externaldata"]);
|
||||||
@@ -122,12 +127,21 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
|||||||
Dropdown::showYesNo("is_targettoclaim", $this->fields["is_targettoclaim"]);
|
Dropdown::showYesNo("is_targettoclaim", $this->fields["is_targettoclaim"]);
|
||||||
echo "</td></tr>";
|
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 "<tr class='tab_bg_1'>";
|
||||||
echo "<td>".__('External application JSON config', 'processmaker')."</td><td>";
|
echo "<td>".__('External application JSON config', 'processmaker')."</td><td>";
|
||||||
echo "<textarea cols='100' rows='6' name='externalapplication' >".$this->fields["externalapplication"]."</textarea>";
|
echo "<textarea cols='100' rows='6' name='externalapplication' >".$this->fields["externalapplication"]."</textarea>";
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
|
||||||
|
|
||||||
$this->showFormButtons($options );
|
$this->showFormButtons($options );
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -138,7 +152,7 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function getSearchOptions() {
|
function getSearchOptions() {
|
||||||
$tab = array();
|
$tab = [];
|
||||||
|
|
||||||
$tab['common'] = __('ProcessMaker', 'processmaker');
|
$tab['common'] = __('ProcessMaker', 'processmaker');
|
||||||
|
|
||||||
@@ -214,7 +228,7 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
|||||||
$tab[18]['massiveaction'] = false;
|
$tab[18]['massiveaction'] = false;
|
||||||
$tab[18]['datatype'] = 'text';
|
$tab[18]['datatype'] = 'text';
|
||||||
|
|
||||||
//$tab[14]['table'] = 'glpi_taskcategories';
|
//$tab[14]['table'] = 'glpi_taskcategories';
|
||||||
//$tab[14]['field'] = 'completename'; //'plugin_processmaker_taskcategories_id_source';
|
//$tab[14]['field'] = 'completename'; //'plugin_processmaker_taskcategories_id_source';
|
||||||
//$tab[14]['name'] = __('Source task');
|
//$tab[14]['name'] = __('Source task');
|
||||||
//$tab[14]['massiveaction'] = false;
|
//$tab[14]['massiveaction'] = false;
|
||||||
@@ -232,7 +246,6 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
|||||||
// ]
|
// ]
|
||||||
// ];
|
// ];
|
||||||
|
|
||||||
|
|
||||||
return $tab;
|
return $tab;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
|
|
||||||
static $rightname = '';
|
static $rightname = '';
|
||||||
|
|
||||||
static private $_instance = NULL;
|
static private $_instance = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Summary of canCreate
|
* Summary of canCreate
|
||||||
@@ -37,7 +37,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
* @param mixed $nb plural
|
* @param mixed $nb plural
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
static function getTypeName($nb=0) {
|
static function getTypeName($nb = 0) {
|
||||||
return __('ProcessMaker setup', 'processmaker');
|
return __('ProcessMaker setup', 'processmaker');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +46,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
* @param mixed $with_comment with comment
|
* @param mixed $with_comment with comment
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function getName($with_comment=0) {
|
function getName($with_comment = 0) {
|
||||||
return __('ProcessMaker', 'processmaker');
|
return __('ProcessMaker', 'processmaker');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -145,10 +145,10 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
|
|
||||||
$setup_ok = false;
|
$setup_ok = false;
|
||||||
|
|
||||||
$ui_theme = array(
|
$ui_theme = [
|
||||||
'glpi_classic' => 'glpi_classic',
|
'glpi_classic' => 'glpi_classic',
|
||||||
'glpi_neoclassic' => 'glpi_neoclassic'
|
'glpi_neoclassic' => 'glpi_neoclassic'
|
||||||
);
|
];
|
||||||
|
|
||||||
$config = $PM_SOAP->config;
|
$config = $PM_SOAP->config;
|
||||||
$config->showFormHeader(['colspan' => 4]);
|
$config->showFormHeader(['colspan' => 4]);
|
||||||
@@ -158,9 +158,8 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
echo "<tr class='tab_bg_1'>";
|
echo "<tr class='tab_bg_1'>";
|
||||||
echo "<td >".__('Server URL (must be in same domain than GLPI)', 'processmaker')."</td><td >";
|
echo "<td >".__('Server URL (must be in same domain than GLPI)', 'processmaker')."</td><td >";
|
||||||
echo "<input size='50' type='text' name='pm_server_URL' value='".$config->fields['pm_server_URL']."'>";
|
echo "<input size='50' type='text' name='pm_server_URL' value='".$config->fields['pm_server_URL']."'>";
|
||||||
echo "</td></tr>\n";
|
echo "</td>";
|
||||||
|
|
||||||
echo "<tr class='tab_bg_1'>";
|
|
||||||
echo "<td>".__('Common domain with GLPI', 'processmaker')."</td>";
|
echo "<td>".__('Common domain with GLPI', 'processmaker')."</td>";
|
||||||
echo "<td><font color='red'><div name='domain'>".$config->fields['domain']."</div></font>";
|
echo "<td><font color='red'><div name='domain'>".$config->fields['domain']."</div></font>";
|
||||||
|
|
||||||
@@ -198,6 +197,11 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
");
|
");
|
||||||
echo "</td></tr>\n";
|
echo "</td></tr>\n";
|
||||||
|
|
||||||
|
echo "<tr class='tab_bg_1'>";
|
||||||
|
echo "<td >".__('Verify SSL certificate', 'processmaker')."</td><td >";
|
||||||
|
Dropdown::showYesNo("ssl_verify", $config->fields['ssl_verify']);
|
||||||
|
echo "</td></tr>";
|
||||||
|
|
||||||
echo "<tr class='tab_bg_1'>";
|
echo "<tr class='tab_bg_1'>";
|
||||||
echo "<td >".__('Workspace Name', 'processmaker')."</td><td >";
|
echo "<td >".__('Workspace Name', 'processmaker')."</td><td >";
|
||||||
echo "<input type='text' name='pm_workspace' value='".$config->fields['pm_workspace']."'>";
|
echo "<input type='text' name='pm_workspace' value='".$config->fields['pm_workspace']."'>";
|
||||||
@@ -221,7 +225,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
if ($config->fields['pm_server_URL'] != ''
|
if ($config->fields['pm_server_URL'] != ''
|
||||||
&& $config->fields['pm_workspace'] != ''
|
&& $config->fields['pm_workspace'] != ''
|
||||||
&& $config->fields["pm_admin_user"] != ''
|
&& $config->fields["pm_admin_user"] != ''
|
||||||
// && ($pm->login(true))) {
|
// && ($pm->login(true))) {
|
||||||
&& ($PM_SOAP->login(true))) {
|
&& ($PM_SOAP->login(true))) {
|
||||||
echo "<font color='green'>".__('Test successful');
|
echo "<font color='green'>".__('Test successful');
|
||||||
$setup_ok = true;
|
$setup_ok = true;
|
||||||
@@ -268,24 +272,24 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
echo "<tr class='tab_bg_1'>";
|
echo "<tr class='tab_bg_1'>";
|
||||||
echo "<td >".__('Theme Name', 'processmaker')."</td><td >";
|
echo "<td >".__('Theme Name', 'processmaker')."</td><td >";
|
||||||
Dropdown::showFromArray('pm_theme', $ui_theme,
|
Dropdown::showFromArray('pm_theme', $ui_theme,
|
||||||
array('value' => $config->fields['pm_theme']));
|
['value' => $config->fields['pm_theme']]);
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
|
||||||
echo "<tr class='tab_bg_1'>";
|
echo "<tr class='tab_bg_1'>";
|
||||||
echo "<td >".__('Main Task Category (edit to change name)', 'processmaker')."</td><td >";
|
echo "<td >".__('Main Task Category (edit to change name)', 'processmaker')."</td><td >";
|
||||||
TaskCategory::dropdown(array('name' => 'taskcategories_id',
|
TaskCategory::dropdown(['name' => 'taskcategories_id',
|
||||||
'display_emptychoice' => true,
|
'display_emptychoice' => true,
|
||||||
'value' => $config->fields['taskcategories_id']));
|
'value' => $config->fields['taskcategories_id']]);
|
||||||
echo "</td></tr>\n";
|
echo "</td></tr>\n";
|
||||||
|
|
||||||
echo "<tr class='tab_bg_1'>";
|
echo "<tr class='tab_bg_1'>";
|
||||||
echo "<td >".__('Task Writer (edit to change name)', 'processmaker')."</td><td >";
|
echo "<td >".__('Task Writer (edit to change name)', 'processmaker')."</td><td >";
|
||||||
$rand = mt_rand();
|
$rand = mt_rand();
|
||||||
User::dropdown(array('name' => 'users_id',
|
User::dropdown(['name' => 'users_id',
|
||||||
'display_emptychoice' => true,
|
'display_emptychoice' => true,
|
||||||
'right' => 'all',
|
'right' => 'all',
|
||||||
'rand' => $rand,
|
'rand' => $rand,
|
||||||
'value' => $config->fields['users_id']));
|
'value' => $config->fields['users_id']]);
|
||||||
|
|
||||||
// this code adds the + sign to the form
|
// this code adds the + sign to the form
|
||||||
echo "<img alt='' title=\"".__s('Add')."\" src='".$CFG_GLPI["root_doc"].
|
echo "<img alt='' title=\"".__s('Add')."\" src='".$CFG_GLPI["root_doc"].
|
||||||
@@ -293,7 +297,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
onClick=\"".Html::jsGetElementbyID('add_dropdown'.$rand).".dialog('open');\">";
|
onClick=\"".Html::jsGetElementbyID('add_dropdown'.$rand).".dialog('open');\">";
|
||||||
echo Ajax::createIframeModalWindow('add_dropdown'.$rand,
|
echo Ajax::createIframeModalWindow('add_dropdown'.$rand,
|
||||||
User::getFormURL(),
|
User::getFormURL(),
|
||||||
array('display' => false));
|
['display' => false]);
|
||||||
// end of + sign
|
// end of + sign
|
||||||
|
|
||||||
echo "</td></tr>\n";
|
echo "</td></tr>\n";
|
||||||
@@ -301,13 +305,13 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
echo "<tr class='tab_bg_1'>";
|
echo "<tr class='tab_bg_1'>";
|
||||||
echo "<td >".__('Group in ProcessMaker which will contain all GLPI users', 'processmaker')."</td><td >";
|
echo "<td >".__('Group in ProcessMaker which will contain all GLPI users', 'processmaker')."</td><td >";
|
||||||
|
|
||||||
$pmGroups = array( 0 => Dropdown::EMPTY_VALUE );
|
$pmGroups = [ 0 => Dropdown::EMPTY_VALUE ];
|
||||||
$query = "SELECT DISTINCT CON_ID, CON_VALUE FROM CONTENT WHERE CON_CATEGORY='GRP_TITLE' ORDER BY CON_VALUE;";
|
$query = "SELECT DISTINCT CON_ID, CON_VALUE FROM CONTENT WHERE CON_CATEGORY='GRP_TITLE' ORDER BY CON_VALUE;";
|
||||||
if ($PM_DB->connected) {
|
if ($PM_DB->connected) {
|
||||||
foreach ($PM_DB->request( $query ) as $row) {
|
foreach ($PM_DB->request( $query ) as $row) {
|
||||||
$pmGroups[ $row['CON_ID'] ] = $row['CON_VALUE'];
|
$pmGroups[ $row['CON_ID'] ] = $row['CON_VALUE'];
|
||||||
}
|
}
|
||||||
Dropdown::showFromArray( 'pm_group_guid', $pmGroups, array('value' => $config->fields['pm_group_guid']) );
|
Dropdown::showFromArray( 'pm_group_guid', $pmGroups, ['value' => $config->fields['pm_group_guid']] );
|
||||||
} else {
|
} else {
|
||||||
echo "<font color='red'>".__('Not connected');
|
echo "<font color='red'>".__('Not connected');
|
||||||
}
|
}
|
||||||
@@ -329,27 +333,27 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
echo "<tr><td colspan='4'></td></tr>";
|
echo "<tr><td colspan='4'></td></tr>";
|
||||||
|
|
||||||
echo "<tr><th colspan='4'>".__('Processmaker system information', 'processmaker')."</th></tr>";
|
echo "<tr><th colspan='4'>".__('Processmaker system information', 'processmaker')."</th></tr>";
|
||||||
if ($setup_ok) {
|
if ($setup_ok) {
|
||||||
$info = $PM_SOAP->systemInformation( );
|
$info = $PM_SOAP->systemInformation( );
|
||||||
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.$info->version.'</td></tr>';
|
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.$info->version.'</td></tr>';
|
||||||
echo '<tr><td>'.__('Web server', 'processmaker').'</td><td>'.$info->webServer.'</td></tr>';
|
echo '<tr><td>'.__('Web server', 'processmaker').'</td><td>'.$info->webServer.'</td></tr>';
|
||||||
echo '<tr><td>'.__('Server name', 'processmaker').'</td><td>'.$info->serverName.'</td></tr>';
|
echo '<tr><td>'.__('Server name', 'processmaker').'</td><td>'.$info->serverName.'</td></tr>';
|
||||||
echo '<tr><td>'.__('PHP version', 'processmaker').'</td><td>'.$info->phpVersion.'</td></tr>';
|
echo '<tr><td>'.__('PHP version', 'processmaker').'</td><td>'.$info->phpVersion.'</td></tr>';
|
||||||
echo '<tr><td>'.__('DB version', 'processmaker').'</td><td>'.$info->databaseVersion.'</td></tr>';
|
echo '<tr><td>'.__('DB version', 'processmaker').'</td><td>'.$info->databaseVersion.'</td></tr>';
|
||||||
echo '<tr><td>'.__('DB server IP', 'processmaker').'</td><td>'.$info->databaseServerIp.'</td></tr>';
|
echo '<tr><td>'.__('DB server IP', 'processmaker').'</td><td>'.$info->databaseServerIp.'</td></tr>';
|
||||||
echo '<tr><td>'.__('DB name', 'processmaker').'</td><td>'.$info->databaseName.'</td></tr>';
|
echo '<tr><td>'.__('DB name', 'processmaker').'</td><td>'.$info->databaseName.'</td></tr>';
|
||||||
echo '<tr><td>'.__('User browser', 'processmaker').'</td><td>'.$info->userBrowser.'</td></tr>';
|
echo '<tr><td>'.__('User browser', 'processmaker').'</td><td>'.$info->userBrowser.'</td></tr>';
|
||||||
echo '<tr><td>'.__('User IP', 'processmaker').'</td><td>'.$info->userIp.'</td></tr>';
|
echo '<tr><td>'.__('User IP', 'processmaker').'</td><td>'.$info->userIp.'</td></tr>';
|
||||||
} else {
|
} else {
|
||||||
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.__('Not yet!', 'processmaker').'</td></tr>';
|
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.__('Not yet!', 'processmaker').'</td></tr>';
|
||||||
}
|
}
|
||||||
$config->showFormButtons(array('candel'=>false));
|
$config->showFormButtons(['candel'=>false]);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
|
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||||
if ($item->getType()=='Config') {
|
if ($item->getType()=='Config') {
|
||||||
return __('ProcessMaker', 'processmaker');
|
return __('ProcessMaker', 'processmaker');
|
||||||
}
|
}
|
||||||
@@ -357,7 +361,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
|
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||||
|
|
||||||
if ($item->getType()=='Config') {
|
if ($item->getType()=='Config') {
|
||||||
self::showConfigForm($item);
|
self::showConfigForm($item);
|
||||||
|
|||||||
@@ -15,8 +15,9 @@ class PluginProcessmakerCrontaskaction extends CommonDBTM {
|
|||||||
// {"form":{"RELEASE_DONE":"0","btnGLPISendRequest":"submit"},"UID":"28421020557bffc5b374850018853291","__DynaformName__":"51126098657bd96b286ded7016691792_28421020557bffc5b374850018853291","__notValidateThisFields__":"[]","DynaformRequiredFields":"[]","APP_UID":"6077575685836f7d89cabe6013770123","DEL_INDEX":"4"}
|
// {"form":{"RELEASE_DONE":"0","btnGLPISendRequest":"submit"},"UID":"28421020557bffc5b374850018853291","__DynaformName__":"51126098657bd96b286ded7016691792_28421020557bffc5b374850018853291","__notValidateThisFields__":"[]","DynaformRequiredFields":"[]","APP_UID":"6077575685836f7d89cabe6013770123","DEL_INDEX":"4"}
|
||||||
|
|
||||||
|
|
||||||
const WAITING_DATA = 1 ;
|
const WAITING_DATA = 1;
|
||||||
const DATA_READY = 2 ;
|
const DATA_READY = 2;
|
||||||
const DONE = 3 ;
|
const DONE = 3;
|
||||||
|
const NOT_DONE = 4;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -13,7 +13,7 @@ class PluginProcessmakerMenu extends CommonGLPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$front_page = "/plugins/processmaker/front";
|
$front_page = "/plugins/processmaker/front";
|
||||||
$menu = array();
|
$menu = [];
|
||||||
$menu['title'] = self::getMenuName();
|
$menu['title'] = self::getMenuName();
|
||||||
$menu['page'] = "$front_page/process.php";
|
$menu['page'] = "$front_page/process.php";
|
||||||
$menu['links']['search'] = PluginProcessmakerProcess::getSearchURL(false);
|
$menu['links']['search'] = PluginProcessmakerProcess::getSearchURL(false);
|
||||||
@@ -32,13 +32,13 @@ class PluginProcessmakerMenu extends CommonGLPI {
|
|||||||
if (Session::haveRightsOr("config", [READ, UPDATE])) {
|
if (Session::haveRightsOr("config", [READ, UPDATE])) {
|
||||||
$menu['options'][$option]['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
|
$menu['options'][$option]['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
|
||||||
}
|
}
|
||||||
switch( $itemtype ) {
|
switch ($itemtype) {
|
||||||
case 'PluginProcessmakerProcess':
|
case 'PluginProcessmakerProcess':
|
||||||
|
|
||||||
//if ($itemtype::canCreate()) {
|
//if ($itemtype::canCreate()) {
|
||||||
// $menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
|
// $menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
|
||||||
//}
|
//}
|
||||||
break ;
|
break;
|
||||||
case 'PluginProcessmakerCaselink':
|
case 'PluginProcessmakerCaselink':
|
||||||
if (Session::haveRight("plugin_processmaker_config", UPDATE)) {
|
if (Session::haveRight("plugin_processmaker_config", UPDATE)) {
|
||||||
$menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
|
$menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
|
||||||
@@ -47,7 +47,7 @@ class PluginProcessmakerMenu extends CommonGLPI {
|
|||||||
|
|
||||||
default :
|
default :
|
||||||
$menu['options'][$option]['page'] = PluginProcessmakerProcess::getSearchURL(false);
|
$menu['options'][$option]['page'] = PluginProcessmakerProcess::getSearchURL(false);
|
||||||
break ;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,10 +29,12 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
return Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE]);
|
return Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static function canUpdate( ) {
|
|
||||||
|
static function canUpdate() {
|
||||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function canUpdateItem() {
|
function canUpdateItem() {
|
||||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||||
}
|
}
|
||||||
@@ -48,7 +50,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
* @param array $post is the $_POST
|
* @param array $post is the $_POST
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function refreshTasks( $post ) {
|
function refreshTasks($post) {
|
||||||
global $PM_DB, $CFG_GLPI;
|
global $PM_DB, $CFG_GLPI;
|
||||||
|
|
||||||
if ($this->getFromDB( $post['id'] )) {
|
if ($this->getFromDB( $post['id'] )) {
|
||||||
@@ -58,18 +60,19 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
//$database = $config->fields['pm_workspace'] ;
|
//$database = $config->fields['pm_workspace'] ;
|
||||||
$translates = false;
|
$translates = false;
|
||||||
$mapLangs = [];
|
$mapLangs = [];
|
||||||
// if (class_exists('DropdownTranslation')) {
|
$dbu = new DbUtils;
|
||||||
|
// if (class_exists('DropdownTranslation')) {
|
||||||
// to force rights to add translations
|
// to force rights to add translations
|
||||||
$_SESSION['glpi_dropdowntranslations']['TaskCategory']['name'] = 'name';
|
$_SESSION['glpi_dropdowntranslations']['TaskCategory']['name'] = 'name';
|
||||||
$_SESSION['glpi_dropdowntranslations']['TaskCategory']['completename'] = 'completename';
|
$_SESSION['glpi_dropdowntranslations']['TaskCategory']['completename'] = 'completename';
|
||||||
$_SESSION['glpi_dropdowntranslations']['TaskCategory']['comment'] = 'comment';
|
$_SESSION['glpi_dropdowntranslations']['TaskCategory']['comment'] = 'comment';
|
||||||
$translates = true;
|
$translates = true;
|
||||||
// create a reversed map for languages
|
// create a reversed map for languages
|
||||||
foreach ($CFG_GLPI['languages'] as $key => $valArray) {
|
foreach ($CFG_GLPI['languages'] as $key => $valArray) {
|
||||||
$lg = locale_get_primary_language( $key );
|
$lg = locale_get_primary_language( $key );
|
||||||
$mapLangs[$lg][] = $key;
|
$mapLangs[$lg][] = $key;
|
||||||
$mapLangs[$key][] = $key; // also add complete lang
|
$mapLangs[$key][] = $key; // also add complete lang
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
$lang = locale_get_primary_language( $CFG_GLPI['language'] );
|
$lang = locale_get_primary_language( $CFG_GLPI['language'] );
|
||||||
$query = "SELECT TASK.TAS_UID, TASK.TAS_START, TASK.TAS_TYPE, CONTENT.CON_LANG, CONTENT.CON_CATEGORY, CONTENT.CON_VALUE FROM TASK
|
$query = "SELECT TASK.TAS_UID, TASK.TAS_START, TASK.TAS_TYPE, CONTENT.CON_LANG, CONTENT.CON_CATEGORY, CONTENT.CON_VALUE FROM TASK
|
||||||
@@ -90,30 +93,30 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$pmtask = new PluginProcessmakerTaskCategory;
|
$pmtask = new PluginProcessmakerTaskCategory;
|
||||||
$currentasksinprocess = getAllDatasFromTable($pmtask->getTable(), '`is_active` = 1 AND `plugin_processmaker_processes_id` = '.$this->getID());
|
$currentasksinprocess = $dbu->getAllDataFromTable($pmtask->getTable(), '`is_active` = 1 AND `plugin_processmaker_processes_id` = '.$this->getID());
|
||||||
$tasks=[];
|
$tasks=[];
|
||||||
foreach($currentasksinprocess as $task){
|
foreach ($currentasksinprocess as $task) {
|
||||||
$tasks[$task['pm_task_guid']] = $task;
|
$tasks[$task['pm_task_guid']] = $task;
|
||||||
}
|
}
|
||||||
$inactivetasks = array_diff_key($tasks, $defaultLangTaskArray);
|
$inactivetasks = array_diff_key($tasks, $defaultLangTaskArray);
|
||||||
foreach($inactivetasks as $taskkey => $task) {
|
foreach ($inactivetasks as $taskkey => $task) {
|
||||||
// must verify if this taskcategory are used in a task somewhere
|
// must verify if this taskcategory are used in a task somewhere
|
||||||
$objs = ['TicketTask', 'ProblemTask', 'ChangeTask'];
|
$objs = ['TicketTask', 'ProblemTask', 'ChangeTask'];
|
||||||
$countElt = 0 ;
|
$countElt = 0;
|
||||||
foreach($objs as $obj) {
|
foreach ($objs as $obj) {
|
||||||
$countElt += countElementsInTable( getTableForItemType($obj), "taskcategories_id = ".$task['taskcategories_id'] );
|
$countElt += $dbu->countElementsInTable( $dbu->getTableForItemType($obj), "taskcategories_id = ".$task['taskcategories_id'] );
|
||||||
if ($countElt != 0) {
|
if ($countElt != 0) {
|
||||||
// just set 'is_active' to 0
|
// just set 'is_active' to 0
|
||||||
$pmtask->Update( array( 'id' => $task['id'], 'is_start' => 0, 'is_active' => 0 ) );
|
$pmtask->Update( [ 'id' => $task['id'], 'is_start' => 0, 'is_active' => 0 ] );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($countElt == 0) {
|
if ($countElt == 0) {
|
||||||
// purge this category as it is not used anywhere
|
// purge this category as it is not used anywhere
|
||||||
$taskCat = new TaskCategory;
|
$taskCat = new TaskCategory;
|
||||||
$taskCat->delete(array( 'id' => $task['taskcategories_id'] ), 1);
|
$taskCat->delete([ 'id' => $task['taskcategories_id'] ], 1);
|
||||||
$pmTaskCat = new PluginProcessmakerTaskCategory;
|
$pmTaskCat = new PluginProcessmakerTaskCategory;
|
||||||
$pmTaskCat->delete(array( 'id' => $task['id'] ), 1);
|
$pmTaskCat->delete([ 'id' => $task['id'] ], 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -125,21 +128,21 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
if ($taskCat->getFromDB( $pmTaskCat->fields['taskcategories_id'] )) {
|
if ($taskCat->getFromDB( $pmTaskCat->fields['taskcategories_id'] )) {
|
||||||
// found it must test if should be updated
|
// found it must test if should be updated
|
||||||
if ($taskCat->fields['name'] != $task['TAS_TITLE'] || $taskCat->fields['comment'] != $task['TAS_DESCRIPTION']) {
|
if ($taskCat->fields['name'] != $task['TAS_TITLE'] || $taskCat->fields['comment'] != $task['TAS_DESCRIPTION']) {
|
||||||
$taskCat->update( array( 'id' => $taskCat->getID(), 'name' => $PM_DB->escape($task['TAS_TITLE']), 'comment' => $PM_DB->escape($task['TAS_DESCRIPTION']), 'taskcategories_id' => $this->fields['taskcategories_id'] ) );
|
$taskCat->update( [ 'id' => $taskCat->getID(), 'name' => $PM_DB->escape($task['TAS_TITLE']), 'comment' => $PM_DB->escape($task['TAS_DESCRIPTION']), 'taskcategories_id' => $this->fields['taskcategories_id'] ] );
|
||||||
}
|
}
|
||||||
if ($pmTaskCat->fields['is_start'] != $task['is_start']) {
|
if ($pmTaskCat->fields['is_start'] != $task['is_start']) {
|
||||||
$pmTaskCat->update( array( 'id' => $pmTaskCat->getID(), 'is_start' => $task['is_start'] ) );
|
$pmTaskCat->update( [ 'id' => $pmTaskCat->getID(), 'is_start' => $task['is_start'] ] );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// taskcat must be created
|
// taskcat must be created
|
||||||
$taskCat->add( array( 'is_recursive' => true, 'name' => $PM_DB->escape($task['TAS_TITLE']), 'comment' => $PM_DB->escape($task['TAS_DESCRIPTION']), 'taskcategories_id' => $this->fields['taskcategories_id'] ) );
|
$taskCat->add( [ 'is_recursive' => true, 'name' => $PM_DB->escape($task['TAS_TITLE']), 'comment' => $PM_DB->escape($task['TAS_DESCRIPTION']), 'taskcategories_id' => $this->fields['taskcategories_id'] ] );
|
||||||
// update pmTaskCat
|
// update pmTaskCat
|
||||||
$pmTaskCat->update( array( 'id' => $pmTaskCat->getID(), 'taskcategories_id' => $taskCat->getID(), 'is_start' => $task['is_start'] ) );
|
$pmTaskCat->update( [ 'id' => $pmTaskCat->getID(), 'taskcategories_id' => $taskCat->getID(), 'is_start' => $task['is_start'] ] );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// should create a new one
|
// should create a new one
|
||||||
// taskcat must be created
|
// taskcat must be created
|
||||||
$taskCat->add( array( 'is_recursive' => true, 'name' => $PM_DB->escape($task['TAS_TITLE']), 'comment' => $PM_DB->escape($task['TAS_DESCRIPTION']), 'taskcategories_id' => $this->fields['taskcategories_id'] ) );
|
$taskCat->add( [ 'is_recursive' => true, 'name' => $PM_DB->escape($task['TAS_TITLE']), 'comment' => $PM_DB->escape($task['TAS_DESCRIPTION']), 'taskcategories_id' => $this->fields['taskcategories_id'] ] );
|
||||||
// pmTaskCat must be created too
|
// pmTaskCat must be created too
|
||||||
$pmTaskCat->add( ['plugin_processmaker_processes_id' => $this->getID(),
|
$pmTaskCat->add( ['plugin_processmaker_processes_id' => $this->getID(),
|
||||||
'pm_task_guid' => $taskGUID,
|
'pm_task_guid' => $taskGUID,
|
||||||
@@ -157,15 +160,15 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
if (DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'name', $langTask ) != $taskL[ 'TAS_TITLE' ]) {
|
if (DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'name', $langTask ) != $taskL[ 'TAS_TITLE' ]) {
|
||||||
// must be updated
|
// must be updated
|
||||||
$trans = new DropdownTranslation;
|
$trans = new DropdownTranslation;
|
||||||
$trans->update( array( 'id' => $loc_id, 'field' => 'name', 'value' => $PM_DB->escape($taskL[ 'TAS_TITLE' ]), 'itemtype' => 'TaskCategory', 'items_id' => $taskCat->getID(), 'language' => $langTask ) );
|
$trans->update( [ 'id' => $loc_id, 'field' => 'name', 'value' => $PM_DB->escape($taskL[ 'TAS_TITLE' ]), 'itemtype' => 'TaskCategory', 'items_id' => $taskCat->getID(), 'language' => $langTask ] );
|
||||||
$trans->generateCompletename( array( 'itemtype' => 'TaskCategory', 'items_id' => $taskCat->getID(), 'language' => $langTask ) );
|
$trans->generateCompletename( [ 'itemtype' => 'TaskCategory', 'items_id' => $taskCat->getID(), 'language' => $langTask ] );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// must be added
|
// must be added
|
||||||
// must be updated
|
// must be updated
|
||||||
$trans = new DropdownTranslation;
|
$trans = new DropdownTranslation;
|
||||||
$trans->add( array( 'items_id' => $taskCat->getID(), 'itemtype' => 'TaskCategory', 'language' => $langTask, 'field' => 'name', 'value' => $PM_DB->escape($taskL[ 'TAS_TITLE' ]) ) );
|
$trans->add( [ 'items_id' => $taskCat->getID(), 'itemtype' => 'TaskCategory', 'language' => $langTask, 'field' => 'name', 'value' => $PM_DB->escape($taskL[ 'TAS_TITLE' ]) ] );
|
||||||
$trans->generateCompletename( array( 'itemtype' => 'TaskCategory', 'items_id' => $taskCat->getID(),'language' => $langTask ) );
|
$trans->generateCompletename( [ 'itemtype' => 'TaskCategory', 'items_id' => $taskCat->getID(),'language' => $langTask ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
// look for 'comment' field
|
// look for 'comment' field
|
||||||
@@ -173,12 +176,12 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
if (DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'comment', $langTask ) != $taskL[ 'TAS_DESCRIPTION' ]) {
|
if (DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'comment', $langTask ) != $taskL[ 'TAS_DESCRIPTION' ]) {
|
||||||
// must be updated
|
// must be updated
|
||||||
$trans = new DropdownTranslation;
|
$trans = new DropdownTranslation;
|
||||||
$trans->update( array( 'id' => $loc_id, 'field' => 'comment', 'value' => $PM_DB->escape($taskL[ 'TAS_DESCRIPTION' ]) , 'itemtype' => 'TaskCategory', 'items_id' => $taskCat->getID(), 'language' => $langTask) );
|
$trans->update( [ 'id' => $loc_id, 'field' => 'comment', 'value' => $PM_DB->escape($taskL[ 'TAS_DESCRIPTION' ]) , 'itemtype' => 'TaskCategory', 'items_id' => $taskCat->getID(), 'language' => $langTask] );
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// must be added
|
// must be added
|
||||||
$trans = new DropdownTranslation;
|
$trans = new DropdownTranslation;
|
||||||
$trans->add( array( 'items_id' => $taskCat->getID(), 'itemtype' => 'TaskCategory', 'language' => $langTask, 'field' => 'comment', 'value' => $PM_DB->escape($taskL[ 'TAS_DESCRIPTION' ]) ) );
|
$trans->add( [ 'items_id' => $taskCat->getID(), 'itemtype' => 'TaskCategory', 'language' => $langTask, 'field' => 'comment', 'value' => $PM_DB->escape($taskL[ 'TAS_DESCRIPTION' ]) ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -189,7 +192,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareInputForAdd($input){
|
function prepareInputForAdd($input) {
|
||||||
global $PM_DB;
|
global $PM_DB;
|
||||||
if (isset($input['name'])) {
|
if (isset($input['name'])) {
|
||||||
$input['name'] = $PM_DB->escape($input['name']);
|
$input['name'] = $PM_DB->escape($input['name']);
|
||||||
@@ -197,7 +200,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
return $input;
|
return $input;
|
||||||
}
|
}
|
||||||
|
|
||||||
function prepareInputForUpdate($input){
|
function prepareInputForUpdate($input) {
|
||||||
global $PM_DB;
|
global $PM_DB;
|
||||||
if (isset($input['name'])) {
|
if (isset($input['name'])) {
|
||||||
$input['name'] = $PM_DB->escape($input['name']);
|
$input['name'] = $PM_DB->escape($input['name']);
|
||||||
@@ -218,9 +221,9 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
* used to refresh process list and task category list
|
* used to refresh process list and task category list
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function refresh( ) {
|
function refresh() {
|
||||||
global $DB, $PM_SOAP;
|
global $DB, $PM_SOAP;
|
||||||
|
$dbu = new DbUtils;
|
||||||
$pmCurrentProcesses = [];
|
$pmCurrentProcesses = [];
|
||||||
|
|
||||||
// then refresh list of available process from PM to inner table
|
// then refresh list of available process from PM to inner table
|
||||||
@@ -237,7 +240,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
if ($glpiprocess->getFromGUID($process->guid)) {
|
if ($glpiprocess->getFromGUID($process->guid)) {
|
||||||
// then update it only if name has changed
|
// then update it only if name has changed
|
||||||
if ($glpiprocess->fields['name'] != $process->name) {
|
if ($glpiprocess->fields['name'] != $process->name) {
|
||||||
$glpiprocess->update( array( 'id' => $glpiprocess->getID(), 'name' => $process->name) );
|
$glpiprocess->update( [ 'id' => $glpiprocess->getID(), 'name' => $process->name] );
|
||||||
}
|
}
|
||||||
// and check if main task category needs update
|
// and check if main task category needs update
|
||||||
if (!$glpiprocess->fields['taskcategories_id']) {
|
if (!$glpiprocess->fields['taskcategories_id']) {
|
||||||
@@ -254,7 +257,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
$project_type = 'classic';
|
$project_type = 'classic';
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($glpiprocess->add( array( 'process_guid' => $process->guid, 'name' => $process->name, 'project_type' => $project_type ))) {
|
if ($glpiprocess->add( [ 'process_guid' => $process->guid, 'name' => $process->name, 'project_type' => $project_type ])) {
|
||||||
// and add main task category for this process
|
// and add main task category for this process
|
||||||
$glpiprocess->addTaskCategory( $pmMainTaskCat );
|
$glpiprocess->addTaskCategory( $pmMainTaskCat );
|
||||||
}
|
}
|
||||||
@@ -264,9 +267,9 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// should de-activate other
|
// should de-activate other
|
||||||
$glpiCurrentProcesses = getAllDatasFromTable(self::getTable());
|
$glpiCurrentProcesses = $dbu->getAllDataFromTable(self::getTable());
|
||||||
// get difference between PM and GLPI
|
// get difference between PM and GLPI
|
||||||
foreach( array_diff_key($glpiCurrentProcesses, $pmCurrentProcesses) as $key => $process){
|
foreach (array_diff_key($glpiCurrentProcesses, $pmCurrentProcesses) as $key => $process) {
|
||||||
$proc = new PluginProcessmakerProcess;
|
$proc = new PluginProcessmakerProcess;
|
||||||
$proc->getFromDB($key);
|
$proc->getFromDB($key);
|
||||||
|
|
||||||
@@ -285,8 +288,8 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
$tmp->deleteByCriteria(['plugin_processmaker_processes_id' => $key]);
|
$tmp->deleteByCriteria(['plugin_processmaker_processes_id' => $key]);
|
||||||
|
|
||||||
// must delete any taskcategory and translations
|
// must delete any taskcategory and translations
|
||||||
$pmtaskcategories = getAllDatasFromTable( PluginProcessmakerTaskCategory::getTable(), "plugin_processmaker_processes_id = $key");
|
$pmtaskcategories = $dbu->getAllDataFromTable( PluginProcessmakerTaskCategory::getTable(), "plugin_processmaker_processes_id = $key");
|
||||||
foreach($pmtaskcategories as $pmcat){
|
foreach ($pmtaskcategories as $pmcat) {
|
||||||
// delete taskcat
|
// delete taskcat
|
||||||
$tmp = new TaskCategory;
|
$tmp = new TaskCategory;
|
||||||
$tmp->delete(['id' => $pmcat['taskcategories_id']]);
|
$tmp->delete(['id' => $pmcat['taskcategories_id']]);
|
||||||
@@ -313,11 +316,11 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
* @param integer $pmMainTaskCat is the id of the main task category
|
* @param integer $pmMainTaskCat is the id of the main task category
|
||||||
* @return boolean true if update is done, false otherwise
|
* @return boolean true if update is done, false otherwise
|
||||||
*/
|
*/
|
||||||
function updateTaskCategory( $pmMainTaskCat ) {
|
function updateTaskCategory($pmMainTaskCat) {
|
||||||
global $PM_DB;
|
global $PM_DB;
|
||||||
$taskCat = new TaskCategory;
|
$taskCat = new TaskCategory;
|
||||||
if ($taskCat->getFromDB( $this->fields['taskcategories_id'] ) && $taskCat->fields['name'] != $this->fields['name']) {
|
if ($taskCat->getFromDB( $this->fields['taskcategories_id'] ) && $taskCat->fields['name'] != $this->fields['name']) {
|
||||||
return $taskCat->update( array( 'id' => $taskCat->getID(), 'taskcategories_id' => $pmMainTaskCat, 'name' => $PM_DB->escape($this->fields['name'])) );
|
return $taskCat->update( [ 'id' => $taskCat->getID(), 'taskcategories_id' => $pmMainTaskCat, 'name' => $PM_DB->escape($this->fields['name'])] );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -328,11 +331,11 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
* @param int $pmMainTaskCat is the main TaskCategory from PM configuration
|
* @param int $pmMainTaskCat is the main TaskCategory from PM configuration
|
||||||
* @return boolean true if TaskCategory has been created and updated into $this process, else otherwise
|
* @return boolean true if TaskCategory has been created and updated into $this process, else otherwise
|
||||||
*/
|
*/
|
||||||
function addTaskCategory( $pmMainTaskCat ) {
|
function addTaskCategory($pmMainTaskCat) {
|
||||||
global $PM_DB;
|
global $PM_DB;
|
||||||
$taskCat = new TaskCategory;
|
$taskCat = new TaskCategory;
|
||||||
if ($taskCat->add( array( 'is_recursive' => true, 'taskcategories_id' => $pmMainTaskCat, 'name' => $PM_DB->escape($this->fields['name'])) )) {
|
if ($taskCat->add( [ 'is_recursive' => true, 'taskcategories_id' => $pmMainTaskCat, 'name' => $PM_DB->escape($this->fields['name'])] )) {
|
||||||
return $this->update( array( 'id' => $this->getID(), 'taskcategories_id' => $taskCat->getID() ) );
|
return $this->update( [ 'id' => $this->getID(), 'taskcategories_id' => $taskCat->getID() ] );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -346,7 +349,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
function title() {
|
function title() {
|
||||||
global $CFG_GLPI;
|
global $CFG_GLPI;
|
||||||
|
|
||||||
$buttons = array();
|
$buttons = [];
|
||||||
$title = __('Synchronize Process List', 'processmaker');
|
$title = __('Synchronize Process List', 'processmaker');
|
||||||
|
|
||||||
if ($this->canCreate()) {
|
if ($this->canCreate()) {
|
||||||
@@ -388,7 +391,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
function getSearchOptions() {
|
function getSearchOptions() {
|
||||||
$tab = array();
|
$tab = [];
|
||||||
|
|
||||||
$tab['common'] = __('ProcessMaker', 'processmaker');
|
$tab['common'] = __('ProcessMaker', 'processmaker');
|
||||||
|
|
||||||
@@ -494,9 +497,9 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
* @param $values
|
* @param $values
|
||||||
* @param $options array
|
* @param $options array
|
||||||
**/
|
**/
|
||||||
static function getSpecificValueToDisplay($field, $values, array $options=array()) {
|
static function getSpecificValueToDisplay($field, $values, array $options = []) {
|
||||||
if (!is_array($values)) {
|
if (!is_array($values)) {
|
||||||
$values = array($field => $values);
|
$values = [$field => $values];
|
||||||
}
|
}
|
||||||
switch ($field) {
|
switch ($field) {
|
||||||
|
|
||||||
@@ -516,8 +519,8 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
*/
|
*/
|
||||||
static function getAllTypeArray() {
|
static function getAllTypeArray() {
|
||||||
|
|
||||||
$tab = array(self::CLASSIC => _x('process_type', 'Classic', 'processmaker'),
|
$tab = [self::CLASSIC => _x('process_type', 'Classic', 'processmaker'),
|
||||||
self::BPMN => _x('process_type', 'BPMN', 'processmaker'));
|
self::BPMN => _x('process_type', 'BPMN', 'processmaker')];
|
||||||
|
|
||||||
return $tab;
|
return $tab;
|
||||||
}
|
}
|
||||||
@@ -541,17 +544,17 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
* @param mixed $nb
|
* @param mixed $nb
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
static function getTypeName($nb=0) {
|
static function getTypeName($nb = 0) {
|
||||||
if ($nb>1) {
|
if ($nb>1) {
|
||||||
return __('Processes', 'processmaker');
|
return __('Processes', 'processmaker');
|
||||||
}
|
}
|
||||||
return __('Process', 'processmaker');
|
return __('Process', 'processmaker');
|
||||||
}
|
}
|
||||||
|
|
||||||
function defineTabs($options=array()) {
|
function defineTabs($options = []) {
|
||||||
|
|
||||||
// $ong = array('empty' => $this->getTypeName(1));
|
// $ong = array('empty' => $this->getTypeName(1));
|
||||||
$ong = array();
|
$ong = [];
|
||||||
$this->addDefaultFormTab($ong);
|
$this->addDefaultFormTab($ong);
|
||||||
$this->addStandardTab(__CLASS__, $ong, $options);
|
$this->addStandardTab(__CLASS__, $ong, $options);
|
||||||
|
|
||||||
@@ -563,7 +566,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
return $ong;
|
return $ong;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showForm ($ID, $options=array('candel'=>false)) {
|
function showForm ($ID, $options = ['candel'=>false]) {
|
||||||
global $DB, $CFG_GLPI;
|
global $DB, $CFG_GLPI;
|
||||||
|
|
||||||
//if ($ID > 0) {
|
//if ($ID > 0) {
|
||||||
@@ -618,7 +621,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
echo "<tr class='tab_bg_1'>";
|
echo "<tr class='tab_bg_1'>";
|
||||||
echo "<td >".__('ITIL Category for Self-service interface (left empty to disable)', 'processmaker')."</td><td>";
|
echo "<td >".__('ITIL Category for Self-service interface (left empty to disable)', 'processmaker')."</td><td>";
|
||||||
if (true) { // $canupdate || !$ID || $canupdate_descr
|
if (true) { // $canupdate || !$ID || $canupdate_descr
|
||||||
$opt = array('value' => $this->fields["itilcategories_id"]);
|
$opt = ['value' => $this->fields["itilcategories_id"]];
|
||||||
|
|
||||||
switch ($this->fields['type']) {
|
switch ($this->fields['type']) {
|
||||||
case Ticket::INCIDENT_TYPE :
|
case Ticket::INCIDENT_TYPE :
|
||||||
@@ -645,13 +648,13 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
|
|
||||||
echo "<td >".__('Type for Self-service interface', 'processmaker')."</td><td>";
|
echo "<td >".__('Type for Self-service interface', 'processmaker')."</td><td>";
|
||||||
if (true) { // $canupdate || !$ID
|
if (true) { // $canupdate || !$ID
|
||||||
$idticketcategorysearch = mt_rand(); $opt = array('value' => $this->fields["type"]);
|
$idticketcategorysearch = mt_rand(); $opt = ['value' => $this->fields["type"]];
|
||||||
$rand = Ticket::dropdownType('type', $opt, array(), array('toupdate' => "search_".$idticketcategorysearch ));
|
$rand = Ticket::dropdownType('type', $opt, [], ['toupdate' => "search_".$idticketcategorysearch ]);
|
||||||
$opt = array('value' => $this->fields["type"]);
|
$opt = ['value' => $this->fields["type"]];
|
||||||
$params = array('type' => '__VALUE__',
|
$params = ['type' => '__VALUE__',
|
||||||
//'entity_restrict' => -1, //$this->fields['entities_id'],
|
//'entity_restrict' => -1, //$this->fields['entities_id'],
|
||||||
'value' => $this->fields['itilcategories_id'],
|
'value' => $this->fields['itilcategories_id'],
|
||||||
'currenttype' => $this->fields['type']);
|
'currenttype' => $this->fields['type']];
|
||||||
|
|
||||||
Ajax::updateItemOnSelectEvent("dropdown_type$rand", "show_category_by_type",
|
Ajax::updateItemOnSelectEvent("dropdown_type$rand", "show_category_by_type",
|
||||||
$CFG_GLPI["root_doc"]."/ajax/dropdownTicketCategories.php",
|
$CFG_GLPI["root_doc"]."/ajax/dropdownTicketCategories.php",
|
||||||
@@ -674,7 +677,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
|
|
||||||
echo "<tr class='tab_bg_1'>";
|
echo "<tr class='tab_bg_1'>";
|
||||||
echo "<td >".__('Process type (to be changed only if not up-to-date)', 'processmaker')."</td><td>";
|
echo "<td >".__('Process type (to be changed only if not up-to-date)', 'processmaker')."</td><td>";
|
||||||
Dropdown::showFromArray( 'project_type', self::getAllTypeArray(), array( 'value' => $this->fields["project_type"] ) );
|
Dropdown::showFromArray( 'project_type', self::getAllTypeArray(), [ 'value' => $this->fields["project_type"] ] );
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
|
||||||
$this->showFormButtons($options);
|
$this->showFormButtons($options);
|
||||||
@@ -692,9 +695,10 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
*
|
*
|
||||||
* @return mysql result set.
|
* @return mysql result set.
|
||||||
**/
|
**/
|
||||||
static function getSqlSearchResult ($count=true, $search='') {
|
static function getSqlSearchResult ($count = true, $search = '') {
|
||||||
global $DB, $CFG_GLPI;
|
global $DB, $CFG_GLPI;
|
||||||
|
|
||||||
|
$where = '';
|
||||||
$orderby = '';
|
$orderby = '';
|
||||||
|
|
||||||
if (isset($_REQUEST['condition']) && isset($_SESSION['glpicondition'][$_REQUEST['condition']])) {
|
if (isset($_REQUEST['condition']) && isset($_SESSION['glpicondition'][$_REQUEST['condition']])) {
|
||||||
@@ -724,13 +728,13 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
* @param mixed $link
|
* @param mixed $link
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
static function getProcessName( $pid, $link=0 ) {
|
static function getProcessName($pid, $link = 0) {
|
||||||
global $DB;
|
global $DB;
|
||||||
$process='';
|
$process='';
|
||||||
if ($link==2) {
|
if ($link==2) {
|
||||||
$process = array("name" => "",
|
$process = ["name" => "",
|
||||||
"link" => "",
|
"link" => "",
|
||||||
"comment" => "");
|
"comment" => ""];
|
||||||
}
|
}
|
||||||
|
|
||||||
$query="SELECT * FROM glpi_plugin_processmaker_processes WHERE id=$pid";
|
$query="SELECT * FROM glpi_plugin_processmaker_processes WHERE id=$pid";
|
||||||
@@ -760,18 +764,18 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
*
|
*
|
||||||
* @return Array of entity ID
|
* @return Array of entity ID
|
||||||
*/
|
*/
|
||||||
static function getEntitiesForProfileByProcess($processes_id, $profiles_id, $child=false) {
|
static function getEntitiesForProfileByProcess($processes_id, $profiles_id, $child = false) {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
$dbu = new DbUtils;
|
||||||
$query = "SELECT `entities_id`, `is_recursive`
|
$query = "SELECT `entities_id`, `is_recursive`
|
||||||
FROM `glpi_plugin_processmaker_processes_profiles`
|
FROM `glpi_plugin_processmaker_processes_profiles`
|
||||||
WHERE `plugin_processmaker_processes_id` = '$processes_id'
|
WHERE `plugin_processmaker_processes_id` = '$processes_id'
|
||||||
AND `profiles_id` = '$profiles_id'";
|
AND `profiles_id` = '$profiles_id'";
|
||||||
|
|
||||||
$entities = array();
|
$entities = [];
|
||||||
foreach ($DB->request($query) as $data) {
|
foreach ($DB->request($query) as $data) {
|
||||||
if ($child && $data['is_recursive']) {
|
if ($child && $data['is_recursive']) {
|
||||||
foreach (getSonsOf('glpi_entities', $data['entities_id']) as $id) {
|
foreach ($dbu->getSonsOf('glpi_entities', $data['entities_id']) as $id) {
|
||||||
$entities[$id] = $id;
|
$entities[$id] = $id;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -786,8 +790,12 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
* @param mixed $options
|
* @param mixed $options
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
static function dropdown($options=array()) {
|
static function dropdown($options = []) {
|
||||||
global $CFG_GLPI;
|
global $CFG_GLPI;
|
||||||
|
|
||||||
|
if (!isset($options['specific_tags']['process_restrict'])) {
|
||||||
|
$options['specific_tags']['process_restrict'] = 1;
|
||||||
|
}
|
||||||
$options['url'] = $CFG_GLPI["root_doc"].'/plugins/processmaker/ajax/dropdownProcesses.php';
|
$options['url'] = $CFG_GLPI["root_doc"].'/plugins/processmaker/ajax/dropdownProcesses.php';
|
||||||
return Dropdown::show( __CLASS__, $options );
|
return Dropdown::show( __CLASS__, $options );
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ class PluginProcessmakerProcess_Profile extends CommonDBTM
|
|||||||
|
|
||||||
static $rightname = '';
|
static $rightname = '';
|
||||||
|
|
||||||
function can($ID, $right, array &$input = NULL) {
|
function can($ID, $right, array &$input = null) {
|
||||||
switch ($right) {
|
switch ($right) {
|
||||||
case DELETE :
|
case DELETE :
|
||||||
case PURGE :
|
case PURGE :
|
||||||
@@ -22,11 +22,11 @@ class PluginProcessmakerProcess_Profile extends CommonDBTM
|
|||||||
return Session::haveRight('plugin_processmaker_config', $right);
|
return Session::haveRight('plugin_processmaker_config', $right);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTabNameForItem( CommonGLPI $item, $withtemplate=0) {
|
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||||
return __('Authorizations', 'processmaker');
|
return __('Authorizations', 'processmaker');
|
||||||
}
|
}
|
||||||
|
|
||||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
|
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||||
|
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
@@ -46,9 +46,9 @@ class PluginProcessmakerProcess_Profile extends CommonDBTM
|
|||||||
|
|
||||||
echo "<tr class='tab_bg_2'><td class='center'>";
|
echo "<tr class='tab_bg_2'><td class='center'>";
|
||||||
echo "<input type='hidden' name='plugin_processmaker_processes_id' value='$ID'>";
|
echo "<input type='hidden' name='plugin_processmaker_processes_id' value='$ID'>";
|
||||||
Entity::Dropdown( array('entity' => $_SESSION['glpiactiveentities']));
|
Entity::Dropdown( ['entity' => $_SESSION['glpiactiveentities']]);
|
||||||
echo "</td><td class='center'>".Profile::getTypeName(1)."</td><td>";
|
echo "</td><td class='center'>".Profile::getTypeName(1)."</td><td>";
|
||||||
Profile::dropdownUnder(array('value' => Profile::getDefault()));
|
Profile::dropdownUnder(['value' => Profile::getDefault()]);
|
||||||
echo "</td><td class='center'>".__('Recursive')."</td><td>";
|
echo "</td><td class='center'>".__('Recursive')."</td><td>";
|
||||||
Dropdown::showYesNo("is_recursive", 0);
|
Dropdown::showYesNo("is_recursive", 0);
|
||||||
echo "</td><td class='center'>";
|
echo "</td><td class='center'>";
|
||||||
@@ -80,8 +80,8 @@ class PluginProcessmakerProcess_Profile extends CommonDBTM
|
|||||||
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
|
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
|
||||||
|
|
||||||
if ($canedit && $num) {
|
if ($canedit && $num) {
|
||||||
$massiveactionparams = array('num_displayed' => $num,
|
$massiveactionparams = ['num_displayed' => $num,
|
||||||
'container' => 'mass'.__CLASS__.$rand);
|
'container' => 'mass'.__CLASS__.$rand];
|
||||||
Html::showMassiveActions($massiveactionparams);
|
Html::showMassiveActions($massiveactionparams);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -12,16 +12,16 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
|||||||
* @return array[]
|
* @return array[]
|
||||||
*/
|
*/
|
||||||
static function getAllRights() {
|
static function getAllRights() {
|
||||||
$rights = array(
|
$rights = [
|
||||||
array('itemtype' => 'PluginProcessmakerConfig',
|
['itemtype' => 'PluginProcessmakerConfig',
|
||||||
'label' => __('Process configuration', 'processmaker'),
|
'label' => __('Process configuration', 'processmaker'),
|
||||||
'field' => 'plugin_processmaker_config',
|
'field' => 'plugin_processmaker_config',
|
||||||
'rights' => array(READ => __('Read'), UPDATE => __('Update'))),
|
'rights' => [READ => __('Read'), UPDATE => __('Update')]],
|
||||||
array('itemtype' => 'PluginProcessmakerConfig',
|
['itemtype' => 'PluginProcessmakerConfig',
|
||||||
'label' => __('Cases', 'processmaker'),
|
'label' => __('Cases', 'processmaker'),
|
||||||
'field' => 'plugin_processmaker_case',
|
'field' => 'plugin_processmaker_case',
|
||||||
'rights' => array(READ => __('Read'), CANCEL => __('Cancel', 'processmaker'), DELETE => __('Delete')))
|
'rights' => [READ => __('Read'), CANCEL => __('Cancel', 'processmaker'), DELETE => __('Delete')]]
|
||||||
);
|
];
|
||||||
|
|
||||||
return $rights;
|
return $rights;
|
||||||
}
|
}
|
||||||
@@ -34,7 +34,7 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
|||||||
* @param mixed $closeform
|
* @param mixed $closeform
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
function showForm($ID=0, $openform=TRUE, $closeform=TRUE) {
|
function showForm($ID = 0, $openform = true, $closeform = true) {
|
||||||
|
|
||||||
if (!Session::haveRight("profile", READ)) {
|
if (!Session::haveRight("profile", READ)) {
|
||||||
return false;
|
return false;
|
||||||
@@ -47,15 +47,15 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
echo "<form action='".$prof->getFormURL()."' method='post'>";
|
echo "<form action='".$prof->getFormURL()."' method='post'>";
|
||||||
$rights = $this->getAllRights();
|
$rights = $this->getAllRights();
|
||||||
$prof->displayRightsChoiceMatrix($rights, array('canedit' => $canedit,
|
$prof->displayRightsChoiceMatrix($rights, ['canedit' => $canedit,
|
||||||
'default_class' => 'tab_bg_2',
|
'default_class' => 'tab_bg_2',
|
||||||
'title' => __('ProcessMaker', 'processmaker')));
|
'title' => __('ProcessMaker', 'processmaker')]);
|
||||||
|
|
||||||
if ($canedit && $closeform) {
|
if ($canedit && $closeform) {
|
||||||
echo "<div class='center'>";
|
echo "<div class='center'>";
|
||||||
echo Html::hidden('id', array('value' => $ID));
|
echo Html::hidden('id', ['value' => $ID]);
|
||||||
echo Html::submit(_sx('button', 'Save'),
|
echo Html::submit(_sx('button', 'Save'),
|
||||||
array('name' => 'update'));
|
['name' => 'update']);
|
||||||
echo "</div>\n";
|
echo "</div>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
|||||||
* @param mixed $ID
|
* @param mixed $ID
|
||||||
*/
|
*/
|
||||||
static function createAdminAccess($ID) {
|
static function createAdminAccess($ID) {
|
||||||
self::addDefaultProfileInfos($ID, array('plugin_processmaker_config' => READ + UPDATE, 'plugin_processmaker_case' => READ + DELETE + CANCEL), true);
|
self::addDefaultProfileInfos($ID, ['plugin_processmaker_config' => READ + UPDATE, 'plugin_processmaker_case' => READ + DELETE + CANCEL], true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -78,7 +78,7 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
|||||||
* @param mixed $withtemplate
|
* @param mixed $withtemplate
|
||||||
* @return string|string[]
|
* @return string|string[]
|
||||||
*/
|
*/
|
||||||
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
|
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||||
if ($item->getType()=='Profile') {
|
if ($item->getType()=='Profile') {
|
||||||
return __('ProcessMaker', 'processmaker');
|
return __('ProcessMaker', 'processmaker');
|
||||||
}
|
}
|
||||||
@@ -92,16 +92,16 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
|||||||
* @param mixed $withtemplate
|
* @param mixed $withtemplate
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
|
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||||
global $CFG_GLPI;
|
global $CFG_GLPI;
|
||||||
|
|
||||||
if ($item->getType()=='Profile') {
|
if ($item->getType()=='Profile') {
|
||||||
$ID = $item->getID();
|
$ID = $item->getID();
|
||||||
$prof = new self();
|
$prof = new self();
|
||||||
self::addDefaultProfileInfos($ID,
|
self::addDefaultProfileInfos($ID,
|
||||||
array('plugin_processmaker_config' => 0,
|
['plugin_processmaker_config' => 0,
|
||||||
'plugin_processmaker_case' => 0
|
'plugin_processmaker_case' => 0
|
||||||
));
|
]);
|
||||||
|
|
||||||
$prof->showForm($ID);
|
$prof->showForm($ID);
|
||||||
}
|
}
|
||||||
@@ -113,14 +113,14 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
|||||||
**/
|
**/
|
||||||
static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) {
|
static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
$dbu = new DbUtils;
|
||||||
$profileRight = new ProfileRight();
|
$profileRight = new ProfileRight();
|
||||||
foreach ($rights as $right => $value) {
|
foreach ($rights as $right => $value) {
|
||||||
if (countElementsInTable('glpi_profilerights',
|
if ($dbu->countElementsInTable('glpi_profilerights',
|
||||||
"`profiles_id`='$profiles_id' AND `name`='$right'") && $drop_existing) {
|
"`profiles_id`='$profiles_id' AND `name`='$right'") && $drop_existing) {
|
||||||
$profileRight->deleteByCriteria(array('profiles_id' => $profiles_id, 'name' => $right));
|
$profileRight->deleteByCriteria(['profiles_id' => $profiles_id, 'name' => $right]);
|
||||||
}
|
}
|
||||||
if (!countElementsInTable('glpi_profilerights',
|
if (!$dbu->countElementsInTable('glpi_profilerights',
|
||||||
"`profiles_id`='$profiles_id' AND `name`='$right'")) {
|
"`profiles_id`='$profiles_id' AND `name`='$right'")) {
|
||||||
$myright['profiles_id'] = $profiles_id;
|
$myright['profiles_id'] = $profiles_id;
|
||||||
$myright['name'] = $right;
|
$myright['name'] = $right;
|
||||||
|
|||||||
@@ -11,9 +11,9 @@
|
|||||||
class PluginProcessmakerTask extends CommonITILTask
|
class PluginProcessmakerTask extends CommonITILTask
|
||||||
{
|
{
|
||||||
private $itemtype;
|
private $itemtype;
|
||||||
function __construct($itemtype='TicketTask') {
|
function __construct($itemtype = 'TicketTask') {
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->itemtype=$itemtype;
|
$this->itemtype = $itemtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -25,7 +25,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
*
|
*
|
||||||
* @param $nb : number of item in the type (default 0)
|
* @param $nb : number of item in the type (default 0)
|
||||||
**/
|
**/
|
||||||
static function getTypeName($nb=0) {
|
static function getTypeName($nb = 0) {
|
||||||
return _n('Process case task', 'Process case tasks', $nb, 'processmaker');
|
return _n('Process case task', 'Process case tasks', $nb, 'processmaker');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -66,10 +66,11 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
* returns all 'to do' tasks associated with this case
|
* returns all 'to do' tasks associated with this case
|
||||||
* @param mixed $case_id
|
* @param mixed $case_id
|
||||||
*/
|
*/
|
||||||
public static function getToDoTasks( $case_id, $itemtype ) {
|
public static function getToDoTasks($case_id, $itemtype) {
|
||||||
global $DB;
|
global $DB;
|
||||||
$ret = array();
|
$ret = [];
|
||||||
$selfTable = getTableForItemType( __CLASS__);
|
$dbu = new DbUtils;
|
||||||
|
$selfTable = $dbu->getTableForItemType( __CLASS__);
|
||||||
//$itemTypeTaskTable = getTableForItemType( $itemtype );
|
//$itemTypeTaskTable = getTableForItemType( $itemtype );
|
||||||
|
|
||||||
$query = "SELECT `$selfTable`.`items_id` as taskID from $selfTable
|
$query = "SELECT `$selfTable`.`items_id` as taskID from $selfTable
|
||||||
@@ -84,15 +85,15 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
return $ret;
|
return $ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function canView( ) {
|
static function canView() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static function populatePlanning($params) {
|
static function populatePlanning($params) {
|
||||||
global $CFG_GLPI;
|
//global $CFG_GLPI;
|
||||||
|
|
||||||
|
$events = [];
|
||||||
|
|
||||||
$ret = array();
|
|
||||||
$events = array();
|
|
||||||
if (isset($params['start'])) {
|
if (isset($params['start'])) {
|
||||||
$params['begin'] = '2000-01-01 00:00:00';
|
$params['begin'] = '2000-01-01 00:00:00';
|
||||||
if ($params['type'] == 'group') {
|
if ($params['type'] == 'group') {
|
||||||
@@ -100,33 +101,42 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
$params['whogroup'] = $params['who'];
|
$params['whogroup'] = $params['who'];
|
||||||
$params['who'] = 0;
|
$params['who'] = 0;
|
||||||
}
|
}
|
||||||
$ret = CommonITILTask::genericPopulatePlanning( 'TicketTask', $params );
|
|
||||||
|
|
||||||
foreach ($ret as $key => $event) {
|
$objects = ['TicketTask', 'ChangeTask', 'ProblemTask'];
|
||||||
if ($event['state'] == 1 || ($params['display_done_events'] == 1 && $event['state'] == 2)) { // if todo or done but need to show them (=planning)
|
//foreach ($objects as $itemtype) {
|
||||||
// check if task is one within a case
|
foreach ($_SESSION['glpi_plannings']['filters'] as $tasktype => $iteminfo) {
|
||||||
$pmTask = new self('TicketTask');
|
if (!$iteminfo['display'] || !in_array($tasktype, $objects)) {
|
||||||
if ($pmTask->getFromDB( $event['tickettasks_id'] )) { // $pmTask->getFromDBByQuery( " WHERE itemtype = 'TicketTask' AND items_id = ". $event['tickettasks_id'] ) ) {
|
continue;
|
||||||
$event['editable'] = false;
|
}
|
||||||
//$event['url'] .= '&forcetab=PluginProcessmakerCase$processmakercases';
|
$ret = CommonITILTask::genericPopulatePlanning($tasktype, $params);
|
||||||
$tmpCase = new PluginProcessmakerCase;
|
|
||||||
$tmpCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']);
|
|
||||||
$event['url'] = $tmpCase->getLinkURL().'&forcetab=PluginProcessmakerTask$'.$pmTask->fields['items_id'];
|
|
||||||
|
|
||||||
$taskCat = new TaskCategory;
|
foreach ($ret as $key => $event) {
|
||||||
$taskCat->getFromDB( $pmTask->fields['taskcategories_id'] );
|
// if todo or done but need to show them (=planning)
|
||||||
$taskComment = isset($taskCat->fields['comment']) ? $taskCat->fields['comment'] : '';
|
if ($event['state'] == Planning::TODO || $event['state'] == Planning::INFO || ($params['display_done_events'] == 1 && $event['state'] == Planning::DONE)) {
|
||||||
if (Session::haveTranslations('TaskCategory', 'comment')) {
|
// check if task is one within a case
|
||||||
$taskComment = DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'comment', $_SESSION['glpilanguage'], $taskComment );
|
$pmTask = new PluginProcessmakerTask($tasktype);
|
||||||
|
if ($pmTask->getFromDB($event[strtolower($tasktype).'s_id'])) { // $pmTask->getFromDBByQuery( " WHERE itemtype = 'TicketTask' AND items_id = ". $event['tickettasks_id'] ) ) {
|
||||||
|
$event['editable'] = false;
|
||||||
|
//$event['url'] .= '&forcetab=PluginProcessmakerCase$processmakercases';
|
||||||
|
$tmpCase = new PluginProcessmakerCase;
|
||||||
|
$tmpCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']);
|
||||||
|
$event['url'] = $tmpCase->getLinkURL().'&forcetab=PluginProcessmakerTask$'.$pmTask->fields['items_id'];
|
||||||
|
|
||||||
|
$taskCat = new TaskCategory;
|
||||||
|
$taskCat->getFromDB( $pmTask->fields['taskcategories_id'] );
|
||||||
|
$taskComment = isset($taskCat->fields['comment']) ? $taskCat->fields['comment'] : '';
|
||||||
|
if (Session::haveTranslations('TaskCategory', 'comment')) {
|
||||||
|
$taskComment = DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'comment', $_SESSION['glpilanguage'], $taskComment );
|
||||||
|
}
|
||||||
|
|
||||||
|
$event['content'] = str_replace( '##processmaker.taskcomment##', $taskComment, $event['content'] );
|
||||||
|
$event['content'] = str_replace( ['\n##processmakercase.url##', '##processmakercase.url##'], "", $event['content'] ); //<a href=\"".$event['url']."\">"."Click to manage task"."</a>
|
||||||
|
//if( $event['state'] == 1 && $event['end'] < $params['start'] ) { // if todo and late
|
||||||
|
// $event['name'] = $event['end'].' '.$event['name'] ; //$event['begin'].' to '.$event['end'].' '.$event['name'] ;
|
||||||
|
// $event['end'] = $params['start'].' 24:00:00'; //.$CFG_GLPI['planning_end'];
|
||||||
|
//}
|
||||||
|
$events[$key] = $event;
|
||||||
}
|
}
|
||||||
|
|
||||||
$event['content'] = str_replace( '##processmaker.taskcomment##', $taskComment, $event['content'] );
|
|
||||||
$event['content'] = str_replace( '##processmakercase.url##', "", $event['content'] ); //<a href=\"".$event['url']."\">"."Click to manage task"."</a>
|
|
||||||
//if( $event['state'] == 1 && $event['end'] < $params['start'] ) { // if todo and late
|
|
||||||
// $event['name'] = $event['end'].' '.$event['name'] ; //$event['begin'].' to '.$event['end'].' '.$event['name'] ;
|
|
||||||
// $event['end'] = $params['start'].' 24:00:00'; //.$CFG_GLPI['planning_end'];
|
|
||||||
//}
|
|
||||||
$events[$key] = $event;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -135,7 +145,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0){
|
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||||
global $DB, $PM_DB;
|
global $DB, $PM_DB;
|
||||||
|
|
||||||
$tab = [];
|
$tab = [];
|
||||||
@@ -143,13 +153,13 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
$caseInfo = $case->getCaseInfo();
|
$caseInfo = $case->getCaseInfo();
|
||||||
|
|
||||||
if (property_exists($caseInfo, 'currentUsers')) {
|
if (property_exists($caseInfo, 'currentUsers')) {
|
||||||
|
$dbu = new DbUtils;
|
||||||
$GLPICurrentPMUserId = PluginProcessmakerUser::getPMUserId(Session::getLoginUserID());
|
$GLPICurrentPMUserId = PluginProcessmakerUser::getPMUserId(Session::getLoginUserID());
|
||||||
|
|
||||||
// get all tasks that are OPEN for this case
|
// get all tasks that are OPEN for this case
|
||||||
$tasks = [];
|
$tasks = [];
|
||||||
$query = "SELECT * FROM `glpi_plugin_processmaker_tasks` WHERE `plugin_processmaker_cases_id`={$case->fields['id']} AND `del_thread_status`='OPEN'";
|
$query = "SELECT * FROM `glpi_plugin_processmaker_tasks` WHERE `plugin_processmaker_cases_id`={$case->fields['id']} AND `del_thread_status`='OPEN'";
|
||||||
foreach($DB->request($query) as $task) {
|
foreach ($DB->request($query) as $task) {
|
||||||
$tasks[$task['del_index']] = $task;
|
$tasks[$task['del_index']] = $task;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -170,7 +180,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
if (isset($tasks[$caseUser->delIndex])) {
|
if (isset($tasks[$caseUser->delIndex])) {
|
||||||
$hide_claim_button = false;
|
$hide_claim_button = false;
|
||||||
if ($caseUser->userId == '') { // task to be claimed
|
if ($caseUser->userId == '') { // task to be claimed
|
||||||
$itemtask = getItemForItemtype($tasks[$caseUser->delIndex]['itemtype']);
|
$itemtask = $dbu->getItemForItemtype($tasks[$caseUser->delIndex]['itemtype']);
|
||||||
$itemtask->getFromDB($tasks[$caseUser->delIndex]['items_id']);
|
$itemtask->getFromDB($tasks[$caseUser->delIndex]['items_id']);
|
||||||
// check if this group can be found in the current user's groups
|
// check if this group can be found in the current user's groups
|
||||||
if (!isset($_SESSION['glpigroups']) || !in_array( $itemtask->fields['groups_id_tech'], $_SESSION['glpigroups'] )) {
|
if (!isset($_SESSION['glpigroups']) || !in_array( $itemtask->fields['groups_id_tech'], $_SESSION['glpigroups'] )) {
|
||||||
@@ -227,8 +237,9 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
* @param integer $tabnum contains the PluginProcessmakerTask id
|
* @param integer $tabnum contains the PluginProcessmakerTask id
|
||||||
* @param mixed $withtemplate
|
* @param mixed $withtemplate
|
||||||
*/
|
*/
|
||||||
static function displayTabContentForItem(CommonGLPI $case, $tabnum=1, $withtemplate=0) {
|
static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) {
|
||||||
global $CFG_GLPI, $PM_SOAP, $DB, $PM_DB;
|
global $CFG_GLPI, $PM_SOAP, $DB, $PM_DB;
|
||||||
|
$dbu = new DbUtils;
|
||||||
|
|
||||||
// check if we are going to view a sub-task, then redirect to sub-case itself
|
// check if we are going to view a sub-task, then redirect to sub-case itself
|
||||||
if (preg_match('/^(?\'cases_id\'\d+)-(\d+)$/', $tabnum, $matches)) {
|
if (preg_match('/^(?\'cases_id\'\d+)-(\d+)$/', $tabnum, $matches)) {
|
||||||
@@ -238,7 +249,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
$sub_tasks = [];
|
$sub_tasks = [];
|
||||||
$query = "SELECT `glpi_plugin_processmaker_tasks`.* FROM `glpi_plugin_processmaker_tasks`
|
$query = "SELECT `glpi_plugin_processmaker_tasks`.* FROM `glpi_plugin_processmaker_tasks`
|
||||||
WHERE `glpi_plugin_processmaker_tasks`.`plugin_processmaker_cases_id`={$matches['cases_id']} AND `del_thread_status`='OPEN'";
|
WHERE `glpi_plugin_processmaker_tasks`.`plugin_processmaker_cases_id`={$matches['cases_id']} AND `del_thread_status`='OPEN'";
|
||||||
foreach($DB->request($query) as $task) {
|
foreach ($DB->request($query) as $task) {
|
||||||
$sub_tasks[$task['plugin_processmaker_cases_id']][$task['del_index']] = $task;
|
$sub_tasks[$task['plugin_processmaker_cases_id']][$task['del_index']] = $task;
|
||||||
}
|
}
|
||||||
$sub_case = new PluginProcessmakerCase;
|
$sub_case = new PluginProcessmakerCase;
|
||||||
@@ -247,7 +258,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
|
|
||||||
$query = "SELECT `DEL_INDEX`, `DEL_DELEGATE_DATE` FROM `APP_DELEGATION` WHERE `APP_UID`='{$sub_case->fields['case_guid']}'";
|
$query = "SELECT `DEL_INDEX`, `DEL_DELEGATE_DATE` FROM `APP_DELEGATION` WHERE `APP_UID`='{$sub_case->fields['case_guid']}'";
|
||||||
$sub_tasks_pm = [];
|
$sub_tasks_pm = [];
|
||||||
foreach($PM_DB->request($query) as $row){
|
foreach ($PM_DB->request($query) as $row) {
|
||||||
$sub_tasks_pm[$row['DEL_INDEX']] = $row['DEL_DELEGATE_DATE'];
|
$sub_tasks_pm[$row['DEL_INDEX']] = $row['DEL_DELEGATE_DATE'];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -266,7 +277,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
<th>".__('Task delegation date', 'processmaker')."</th>
|
<th>".__('Task delegation date', 'processmaker')."</th>
|
||||||
</tr>";
|
</tr>";
|
||||||
|
|
||||||
foreach($sub_case_info->currentUsers as $currentTask) {
|
foreach ($sub_case_info->currentUsers as $currentTask) {
|
||||||
echo "<tr>";
|
echo "<tr>";
|
||||||
$sub_case_url .= $sub_tasks[$matches['cases_id']][$currentTask->delIndex]['id'];
|
$sub_case_url .= $sub_tasks[$matches['cases_id']][$currentTask->delIndex]['id'];
|
||||||
echo "<td class='tab_bg_2'><a href='$sub_case_url'>".$currentTask->taskName."</a></td>";
|
echo "<td class='tab_bg_2'><a href='$sub_case_url'>".$currentTask->taskName."</a></td>";
|
||||||
@@ -295,7 +306,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
$rand = rand();
|
$rand = rand();
|
||||||
|
|
||||||
// get infos for the current task
|
// get infos for the current task
|
||||||
$task = getAllDatasFromTable('glpi_plugin_processmaker_tasks', "id = $tabnum");
|
$task = $dbu->getAllDataFromTable('glpi_plugin_processmaker_tasks', "id = $tabnum");
|
||||||
|
|
||||||
// shows the re-assign form
|
// shows the re-assign form
|
||||||
$caseInfo = $case->getCaseInfo();
|
$caseInfo = $case->getCaseInfo();
|
||||||
@@ -327,7 +338,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
// manages the claim
|
// manages the claim
|
||||||
// current task is to be claimed
|
// current task is to be claimed
|
||||||
// get the assigned group to the item task
|
// get the assigned group to the item task
|
||||||
$itemtask = getItemForItemtype( $task[$tabnum]['itemtype'] );
|
$itemtask = $dbu->getItemForItemtype( $task[$tabnum]['itemtype'] );
|
||||||
$itemtask->getFromDB( $task[$tabnum]['items_id'] );
|
$itemtask->getFromDB( $task[$tabnum]['items_id'] );
|
||||||
// check if this group can be found in the current user's groups
|
// check if this group can be found in the current user's groups
|
||||||
if (!isset($_SESSION['glpigroups']) || !in_array( $itemtask->fields['groups_id_tech'], $_SESSION['glpigroups'] )) {
|
if (!isset($_SESSION['glpigroups']) || !in_array( $itemtask->fields['groups_id_tech'], $_SESSION['glpigroups'] )) {
|
||||||
@@ -340,18 +351,55 @@ class PluginProcessmakerTask extends CommonITILTask
|
|||||||
|
|
||||||
$csrf = Session::getNewCSRFToken();
|
$csrf = Session::getNewCSRFToken();
|
||||||
|
|
||||||
|
//echo "<iframe id='caseiframe-task-{$task[$tabnum]['del_index']}' onload=\"onTaskFrameLoad( event, {$task[$tabnum]['del_index']}, "
|
||||||
|
// .($hide_claim_button?"true":"false")
|
||||||
|
// .", '$csrf' );\" style='border:none;' class='tab_bg_2' width='100%' src='";
|
||||||
|
//echo $PM_SOAP->serverURL
|
||||||
|
// ."/cases/cases_Open?sid="
|
||||||
|
// .$PM_SOAP->getPMSessionID()
|
||||||
|
// ."&APP_UID="
|
||||||
|
// .$case->fields['case_guid']
|
||||||
|
// ."&DEL_INDEX="
|
||||||
|
// .$task[$tabnum]['del_index']
|
||||||
|
// ."&action=TO_DO";
|
||||||
|
//echo "&rand=$rand&glpi_domain={$config->fields['domain']}'></iframe></div>";
|
||||||
|
$url = $PM_SOAP->serverURL
|
||||||
|
."/cases/cases_Open?sid=".$PM_SOAP->getPMSessionID()
|
||||||
|
."&APP_UID=".$case->fields['case_guid']
|
||||||
|
."&DEL_INDEX=".$task[$tabnum]['del_index']
|
||||||
|
."&action=TO_DO"
|
||||||
|
."&rand=$rand"
|
||||||
|
."&glpi_domain={$config->fields['domain']}";
|
||||||
|
|
||||||
|
$encoded_url = urlencode($url);
|
||||||
|
|
||||||
echo "<iframe id='caseiframe-task-{$task[$tabnum]['del_index']}' onload=\"onTaskFrameLoad( event, {$task[$tabnum]['del_index']}, "
|
echo "<iframe id='caseiframe-task-{$task[$tabnum]['del_index']}' onload=\"onTaskFrameLoad( event, {$task[$tabnum]['del_index']}, "
|
||||||
.($hide_claim_button?"true":"false")
|
.($hide_claim_button?"true":"false").", '$csrf');\" style='border:none;' class='tab_bg_2' width='100%' src='$url'></iframe></div>";
|
||||||
.", '$csrf' );\" style='border:none;' class='tab_bg_2' width='100%' src='";
|
|
||||||
echo $PM_SOAP->serverURL
|
echo Html::scriptBlock("
|
||||||
."/cases/cases_Open?sid="
|
$('#tabspanel').next('div[id^=\"tabs\"]').on( 'tabsbeforeactivate', function(event, ui) {
|
||||||
.$PM_SOAP->getPMSessionID()
|
function urldecode(url) {
|
||||||
."&APP_UID="
|
return decodeURIComponent(url.replace(/\+/g, ' '));
|
||||||
.$case->fields['case_guid']
|
}
|
||||||
."&DEL_INDEX="
|
var iframe_id = 'caseiframe-task-{$task[$tabnum]['del_index']}';
|
||||||
.$task[$tabnum]['del_index']
|
var iframe = ui.newPanel.children('iframe[id=\"' + iframe_id + '\"]');
|
||||||
."&action=TO_DO";
|
if (iframe.length != 0) {
|
||||||
echo "&rand=$rand&glpi_domain={$config->fields['domain']}'></iframe></div>";
|
var str = urldecode('$encoded_url');
|
||||||
|
$.ajax( { url: str,
|
||||||
|
xhrFields: { withCredentials: true },
|
||||||
|
success: function (jqXHR) {
|
||||||
|
//debugger;
|
||||||
|
},
|
||||||
|
error: function (jqXHR) {
|
||||||
|
// debugger;
|
||||||
|
},
|
||||||
|
cache: false,
|
||||||
|
crossDomain: true
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -17,12 +17,12 @@ if (!defined('GLPI_ROOT')) {
|
|||||||
class PluginProcessmakerTaskCategory extends CommonDBTM
|
class PluginProcessmakerTaskCategory extends CommonDBTM
|
||||||
{
|
{
|
||||||
|
|
||||||
function getTabNameForItem( CommonGLPI $item, $withtemplate=0) {
|
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||||
return __('Task List', 'processmaker');
|
return __('Task List', 'processmaker');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
|
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||||
global $DB, $CFG_GLPI;
|
global $DB, $CFG_GLPI;
|
||||||
|
|
||||||
self::title($item);
|
self::title($item);
|
||||||
@@ -67,7 +67,7 @@ class PluginProcessmakerTaskCategory extends CommonDBTM
|
|||||||
|
|
||||||
echo "<td class='center'>";
|
echo "<td class='center'>";
|
||||||
if ($taskCat['is_active']) {
|
if ($taskCat['is_active']) {
|
||||||
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
|
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
|
||||||
__('Active')."\">";
|
__('Active')."\">";
|
||||||
}
|
}
|
||||||
echo "</td>";
|
echo "</td>";
|
||||||
@@ -94,7 +94,7 @@ class PluginProcessmakerTaskCategory extends CommonDBTM
|
|||||||
static function title(CommonGLPI $item) {
|
static function title(CommonGLPI $item) {
|
||||||
global $CFG_GLPI;
|
global $CFG_GLPI;
|
||||||
|
|
||||||
$buttons = array();
|
$buttons = [];
|
||||||
$title = __('Synchronize Task List', 'processmaker');
|
$title = __('Synchronize Task List', 'processmaker');
|
||||||
|
|
||||||
if (Session::haveRight('plugin_processmaker_config', UPDATE)) {
|
if (Session::haveRight('plugin_processmaker_config', UPDATE)) {
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
*
|
*
|
||||||
* @return mysql result set.
|
* @return mysql result set.
|
||||||
**/
|
**/
|
||||||
static function getSqlSearchResult ($taskId, $count=true, $right="all", $entity_restrict=-1, $value=0,
|
static function getSqlSearchResult ($taskId, $count = true, $right = "all", $entity_restrict = -1, $value = 0,
|
||||||
$used=array(), $search='', $limit='') {
|
$used = [], $search = '', $limit = '') {
|
||||||
global $DB, $PM_DB, $CFG_GLPI;
|
global $DB, $PM_DB, $CFG_GLPI;
|
||||||
|
|
||||||
// first need to get all users from $taskId
|
// first need to get all users from $taskId
|
||||||
@@ -37,7 +37,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
UNION
|
UNION
|
||||||
SELECT TASK_USER.USR_UID AS pm_user_id FROM TASK_USER
|
SELECT TASK_USER.USR_UID AS pm_user_id FROM TASK_USER
|
||||||
WHERE TAS_UID = '$taskId' AND TASK_USER.TU_RELATION = 1 AND TASK_USER.TU_TYPE=1 ; ";
|
WHERE TAS_UID = '$taskId' AND TASK_USER.TU_RELATION = 1 AND TASK_USER.TU_TYPE=1 ; ";
|
||||||
$pmUsers = array( );
|
$pmUsers = [ ];
|
||||||
foreach ($PM_DB->request( $pmQuery ) as $pmUser) {
|
foreach ($PM_DB->request( $pmQuery ) as $pmUser) {
|
||||||
$pmUsers[ ] = $pmUser[ 'pm_user_id' ];
|
$pmUsers[ ] = $pmUser[ 'pm_user_id' ];
|
||||||
}
|
}
|
||||||
@@ -162,7 +162,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
*
|
*
|
||||||
* @return int (print out an HTML select box)
|
* @return int (print out an HTML select box)
|
||||||
**/
|
**/
|
||||||
static function dropdown($options=array()) {
|
static function dropdown($options = []) {
|
||||||
global $CFG_GLPI;
|
global $CFG_GLPI;
|
||||||
|
|
||||||
$options['url'] = $CFG_GLPI["root_doc"].'/plugins/processmaker/ajax/dropdownUsers.php';
|
$options['url'] = $CFG_GLPI["root_doc"].'/plugins/processmaker/ajax/dropdownUsers.php';
|
||||||
@@ -176,7 +176,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
* @param string $pmUserId
|
* @param string $pmUserId
|
||||||
* @return int GLPI user id, or 0 if not found
|
* @return int GLPI user id, or 0 if not found
|
||||||
*/
|
*/
|
||||||
public static function getGLPIUserId( $pmUserId ) {
|
public static function getGLPIUserId($pmUserId) {
|
||||||
$obj = new self;
|
$obj = new self;
|
||||||
if ($obj->getFromDBByQuery("WHERE `pm_users_id` = '$pmUserId'")) {
|
if ($obj->getFromDBByQuery("WHERE `pm_users_id` = '$pmUserId'")) {
|
||||||
return $obj->fields['id'];
|
return $obj->fields['id'];
|
||||||
@@ -190,7 +190,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
* @param int $glpi_userId id of user from GLPI database
|
* @param int $glpi_userId id of user from GLPI database
|
||||||
* @return string which is the uid of user in Processmaker database, or false if not found
|
* @return string which is the uid of user in Processmaker database, or false if not found
|
||||||
*/
|
*/
|
||||||
public static function getPMUserId( $glpiUserId ) {
|
public static function getPMUserId($glpiUserId) {
|
||||||
$obj = new self;
|
$obj = new self;
|
||||||
if ($obj->getFromDB( Toolbox::cleanInteger($glpiUserId) )) {
|
if ($obj->getFromDB( Toolbox::cleanInteger($glpiUserId) )) {
|
||||||
return $obj->fields['pm_users_id'];
|
return $obj->fields['pm_users_id'];
|
||||||
|
|||||||
@@ -1,17 +1,28 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function processmaker_install(){
|
function processmaker_install() {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
// installation from scratch
|
// installation from scratch
|
||||||
include_once(GLPI_ROOT."/plugins/processmaker/setup.php");
|
include_once(GLPI_ROOT."/plugins/processmaker/setup.php");
|
||||||
$info = plugin_version_processmaker();
|
$info = plugin_version_processmaker();
|
||||||
switch($info['version']){
|
switch ($info['version']) {
|
||||||
//case '3.3.0' :
|
case '3.3.0' :
|
||||||
// $version = '3.2.9';
|
$version = '3.3.0';
|
||||||
// break;
|
break;
|
||||||
default :
|
case '3.3.1' :
|
||||||
$version = $info['version'];
|
case '3.3.2' :
|
||||||
|
case '3.3.3' :
|
||||||
|
case '3.3.4' :
|
||||||
|
case '3.3.5' :
|
||||||
|
case '3.3.6' :
|
||||||
|
case '3.3.7' :
|
||||||
|
$version = '3.3.1';
|
||||||
|
break;
|
||||||
|
case '3.3.8' :
|
||||||
|
default :
|
||||||
|
$version = '3.3.8';
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
$DB->runFile(GLPI_ROOT . "/plugins/processmaker/install/mysql/$version-empty.sql");
|
$DB->runFile(GLPI_ROOT . "/plugins/processmaker/install/mysql/$version-empty.sql");
|
||||||
|
|
||||||
|
|||||||
187
install/mysql/3.3.8-empty.sql
Normal file
187
install/mysql/3.3.8-empty.sql
Normal file
@@ -0,0 +1,187 @@
|
|||||||
|
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
|
||||||
|
/*!40101 SET NAMES utf8 */;
|
||||||
|
/*!50503 SET NAMES utf8mb4 */;
|
||||||
|
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
|
||||||
|
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
|
||||||
|
|
||||||
|
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinkactions
|
||||||
|
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinkactions` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`value` text,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `caselinks_id_name` (`plugin_processmaker_caselinks_id`,`name`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinks
|
||||||
|
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`is_active` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`is_externaldata` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas',
|
||||||
|
`is_self` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self',
|
||||||
|
`sourcetask_guid` varchar(32) DEFAULT NULL,
|
||||||
|
`targettask_guid` varchar(32) DEFAULT NULL,
|
||||||
|
`targetprocess_guid` varchar(32) DEFAULT NULL,
|
||||||
|
`targetdynaform_guid` varchar(32) DEFAULT NULL,
|
||||||
|
`sourcecondition` text,
|
||||||
|
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`is_targettoreassign` TINYINT(1) NOT NULL DEFAULT '0',
|
||||||
|
`is_targettoimpersonate` TINYINT(1) NOT NULL DEFAULT '0',
|
||||||
|
`externalapplication` TEXT NULL,
|
||||||
|
`is_synchronous` TINYINT(1) NOT NULL DEFAULT '0',
|
||||||
|
`date_mod` timestamp NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
KEY `is_active` (`is_active`),
|
||||||
|
KEY `is_externaldata` (`is_externaldata`),
|
||||||
|
KEY `is_self` (`is_self`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
-- Dumping structure for table glpi.glpi_plugin_processmaker_cases
|
||||||
|
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` (
|
||||||
|
`id` INT(11) NOT NULL,
|
||||||
|
`itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket',
|
||||||
|
`items_id` INT(11) NOT NULL,
|
||||||
|
`entities_id` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`name` MEDIUMTEXT NOT NULL DEFAULT '',
|
||||||
|
`case_guid` VARCHAR(32) NOT NULL,
|
||||||
|
`case_status` VARCHAR(20) NOT NULL DEFAULT 'DRAFT',
|
||||||
|
`plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL,
|
||||||
|
`plugin_processmaker_cases_id` INT(11) NULL DEFAULT NULL,
|
||||||
|
INDEX `items` (`itemtype`, `items_id`),
|
||||||
|
INDEX `case_status` (`case_status`),
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE INDEX `case_guid` (`case_guid`),
|
||||||
|
INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`),
|
||||||
|
INDEX `plugin_processmaker_cases_id` (`plugin_processmaker_cases_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
-- Dumping structure for table glpi.glpi_plugin_processmaker_configs
|
||||||
|
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`name` varchar(50) NOT NULL DEFAULT 'ProcessMaker',
|
||||||
|
`pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://localhost/',
|
||||||
|
`pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow',
|
||||||
|
`pm_admin_user` varchar(255) DEFAULT NULL,
|
||||||
|
`pm_admin_passwd` varchar(255) DEFAULT NULL,
|
||||||
|
`pm_theme` varchar(50) NOT NULL DEFAULT 'glpi_classic',
|
||||||
|
`date_mod` timestamp NULL DEFAULT NULL,
|
||||||
|
`taskcategories_id` int(11) DEFAULT NULL,
|
||||||
|
`users_id` int(11) DEFAULT NULL,
|
||||||
|
`pm_group_guid` varchar(32) DEFAULT NULL,
|
||||||
|
`comment` text,
|
||||||
|
`pm_dbserver_name` varchar(255) DEFAULT 'localhost',
|
||||||
|
`pm_dbname` varchar(50) DEFAULT 'wf_workflow',
|
||||||
|
`pm_dbserver_user` varchar(255) DEFAULT NULL,
|
||||||
|
`pm_dbserver_passwd` varchar(255) DEFAULT NULL,
|
||||||
|
`domain` varchar(50) DEFAULT '',
|
||||||
|
`maintenance` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`ssl_verify` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`db_version` varchar(10) NOT NULL DEFAULT '3.3.8',
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
-- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions
|
||||||
|
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
|
||||||
|
`plugin_processmaker_cases_id` int(11) DEFAULT '0',
|
||||||
|
`users_id` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`postdata` mediumtext,
|
||||||
|
`logs_out` mediumtext,
|
||||||
|
`state` int(11) NOT NULL,
|
||||||
|
`date_mod` timestamp NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes
|
||||||
|
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`process_guid` varchar(32) NOT NULL,
|
||||||
|
`name` varchar(255) NOT NULL,
|
||||||
|
`is_active` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`hide_case_num_title` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`insert_task_comment` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`comment` text,
|
||||||
|
`taskcategories_id` int(11) DEFAULT NULL,
|
||||||
|
`itilcategories_id` int(11) NOT NULL DEFAULT '0',
|
||||||
|
`type` int(11) NOT NULL DEFAULT '1' COMMENT 'Only used for self-service Tickets',
|
||||||
|
`date_mod` timestamp NULL DEFAULT NULL,
|
||||||
|
`project_type` varchar(50) NOT NULL DEFAULT 'classic',
|
||||||
|
`is_change` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`is_problem` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`is_incident` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`is_request` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `process_guid` (`process_guid`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles
|
||||||
|
CREATE TABLE `glpi_plugin_processmaker_processes_profiles` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`plugin_processmaker_processes_id` int(11) NOT NULL,
|
||||||
|
`profiles_id` int(11) NOT NULL,
|
||||||
|
`entities_id` int(11) NOT NULL,
|
||||||
|
`is_recursive` tinyint(1) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE INDEX `plugin_processmaker_processes_id_profiles_id_entities_id` (`plugin_processmaker_processes_id`, `profiles_id`, `entities_id`),
|
||||||
|
KEY `entities_id` (`entities_id`),
|
||||||
|
KEY `profiles_id` (`profiles_id`),
|
||||||
|
KEY `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`),
|
||||||
|
KEY `is_recursive` (`is_recursive`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
|
||||||
|
|
||||||
|
|
||||||
|
-- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories
|
||||||
|
CREATE TABLE `glpi_plugin_processmaker_taskcategories` (
|
||||||
|
`id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`plugin_processmaker_processes_id` INT(11) NOT NULL,
|
||||||
|
`pm_task_guid` VARCHAR(32) NOT NULL,
|
||||||
|
`taskcategories_id` INT(11) NOT NULL,
|
||||||
|
`is_start` TINYINT(1) NOT NULL DEFAULT '0',
|
||||||
|
`is_active` TINYINT(1) NOT NULL DEFAULT '1',
|
||||||
|
`is_subprocess` TINYINT(1) NOT NULL DEFAULT '0',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE INDEX `pm_task_guid` (`pm_task_guid`),
|
||||||
|
UNIQUE INDEX `items` (`taskcategories_id`),
|
||||||
|
INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
-- Dumping structure for table glpi.glpi_plugin_processmaker_tasks
|
||||||
|
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`items_id` int(11) NOT NULL,
|
||||||
|
`itemtype` varchar(32) NOT NULL,
|
||||||
|
`plugin_processmaker_cases_id` int(11) NOT NULL,
|
||||||
|
`plugin_processmaker_taskcategories_id` int(11) NOT NULL,
|
||||||
|
`del_index` int(11) NOT NULL,
|
||||||
|
`del_thread` INT(11) NOT NULL,
|
||||||
|
`del_thread_status` varchar(32) NOT NULL DEFAULT 'OPEN',
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `tasks` (`plugin_processmaker_cases_id`,`del_index`),
|
||||||
|
UNIQUE KEY `items` (`itemtype`,`items_id`),
|
||||||
|
KEY `del_thread_status` (`del_thread_status`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
-- Dumping structure for table glpi.glpi_plugin_processmaker_users
|
||||||
|
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` (
|
||||||
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
||||||
|
`pm_users_id` varchar(32) NOT NULL,
|
||||||
|
PRIMARY KEY (`id`),
|
||||||
|
UNIQUE KEY `pm_users_id` (`pm_users_id`)
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||||
|
|
||||||
|
|
||||||
|
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
|
||||||
|
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
|
||||||
|
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
|
||||||
@@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function processmaker_update(){
|
function processmaker_update() {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
// update from older versions
|
// update from older versions
|
||||||
// load config to get current version
|
// load config to get current version
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "db_version" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "db_version" )) {
|
||||||
$current_version = '2.4.1';
|
$current_version = '2.4.1';
|
||||||
} else {
|
} else {
|
||||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/config.class.php");
|
include_once(GLPI_ROOT."/plugins/processmaker/inc/config.class.php");
|
||||||
@@ -13,7 +13,7 @@ function processmaker_update(){
|
|||||||
$current_version = $config->fields['db_version'];
|
$current_version = $config->fields['db_version'];
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($current_version){
|
switch ($current_version) {
|
||||||
case '2.4.1' :
|
case '2.4.1' :
|
||||||
// will upgrade any old versions (< 3.2.8) to 3.2.8
|
// will upgrade any old versions (< 3.2.8) to 3.2.8
|
||||||
include_once(GLPI_ROOT."/plugins/processmaker/install/update_to_3_2_8.php");
|
include_once(GLPI_ROOT."/plugins/processmaker/install/update_to_3_2_8.php");
|
||||||
@@ -33,11 +33,17 @@ function processmaker_update(){
|
|||||||
// will upgrade 3.3.0 to 3.3.1
|
// will upgrade 3.3.0 to 3.3.1
|
||||||
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_0_to_3_3_1.php");
|
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_0_to_3_3_1.php");
|
||||||
$new_version = update_3_3_0_to_3_3_1();
|
$new_version = update_3_3_0_to_3_3_1();
|
||||||
|
case '3.3.1' :
|
||||||
|
// will upgrade 3.3.1 to 3.3.8
|
||||||
|
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_1_to_3_3_8.php");
|
||||||
|
$new_version = update_3_3_1_to_3_3_8();
|
||||||
}
|
}
|
||||||
|
|
||||||
// end update by updating the db version number
|
if (isset($new_version)) {
|
||||||
$query = "UPDATE `glpi_plugin_processmaker_configs` SET `db_version` = '$new_version' WHERE `id` = 1;";
|
// end update by updating the db version number
|
||||||
|
$query = "UPDATE `glpi_plugin_processmaker_configs` SET `db_version` = '$new_version' WHERE `id` = 1;";
|
||||||
|
|
||||||
$DB->query($query) or die("error when updating db_version field in glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error when updating db_version field in glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function update_3_2_8_to_3_2_9(){
|
function update_3_2_8_to_3_2_9() {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "db_version")) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "db_version")) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||||
ADD COLUMN `db_version` VARCHAR(10) NULL;";
|
ADD COLUMN `db_version` VARCHAR(10) NULL;";
|
||||||
$DB->query($query) or die("error adding db_version field to glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error adding db_version field to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
|
|||||||
@@ -1,14 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function update_3_2_9_to_3_3_0(){
|
function update_3_2_9_to_3_3_0() {
|
||||||
global $DB, $PM_DB; //, $PM_SOAP;
|
global $DB, $PM_DB; //, $PM_SOAP;
|
||||||
|
|
||||||
|
|
||||||
// to be sure
|
// to be sure
|
||||||
$PM_DB = new PluginProcessmakerDB;
|
$PM_DB = new PluginProcessmakerDB;
|
||||||
|
|
||||||
// Alter table plugin_processmaker_cases
|
// Alter table plugin_processmaker_cases
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_cases", "plugin_processmaker_processes_id" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_cases", "plugin_processmaker_processes_id" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||||
ALTER `id` DROP DEFAULT;";
|
ALTER `id` DROP DEFAULT;";
|
||||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 1" . $DB->error());
|
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_cases table step 1" . $DB->error());
|
||||||
@@ -35,13 +34,13 @@ function update_3_2_9_to_3_3_0(){
|
|||||||
|
|
||||||
// needs to set entities_id and name fields
|
// 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)
|
// 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) {
|
foreach ($DB->request(PluginProcessmakerCase::getTable()) as $row) {
|
||||||
$tmp = new $row['itemtype'];
|
$tmp = new $row['itemtype'];
|
||||||
$entities_id = 0;
|
$entities_id = 0;
|
||||||
if ($tmp->getFromDB($row['items_id'])) {
|
if ($tmp->getFromDB($row['items_id'])) {
|
||||||
$entities_id = $tmp->fields['entities_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) {
|
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 :)
|
// there is only one record :)
|
||||||
$name = $PM_DB->escape($name['CON_VALUE']);
|
$name = $PM_DB->escape($name['CON_VALUE']);
|
||||||
$query = "UPDATE ".PluginProcessmakerCase::getTable()." SET `name` = '{$name}', `entities_id` = $entities_id WHERE `id` = {$row['id']};";
|
$query = "UPDATE ".PluginProcessmakerCase::getTable()." SET `name` = '{$name}', `entities_id` = $entities_id WHERE `id` = {$row['id']};";
|
||||||
@@ -50,7 +49,7 @@ function update_3_2_9_to_3_3_0(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_processes_profiles", "plugin_processmaker_processes_id")) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_processes_profiles", "plugin_processmaker_processes_id")) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes_profiles`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_processes_profiles`
|
||||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL DEFAULT '0' AFTER `id`,
|
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL DEFAULT '0' AFTER `id`,
|
||||||
DROP INDEX `processes_id`,
|
DROP INDEX `processes_id`,
|
||||||
@@ -63,7 +62,7 @@ function update_3_2_9_to_3_3_0(){
|
|||||||
GROUP BY gpp.plugin_processmaker_processes_id, gpp.profiles_id, gpp.entities_id
|
GROUP BY gpp.plugin_processmaker_processes_id, gpp.profiles_id, gpp.entities_id
|
||||||
HAVING COUNT(id) > 1;";
|
HAVING COUNT(id) > 1;";
|
||||||
|
|
||||||
foreach($DB->request($query) as $rec){
|
foreach ($DB->request($query) as $rec) {
|
||||||
// there we have one rec per duplicates
|
// there we have one rec per duplicates
|
||||||
// so we may delete all records in the table, and a new one
|
// 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']."
|
$del_query = "DELETE FROM glpi_plugin_processmaker_processes_profiles WHERE plugin_processmaker_processes_id=".$rec['plugin_processmaker_processes_id']."
|
||||||
@@ -81,7 +80,7 @@ function update_3_2_9_to_3_3_0(){
|
|||||||
$DB->query($query) or die("error when adding new index on glpi_plugin_processmaker_processes_profiles table " . $DB->error());
|
$DB->query($query) or die("error when adding new index on glpi_plugin_processmaker_processes_profiles table " . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_tasks", "plugin_processmaker_cases_id" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_tasks", "plugin_processmaker_cases_id" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_tasks`
|
||||||
ALTER `itemtype` DROP DEFAULT;";
|
ALTER `itemtype` DROP DEFAULT;";
|
||||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_tasks table step 1" . $DB->error());
|
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_tasks table step 1" . $DB->error());
|
||||||
@@ -110,15 +109,15 @@ function update_3_2_9_to_3_3_0(){
|
|||||||
// set real thread status get it from APP_DELEGATION
|
// 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';";
|
$query = "SELECT APP_UID, DEL_INDEX, DEL_THREAD, DEL_THREAD_STATUS FROM APP_DELEGATION WHERE DEL_THREAD_STATUS = 'CLOSED';";
|
||||||
$locThreads = [];
|
$locThreads = [];
|
||||||
foreach($PM_DB->request($query) as $thread){
|
foreach ($PM_DB->request($query) as $thread) {
|
||||||
$locThreads[$thread['APP_UID']][] = $thread;
|
$locThreads[$thread['APP_UID']][] = $thread;
|
||||||
}
|
}
|
||||||
$locCase = new PluginProcessmakerCase;
|
$locCase = new PluginProcessmakerCase;
|
||||||
foreach($locThreads as $key => $threads){
|
foreach ($locThreads as $key => $threads) {
|
||||||
// get GLPI case id
|
// get GLPI case id
|
||||||
$locCase->getFromGUID($key);
|
$locCase->getFromGUID($key);
|
||||||
$del_indexes = [];
|
$del_indexes = [];
|
||||||
foreach($threads as $thread){
|
foreach ($threads as $thread) {
|
||||||
$del_indexes[] = $thread['DEL_INDEX'];
|
$del_indexes[] = $thread['DEL_INDEX'];
|
||||||
}
|
}
|
||||||
$del_indexes = implode(", ", $del_indexes);
|
$del_indexes = implode(", ", $del_indexes);
|
||||||
@@ -130,18 +129,18 @@ function update_3_2_9_to_3_3_0(){
|
|||||||
$app_delegation = [];
|
$app_delegation = [];
|
||||||
$query = "SELECT CONCAT(APPLICATION.APP_NUMBER, '-', APP_DELEGATION.DEL_INDEX) AS 'key', APP_DELEGATION.TAS_UID FROM 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";
|
LEFT JOIN APPLICATION ON APPLICATION.APP_UID=APP_DELEGATION.APP_UID";
|
||||||
foreach($PM_DB->request($query) as $row) {
|
foreach ($PM_DB->request($query) as $row) {
|
||||||
$app_delegation[$row['key']]=$row['TAS_UID'];
|
$app_delegation[$row['key']]=$row['TAS_UID'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$taskcats = [];
|
$taskcats = [];
|
||||||
$query = "SELECT * FROM glpi_plugin_processmaker_taskcategories";
|
$query = "SELECT * FROM glpi_plugin_processmaker_taskcategories";
|
||||||
foreach($DB->request($query) as $row) {
|
foreach ($DB->request($query) as $row) {
|
||||||
$taskcats[$row['pm_task_guid']] = $row['id'];
|
$taskcats[$row['pm_task_guid']] = $row['id'];
|
||||||
}
|
}
|
||||||
|
|
||||||
$query = "SELECT * FROM glpi_plugin_processmaker_tasks";
|
$query = "SELECT * FROM glpi_plugin_processmaker_tasks";
|
||||||
foreach($DB->request($query) as $row) {
|
foreach ($DB->request($query) as $row) {
|
||||||
$key = $row['plugin_processmaker_cases_id']."-".$row['del_index'];
|
$key = $row['plugin_processmaker_cases_id']."-".$row['del_index'];
|
||||||
if (isset($app_delegation[$key]) && isset($taskcats[$app_delegation[$key]])) {
|
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
|
$DB->query("UPDATE glpi_plugin_processmaker_tasks SET plugin_processmaker_taskcategories_id={$taskcats[$app_delegation[$key]]} WHERE id={$row['id']}") or
|
||||||
@@ -155,7 +154,7 @@ function update_3_2_9_to_3_3_0(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_taskcategories", "is_subprocess" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_taskcategories", "is_subprocess" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||||
ALTER `processes_id` DROP DEFAULT;";
|
ALTER `processes_id` DROP DEFAULT;";
|
||||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_taskcategories step 1" . $DB->error());
|
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_taskcategories step 1" . $DB->error());
|
||||||
@@ -169,17 +168,16 @@ function update_3_2_9_to_3_3_0(){
|
|||||||
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_taskcategories step 2" . $DB->error());
|
$DB->query($query) or die("error normalizing glpi_plugin_processmaker_taskcategories step 2" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($DB->fieldExists("glpi_plugin_processmaker_users", "password" )) {
|
||||||
if (arFieldExists("glpi_plugin_processmaker_users", "password" )) {
|
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||||
DROP COLUMN `password`;
|
DROP COLUMN `password`;
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error deleting password col from glpi_plugin_processmaker_users" . $DB->error());
|
$DB->query($query) or die("error deleting password col from glpi_plugin_processmaker_users" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_crontaskactions", "plugin_processmaker_cases_id" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_crontaskactions", "plugin_processmaker_cases_id" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||||
ADD COLUMN `plugin_processmaker_cases_id` INT(11) DEFAULT '0' AFTER `plugin_processmaker_caselinks_id`;" ;
|
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());
|
$DB->query($query) or die("error adding plugin_processmaker_cases_id col into glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||||
|
|
||||||
// data migration
|
// data migration
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function update_3_3_0_to_3_3_1(){
|
function update_3_3_0_to_3_3_1() {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
// Alter table glpi_plugin_processmaker_processes
|
// Alter table glpi_plugin_processmaker_processes
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_processes", "is_change" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_processes", "is_change" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||||
ADD COLUMN `is_change` TINYINT(1) NOT NULL DEFAULT '0' AFTER `project_type`,
|
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_problem` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_change`,
|
||||||
@@ -16,7 +16,7 @@ function update_3_3_0_to_3_3_1(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Alter table glpi_plugin_processmaker_caselinks
|
// Alter table glpi_plugin_processmaker_caselinks
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_caselinks", "is_targettoreassign" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "is_targettoreassign" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||||
ADD COLUMN `is_targettoreassign` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_targettoclaim`,
|
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_targettoimpersonate` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_targettoreassign`,
|
||||||
@@ -26,6 +26,5 @@ function update_3_3_0_to_3_3_1(){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return '3.3.1';
|
return '3.3.1';
|
||||||
}
|
}
|
||||||
|
|||||||
15
install/update_3_3_1_to_3_3_8.php
Normal file
15
install/update_3_3_1_to_3_3_8.php
Normal file
@@ -0,0 +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';
|
||||||
|
}
|
||||||
@@ -1,156 +1,152 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function update_to_3_2_8(){
|
function update_to_3_2_8() {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
if (arTableExists("glpi_plugin_processmaker_config")) {
|
if ($DB->tableExists("glpi_plugin_processmaker_config")) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_config`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_config`
|
||||||
ADD COLUMN `date_mod` DATETIME NULL DEFAULT NULL AFTER `pm_theme`,
|
ADD COLUMN `date_mod` DATETIME NULL DEFAULT NULL AFTER `pm_theme`,
|
||||||
ADD COLUMN `comment` TEXT NULL AFTER `date_mod`;
|
ADD COLUMN `comment` TEXT NULL AFTER `date_mod`;
|
||||||
RENAME TABLE `glpi_plugin_processmaker_config` TO `glpi_plugin_processmaker_configs`;";
|
RENAME TABLE `glpi_plugin_processmaker_config` TO `glpi_plugin_processmaker_configs`;";
|
||||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error creating glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "pm_dbserver_name" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "pm_dbserver_name" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||||
ADD COLUMN `pm_dbserver_name` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_group_guid`,
|
ADD COLUMN `pm_dbserver_name` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_group_guid`,
|
||||||
ADD COLUMN `pm_dbserver_user` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_name`,
|
ADD COLUMN `pm_dbserver_user` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_name`,
|
||||||
ADD COLUMN `pm_dbserver_passwd` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_user`;";
|
ADD COLUMN `pm_dbserver_passwd` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_user`;";
|
||||||
$DB->query($query) or die("error adding fields pm_dbserver_name, pm_dbserver_user, pm_dbserver_passwd to glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error adding fields pm_dbserver_name, pm_dbserver_user, pm_dbserver_passwd to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "domain" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "domain" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||||
ADD COLUMN `domain` VARCHAR(50) NULL DEFAULT '' AFTER `pm_dbserver_passwd`;
|
ADD COLUMN `domain` VARCHAR(50) NULL DEFAULT '' AFTER `pm_dbserver_passwd`;
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error adding field domain to glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error adding field domain to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "maintenance" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "maintenance" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||||
ADD COLUMN `maintenance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `domain`;
|
ADD COLUMN `maintenance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `domain`;
|
||||||
;";
|
;";
|
||||||
$DB->query($query) or die("error adding fields maintenance to glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error adding fields maintenance to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "pm_dbname" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "pm_dbname" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||||
ADD COLUMN `pm_dbname` VARCHAR(50) NULL DEFAULT 'wf_workflow' AFTER `pm_dbserver_name`;
|
ADD COLUMN `pm_dbname` VARCHAR(50) NULL DEFAULT 'wf_workflow' AFTER `pm_dbserver_name`;
|
||||||
;";
|
;";
|
||||||
$DB->query($query) or die("error adding field pm_dbname to glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error adding field pm_dbname to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
|
|
||||||
$DB->query("UPDATE glpi_plugin_processmaker_configs SET `pm_dbname` = CONCAT('wf_', `pm_workspace`) WHERE `id` = 1");
|
$DB->query("UPDATE glpi_plugin_processmaker_configs SET `pm_dbname` = CONCAT('wf_', `pm_workspace`) WHERE `id` = 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arTableExists("glpi_plugin_processmaker_profiles")) {
|
if ($DB->tableExists("glpi_plugin_processmaker_profiles")) {
|
||||||
$query = "DROP TABLE `glpi_plugin_processmaker_profiles` ;";
|
$query = "DROP TABLE `glpi_plugin_processmaker_profiles` ;";
|
||||||
$DB->query($query) or die("error dropping glpi_plugin_processmaker_profiles" . $DB->error());
|
$DB->query($query) or die("error dropping glpi_plugin_processmaker_profiles" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_cases", "processes_id")) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_cases", "processes_id")) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||||
ADD COLUMN `processes_id` INT(11) NULL DEFAULT NULL;
|
ADD COLUMN `processes_id` INT(11) NULL DEFAULT NULL;
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error adding column processes_id into glpi_plugin_processmaker_cases" . $DB->error());
|
$DB->query($query) or die("error adding column processes_id into glpi_plugin_processmaker_cases" . $DB->error());
|
||||||
} else {
|
} else {
|
||||||
$flds = $DB->list_fields('glpi_plugin_processmaker_cases');
|
$flds = $DB->list_fields('glpi_plugin_processmaker_cases');
|
||||||
if (strcasecmp( $flds['processes_id']['Type'], 'varchar(32)' ) == 0) {
|
if (strcasecmp( $flds['processes_id']['Type'], 'varchar(32)' ) == 0) {
|
||||||
// required because autoload doesn't work for unactive plugin'
|
// required because autoload doesn't work for unactive plugin'
|
||||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/process.class.php");
|
include_once(GLPI_ROOT."/plugins/processmaker/inc/process.class.php");
|
||||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/case.class.php");
|
include_once(GLPI_ROOT."/plugins/processmaker/inc/case.class.php");
|
||||||
$proc = new PluginProcessmakerProcess;
|
$proc = new PluginProcessmakerProcess;
|
||||||
$case = new PluginProcessmakerCase;
|
$case = new PluginProcessmakerCase;
|
||||||
foreach ($DB->request("SELECT * FROM glpi_plugin_processmaker_cases WHERE LENGTH( processes_id ) = 32") as $row) {
|
foreach ($DB->request("SELECT * FROM glpi_plugin_processmaker_cases WHERE LENGTH( processes_id ) = 32") as $row) {
|
||||||
$proc->getFromGUID( $row['processes_id'] );
|
$proc->getFromGUID( $row['processes_id'] );
|
||||||
$case->update(array( 'id' => $row['id'], 'processes_id' => $proc->getID() ) );
|
$case->update([ 'id' => $row['id'], 'processes_id' => $proc->getID() ] );
|
||||||
}
|
}
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||||
CHANGE COLUMN `processes_id` `processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`;
|
CHANGE COLUMN `processes_id` `processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`;
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error converting column processes_id into INT(11) in glpi_plugin_processmaker_cases" . $DB->error());
|
$DB->query($query) or die("error converting column processes_id into INT(11) in glpi_plugin_processmaker_cases" . $DB->error());
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!$DB->fieldExists('glpi_plugin_processmaker_users', 'password')) {
|
||||||
if (!arFieldExists('glpi_plugin_processmaker_users', 'password')) {
|
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
|
||||||
ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST,
|
ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST,
|
||||||
ADD COLUMN `password` VARCHAR(32) NULL DEFAULT NULL AFTER `pm_users_id`,
|
ADD COLUMN `password` VARCHAR(32) NULL DEFAULT NULL AFTER `pm_users_id`,
|
||||||
ADD PRIMARY KEY (`id`);
|
ADD PRIMARY KEY (`id`);
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error adding column 'password' to glpi_plugin_processmaker_users" . $DB->error());
|
$DB->query($query) or die("error adding column 'password' to glpi_plugin_processmaker_users" . $DB->error());
|
||||||
|
|
||||||
// also need to change text of tasks for tasks linked to cases
|
// also need to change text of tasks for tasks linked to cases
|
||||||
$query = "UPDATE glpi_tickettasks SET content=REPLACE(content,'##_PluginProcessmakerCases\$processmakercases','##_PluginProcessmakerCase\$processmakercases')
|
$query = "UPDATE glpi_tickettasks SET content=REPLACE(content,'##_PluginProcessmakerCases\$processmakercases','##_PluginProcessmakerCase\$processmakercases')
|
||||||
WHERE glpi_tickettasks.id IN (SELECT items_id FROM glpi_plugin_processmaker_tasks WHERE itemtype='TicketTask') AND content LIKE '%_PluginProcessmakerCases\$processmakercases%'";
|
WHERE glpi_tickettasks.id IN (SELECT items_id FROM glpi_plugin_processmaker_tasks WHERE itemtype='TicketTask') AND content LIKE '%_PluginProcessmakerCases\$processmakercases%'";
|
||||||
$DB->query($query) or die("error updating TicketTask" . $DB->error());
|
$DB->query($query) or die("error updating TicketTask" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arFieldExists('glpi_plugin_processmaker_users', 'glpi_users_id')) {
|
if ($DB->fieldExists('glpi_plugin_processmaker_users', 'glpi_users_id')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||||
ALTER `glpi_users_id` DROP DEFAULT,
|
ALTER `glpi_users_id` DROP DEFAULT,
|
||||||
DROP PRIMARY KEY,
|
DROP PRIMARY KEY,
|
||||||
DROP COLUMN `id`,
|
DROP COLUMN `id`,
|
||||||
DROP INDEX `glpi_users_id`;
|
DROP INDEX `glpi_users_id`;
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error droping 'defaults' from 'glpi_users_id' to glpi_plugin_processmaker_users" . $DB->error());
|
$DB->query($query) or die("error droping 'defaults' from 'glpi_users_id' to glpi_plugin_processmaker_users" . $DB->error());
|
||||||
|
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||||
CHANGE COLUMN `glpi_users_id` `id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
CHANGE COLUMN `glpi_users_id` `id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
||||||
ADD PRIMARY KEY (`id`);
|
ADD PRIMARY KEY (`id`);
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error renaming 'glpi_users_id' into 'id' to glpi_plugin_processmaker_users" . $DB->error());
|
$DB->query($query) or die("error renaming 'glpi_users_id' into 'id' to glpi_plugin_processmaker_users" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($DB->fieldExists( 'glpi_plugin_processmaker_processes', 'is_helpdeskvisible')) {
|
||||||
if (arFieldExists( 'glpi_plugin_processmaker_processes', 'is_helpdeskvisible')) {
|
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
|
||||||
CHANGE COLUMN `is_helpdeskvisible` `is_helpdeskvisible_notusedanymore` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'Not used any more since version 2.2' AFTER `name`;";
|
CHANGE COLUMN `is_helpdeskvisible` `is_helpdeskvisible_notusedanymore` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'Not used any more since version 2.2' AFTER `name`;";
|
||||||
$DB->query($query);
|
$DB->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists( 'glpi_plugin_processmaker_processes', 'itilcategories_id')) {
|
if (!$DB->fieldExists( 'glpi_plugin_processmaker_processes', 'itilcategories_id')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||||
ADD COLUMN `itilcategories_id` INT(11) NOT NULL DEFAULT '0',
|
ADD COLUMN `itilcategories_id` INT(11) NOT NULL DEFAULT '0',
|
||||||
ADD COLUMN `type` INT(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets';";
|
ADD COLUMN `type` INT(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets';";
|
||||||
|
|
||||||
$DB->query($query) or die("error adding columns 'itilcategories_id' and 'type' to glpi_plugin_processmaker_processes" . $DB->error());
|
$DB->query($query) or die("error adding columns 'itilcategories_id' and 'type' to glpi_plugin_processmaker_processes" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists( 'glpi_plugin_processmaker_processes', 'project_type')) {
|
if (!$DB->fieldExists( 'glpi_plugin_processmaker_processes', 'project_type')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||||
ADD COLUMN `project_type` VARCHAR(50) NOT NULL DEFAULT 'classic';";
|
ADD COLUMN `project_type` VARCHAR(50) NOT NULL DEFAULT 'classic';";
|
||||||
|
|
||||||
$DB->query($query) or die("error adding columns 'project_type' to glpi_plugin_processmaker_processes" . $DB->error());
|
$DB->query($query) or die("error adding columns 'project_type' to glpi_plugin_processmaker_processes" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists('glpi_plugin_processmaker_taskcategories', 'is_active')) {
|
if (!$DB->fieldExists('glpi_plugin_processmaker_taskcategories', 'is_active')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||||
ADD COLUMN `is_active` TINYINT(1) NOT NULL DEFAULT '1' AFTER `start`;" ;
|
ADD COLUMN `is_active` TINYINT(1) NOT NULL DEFAULT '1' AFTER `start`;";
|
||||||
$DB->query($query) or die("error adding field is_active to glpi_plugin_processmaker_taskcategories table" . $DB->error());
|
$DB->query($query) or die("error adding field is_active to glpi_plugin_processmaker_taskcategories table" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($DB->fieldExists('glpi_plugin_processmaker_crontaskactions', 'postdatas')) {
|
||||||
if (arFieldExists('glpi_plugin_processmaker_crontaskactions', 'postdatas')) {
|
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
|
||||||
CHANGE COLUMN `postdatas` `postdata` MEDIUMTEXT NULL DEFAULT NULL AFTER `toclaim`;";
|
CHANGE COLUMN `postdatas` `postdata` MEDIUMTEXT NULL DEFAULT NULL AFTER `toclaim`;";
|
||||||
$DB->query($query) or die("error changing 'postdatas' from glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
$DB->query($query) or die("error changing 'postdatas' from glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists('glpi_plugin_processmaker_crontaskactions', 'logs_out')) {
|
if (!$DB->fieldExists('glpi_plugin_processmaker_crontaskactions', 'logs_out')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||||
ADD COLUMN `logs_out` MEDIUMTEXT NULL AFTER `postdata`;";
|
ADD COLUMN `logs_out` MEDIUMTEXT NULL AFTER `postdata`;";
|
||||||
$DB->query($query) or die("error adding 'logs_out' field into glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
$DB->query($query) or die("error adding 'logs_out' field into glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_crontaskactions", "is_targettoclaim")) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_crontaskactions", "is_targettoclaim")) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||||
CHANGE COLUMN `toclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `users_id`;";
|
CHANGE COLUMN `toclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `users_id`;";
|
||||||
$DB->query($query) or die("error renaming toclaim in glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
$DB->query($query) or die("error renaming toclaim in glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "plugin_processmaker_taskcategories_id_source")) {
|
||||||
//if (!arFieldExists("glpi_plugin_processmaker_caselinks", "plugin_processmaker_taskcategories_id_source")) {
|
|
||||||
// $query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
// $query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||||
// ADD COLUMN `plugin_processmaker_taskcategories_id_source` INT(11) NULL DEFAULT NULL AFTER `sourcetask_guid`,
|
// ADD COLUMN `plugin_processmaker_taskcategories_id_source` INT(11) NULL DEFAULT NULL AFTER `sourcetask_guid`,
|
||||||
// ADD COLUMN `plugin_processmaker_taskcategories_id_target` INT(11) NULL DEFAULT NULL AFTER `targettask_guid`,
|
// ADD COLUMN `plugin_processmaker_taskcategories_id_target` INT(11) NULL DEFAULT NULL AFTER `targettask_guid`,
|
||||||
@@ -173,13 +169,13 @@ function update_to_3_2_8(){
|
|||||||
// $DB->query($query) or die("error dropping col plugin_processmaker_taskcategories_id_source from glpi_plugin_processmaker_caselinks" . $DB->error());
|
// $DB->query($query) or die("error dropping col plugin_processmaker_taskcategories_id_source from glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (!arFieldExists("glpi_plugin_processmaker_caselinks", "is_targettoclaim")) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "is_targettoclaim")) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||||
CHANGE COLUMN `targettoclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `sourcecondition`;" ;
|
CHANGE COLUMN `targettoclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `sourcecondition`;";
|
||||||
$DB->query($query) or die("error renaming targettoclaim in glpi_plugin_processmaker_caselinks" . $DB->error());
|
$DB->query($query) or die("error renaming targettoclaim in glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
//if( !arTableExists('glpi_plugin_processmaker_selfservicedrafts')){
|
//if( !$DB->tableExists('glpi_plugin_processmaker_selfservicedrafts')){
|
||||||
// $query = "CREATE TABLE `glpi_plugin_processmaker_selfservicedrafts` (
|
// $query = "CREATE TABLE `glpi_plugin_processmaker_selfservicedrafts` (
|
||||||
// `id` INT(11) NOT NULL AUTO_INCREMENT,
|
// `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
// `users_id` INT(11) NOT NULL,
|
// `users_id` INT(11) NOT NULL,
|
||||||
|
|||||||
64
js/cases.js
64
js/cases.js
@@ -162,7 +162,7 @@ function onTaskFrameLoad(event, delIndex, hideClaimButton, csrf) {
|
|||||||
// nothing to do here for the moment
|
// nothing to do here for the moment
|
||||||
}
|
}
|
||||||
|
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -181,44 +181,44 @@ function redimTaskFrame(taskFrame, delIndex) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTaskFrameActivation(delIndex) {
|
//function onTaskFrameActivation(delIndex) {
|
||||||
var taskFrameId = "caseiframe-" + delIndex;
|
// var taskFrameId = "caseiframe-" + delIndex;
|
||||||
var taskFrameTimerCounter = 0;
|
// var taskFrameTimerCounter = 0;
|
||||||
var redimIFrame = false;
|
// var redimIFrame = false;
|
||||||
|
|
||||||
var taskFrameTimer = window.setInterval(function () {
|
// var taskFrameTimer = window.setInterval(function () {
|
||||||
try {
|
// try {
|
||||||
var locContentDocument;
|
// var locContentDocument;
|
||||||
var taskFrame = document.getElementById(taskFrameId);
|
// var taskFrame = document.getElementById(taskFrameId);
|
||||||
|
|
||||||
if (taskFrame != undefined && taskFrame.contentDocument != undefined) {
|
// if (taskFrame != undefined && taskFrame.contentDocument != undefined) {
|
||||||
// here we've caught the content of the iframe
|
// // here we've caught the content of the iframe
|
||||||
locContentDocument = taskFrame.contentDocument;
|
// locContentDocument = taskFrame.contentDocument;
|
||||||
|
|
||||||
// try to redim caseIFrame
|
// // try to redim caseIFrame
|
||||||
if (!redimIFrame) {
|
// if (!redimIFrame) {
|
||||||
var newHeight;
|
// var newHeight;
|
||||||
var locElt = locContentDocument.getElementsByTagName("html")[0];
|
// var locElt = locContentDocument.getElementsByTagName("html")[0];
|
||||||
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
// newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||||
|
|
||||||
tabs.getItem('task-' + delIndex).setHeight(newHeight);
|
// tabs.getItem('task-' + delIndex).setHeight(newHeight);
|
||||||
taskFrame.height = newHeight;
|
// taskFrame.height = newHeight;
|
||||||
redimIFrame = true;
|
// redimIFrame = true;
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
|
|
||||||
taskFrameTimerCounter = taskFrameTimerCounter + 1;
|
// taskFrameTimerCounter = taskFrameTimerCounter + 1;
|
||||||
|
|
||||||
if (taskFrameTimerCounter > 3000 || redimIFrame) { // timeout
|
// if (taskFrameTimerCounter > 3000 || redimIFrame) { // timeout
|
||||||
window.clearInterval(taskFrameTimer);
|
// window.clearInterval(taskFrameTimer);
|
||||||
}
|
// }
|
||||||
|
|
||||||
} catch (evt) {
|
// } catch (evt) {
|
||||||
// nothing to do here for the moment
|
// // nothing to do here for the moment
|
||||||
}
|
// }
|
||||||
|
|
||||||
}, 10);
|
// }, 10);
|
||||||
}
|
//}
|
||||||
function clearClass(lociFrame) {
|
function clearClass(lociFrame) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -307,6 +307,6 @@ function onOtherFrameLoad(tabPanelName, frameName, eltTagName, isMap3) {
|
|||||||
} catch (ev) {
|
} catch (ev) {
|
||||||
// nothing to do here for the moment
|
// nothing to do here for the moment
|
||||||
}
|
}
|
||||||
}, 10);
|
}, 10);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
21
js/central.js
Normal file
21
js/central.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
$(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,17 +1,19 @@
|
|||||||
<?php
|
<?php
|
||||||
define('GLPI_ROOT','../../..');
|
define('GLPI_ROOT', '../../..');
|
||||||
include (GLPI_ROOT."/inc/includes.php");
|
include (GLPI_ROOT."/inc/includes.php");
|
||||||
header("Content-type: application/javascript");
|
header("Content-type: application/javascript");
|
||||||
|
$plugin = new Plugin();
|
||||||
$config = PluginProcessmakerConfig::getInstance() ;
|
if ($plugin->isActivated('processmaker')) {
|
||||||
if( isset($config->fields['domain']) && $config->fields['domain'] != '' ) {
|
$config = PluginProcessmakerConfig::getInstance();
|
||||||
echo "
|
if (isset($config->fields['domain']) && $config->fields['domain'] != '') {
|
||||||
//debugger;
|
echo "
|
||||||
var d = document,
|
//debugger;
|
||||||
g = d.createElement('script'),
|
var d = document,
|
||||||
s = d.getElementsByTagName('script')[0];
|
g = d.createElement('script'),
|
||||||
g.type = 'text/javascript';
|
s = d.getElementsByTagName('script')[0];
|
||||||
g.text = 'try { document.domain = \'".$config->fields['domain']."\'; } catch(ev) { /*console.log(ev);*/ }';
|
g.type = 'text/javascript';
|
||||||
s.parentNode.insertBefore(g, s);
|
g.text = 'try { document.domain = \'".$config->fields['domain']."\'; } catch(ev) { /*console.log(ev);*/ }';
|
||||||
" ;
|
s.parentNode.insertBefore(g, s);
|
||||||
|
";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
9
js/planning.js
Normal file
9
js/planning.js
Normal file
@@ -0,0 +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();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -3,15 +3,15 @@
|
|||||||
<name>Processmaker</name>
|
<name>Processmaker</name>
|
||||||
<key>processmaker</key>
|
<key>processmaker</key>
|
||||||
<state>stable</state>
|
<state>stable</state>
|
||||||
<logo>https://raw.githubusercontent.com/tomolimo/processmaker/master/processmaker.png</logo>
|
<logo>https://raw.githubusercontent.com/tomolimo/processmaker/master/processmaker.png</logo>
|
||||||
<description>
|
<description>
|
||||||
<short>
|
<short>
|
||||||
<fr>Ce plugin fournit la possibilité d'intégrer un processus (workflow) aux tickets.</fr>
|
<fr>Ce plugin fournit la possibilité d'intégrer un processus (workflow) aux objets ITIL (Tickets, Changements et Problèmes).</fr>
|
||||||
<en>This plugin provides a process (workflow) management linked to tickets.</en>
|
<en>This plugin provides a process (workflow) management linked to ITIL objects (Tickets, Changes and Problems).</en>
|
||||||
</short>
|
</short>
|
||||||
<long>
|
<long>
|
||||||
<en>This plugin is dedicated to provide a process (workflow) management linked to tickets. This goal is achieved using ProcessMaker (URL: http://www.processmaker.com/). ProcessMaker will provide Process design and Workflow execution. This plugin is the glue between GLPI and ProcessMaker.</en>
|
<en>This plugin is dedicated to provide process (workflows) management linked to ITIL objects (Tickets, Changes and Problems). This goal is achieved using a customized ProcessMaker server (URL: https://github.com/tomolimo/processmaker-server). ProcessMaker provides BPMN Process design and execution. This plugin is the glue between GLPI and ProcessMaker.</en>
|
||||||
<fr>Ce plugin est dédié à la gestion de processus (workflows) liés à des tickets. Ce but est atteint par l'utilisation de ProcessMaker (URL: http://www.processmaker.com/). ProcessMaker fournit un outil graphique de création de processus et permet l'exécution de ceux-ci. Ce plugin sert de glue entre GLPI et ProcessMaker.</fr>
|
<fr>Ce plugin est dédié à la gestion de processus (workflows) liés aux objets ITIL (Tickets, Changements et Problèmes). Ce but est atteint par l'utilisation d'un serveur ProcessMaker customisé (URL: https://github.com/tomolimo/processmaker-server). ProcessMaker fournit un outil graphique de création de processus BPMN et permet l'exécution de ceux-ci. Ce plugin sert de glue entre GLPI et ProcessMaker.</fr>
|
||||||
</long>
|
</long>
|
||||||
</description>
|
</description>
|
||||||
<homepage>https://github.com/tomolimo/processmaker</homepage>
|
<homepage>https://github.com/tomolimo/processmaker</homepage>
|
||||||
@@ -22,14 +22,14 @@
|
|||||||
<author>Olivier Moron</author>
|
<author>Olivier Moron</author>
|
||||||
</authors>
|
</authors>
|
||||||
<versions>
|
<versions>
|
||||||
<version>
|
<version>
|
||||||
<num>3.3.1</num>
|
<num>3.3.8</num>
|
||||||
<compatibility>9.2</compatibility>
|
<compatibility>9.1</compatibility>
|
||||||
</version>
|
</version>
|
||||||
<version>
|
<version>
|
||||||
<num>3.3.1</num>
|
<num>3.4.5</num>
|
||||||
<compatibility>9.1</compatibility>
|
<compatibility>9.2</compatibility>
|
||||||
</version>
|
</version>
|
||||||
</versions>
|
</versions>
|
||||||
<langs>
|
<langs>
|
||||||
<lang>en_gb</lang>
|
<lang>en_gb</lang>
|
||||||
@@ -38,17 +38,19 @@
|
|||||||
</langs>
|
</langs>
|
||||||
<license>GPL v2+</license>
|
<license>GPL v2+</license>
|
||||||
<tags>
|
<tags>
|
||||||
<fr>
|
<fr>
|
||||||
<tag>Processus</tag>
|
<tag>Processus</tag>
|
||||||
<tag>Workflow</tag>
|
<tag>BPMN 2.0</tag>
|
||||||
<tag>Helpdesk</tag>
|
<tag>Workflow</tag>
|
||||||
<tag>Ticket</tag>
|
<tag>Helpdesk</tag>
|
||||||
</fr>
|
<tag>Ticket</tag>
|
||||||
<en>
|
</fr>
|
||||||
<tag>Processes</tag>
|
<en>
|
||||||
<tag>Helpdesk</tag>
|
<tag>Processes</tag>
|
||||||
<tag>Workflows</tag>
|
<tag>BPMN 2.0</tag>
|
||||||
<tag>Ticket</tag>
|
<tag>Helpdesk</tag>
|
||||||
</en>
|
<tag>Workflows</tag>
|
||||||
|
<tag>Ticket</tag>
|
||||||
|
</en>
|
||||||
</tags>
|
</tags>
|
||||||
</root>
|
</root>
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?php
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* */
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
// Original Author of file: Olivier Moron
|
|
||||||
// Purpose of file: script to be used to purge logos from DB
|
|
||||||
// ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Ensure current directory as run command prompt
|
|
||||||
chdir(dirname($_SERVER["SCRIPT_FILENAME"]));
|
|
||||||
|
|
||||||
define('DO_NOT_CHECK_HTTP_REFERER', 1);
|
|
||||||
define('GLPI_ROOT', '../../..');
|
|
||||||
include (GLPI_ROOT . "/inc/includes.php");
|
|
||||||
include_once 'inc/processmaker.class.php' ;
|
|
||||||
|
|
||||||
$myCronTask = new CronTask;
|
|
||||||
|
|
||||||
if( $myCronTask->getFromDBbyName( "PluginProcessmakerProcessmaker", "pmusers" ) ) {
|
|
||||||
$myCronTask->start();
|
|
||||||
|
|
||||||
$ret = PluginProcessmakerProcessmaker::cronPMUsers( $myCronTask ) ;
|
|
||||||
|
|
||||||
$myCronTask->end( $ret ) ;
|
|
||||||
} else
|
|
||||||
echo "Cron not found!\n" ;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
96
setup.php
96
setup.php
@@ -1,7 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// used for case cancellation
|
// used for case cancellation
|
||||||
define("CANCEL", 256);
|
define("CANCEL", 256);
|
||||||
|
define('PROCESSMAKER_VERSION', '3.4.5');
|
||||||
|
|
||||||
// Init the hooks of the plugins -Needed
|
// Init the hooks of the plugins -Needed
|
||||||
function plugin_init_processmaker() {
|
function plugin_init_processmaker() {
|
||||||
@@ -10,29 +11,27 @@ function plugin_init_processmaker() {
|
|||||||
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
|
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
|
||||||
|
|
||||||
$objects = ['Ticket', 'Change', 'Problem'];
|
$objects = ['Ticket', 'Change', 'Problem'];
|
||||||
// $objects = ['Ticket'];
|
// $objects = ['Ticket'];
|
||||||
|
|
||||||
Plugin::registerClass('PluginProcessmakerProcessmaker');
|
Plugin::registerClass('PluginProcessmakerProcessmaker');
|
||||||
|
|
||||||
Plugin::registerClass('PluginProcessmakerCase', array('addtabon' => $objects));
|
Plugin::registerClass('PluginProcessmakerCase', ['addtabon' => $objects]);
|
||||||
|
|
||||||
Plugin::registerClass('PluginProcessmakerTaskCategory');
|
Plugin::registerClass('PluginProcessmakerTaskCategory');
|
||||||
|
|
||||||
if (Session::haveRightsOr("config", [READ, UPDATE])) {
|
if (Session::haveRightsOr("config", [READ, UPDATE])) {
|
||||||
Plugin::registerClass('PluginProcessmakerConfig', array('addtabon' => 'Config'));
|
Plugin::registerClass('PluginProcessmakerConfig', ['addtabon' => 'Config']);
|
||||||
$PLUGIN_HOOKS['config_page']['processmaker'] = 'front/config.form.php';
|
$PLUGIN_HOOKS['config_page']['processmaker'] = 'front/config.form.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin::registerClass('PluginProcessmakerProfile', array('addtabon' => 'Profile'));
|
Plugin::registerClass('PluginProcessmakerProfile', ['addtabon' => 'Profile']);
|
||||||
|
|
||||||
$PLUGIN_HOOKS['change_profile']['processmaker'] = array('PluginProcessmakerProfile','select');
|
|
||||||
|
|
||||||
Plugin::registerClass('PluginProcessmakerProcess_Profile');
|
Plugin::registerClass('PluginProcessmakerProcess_Profile');
|
||||||
|
|
||||||
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
|
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
|
||||||
|
|
||||||
$PLUGIN_HOOKS['pre_show_item']['processmaker']
|
$PLUGIN_HOOKS['pre_show_item']['processmaker']
|
||||||
= array('PluginProcessmakerProcessmaker', 'pre_show_item_processmaker');
|
= ['PluginProcessmakerProcessmaker', 'pre_show_item_processmaker'];
|
||||||
|
|
||||||
//$PLUGIN_HOOKS['pre_item_form']['processmaker']
|
//$PLUGIN_HOOKS['pre_item_form']['processmaker']
|
||||||
// = array('PluginProcessmakerProcessmaker', 'pre_item_form_processmakerticket');
|
// = array('PluginProcessmakerProcessmaker', 'pre_item_form_processmakerticket');
|
||||||
@@ -40,9 +39,9 @@ function plugin_init_processmaker() {
|
|||||||
// = array('PluginProcessmakerProcessmaker', 'post_item_form_processmakerticket');
|
// = array('PluginProcessmakerProcessmaker', 'post_item_form_processmakerticket');
|
||||||
|
|
||||||
$PLUGIN_HOOKS['pre_show_tab']['processmaker']
|
$PLUGIN_HOOKS['pre_show_tab']['processmaker']
|
||||||
= array('PluginProcessmakerProcessmaker', 'pre_show_tab_processmaker');
|
= ['PluginProcessmakerProcessmaker', 'pre_show_tab_processmaker'];
|
||||||
$PLUGIN_HOOKS['post_show_tab']['processmaker']
|
$PLUGIN_HOOKS['post_show_tab']['processmaker']
|
||||||
= array('PluginProcessmakerProcessmaker', 'post_show_tab_processmaker');
|
= ['PluginProcessmakerProcessmaker', 'post_show_tab_processmaker'];
|
||||||
|
|
||||||
// Display a menu entry ?
|
// Display a menu entry ?
|
||||||
if (Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE])) {
|
if (Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE])) {
|
||||||
@@ -50,55 +49,60 @@ function plugin_init_processmaker() {
|
|||||||
$PLUGIN_HOOKS['menu_toadd']['processmaker'] = ['tools' => 'PluginProcessmakerMenu', 'helpdesk' => 'PluginProcessmakerCase'];
|
$PLUGIN_HOOKS['menu_toadd']['processmaker'] = ['tools' => 'PluginProcessmakerMenu', 'helpdesk' => 'PluginProcessmakerCase'];
|
||||||
}
|
}
|
||||||
|
|
||||||
Plugin::registerClass('PluginProcessmakerProcess', array( 'massiveaction_nodelete_types' => true) );
|
Plugin::registerClass('PluginProcessmakerProcess', [ 'massiveaction_nodelete_types' => true] );
|
||||||
|
|
||||||
$hooks = [];
|
$hooks = [];
|
||||||
foreach($objects as $obj){
|
foreach ($objects as $obj) {
|
||||||
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_pre_item_add_processmaker'];
|
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_pre_item_add_processmaker'];
|
||||||
}
|
}
|
||||||
$PLUGIN_HOOKS['pre_item_add']['processmaker'] = $hooks;
|
$PLUGIN_HOOKS['pre_item_add']['processmaker'] = $hooks;
|
||||||
|
|
||||||
$hooks = [];
|
$hooks = [];
|
||||||
foreach($objects as $obj){
|
foreach ($objects as $obj) {
|
||||||
$hooks[$obj] = 'plugin_pre_item_update_processmaker';
|
$hooks[$obj] = 'plugin_pre_item_update_processmaker';
|
||||||
}
|
}
|
||||||
$PLUGIN_HOOKS['pre_item_update']['processmaker'] = $hooks;
|
$PLUGIN_HOOKS['pre_item_update']['processmaker'] = $hooks;
|
||||||
|
|
||||||
$hooks = ['TicketSatisfaction' => 'plugin_item_update_processmaker_satisfaction'];
|
$hooks = ['TicketSatisfaction' => 'plugin_item_update_processmaker_satisfaction'];
|
||||||
foreach($objects as $obj){
|
foreach ($objects as $obj) {
|
||||||
$hooks[$obj.'Task'] = 'plugin_item_update_processmaker_tasks';
|
$hooks[$obj.'Task'] = 'plugin_item_update_processmaker_tasks';
|
||||||
}
|
}
|
||||||
$PLUGIN_HOOKS['item_update']['processmaker'] = $hooks;
|
$PLUGIN_HOOKS['item_update']['processmaker'] = $hooks;
|
||||||
|
|
||||||
$hooks = [];
|
$hooks = [];
|
||||||
foreach($objects as $obj){
|
foreach ($objects as $obj) {
|
||||||
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_add_processmaker'];
|
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_add_processmaker'];
|
||||||
}
|
}
|
||||||
$PLUGIN_HOOKS['item_add']['processmaker'] = $hooks;
|
$PLUGIN_HOOKS['item_add']['processmaker'] = $hooks;
|
||||||
$PLUGIN_HOOKS['item_get_datas']['processmaker'] = array(
|
|
||||||
'NotificationTargetTicket' => array('PluginProcessmakerProcessmaker', 'plugin_item_get_datas_processmaker')
|
|
||||||
);
|
|
||||||
|
|
||||||
$PLUGIN_HOOKS['item_get_pdfdatas']['processmaker'] = array(
|
|
||||||
'PluginPdfTicketTask' => array('PluginProcessmakerProcessmaker', 'plugin_item_get_pdfdatas_processmaker')
|
|
||||||
);
|
|
||||||
|
|
||||||
$hooks = [];
|
$hooks = [];
|
||||||
foreach($objects as $obj){
|
foreach ($objects as $obj) {
|
||||||
$hooks[$obj.'_User'] = 'plugin_pre_item_purge_processmaker';
|
$hooks['NotificationTarget'.$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_data_processmaker'];
|
||||||
}
|
}
|
||||||
$PLUGIN_HOOKS['pre_item_purge']['processmaker'] = $hooks;
|
$PLUGIN_HOOKS['item_get_datas']['processmaker'] = $hooks;
|
||||||
|
|
||||||
$hooks = [];
|
$hooks = [];
|
||||||
foreach($objects as $obj){
|
foreach ($objects as $obj) {
|
||||||
$hooks[$obj.'_User'] = 'plugin_item_purge_processmaker';
|
$hooks["PluginPdf'.$obj.'Task"] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_pdfdata_processmaker'];
|
||||||
}
|
}
|
||||||
$PLUGIN_HOOKS['item_purge']['processmaker'] = $hooks;
|
$PLUGIN_HOOKS['item_get_pdfdatas']['processmaker'] = $hooks;
|
||||||
|
|
||||||
|
//$hooks = [];
|
||||||
|
//foreach($objects as $obj){
|
||||||
|
// $hooks[$obj.'_User'] = 'plugin_pre_item_purge_processmaker';
|
||||||
|
//}
|
||||||
|
//$PLUGIN_HOOKS['pre_item_purge']['processmaker'] = $hooks;
|
||||||
|
|
||||||
|
//$hooks = [];
|
||||||
|
//foreach($objects as $obj){
|
||||||
|
// $hooks[$obj.'_User'] = 'plugin_item_purge_processmaker';
|
||||||
|
//}
|
||||||
|
//$PLUGIN_HOOKS['item_purge']['processmaker'] = $hooks;
|
||||||
|
|
||||||
$plugin = new Plugin();
|
$plugin = new Plugin();
|
||||||
if ($plugin->isActivated('processmaker')
|
if ($plugin->isActivated('processmaker')
|
||||||
&& Session::getLoginUserID() ) {
|
&& Session::getLoginUserID() ) {
|
||||||
$PLUGIN_HOOKS['add_javascript']['processmaker'] = array("js/domain.js.php");
|
|
||||||
$url = explode("/", $_SERVER['PHP_SELF']);
|
$url = explode("/", $_SERVER['PHP_SELF']);
|
||||||
$pageName = explode("?", array_pop($url));
|
$pageName = explode("?", array_pop($url));
|
||||||
switch ($pageName[0]) {
|
switch ($pageName[0]) {
|
||||||
@@ -106,6 +110,16 @@ function plugin_init_processmaker() {
|
|||||||
case "helpdesk.public.php":
|
case "helpdesk.public.php":
|
||||||
$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/helpdesk.public.js.php";
|
$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/helpdesk.public.js.php";
|
||||||
break;
|
break;
|
||||||
|
case "planning.php":
|
||||||
|
$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/planning.js";
|
||||||
|
break;
|
||||||
|
case "central.php":
|
||||||
|
$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/central.js";
|
||||||
|
break;
|
||||||
|
case "case.form.php":
|
||||||
|
case "processmaker.helpdesk.form.php" :
|
||||||
|
$PLUGIN_HOOKS['add_javascript']['processmaker'] = ["js/domain.js.php"];
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -118,22 +132,30 @@ function plugin_init_processmaker() {
|
|||||||
// otherwise post-only users can't see cases and then can't act on a case task.
|
// otherwise post-only users can't see cases and then can't act on a case task.
|
||||||
$PLUGIN_HOOKS['change_profile']['processmaker'] = 'plugin_processmaker_change_profile';
|
$PLUGIN_HOOKS['change_profile']['processmaker'] = 'plugin_processmaker_change_profile';
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Get the name and the version of the plugin - Needed
|
// Get the name and the version of the plugin - Needed
|
||||||
function plugin_version_processmaker() {
|
function plugin_version_processmaker() {
|
||||||
return array ('name' => 'Process Maker',
|
return [
|
||||||
'version' => '3.3.1',
|
'name' => 'Process Maker',
|
||||||
'author' => 'Olivier Moron',
|
'version' => PROCESSMAKER_VERSION,
|
||||||
'homepage' => 'https://github.com/tomolimo/processmaker',
|
'author' => 'Olivier Moron',
|
||||||
'minGlpiVersion' => '9.1');
|
'license' => 'GPLv3+',
|
||||||
|
'homepage' => 'https://github.com/tomolimo/processmaker',
|
||||||
|
'requirements' => [
|
||||||
|
'glpi' => [
|
||||||
|
'min' => '9.2',
|
||||||
|
'max' => '9.2.99'
|
||||||
|
],
|
||||||
|
]
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
// Optional : check prerequisites before install : may print errors or add to message after redirect
|
// Optional : check prerequisites before install : may print errors or add to message after redirect
|
||||||
function plugin_processmaker_check_prerequisites() {
|
function plugin_processmaker_check_prerequisites() {
|
||||||
if (version_compare(GLPI_VERSION, '9.1', 'lt') || version_compare(GLPI_VERSION, '9.3', 'ge')) {
|
if (version_compare(GLPI_VERSION, '9.2', 'lt') || version_compare(GLPI_VERSION, '9.3', 'ge')) {
|
||||||
echo "This plugin requires GLPI >= 9.1 and < 9.3";
|
echo "This plugin requires GLPI >= 9.2 and < 9.3";
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user