Version 3.4.5
Compatibility with GLPI 9.2
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
# 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
|
||||
|
||||
An IRC channel is available: #processmaker-glpi on https://webchat.freenode.net/
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
if (strpos($_SERVER['PHP_SELF'],"asynchronousdatas.php")) {
|
||||
if (strpos($_SERVER['PHP_SELF'], "asynchronousdatas.php")) {
|
||||
$AJAX_INCLUDE = 1;
|
||||
define('GLPI_ROOT','../../..');
|
||||
define('GLPI_ROOT', '../../..');
|
||||
include (GLPI_ROOT."/inc/includes.php");
|
||||
Html::header_nocache();
|
||||
}
|
||||
@@ -10,38 +10,38 @@ if (!defined('GLPI_ROOT')) {
|
||||
die("Can not access directly to this file");
|
||||
}
|
||||
|
||||
include_once dirname(__FILE__)."/../inc/crontaskaction.class.php" ;
|
||||
if( isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS' ) {
|
||||
header("Access-Control-Allow-Origin: *") ;
|
||||
include_once dirname(__FILE__)."/../inc/crontaskaction.class.php";
|
||||
if (isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS') {
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Access-Control-Allow-Methods: POST");
|
||||
header("Access-Control-Allow-Headers: Content-Type");
|
||||
} else {
|
||||
header("Access-Control-Allow-Origin: *") ;
|
||||
header("Access-Control-Allow-Origin: *");
|
||||
header("Content-Type: application/json; charset=UTF-8");
|
||||
|
||||
if( isset($_SERVER['REQUEST_METHOD']) ) {
|
||||
switch($_SERVER['REQUEST_METHOD']) {
|
||||
if (isset($_SERVER['REQUEST_METHOD'])) {
|
||||
switch ($_SERVER['REQUEST_METHOD']) {
|
||||
case 'POST' :
|
||||
$request_body = file_get_contents('php://input');
|
||||
$datas = json_decode($request_body, true);
|
||||
|
||||
$asyncdata = new PluginProcessmakerCrontaskaction ;
|
||||
if( isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA ) {
|
||||
$asyncdata = new PluginProcessmakerCrontaskaction;
|
||||
if (isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA) {
|
||||
$initialdatas = json_decode($asyncdata->fields['postdata'], true);
|
||||
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] ) ;
|
||||
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] );
|
||||
$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 ) ) ;
|
||||
$ret = array( 'code' => '0', 'message' => 'Done' );
|
||||
$asyncdata->update( [ 'id' => $datas['id'], 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'postdata' => $postdata ] );
|
||||
$ret = [ 'code' => '0', 'message' => 'Done' ];
|
||||
} 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;
|
||||
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']);
|
||||
}
|
||||
|
||||
$processes = array();
|
||||
$processes = [];
|
||||
|
||||
// Empty search text : display first
|
||||
if (empty($_REQUEST['searchText'])) {
|
||||
if ($_REQUEST['display_emptychoice']) {
|
||||
if (($one_item < 0) || ($one_item == 0)) {
|
||||
array_push($processes, array('id' => 0,
|
||||
'text' => $_REQUEST['emptylabel']));
|
||||
array_push($processes, ['id' => 0,
|
||||
'text' => $_REQUEST['emptylabel']]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$processall = (isset($_REQUEST['specific_tags']['process_restrict']) && !$_REQUEST['specific_tags']['process_restrict']);
|
||||
|
||||
$result = PluginProcessmakerProcess::getSqlSearchResult(false, $search);
|
||||
|
||||
if ($DB->numrows($result)) {
|
||||
while ($data = $DB->fetch_array($result)) {
|
||||
$process_entities = PluginProcessmakerProcess::getEntitiesForProfileByProcess($data["id"], $_SESSION['glpiactiveprofile']['id'], true);
|
||||
if (in_array( $_REQUEST["entity_restrict"], $process_entities)) {
|
||||
array_push( $processes, array( 'id' => $data["id"],
|
||||
'text' => $data["name"] ));
|
||||
if ($processall || in_array( $_REQUEST["entity_restrict"], $process_entities)) {
|
||||
array_push( $processes, [ 'id' => $data["id"],
|
||||
'text' => $data["name"] ]);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ if (!defined('GLPI_ROOT')) {
|
||||
Session::checkLoginUser();
|
||||
|
||||
$PM_DB = new PluginProcessmakerDB;
|
||||
$dbu = new DbUtils;
|
||||
|
||||
if (!isset($_REQUEST['right'])) {
|
||||
$_REQUEST['right'] = "all";
|
||||
@@ -33,7 +34,7 @@ if (!isset($_REQUEST['all'])) {
|
||||
$_REQUEST['all'] = 0;
|
||||
}
|
||||
|
||||
$used = array();
|
||||
$used = [];
|
||||
|
||||
if (isset($_REQUEST['used'])) {
|
||||
$used = $_REQUEST['used'];
|
||||
@@ -64,13 +65,13 @@ if ($one_item < 0) {
|
||||
WHERE `glpi_users`.`id` = '$one_item';";
|
||||
$result = $DB->query($query);
|
||||
}
|
||||
$users = array();
|
||||
$users = [];
|
||||
|
||||
// Count real items returned
|
||||
$count = 0;
|
||||
if ($DB->numrows($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"]);
|
||||
$logins[$data["id"]] = $data["name"];
|
||||
}
|
||||
@@ -82,17 +83,17 @@ if (!function_exists('dpuser_cmp')) {
|
||||
}
|
||||
}
|
||||
|
||||
$datas = array();
|
||||
$datas = [];
|
||||
|
||||
// Display first if empty search
|
||||
if ($_REQUEST['page'] == 1 && empty($_REQUEST['searchText'])) {
|
||||
if (($one_item < 0) || ($one_item == 0)) {
|
||||
if ($_REQUEST['all'] == 0) {
|
||||
array_push($datas, array('id' => 0,
|
||||
'text' => Dropdown::EMPTY_VALUE));
|
||||
array_push($datas, ['id' => 0,
|
||||
'text' => Dropdown::EMPTY_VALUE]);
|
||||
} else if ($_REQUEST['all'] == 1) {
|
||||
array_push($datas, array('id' => 0,
|
||||
'text' => __('All')));
|
||||
array_push($datas, ['id' => 0,
|
||||
'text' => __('All')]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -101,9 +102,9 @@ if (count($users)) {
|
||||
foreach ($users as $ID => $output) {
|
||||
$title = sprintf('%1$s - %2$s', $output, $logins[$ID]);
|
||||
|
||||
array_push($datas, array('id' => $ID,
|
||||
array_push($datas, ['id' => $ID,
|
||||
'text' => $output,
|
||||
'title' => $title));
|
||||
'title' => $title]);
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ if (!defined('GLPI_ROOT')) {
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
$PM_SOAP = new PluginProcessmakerProcessmaker; // not used in this context, just here to define the type of $PM_SOAP
|
||||
$PM_DB = new PluginProcessmakerDB;
|
||||
$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='delThread' value='".$_REQUEST['delThread']."'>";
|
||||
|
||||
PluginProcessmakerUser::dropdown( array('name' => 'users_id_recipient',
|
||||
PluginProcessmakerUser::dropdown( ['name' => 'users_id_recipient',
|
||||
'value' => $_REQUEST['users_id'],
|
||||
'used' => [$_REQUEST['users_id']],
|
||||
'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',
|
||||
'rand' => $rand,
|
||||
'width' => '',
|
||||
'specific_tags' => array('taskGuid' => $_REQUEST['taskGuid'])));
|
||||
'specific_tags' => ['taskGuid' => $_REQUEST['taskGuid']]]);
|
||||
echo " ";
|
||||
echo "<input type='submit' name='reassign' value='".__('Re-assign', 'processmaker')."' class='submit'>";
|
||||
Html::closeForm(true);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
$locCase = new PluginProcessmakerCase();
|
||||
|
||||
@@ -28,8 +29,7 @@ if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'route' && isset( $_REQ
|
||||
}
|
||||
glpi_processmaker_case_reload_page();
|
||||
|
||||
} else
|
||||
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
|
||||
} else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') {
|
||||
// delete case from case table, this will also delete the tasks
|
||||
if ($locCase->getFromDB($_POST['cases_id']) && $locCase->deleteCase()) {
|
||||
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
|
||||
$locCase->redirectToList();
|
||||
|
||||
} else
|
||||
if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'cancel') {
|
||||
} else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'cancel') {
|
||||
// cancel case from PM
|
||||
$locCase = new PluginProcessmakerCase;
|
||||
$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);
|
||||
}
|
||||
Html::back();
|
||||
} else
|
||||
if (isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && isset( $_REQUEST['form']['APP_UID'])) {
|
||||
} else if (isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && isset( $_REQUEST['form']['APP_UID'])) {
|
||||
// Claim task management
|
||||
// here we are in a Claim request
|
||||
$myCase = new PluginProcessmakerCase;
|
||||
@@ -69,8 +67,7 @@ if (isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && iss
|
||||
}
|
||||
glpi_processmaker_case_reload_page();
|
||||
|
||||
} else
|
||||
if (isset($_REQUEST['id']) && $_REQUEST['id'] > 0) {
|
||||
} else if (isset($_REQUEST['id']) && $_REQUEST['id'] > 0) {
|
||||
|
||||
if ($_SESSION["glpiactiveprofile"]["interface"] == "helpdesk") {
|
||||
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 (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');
|
||||
} else {
|
||||
Html::displayRightError();
|
||||
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Plugin::load('processmaker', true);
|
||||
Session::checkLoginUser();
|
||||
|
||||
Plugin::load('processmaker', true); // ???
|
||||
|
||||
if (!isset($_REQUEST["id"])) {
|
||||
$_REQUEST["id"] = "";
|
||||
@@ -14,11 +16,11 @@ if (isset($_REQUEST["update"])) {
|
||||
$PluginCaselink->check($_REQUEST['id'], UPDATE);
|
||||
$PluginCaselink->update($_REQUEST);
|
||||
Html::back();
|
||||
} elseif (isset($_REQUEST['add'])) {
|
||||
} else if (isset($_REQUEST['add'])) {
|
||||
$PluginCaselink->check($_REQUEST['id'], UPDATE);
|
||||
$PluginCaselink->add($_REQUEST);
|
||||
Html::back();
|
||||
} elseif (isset($_REQUEST['purge'])) {
|
||||
} else if (isset($_REQUEST['purge'])) {
|
||||
$PluginCaselink->check($_REQUEST['id'], PURGE);
|
||||
$PluginCaselink->delete($_REQUEST, true);
|
||||
$PluginCaselink->redirectToList();
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
include_once ("../../../inc/includes.php");
|
||||
|
||||
Session::checkLoginUser();
|
||||
|
||||
Plugin::load('processmaker', true); // ???
|
||||
|
||||
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)
|
||||
$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_ITEM_TYPE' => 'Ticket',
|
||||
'GLPI_URL' => $CFG_GLPI['url_base']) );
|
||||
'GLPI_URL' => $CFG_GLPI['url_base']] );
|
||||
if ($resultCase->status_code == 0) {
|
||||
// case is created
|
||||
// Must show it...
|
||||
@@ -87,7 +87,7 @@ switch ($_POST["action"]) {
|
||||
Session::addMessageAfterRedirect(__('Error re-assigning task: ', 'processmaker').$pmResponse->message, true, ERROR);
|
||||
}
|
||||
} 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'])) {
|
||||
// // delete case from case table, this will also delete the tasks
|
||||
|
||||
@@ -18,16 +18,16 @@ function processMakerShowProcessList ($ID, $from_helpdesk) {
|
||||
$rand = rand();
|
||||
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 "<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'>";
|
||||
_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='id' value='-1'>";
|
||||
echo "<input type='hidden' name='itemtype' value='Ticket'>";
|
||||
echo "<input type='hidden' name='itilcategories_id' value='".$_REQUEST['itilcategories_id']."'>";
|
||||
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 "<input type='submit' name='additem' value='Start' class='submit'>";
|
||||
echo "</td></tr>";
|
||||
@@ -44,7 +44,7 @@ function processMakerShowProcessList ($ID, $from_helpdesk) {
|
||||
* @param mixed $ID
|
||||
* @param mixed $from_helpdesk
|
||||
*/
|
||||
function processMakerShowCase( $ID, $from_helpdesk ) {
|
||||
function processMakerShowCase($ID, $from_helpdesk) {
|
||||
global $CFG_GLPI, $PM_SOAP;
|
||||
|
||||
$caseInfo = $PM_SOAP->getCaseInfo( $_REQUEST['case_guid'] );
|
||||
@@ -101,10 +101,10 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
|
||||
$xpath = new DOMXPath($dom);
|
||||
|
||||
// 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]';
|
||||
$res = $xpath->query($xpath_str);
|
||||
foreach($res as $elt) {
|
||||
foreach ($res as $elt) {
|
||||
$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
|
||||
$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;');
|
||||
}
|
||||
|
||||
$res = $xpath->query('//*[@name="content"]/ancestor::td[1]');
|
||||
foreach($res as $elt) {
|
||||
foreach ($res as $elt) {
|
||||
// there should be only one td
|
||||
$elt->setAttribute( 'colspan', '2');
|
||||
}
|
||||
@@ -148,11 +148,11 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
|
||||
$pmCaseUser = $caseInfo->currentUsers[0]; // by default
|
||||
$paramsURL = "DEL_INDEX={$pmCaseUser->delIndex}&action={$caseInfo->caseStatus}";
|
||||
|
||||
$iframe->setAttribute('id', 'caseiframe' ) ;
|
||||
$iframe->setAttribute('onload', "onLoadFrame( event, '{$caseInfo->caseId}', {$pmCaseUser->delIndex}, {$caseInfo->caseNumber}, '{$caseInfo->processName}') ;" ) ;
|
||||
$iframe->setAttribute('width', '100%' ) ;
|
||||
$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('id', 'caseiframe' );
|
||||
$iframe->setAttribute('onload', "onLoadFrame( event, '{$caseInfo->caseId}', {$pmCaseUser->delIndex}, {$caseInfo->caseNumber}, '{$caseInfo->processName}') ;" );
|
||||
$iframe->setAttribute('width', '100%' );
|
||||
$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']}" );
|
||||
|
||||
// set the width and the title of the first table th
|
||||
$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)
|
||||
|| Session::haveRight('task', TicketTask::SEEPUBLIC)
|
||||
|| Session::haveRightsOr('ticketvalidation', array(TicketValidation::VALIDATEREQUEST,
|
||||
TicketValidation::VALIDATEINCIDENT))) {
|
||||
|| Session::haveRightsOr('ticketvalidation', [TicketValidation::VALIDATEREQUEST,
|
||||
TicketValidation::VALIDATEINCIDENT])) {
|
||||
Html::redirect($CFG_GLPI['root_doc']."/front/ticket.php");
|
||||
|
||||
} else if (Session::haveRight('reservation', ReservationItem::RESERVEANITEM)) {
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
// Original Author of file: MoronO
|
||||
// Purpose of file: mimic tracking.injector.php
|
||||
// ----------------------------------------------------------------------
|
||||
if( isset( $_REQUEST['_glpi_csrf_token'] ) ) {
|
||||
define('GLPI_KEEP_CSRF_TOKEN', true) ;
|
||||
if (isset( $_REQUEST['_glpi_csrf_token'] )) {
|
||||
define('GLPI_KEEP_CSRF_TOKEN', true);
|
||||
}
|
||||
$PM_POST = $_POST;
|
||||
$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
|
||||
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["itilcategories_id"])
|
||||
&& isset($_POST["entities_id"])) {
|
||||
@@ -33,26 +33,26 @@ if( isset($_POST["_from_helpdesk"]) && $_POST["_from_helpdesk"] == 1
|
||||
// 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.
|
||||
|
||||
$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
|
||||
$processQt = count( $processList ) ;
|
||||
if( $processQt == 1 ) {
|
||||
$processQt = count( $processList );
|
||||
if ($processQt == 1) {
|
||||
$_POST['action']='newcase';
|
||||
$_POST['plugin_processmaker_processes_id'] = $processList[0]['id'];
|
||||
include (GLPI_ROOT . "/plugins/processmaker/front/processmaker.form.php");
|
||||
die() ;
|
||||
} elseif( $processQt > 1 ) {
|
||||
die();
|
||||
} else if ($processQt > 1) {
|
||||
// in this case we should show the process dropdown selection
|
||||
include (GLPI_ROOT . "/plugins/processmaker/front/processmaker.helpdesk.form.php");
|
||||
die() ;
|
||||
} else{
|
||||
die();
|
||||
} else {
|
||||
// in this case should start RUMT
|
||||
// if and only if itilcategories_id matches one of the 'User Management' categories
|
||||
// could be done via ARBehviours or RUMT itself
|
||||
$userManagementCat = array( 100556, 100557, 100558 ) ;
|
||||
$plug = new Plugin ;
|
||||
if( $processQt == 0 && in_array( $_POST["itilcategories_id"], $userManagementCat) && $plug->isActivated('rayusermanagementticket' )) {
|
||||
$userManagementCat = [ 100556, 100557, 100558 ];
|
||||
$plug = new Plugin;
|
||||
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");
|
||||
}
|
||||
}
|
||||
|
||||
208
hook.php
208
hook.php
@@ -2,38 +2,16 @@
|
||||
|
||||
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) {
|
||||
switch ($type) {
|
||||
case 'PluginProcessmakerProcess' :
|
||||
if (plugin_processmaker_haveRight('config', UPDATE)) {
|
||||
return array('plugin_processmaker_taskrefresh' => __('Synchronize Task List', 'processmaker'));
|
||||
return ['plugin_processmaker_taskrefresh' => __('Synchronize Task List', 'processmaker')];
|
||||
}
|
||||
break;
|
||||
case 'PluginProcessmakerProcess_Profile' :
|
||||
if (plugin_processmaker_haveRight('config', UPDATE)) {
|
||||
return array('purge' => __('Delete permanently'));
|
||||
return ['purge' => __('Delete permanently')];
|
||||
}
|
||||
break;
|
||||
//case 'PluginProcessmakerCase' :
|
||||
@@ -42,7 +20,7 @@ function plugin_processmaker_MassiveActions($type) {
|
||||
// }
|
||||
//break;
|
||||
}
|
||||
return array();
|
||||
return [];
|
||||
}
|
||||
|
||||
|
||||
@@ -113,8 +91,8 @@ function plugin_processmaker_MassiveActions($type) {
|
||||
* @return true or die!
|
||||
*/
|
||||
function plugin_processmaker_install() {
|
||||
|
||||
if (!arTableExists("glpi_plugin_processmaker_cases")) {
|
||||
global $DB;
|
||||
if (!$DB->tableExists("glpi_plugin_processmaker_cases")) {
|
||||
// new installation
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/install/install.php");
|
||||
processmaker_install();
|
||||
@@ -127,9 +105,9 @@ function plugin_processmaker_install() {
|
||||
|
||||
// To be called for each task managed by the plugin
|
||||
// task in class
|
||||
CronTask::Register('PluginProcessmakerProcessmaker', 'pmusers', DAY_TIMESTAMP, array( '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', 'pmtaskactions', MINUTE_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, ['param' => 10, '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'
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/profile.class.php");
|
||||
@@ -148,7 +126,7 @@ function plugin_processmaker_uninstall() {
|
||||
|
||||
function plugin_processmaker_getAddSearchOptions($itemtype) {
|
||||
|
||||
$sopt = array();
|
||||
$sopt = [];
|
||||
// TODO add Change and Problem + other fields to the search
|
||||
if ($itemtype == 'Ticket') {
|
||||
$sopt[10001]['table'] = 'glpi_plugin_processmaker_cases';
|
||||
@@ -179,7 +157,7 @@ function plugin_processmaker_getAddSearchOptions($itemtype) {
|
||||
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) {
|
||||
|
||||
@@ -209,7 +187,7 @@ function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
|
||||
global $DB;//, $PM_SOAP;
|
||||
|
||||
if (isset($_SESSION['glpiname'])) { // && $parm->getType() == 'Ticket') {
|
||||
$locVar = array( );
|
||||
$locVar = [ ];
|
||||
foreach ($parm->input as $key => $val) {
|
||||
switch ($key) {
|
||||
case 'global_validation' :
|
||||
@@ -218,7 +196,10 @@ function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
|
||||
case 'itilcategories_id' :
|
||||
$locVar[ 'GLPI_ITEM_ITIL_CATEGORY_ID' ] = $val;
|
||||
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_ITEM_DUE_DATE' ] = $val;
|
||||
break;
|
||||
@@ -239,7 +220,7 @@ function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
|
||||
$itemType = $parm->getType();
|
||||
|
||||
$locCase = new PluginProcessmakerCase;
|
||||
foreach(PluginProcessmakerCase::getIDsFromItem($itemType, $itemId ) as $cases_id){
|
||||
foreach (PluginProcessmakerCase::getIDsFromItem($itemType, $itemId ) as $cases_id) {
|
||||
$locCase->getFromDB($cases_id);
|
||||
$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
|
||||
* @param mixed $parm is the object
|
||||
*/
|
||||
function plugin_pre_item_purge_processmaker ( $parm ) {
|
||||
///**
|
||||
// * Summary of plugin_pre_item_purge_processmaker
|
||||
// * @param mixed $parm is the object
|
||||
// */
|
||||
//function plugin_pre_item_purge_processmaker ( $parm ) {
|
||||
|
||||
if ($parm->getType() == 'Ticket_User' && is_array( $parm->fields ) && isset( $parm->fields['type'] ) && $parm->fields['type'] == 2) {
|
||||
$itemId = $parm->fields['tickets_id'];
|
||||
$itemType = 'Ticket';
|
||||
$technicians = PluginProcessmakerProcessmaker::getItemUsers( $itemType, $itemId, 2 ); // 2 for technicians
|
||||
// if ($parm->getType() == 'Ticket_User' && is_array( $parm->fields ) && isset( $parm->fields['type'] ) && $parm->fields['type'] == 2) {
|
||||
// $itemId = $parm->fields['tickets_id'];
|
||||
// $itemType = 'Ticket';
|
||||
// $technicians = PluginProcessmakerProcessmaker::getItemUsers( $itemType, $itemId, 2 ); // 2 for technicians
|
||||
|
||||
if (PluginProcessmakerCase::getIDFromItem($itemType, $itemId) && count($technicians) == 1) {
|
||||
$parm->input = null; // to cancel deletion of the last tech in the ticket
|
||||
}
|
||||
}
|
||||
}
|
||||
// if (PluginProcessmakerCase::getIDFromItem($itemType, $itemId) && count($technicians) == 1) {
|
||||
// $parm->input = null; // to cancel deletion of the last tech in the ticket
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
/**
|
||||
* Summary of plugin_item_purge_processmaker
|
||||
* @param mixed $parm is the object
|
||||
*/
|
||||
function plugin_item_purge_processmaker($parm) {
|
||||
global $DB, $PM_SOAP;
|
||||
///**
|
||||
// * Summary of plugin_item_purge_processmaker
|
||||
// * @param mixed $parm is the object
|
||||
// */
|
||||
//function plugin_item_purge_processmaker($parm) {
|
||||
// global $DB, $PM_SOAP;
|
||||
|
||||
//$objects = ['Ticket', 'Change', 'Problem'];
|
||||
$object_users = ['Ticket_User', 'Change_User', 'Problem_User'];
|
||||
// //$objects = ['Ticket', 'Change', 'Problem'];
|
||||
// $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
|
||||
// and re-assign them to the first tech in the list !!!!
|
||||
// // 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 !!!!
|
||||
|
||||
$itemType = strtolower(explode('_', $parm->getType())[0]); // $parm->getType() returns 'Ticket_User';
|
||||
$itemId = $parm->fields[$itemType.'s_id'];
|
||||
$cases = PluginProcessmakerCase::getIDsFromItem($itemType, $itemId);
|
||||
foreach ($cases as $cases_id) {
|
||||
// cases are existing for this item
|
||||
$locCase = new PluginProcessmakerCase;
|
||||
if ($locCase->getFromDB($cases_id)) {
|
||||
$technicians = PluginProcessmakerProcessmaker::getItemUsers($itemType, $itemId, CommonITILActor::ASSIGN);
|
||||
// $itemType = strtolower(explode('_', $parm->getType())[0]); // $parm->getType() returns 'Ticket_User';
|
||||
// $itemId = $parm->fields[$itemType.'s_id'];
|
||||
// $cases = PluginProcessmakerCase::getIDsFromItem($itemType, $itemId);
|
||||
// foreach ($cases as $cases_id) {
|
||||
// // cases are existing for this item
|
||||
// $locCase = new PluginProcessmakerCase;
|
||||
// if ($locCase->getFromDB($cases_id)) {
|
||||
// $technicians = PluginProcessmakerProcessmaker::getItemUsers($itemType, $itemId, CommonITILActor::ASSIGN);
|
||||
|
||||
$locVars = array( 'GLPI_TICKET_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_ITEM_TECHNICIAN_PM_ID' => $technicians[0]['pm_id']
|
||||
);
|
||||
// $locVars = array( 'GLPI_TICKET_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_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 :))!
|
||||
$caseInfo = $locCase->getCaseInfo( );
|
||||
if ($caseInfo !== false) {
|
||||
$locCase->sendVariables( $locVars);
|
||||
// need to get info on the thread of the GLPI current user
|
||||
// we must retreive currentGLPI user from this array
|
||||
$GLPICurrentPMUserId = PluginProcessmakerUser::getPMUserId( $parm->fields['users_id'] );
|
||||
if (property_exists($caseInfo, 'currentUsers') && is_array( $caseInfo->currentUsers )) {
|
||||
foreach ($caseInfo->currentUsers as $caseUser) {
|
||||
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'] );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// // and we must find all tasks assigned to this former user and re-assigned them to new user (if any :))!
|
||||
// $caseInfo = $locCase->getCaseInfo( );
|
||||
// if ($caseInfo !== false) {
|
||||
// $locCase->sendVariables( $locVars);
|
||||
// // need to get info on the thread of the GLPI current user
|
||||
// // we must retreive currentGLPI user from this array
|
||||
// $GLPICurrentPMUserId = PluginProcessmakerUser::getPMUserId( $parm->fields['users_id'] );
|
||||
// if (property_exists($caseInfo, 'currentUsers') && is_array( $caseInfo->currentUsers )) {
|
||||
// foreach ($caseInfo->currentUsers as $caseUser) {
|
||||
// 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'] );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
function plugin_processmaker_post_init() {
|
||||
global $PM_DB, $PM_SOAP;
|
||||
@@ -346,19 +326,19 @@ function plugin_processmaker_post_init() {
|
||||
if (!isset($PM_SOAP)) {
|
||||
$PM_SOAP = new PluginProcessmakerProcessmaker;
|
||||
// and default login is current running user if any
|
||||
if (Session::getLoginUserID() ) {
|
||||
if (Session::getLoginUserID()) {
|
||||
$PM_SOAP->login();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function plugin_processmaker_giveItem($itemtype,$ID,$data,$num) {
|
||||
function plugin_processmaker_giveItem($itemtype, $ID, $data, $num) {
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
function plugin_processmaker_change_profile($parm) {
|
||||
function plugin_processmaker_change_profile() {
|
||||
if ($_SESSION['glpiactiveprofile']['interface'] == "helpdesk") {
|
||||
// must add the rights for simplified interface
|
||||
$_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) {
|
||||
|
||||
// Must check the condition
|
||||
$casevariables = array();
|
||||
$casevariables = [];
|
||||
|
||||
$matches = array();
|
||||
$matches = [];
|
||||
if (preg_match_all( "/@@(\w+)/u", $targetTask['sourcecondition'], $matches )) {
|
||||
$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) {
|
||||
$targetTask['targetactions'][$actionvalue['name']] = $actionvalue['value'];
|
||||
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
|
||||
// then will try to routeCase for each tasks in $val
|
||||
|
||||
$postdata = array();
|
||||
$postdata = [];
|
||||
foreach ($targetTask['targetactions'] as $action => $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['form']['btnGLPISendRequest'] = 'submit';
|
||||
|
||||
$externalapplicationparams = array();
|
||||
$externalapplicationparams = [];
|
||||
if ($externalapplication) {
|
||||
// must call curl
|
||||
foreach ($externalapplication['params'] as $paramname => $variable) {
|
||||
@@ -459,17 +439,6 @@ function plugin_item_update_processmaker_tasks($parm) {
|
||||
}
|
||||
|
||||
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 );
|
||||
foreach ($taskCase as $task) {
|
||||
// search for target task guid
|
||||
@@ -485,7 +454,7 @@ function plugin_item_update_processmaker_tasks($parm) {
|
||||
$pmconfig = $PM_SOAP->config; //PluginProcessmakerConfig::getInstance();
|
||||
|
||||
$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(),
|
||||
//'itemtype' => $itemtype,
|
||||
//'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),
|
||||
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
|
||||
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
|
||||
),
|
||||
],
|
||||
null,
|
||||
false);
|
||||
|
||||
@@ -510,7 +479,7 @@ function plugin_item_update_processmaker_tasks($parm) {
|
||||
|
||||
curl_setopt($ch, CURLOPT_POST, 1);
|
||||
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_HTTPPROXYTUNNEL, 1 ) ;
|
||||
@@ -538,7 +507,7 @@ function plugin_item_update_processmaker_tasks($parm) {
|
||||
$postdata['DEL_INDEX'] = $case['del_index'];
|
||||
|
||||
$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(),
|
||||
//'itemtype' => $itemtype,
|
||||
//'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),
|
||||
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
|
||||
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
|
||||
),
|
||||
],
|
||||
null,
|
||||
false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($targetTask['is_synchronous']) {
|
||||
// must call PluginProcessmakerProcessmaker::cronPMTaskActions()
|
||||
PluginProcessmakerProcessmaker::cronPMTaskActions();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
const COMPLETED = 'COMPLETED';
|
||||
const CANCELLED = 'CANCELLED';
|
||||
|
||||
static function getTypeName($nb=0) {
|
||||
static function getTypeName($nb = 0) {
|
||||
return _n('Process case', 'Process cases', $nb, 'processmaker');
|
||||
}
|
||||
|
||||
@@ -32,6 +32,10 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
// return Session::haveRightsOr('plugin_processmaker_case', [READ, UPDATE]);
|
||||
//}
|
||||
|
||||
//function canViewItem() {
|
||||
// return Session::haveRightsOr('plugin_processmaker_case', READ);
|
||||
//}
|
||||
|
||||
//static function canUpdate( ) {
|
||||
// return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
//}
|
||||
@@ -71,7 +75,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* @param mixed $withtemplate has template
|
||||
* @return array os strings
|
||||
*/
|
||||
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
|
||||
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||
if ($item->getType() == __CLASS__) {
|
||||
// get tab name for a case itself
|
||||
$tabname = __('Case', 'processmaker');
|
||||
@@ -99,7 +103,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* @param mixed $options
|
||||
* @return mixed
|
||||
*/
|
||||
function getName($options = array()){
|
||||
function getName($options = []) {
|
||||
return $this->fields['name'];
|
||||
}
|
||||
|
||||
@@ -128,7 +132,8 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
*/
|
||||
static function getIDsFromItem($itemtype, $items_id) {
|
||||
$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'];
|
||||
}
|
||||
return $ret;
|
||||
@@ -160,7 +165,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* @param mixed $vars
|
||||
* @return mixed
|
||||
*/
|
||||
function getVariables($vars=array()) {
|
||||
function getVariables($vars = []) {
|
||||
global $PM_SOAP;
|
||||
return $PM_SOAP->getVariables($this->fields['case_guid'], $vars);
|
||||
}
|
||||
@@ -171,7 +176,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* @param mixed $vars
|
||||
* @return A
|
||||
*/
|
||||
function sendVariables($vars = array()) {
|
||||
function sendVariables($vars = []) {
|
||||
global $PM_SOAP;
|
||||
return $PM_SOAP->sendVariables($this->fields['case_guid'], $vars);
|
||||
}
|
||||
@@ -182,7 +187,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* @param mixed $delIndex
|
||||
* @return stdClass, a getCaseInfoResponse object, or false exception occured
|
||||
*/
|
||||
function getCaseInfo($delIndex='') {
|
||||
function getCaseInfo($delIndex = '') {
|
||||
global $PM_SOAP;
|
||||
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 );
|
||||
|
||||
$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
|
||||
$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 = [];
|
||||
$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'";
|
||||
foreach($DB->request($query) as $task) {
|
||||
foreach ($DB->request($query) as $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}'";
|
||||
$tasks = [];
|
||||
foreach($PM_DB->request($query) as $row){
|
||||
foreach ($PM_DB->request($query) as $row) {
|
||||
$tasks[$row['DEL_INDEX']] = $row['DEL_DELEGATE_DATE'];
|
||||
}
|
||||
|
||||
@@ -318,7 +323,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
<th>".__('Current user', 'processmaker')."</th>
|
||||
<th>".__('Task delegation date', 'processmaker')."</th>
|
||||
</tr>";
|
||||
foreach($caseInfo->currentUsers as $currentTask) {
|
||||
foreach ($caseInfo->currentUsers as $currentTask) {
|
||||
$case_url = $this->getLinkURL().'&forcetab=PluginProcessmakerTask$';
|
||||
echo "<tr>";
|
||||
if (isset($case_tasks[$currentTask->delIndex])) {
|
||||
@@ -342,7 +347,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
} else {
|
||||
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>";
|
||||
}
|
||||
} else {
|
||||
@@ -368,7 +373,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* @param mixed $caseInfo
|
||||
* @param mixed $showparenturl
|
||||
*/
|
||||
function showShort($caseInfo, $showparenturl=false) {
|
||||
function showShort($caseInfo, $showparenturl = false) {
|
||||
|
||||
echo "<div class='center'>";
|
||||
echo "<table style='margin-bottom: 0px' class='tab_cadre_fixe'>";
|
||||
@@ -397,7 +402,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
|
||||
echo "<tr>";
|
||||
echo "<td class='tab_bg_2'>".$caseInfo->processName."</td>";
|
||||
if ($showparenturl){
|
||||
if ($showparenturl) {
|
||||
echo "<td class='tab_bg_2'>".$this->getLink()."</td>";
|
||||
} else {
|
||||
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'>".$caseInfo->caseId."</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'>".$caseInfo->updateDate."</td>";
|
||||
echo "<td class='tab_bg_2'>".Html::convDateTime($caseInfo->createDate)."</td>";
|
||||
echo "<td class='tab_bg_2'>".Html::convDateTime($caseInfo->updateDate)."</td>";
|
||||
//echo "<td class='tab_bg_2'>".$caseInfo->????."</td>";
|
||||
echo "</tr>";
|
||||
|
||||
@@ -447,10 +452,11 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
} else {
|
||||
if ($caseUser->userId == '') { // task to be claimed
|
||||
$tbctasks[] = $caseUser;
|
||||
} else
|
||||
} else {
|
||||
$infotasks[] = $caseUser;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// order task by "current user", then by "to be claimed", and then push to end "tasks assigned to another user"
|
||||
// then by delindex ASC in these three parts
|
||||
@@ -469,7 +475,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* @param mixed $tabnum
|
||||
* @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 "<table style='margin-bottom: 0px' class='tab_cadre_fixe'>";
|
||||
@@ -572,8 +578,8 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
";
|
||||
$result = $DB->query($query);
|
||||
|
||||
$cases = array();
|
||||
$used = array();
|
||||
$cases = [];
|
||||
$used = [];
|
||||
if ($numrows = $DB->numrows($result)) {
|
||||
while ($data = $DB->fetch_assoc($result)) {
|
||||
$cases[$data['id']] = $data;
|
||||
@@ -581,11 +587,11 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
}
|
||||
}
|
||||
|
||||
$columns = array('pname' => __('Process', 'processmaker'),
|
||||
$columns = ['pname' => __('Process', 'processmaker'),
|
||||
'name' => __('Title', 'processmaker'),
|
||||
'status' => __('Status', 'processmaker'),
|
||||
'sub' => __('Sub-case of', 'processmaker')
|
||||
);
|
||||
];
|
||||
|
||||
// check if item is not solved nor closed
|
||||
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'><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'>";
|
||||
if ($itemtype == 'Ticket') {
|
||||
$is_itemtype = "AND is_incident=1";
|
||||
@@ -618,7 +624,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
'condition' => "is_active=1 $is_itemtype"
|
||||
]);
|
||||
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>";
|
||||
Html::closeForm();
|
||||
echo "</div>";
|
||||
@@ -627,8 +633,8 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
echo "<div class='spaced'>";
|
||||
if ($canupdate && $numrows) {
|
||||
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
|
||||
$massiveactionparams = array('num_displayed' => $numrows,
|
||||
'container' => 'mass'.__CLASS__.$rand);
|
||||
$massiveactionparams = ['num_displayed' => $numrows,
|
||||
'container' => 'mass'.__CLASS__.$rand];
|
||||
Html::showMassiveActions($massiveactionparams);
|
||||
}
|
||||
echo "<table class='tab_cadre_fixehov'>";
|
||||
@@ -716,7 +722,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* @param mixed $tabnum
|
||||
* @param mixed $withtemplate
|
||||
*/
|
||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
|
||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||
global $PM_SOAP;
|
||||
|
||||
if ($item->getType() == __CLASS__) {
|
||||
@@ -741,7 +747,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* 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
|
||||
*/
|
||||
private function deleteTasks( ) {
|
||||
private function deleteTasks() {
|
||||
global $DB;
|
||||
$ret = false;
|
||||
|
||||
@@ -761,7 +767,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* 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
|
||||
*/
|
||||
function deleteCase( ) {
|
||||
function deleteCase() {
|
||||
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
|
||||
* @return true if tasks have been deleted from associated item and from case table
|
||||
*/
|
||||
private function cancelTasks( ) {
|
||||
private function cancelTasks() {
|
||||
global $DB;
|
||||
$ret = false;
|
||||
|
||||
@@ -793,13 +799,13 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* 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
|
||||
*/
|
||||
function cancelCase( ) {
|
||||
function cancelCase() {
|
||||
global $DB;
|
||||
$ret = false;
|
||||
|
||||
if (isset($this->fields['case_status']) && $this->fields['case_status'] == "TO_DO") {
|
||||
if ($this->cancelTasks()) {
|
||||
if ($this->update( array( 'id' => $this->getID(), 'case_status' => 'CANCELLED' ) )) {
|
||||
if ($this->update( [ 'id' => $this->getID(), 'case_status' => 'CANCELLED' ] )) {
|
||||
$ret=true;
|
||||
}
|
||||
}
|
||||
@@ -861,7 +867,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
//}
|
||||
|
||||
$front_page = "/plugins/processmaker/front";
|
||||
$menu = array();
|
||||
$menu = [];
|
||||
$menu['title'] = self::getTypeName(Session::getPluralNumber());
|
||||
$menu['page'] = "$front_page/case.php";
|
||||
$menu['links']['search'] = PluginProcessmakerCase::getSearchURL(false);
|
||||
@@ -880,15 +886,15 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
if (Session::haveRightsOr("config", [READ, UPDATE])) {
|
||||
$menu['options'][$option]['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
|
||||
}
|
||||
switch( $itemtype ) {
|
||||
switch ($itemtype) {
|
||||
case 'PluginProcessmakerCase':
|
||||
//if ($itemtype::canCreate()) {
|
||||
//$menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
|
||||
//}
|
||||
break ;
|
||||
break;
|
||||
default :
|
||||
$menu['options'][$option]['page'] = PluginProcessmakerProcess::getSearchURL(false);
|
||||
break ;
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -902,48 +908,75 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* @param array $options
|
||||
* @return mixed
|
||||
*/
|
||||
static function getSpecificValueToDisplay($field, $values, array $options=array()) {
|
||||
static function getSpecificValueToDisplay($field, $values, array $options = []) {
|
||||
global $PM_DB;
|
||||
if (!is_array($values)) {
|
||||
$values = array($field => $values);
|
||||
$values = [$field => $values];
|
||||
}
|
||||
switch ($field) {
|
||||
case 'id':
|
||||
$locCase = new self;
|
||||
|
||||
//$ret = $locCase->add(['id' => 300, 'itemtype' => 'Ticket', 'items_id' => 252108, 'case_guid' => 'azertyuiop', 'case_num' => -12] );
|
||||
$locCase->getFromDB($values['id']);
|
||||
return $locCase->getLink();
|
||||
|
||||
if (isset($options['searchopt']['processmaker_cases'])) {
|
||||
switch ($options['searchopt']['processmaker_cases']) {
|
||||
case 'creation_date':
|
||||
$res = $PM_DB->query('SELECT * FROM APPLICATION WHERE APP_NUMBER = '.$values['id']);
|
||||
if ($res->num_rows > 0) {
|
||||
$row = $PM_DB->fetch_assoc($res);
|
||||
return Html::convDateTime($row['APP_CREATE_DATE']);
|
||||
}
|
||||
//$locCase = new self;
|
||||
//$locCase->getFromDB($values['id']);
|
||||
//$caseInfo = $locCase->getCaseInfo();
|
||||
//return Html::convDateTime($caseInfo->createDate);
|
||||
break;
|
||||
case 'update_date':
|
||||
$res = $PM_DB->query('SELECT * FROM APPLICATION WHERE APP_NUMBER = '.$values['id']);
|
||||
if ($res->num_rows > 0) {
|
||||
$row = $PM_DB->fetch_assoc($res);
|
||||
return Html::convDateTime($row['APP_UPDATE_DATE']);
|
||||
}
|
||||
//$locCase = new self;
|
||||
//$locCase->getFromDB($values['id']);
|
||||
//$caseInfo = $locCase->getCaseInfo();
|
||||
//return Html::convDateTime($caseInfo->updateDate);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return '-';
|
||||
case 'items_id':
|
||||
switch ($field) {
|
||||
case 8:
|
||||
default:
|
||||
// show an item link
|
||||
$item = new $values['itemtype'];
|
||||
$item->getFromDB($values['items_id']);
|
||||
return $item->getLink(['forceid' => 1]);
|
||||
case 9:
|
||||
// show item entity
|
||||
$item = new $values['itemtype'];
|
||||
$item->getFromDB($values['items_id']);
|
||||
$entity = new Entity;
|
||||
$entity->getFromDB($item->fields['entities_id']);
|
||||
return $entity->getLink(['complete' => 1]);
|
||||
|
||||
}
|
||||
case '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:
|
||||
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)) {
|
||||
$values = array($field => $values);
|
||||
$values = [$field => $values];
|
||||
}
|
||||
$options['display'] = false;
|
||||
|
||||
@@ -952,6 +985,15 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
$options['name'] = $name;
|
||||
$options['value'] = $values[$field];
|
||||
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:
|
||||
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['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::COMPLETED => _x('case_status', 'Completed', 'processmaker'),
|
||||
self::CANCELLED => _x('case_status', 'Cancelled', 'processmaker'));
|
||||
self::CANCELLED => _x('case_status', 'Cancelled', 'processmaker')];
|
||||
|
||||
return $tab;
|
||||
}
|
||||
|
||||
|
||||
static function getStatus($value) {
|
||||
|
||||
$tab = static::getAllStatusArray(true);
|
||||
@@ -1008,12 +1049,61 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
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
|
||||
* @return mixed
|
||||
*/
|
||||
function getSearchOptions() {
|
||||
$tab = array();
|
||||
$tab = [];
|
||||
|
||||
$tab['common'] = __('Process cases', 'processmaker');
|
||||
|
||||
@@ -1031,18 +1121,19 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
$tab[2]['searchtype'] = 'contains';
|
||||
$tab[2]['massiveaction'] = false;
|
||||
|
||||
$tab[3]['table'] = PluginProcessmakerProcess::getTable();
|
||||
$tab[3]['field'] = 'name';
|
||||
$tab[3]['table'] = self::getTable();
|
||||
$tab[3]['field'] = 'plugin_processmaker_processes_id';
|
||||
$tab[3]['name'] = __('Process', 'processmaker');
|
||||
$tab[3]['datatype'] = 'itemlink';
|
||||
$tab[3]['datatype'] = 'specific';
|
||||
$tab[3]['searchtype'] = ['contains', 'equals', 'notequals'];
|
||||
$tab[3]['massiveaction'] = false;
|
||||
|
||||
|
||||
//$tab[7]['table'] = self::getTable();
|
||||
//$tab[7]['field'] = 'itemtype';
|
||||
//$tab[7]['name'] = __('Item type', 'processmaker');
|
||||
//$tab[7]['massiveaction'] = false;
|
||||
//$tab[7]['datatype'] = 'text';
|
||||
$tab[7]['table'] = self::getTable();
|
||||
$tab[7]['field'] = 'itemtype';
|
||||
$tab[7]['name'] = __('Item type', 'processmaker');
|
||||
$tab[7]['massiveaction'] = false;
|
||||
$tab[7]['datatype'] = 'specific';
|
||||
$tab[7]['searchtype'] = ['contains', 'equals', 'notequals'];
|
||||
|
||||
$tab[8]['table'] = self::getTable();
|
||||
$tab[8]['field'] = 'items_id';
|
||||
@@ -1064,18 +1155,37 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
$tab[10]['searchtype'] = ['contains', 'equals', 'notequals'];
|
||||
$tab[10]['massiveaction'] = false;
|
||||
|
||||
|
||||
$tab[14]['table'] = self::getTable();
|
||||
$tab[14]['field'] = 'plugin_processmaker_cases_id';
|
||||
$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]['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;
|
||||
}
|
||||
|
||||
|
||||
function showForm ($ID, $options=array('candel'=>false)) {
|
||||
function showForm ($ID, $options = ['candel'=>false]) {
|
||||
//global $DB, $CFG_GLPI, $LANG;
|
||||
|
||||
$options['candel'] = true;
|
||||
@@ -1149,7 +1259,6 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
//echo "<textarea cols='100' rows='6' name='externalapplication' >".$this->fields["externalapplication"]."</textarea>";
|
||||
//echo "</td></tr>";
|
||||
|
||||
|
||||
$this->showFormButtons($options );
|
||||
|
||||
}
|
||||
@@ -1160,10 +1269,10 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* @param mixed $options
|
||||
* @return array
|
||||
*/
|
||||
function defineTabs($options=array()) {
|
||||
function defineTabs($options = []) {
|
||||
|
||||
// $ong = array('empty' => $this->getTypeName(1));
|
||||
$ong = array();
|
||||
$ong = [];
|
||||
//$this->addDefaultFormTab($ong);
|
||||
|
||||
$this->addStandardTab('PluginProcessmakerTask', $ong, $options);
|
||||
@@ -1200,8 +1309,9 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
$PM_SOAP->login(true);
|
||||
if ($this->deleteTasks() && $this->deleteCronTaskActions() && $PM_SOAP->deleteCase($this->fields['case_guid'])->status_code == 0) {
|
||||
$ret = true;
|
||||
$dbu = new DbUtils;
|
||||
// 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->fields = $row;
|
||||
$ret &= $tmp->delete(['id' => $row['id']]);
|
||||
@@ -1215,7 +1325,7 @@ class PluginProcessmakerCase extends CommonDBTM {
|
||||
* Summary of deleteCronTaskActions
|
||||
* Will delete any cron task actions taht are linked to current case
|
||||
*/
|
||||
function deleteCronTaskActions( ) {
|
||||
function deleteCronTaskActions() {
|
||||
global $DB;
|
||||
|
||||
$query = "DELETE FROM `glpi_plugin_processmaker_crontaskactions` WHERE `plugin_processmaker_cases_id` = ".$this->getID();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*/
|
||||
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;
|
||||
|
||||
$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'>
|
||||
var historyGridListChangeLogGlobal = { viewIdHistory: '', viewIdDin: '', viewDynaformName: '', idHistory: '' } ;
|
||||
var ActionTabFrameGlobal = { tabData: '', tabName: '', tabTitle: '' } ;
|
||||
@@ -36,7 +35,10 @@ class PluginProcessmakerCasedynaform extends CommonDBTM {
|
||||
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']}',
|
||||
complete: function() {
|
||||
xhrFields: { withCredentials: true },
|
||||
cache: false,
|
||||
crossDomain: true,
|
||||
success: function(jqXHR) {
|
||||
//debugger;
|
||||
loctabs.append( '<div id=\'' + name + '\'>' + html + '</div>');
|
||||
loctabs.tabs('refresh'); // to show the panel
|
||||
@@ -72,11 +74,11 @@ class PluginProcessmakerCasedynaform extends CommonDBTM {
|
||||
onload=\"onOtherFrameLoad( 'historyDynaformPage', 'caseiframe-historyDynaformPage', 'body', 0 );\">
|
||||
</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');
|
||||
}
|
||||
|
||||
|
||||
@@ -18,11 +18,11 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
||||
return Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE]);
|
||||
}
|
||||
|
||||
static function canUpdate( ) {
|
||||
static function canUpdate() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
static function canDelete( ) {
|
||||
static function canDelete() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
@@ -46,14 +46,14 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
||||
return false;
|
||||
}
|
||||
|
||||
static function getTypeName($nb=0) {
|
||||
static function getTypeName($nb = 0) {
|
||||
if ($nb>1) {
|
||||
return __('Case-links', 'processmaker');
|
||||
}
|
||||
return __('Case-link', 'processmaker');
|
||||
}
|
||||
|
||||
function showForm ($ID, $options=array('candel'=>false)) {
|
||||
function showForm ($ID, $options = ['candel'=>false]) {
|
||||
global $DB, $CFG_GLPI;
|
||||
|
||||
$options['candel'] = true;
|
||||
@@ -71,6 +71,11 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
||||
Dropdown::showYesNo("is_active", $this->fields["is_active"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Synchronous', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_synchronous", $this->fields["is_synchronous"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('External data', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_externaldata", $this->fields["is_externaldata"]);
|
||||
@@ -122,12 +127,21 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
||||
Dropdown::showYesNo("is_targettoclaim", $this->fields["is_targettoclaim"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
//echo "<tr class='tab_bg_1'>";
|
||||
//echo "<td >".__('Reassign target task', 'processmaker')."</td><td>";
|
||||
//Dropdown::showYesNo("is_targettoreassign", $this->fields["is_targettoreassign"]);
|
||||
//echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Impersonate target task user', 'processmaker')."</td><td>";
|
||||
Dropdown::showYesNo("is_targettoimpersonate", $this->fields["is_targettoimpersonate"]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td>".__('External application JSON config', 'processmaker')."</td><td>";
|
||||
echo "<textarea cols='100' rows='6' name='externalapplication' >".$this->fields["externalapplication"]."</textarea>";
|
||||
echo "</td></tr>";
|
||||
|
||||
|
||||
$this->showFormButtons($options );
|
||||
|
||||
}
|
||||
@@ -138,7 +152,7 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
||||
* @return mixed
|
||||
*/
|
||||
function getSearchOptions() {
|
||||
$tab = array();
|
||||
$tab = [];
|
||||
|
||||
$tab['common'] = __('ProcessMaker', 'processmaker');
|
||||
|
||||
@@ -214,7 +228,7 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
||||
$tab[18]['massiveaction'] = false;
|
||||
$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]['name'] = __('Source task');
|
||||
//$tab[14]['massiveaction'] = false;
|
||||
@@ -232,7 +246,6 @@ class PluginProcessmakerCaselink extends CommonDBTM {
|
||||
// ]
|
||||
// ];
|
||||
|
||||
|
||||
return $tab;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
||||
|
||||
static $rightname = '';
|
||||
|
||||
static private $_instance = NULL;
|
||||
static private $_instance = null;
|
||||
|
||||
/**
|
||||
* Summary of canCreate
|
||||
@@ -37,7 +37,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
||||
* @param mixed $nb plural
|
||||
* @return mixed
|
||||
*/
|
||||
static function getTypeName($nb=0) {
|
||||
static function getTypeName($nb = 0) {
|
||||
return __('ProcessMaker setup', 'processmaker');
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
||||
* @param mixed $with_comment with comment
|
||||
* @return mixed
|
||||
*/
|
||||
function getName($with_comment=0) {
|
||||
function getName($with_comment = 0) {
|
||||
return __('ProcessMaker', 'processmaker');
|
||||
}
|
||||
|
||||
@@ -145,10 +145,10 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
||||
|
||||
$setup_ok = false;
|
||||
|
||||
$ui_theme = array(
|
||||
$ui_theme = [
|
||||
'glpi_classic' => 'glpi_classic',
|
||||
'glpi_neoclassic' => 'glpi_neoclassic'
|
||||
);
|
||||
];
|
||||
|
||||
$config = $PM_SOAP->config;
|
||||
$config->showFormHeader(['colspan' => 4]);
|
||||
@@ -158,9 +158,8 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
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 "</td></tr>\n";
|
||||
echo "</td>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td>".__('Common domain with GLPI', 'processmaker')."</td>";
|
||||
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 "<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 "<td >".__('Workspace Name', 'processmaker')."</td><td >";
|
||||
echo "<input type='text' name='pm_workspace' value='".$config->fields['pm_workspace']."'>";
|
||||
@@ -268,24 +272,24 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Theme Name', 'processmaker')."</td><td >";
|
||||
Dropdown::showFromArray('pm_theme', $ui_theme,
|
||||
array('value' => $config->fields['pm_theme']));
|
||||
['value' => $config->fields['pm_theme']]);
|
||||
echo "</td></tr>";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
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,
|
||||
'value' => $config->fields['taskcategories_id']));
|
||||
'value' => $config->fields['taskcategories_id']]);
|
||||
echo "</td></tr>\n";
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('Task Writer (edit to change name)', 'processmaker')."</td><td >";
|
||||
$rand = mt_rand();
|
||||
User::dropdown(array('name' => 'users_id',
|
||||
User::dropdown(['name' => 'users_id',
|
||||
'display_emptychoice' => true,
|
||||
'right' => 'all',
|
||||
'rand' => $rand,
|
||||
'value' => $config->fields['users_id']));
|
||||
'value' => $config->fields['users_id']]);
|
||||
|
||||
// this code adds the + sign to the form
|
||||
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');\">";
|
||||
echo Ajax::createIframeModalWindow('add_dropdown'.$rand,
|
||||
User::getFormURL(),
|
||||
array('display' => false));
|
||||
['display' => false]);
|
||||
// end of + sign
|
||||
|
||||
echo "</td></tr>\n";
|
||||
@@ -301,13 +305,13 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
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;";
|
||||
if ($PM_DB->connected) {
|
||||
foreach ($PM_DB->request( $query ) as $row) {
|
||||
$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 {
|
||||
echo "<font color='red'>".__('Not connected');
|
||||
}
|
||||
@@ -343,13 +347,13 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
||||
} else {
|
||||
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.__('Not yet!', 'processmaker').'</td></tr>';
|
||||
}
|
||||
$config->showFormButtons(array('candel'=>false));
|
||||
$config->showFormButtons(['candel'=>false]);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
|
||||
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||
if ($item->getType()=='Config') {
|
||||
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') {
|
||||
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"}
|
||||
|
||||
|
||||
const WAITING_DATA = 1 ;
|
||||
const DATA_READY = 2 ;
|
||||
const DONE = 3 ;
|
||||
const WAITING_DATA = 1;
|
||||
const DATA_READY = 2;
|
||||
const DONE = 3;
|
||||
const NOT_DONE = 4;
|
||||
|
||||
}
|
||||
@@ -13,7 +13,7 @@ class PluginProcessmakerMenu extends CommonGLPI {
|
||||
}
|
||||
|
||||
$front_page = "/plugins/processmaker/front";
|
||||
$menu = array();
|
||||
$menu = [];
|
||||
$menu['title'] = self::getMenuName();
|
||||
$menu['page'] = "$front_page/process.php";
|
||||
$menu['links']['search'] = PluginProcessmakerProcess::getSearchURL(false);
|
||||
@@ -32,13 +32,13 @@ class PluginProcessmakerMenu extends CommonGLPI {
|
||||
if (Session::haveRightsOr("config", [READ, UPDATE])) {
|
||||
$menu['options'][$option]['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
|
||||
}
|
||||
switch( $itemtype ) {
|
||||
switch ($itemtype) {
|
||||
case 'PluginProcessmakerProcess':
|
||||
|
||||
//if ($itemtype::canCreate()) {
|
||||
// $menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
|
||||
//}
|
||||
break ;
|
||||
break;
|
||||
case 'PluginProcessmakerCaselink':
|
||||
if (Session::haveRight("plugin_processmaker_config", UPDATE)) {
|
||||
$menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
|
||||
@@ -47,7 +47,7 @@ class PluginProcessmakerMenu extends CommonGLPI {
|
||||
|
||||
default :
|
||||
$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]);
|
||||
}
|
||||
|
||||
static function canUpdate( ) {
|
||||
|
||||
static function canUpdate() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
|
||||
|
||||
function canUpdateItem() {
|
||||
return Session::haveRight('plugin_processmaker_config', UPDATE);
|
||||
}
|
||||
@@ -48,7 +50,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
* @param array $post is the $_POST
|
||||
* @return void
|
||||
*/
|
||||
function refreshTasks( $post ) {
|
||||
function refreshTasks($post) {
|
||||
global $PM_DB, $CFG_GLPI;
|
||||
|
||||
if ($this->getFromDB( $post['id'] )) {
|
||||
@@ -58,7 +60,8 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
//$database = $config->fields['pm_workspace'] ;
|
||||
$translates = false;
|
||||
$mapLangs = [];
|
||||
// if (class_exists('DropdownTranslation')) {
|
||||
$dbu = new DbUtils;
|
||||
// if (class_exists('DropdownTranslation')) {
|
||||
// to force rights to add translations
|
||||
$_SESSION['glpi_dropdowntranslations']['TaskCategory']['name'] = 'name';
|
||||
$_SESSION['glpi_dropdowntranslations']['TaskCategory']['completename'] = 'completename';
|
||||
@@ -90,30 +93,30 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
}
|
||||
|
||||
$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=[];
|
||||
foreach($currentasksinprocess as $task){
|
||||
foreach ($currentasksinprocess as $task) {
|
||||
$tasks[$task['pm_task_guid']] = $task;
|
||||
}
|
||||
$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
|
||||
$objs = ['TicketTask', 'ProblemTask', 'ChangeTask'];
|
||||
$countElt = 0 ;
|
||||
foreach($objs as $obj) {
|
||||
$countElt += countElementsInTable( getTableForItemType($obj), "taskcategories_id = ".$task['taskcategories_id'] );
|
||||
$countElt = 0;
|
||||
foreach ($objs as $obj) {
|
||||
$countElt += $dbu->countElementsInTable( $dbu->getTableForItemType($obj), "taskcategories_id = ".$task['taskcategories_id'] );
|
||||
if ($countElt != 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;
|
||||
}
|
||||
}
|
||||
if ($countElt == 0) {
|
||||
// purge this category as it is not used anywhere
|
||||
$taskCat = new TaskCategory;
|
||||
$taskCat->delete(array( 'id' => $task['taskcategories_id'] ), 1);
|
||||
$taskCat->delete([ 'id' => $task['taskcategories_id'] ], 1);
|
||||
$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'] )) {
|
||||
// found it must test if should be updated
|
||||
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']) {
|
||||
$pmTaskCat->update( array( 'id' => $pmTaskCat->getID(), 'is_start' => $task['is_start'] ) );
|
||||
$pmTaskCat->update( [ 'id' => $pmTaskCat->getID(), 'is_start' => $task['is_start'] ] );
|
||||
}
|
||||
} else {
|
||||
// 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
|
||||
$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 {
|
||||
// should create a new one
|
||||
// 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->add( ['plugin_processmaker_processes_id' => $this->getID(),
|
||||
'pm_task_guid' => $taskGUID,
|
||||
@@ -157,15 +160,15 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
if (DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'name', $langTask ) != $taskL[ 'TAS_TITLE' ]) {
|
||||
// must be updated
|
||||
$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->generateCompletename( array( '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( [ 'itemtype' => 'TaskCategory', 'items_id' => $taskCat->getID(), 'language' => $langTask ] );
|
||||
}
|
||||
} else {
|
||||
// must be added
|
||||
// must be updated
|
||||
$trans = new DropdownTranslation;
|
||||
$trans->add( array( '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->add( [ 'items_id' => $taskCat->getID(), 'itemtype' => 'TaskCategory', 'language' => $langTask, 'field' => 'name', 'value' => $PM_DB->escape($taskL[ 'TAS_TITLE' ]) ] );
|
||||
$trans->generateCompletename( [ 'itemtype' => 'TaskCategory', 'items_id' => $taskCat->getID(),'language' => $langTask ] );
|
||||
}
|
||||
|
||||
// look for 'comment' field
|
||||
@@ -173,12 +176,12 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
if (DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'comment', $langTask ) != $taskL[ 'TAS_DESCRIPTION' ]) {
|
||||
// must be updated
|
||||
$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 {
|
||||
// must be added
|
||||
$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;
|
||||
if (isset($input['name'])) {
|
||||
$input['name'] = $PM_DB->escape($input['name']);
|
||||
@@ -197,7 +200,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
return $input;
|
||||
}
|
||||
|
||||
function prepareInputForUpdate($input){
|
||||
function prepareInputForUpdate($input) {
|
||||
global $PM_DB;
|
||||
if (isset($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
|
||||
* @return void
|
||||
*/
|
||||
function refresh( ) {
|
||||
function refresh() {
|
||||
global $DB, $PM_SOAP;
|
||||
|
||||
$dbu = new DbUtils;
|
||||
$pmCurrentProcesses = [];
|
||||
|
||||
// then refresh list of available process from PM to inner table
|
||||
@@ -237,7 +240,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
if ($glpiprocess->getFromGUID($process->guid)) {
|
||||
// then update it only if name has changed
|
||||
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
|
||||
if (!$glpiprocess->fields['taskcategories_id']) {
|
||||
@@ -254,7 +257,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
$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
|
||||
$glpiprocess->addTaskCategory( $pmMainTaskCat );
|
||||
}
|
||||
@@ -264,9 +267,9 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
}
|
||||
|
||||
// should de-activate other
|
||||
$glpiCurrentProcesses = getAllDatasFromTable(self::getTable());
|
||||
$glpiCurrentProcesses = $dbu->getAllDataFromTable(self::getTable());
|
||||
// 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->getFromDB($key);
|
||||
|
||||
@@ -285,8 +288,8 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
$tmp->deleteByCriteria(['plugin_processmaker_processes_id' => $key]);
|
||||
|
||||
// must delete any taskcategory and translations
|
||||
$pmtaskcategories = getAllDatasFromTable( PluginProcessmakerTaskCategory::getTable(), "plugin_processmaker_processes_id = $key");
|
||||
foreach($pmtaskcategories as $pmcat){
|
||||
$pmtaskcategories = $dbu->getAllDataFromTable( PluginProcessmakerTaskCategory::getTable(), "plugin_processmaker_processes_id = $key");
|
||||
foreach ($pmtaskcategories as $pmcat) {
|
||||
// delete taskcat
|
||||
$tmp = new TaskCategory;
|
||||
$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
|
||||
* @return boolean true if update is done, false otherwise
|
||||
*/
|
||||
function updateTaskCategory( $pmMainTaskCat ) {
|
||||
function updateTaskCategory($pmMainTaskCat) {
|
||||
global $PM_DB;
|
||||
$taskCat = new TaskCategory;
|
||||
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;
|
||||
}
|
||||
@@ -328,11 +331,11 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
* @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
|
||||
*/
|
||||
function addTaskCategory( $pmMainTaskCat ) {
|
||||
function addTaskCategory($pmMainTaskCat) {
|
||||
global $PM_DB;
|
||||
$taskCat = new TaskCategory;
|
||||
if ($taskCat->add( array( 'is_recursive' => true, 'taskcategories_id' => $pmMainTaskCat, 'name' => $PM_DB->escape($this->fields['name'])) )) {
|
||||
return $this->update( array( 'id' => $this->getID(), 'taskcategories_id' => $taskCat->getID() ) );
|
||||
if ($taskCat->add( [ 'is_recursive' => true, 'taskcategories_id' => $pmMainTaskCat, 'name' => $PM_DB->escape($this->fields['name'])] )) {
|
||||
return $this->update( [ 'id' => $this->getID(), 'taskcategories_id' => $taskCat->getID() ] );
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -346,7 +349,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
function title() {
|
||||
global $CFG_GLPI;
|
||||
|
||||
$buttons = array();
|
||||
$buttons = [];
|
||||
$title = __('Synchronize Process List', 'processmaker');
|
||||
|
||||
if ($this->canCreate()) {
|
||||
@@ -388,7 +391,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
* @return mixed
|
||||
*/
|
||||
function getSearchOptions() {
|
||||
$tab = array();
|
||||
$tab = [];
|
||||
|
||||
$tab['common'] = __('ProcessMaker', 'processmaker');
|
||||
|
||||
@@ -494,9 +497,9 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
* @param $values
|
||||
* @param $options array
|
||||
**/
|
||||
static function getSpecificValueToDisplay($field, $values, array $options=array()) {
|
||||
static function getSpecificValueToDisplay($field, $values, array $options = []) {
|
||||
if (!is_array($values)) {
|
||||
$values = array($field => $values);
|
||||
$values = [$field => $values];
|
||||
}
|
||||
switch ($field) {
|
||||
|
||||
@@ -516,8 +519,8 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
*/
|
||||
static function getAllTypeArray() {
|
||||
|
||||
$tab = array(self::CLASSIC => _x('process_type', 'Classic', 'processmaker'),
|
||||
self::BPMN => _x('process_type', 'BPMN', 'processmaker'));
|
||||
$tab = [self::CLASSIC => _x('process_type', 'Classic', 'processmaker'),
|
||||
self::BPMN => _x('process_type', 'BPMN', 'processmaker')];
|
||||
|
||||
return $tab;
|
||||
}
|
||||
@@ -541,17 +544,17 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
* @param mixed $nb
|
||||
* @return mixed
|
||||
*/
|
||||
static function getTypeName($nb=0) {
|
||||
static function getTypeName($nb = 0) {
|
||||
if ($nb>1) {
|
||||
return __('Processes', 'processmaker');
|
||||
}
|
||||
return __('Process', 'processmaker');
|
||||
}
|
||||
|
||||
function defineTabs($options=array()) {
|
||||
function defineTabs($options = []) {
|
||||
|
||||
// $ong = array('empty' => $this->getTypeName(1));
|
||||
$ong = array();
|
||||
$ong = [];
|
||||
$this->addDefaultFormTab($ong);
|
||||
$this->addStandardTab(__CLASS__, $ong, $options);
|
||||
|
||||
@@ -563,7 +566,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
return $ong;
|
||||
}
|
||||
|
||||
function showForm ($ID, $options=array('candel'=>false)) {
|
||||
function showForm ($ID, $options = ['candel'=>false]) {
|
||||
global $DB, $CFG_GLPI;
|
||||
|
||||
//if ($ID > 0) {
|
||||
@@ -618,7 +621,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
echo "<td >".__('ITIL Category for Self-service interface (left empty to disable)', 'processmaker')."</td><td>";
|
||||
if (true) { // $canupdate || !$ID || $canupdate_descr
|
||||
$opt = array('value' => $this->fields["itilcategories_id"]);
|
||||
$opt = ['value' => $this->fields["itilcategories_id"]];
|
||||
|
||||
switch ($this->fields['type']) {
|
||||
case Ticket::INCIDENT_TYPE :
|
||||
@@ -645,13 +648,13 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
|
||||
echo "<td >".__('Type for Self-service interface', 'processmaker')."</td><td>";
|
||||
if (true) { // $canupdate || !$ID
|
||||
$idticketcategorysearch = mt_rand(); $opt = array('value' => $this->fields["type"]);
|
||||
$rand = Ticket::dropdownType('type', $opt, array(), array('toupdate' => "search_".$idticketcategorysearch ));
|
||||
$opt = array('value' => $this->fields["type"]);
|
||||
$params = array('type' => '__VALUE__',
|
||||
$idticketcategorysearch = mt_rand(); $opt = ['value' => $this->fields["type"]];
|
||||
$rand = Ticket::dropdownType('type', $opt, [], ['toupdate' => "search_".$idticketcategorysearch ]);
|
||||
$opt = ['value' => $this->fields["type"]];
|
||||
$params = ['type' => '__VALUE__',
|
||||
//'entity_restrict' => -1, //$this->fields['entities_id'],
|
||||
'value' => $this->fields['itilcategories_id'],
|
||||
'currenttype' => $this->fields['type']);
|
||||
'currenttype' => $this->fields['type']];
|
||||
|
||||
Ajax::updateItemOnSelectEvent("dropdown_type$rand", "show_category_by_type",
|
||||
$CFG_GLPI["root_doc"]."/ajax/dropdownTicketCategories.php",
|
||||
@@ -674,7 +677,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
|
||||
echo "<tr class='tab_bg_1'>";
|
||||
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>";
|
||||
|
||||
$this->showFormButtons($options);
|
||||
@@ -692,9 +695,10 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
*
|
||||
* @return mysql result set.
|
||||
**/
|
||||
static function getSqlSearchResult ($count=true, $search='') {
|
||||
static function getSqlSearchResult ($count = true, $search = '') {
|
||||
global $DB, $CFG_GLPI;
|
||||
|
||||
$where = '';
|
||||
$orderby = '';
|
||||
|
||||
if (isset($_REQUEST['condition']) && isset($_SESSION['glpicondition'][$_REQUEST['condition']])) {
|
||||
@@ -724,13 +728,13 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
* @param mixed $link
|
||||
* @return mixed
|
||||
*/
|
||||
static function getProcessName( $pid, $link=0 ) {
|
||||
static function getProcessName($pid, $link = 0) {
|
||||
global $DB;
|
||||
$process='';
|
||||
if ($link==2) {
|
||||
$process = array("name" => "",
|
||||
$process = ["name" => "",
|
||||
"link" => "",
|
||||
"comment" => "");
|
||||
"comment" => ""];
|
||||
}
|
||||
|
||||
$query="SELECT * FROM glpi_plugin_processmaker_processes WHERE id=$pid";
|
||||
@@ -760,18 +764,18 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
*
|
||||
* @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;
|
||||
|
||||
$dbu = new DbUtils;
|
||||
$query = "SELECT `entities_id`, `is_recursive`
|
||||
FROM `glpi_plugin_processmaker_processes_profiles`
|
||||
WHERE `plugin_processmaker_processes_id` = '$processes_id'
|
||||
AND `profiles_id` = '$profiles_id'";
|
||||
|
||||
$entities = array();
|
||||
$entities = [];
|
||||
foreach ($DB->request($query) as $data) {
|
||||
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;
|
||||
}
|
||||
} else {
|
||||
@@ -786,8 +790,12 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
||||
* @param mixed $options
|
||||
* @return mixed
|
||||
*/
|
||||
static function dropdown($options=array()) {
|
||||
static function dropdown($options = []) {
|
||||
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';
|
||||
return Dropdown::show( __CLASS__, $options );
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ class PluginProcessmakerProcess_Profile extends CommonDBTM
|
||||
|
||||
static $rightname = '';
|
||||
|
||||
function can($ID, $right, array &$input = NULL) {
|
||||
function can($ID, $right, array &$input = null) {
|
||||
switch ($right) {
|
||||
case DELETE :
|
||||
case PURGE :
|
||||
@@ -22,11 +22,11 @@ class PluginProcessmakerProcess_Profile extends CommonDBTM
|
||||
return Session::haveRight('plugin_processmaker_config', $right);
|
||||
}
|
||||
|
||||
function getTabNameForItem( CommonGLPI $item, $withtemplate=0) {
|
||||
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||
return __('Authorizations', 'processmaker');
|
||||
}
|
||||
|
||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
|
||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||
|
||||
global $DB;
|
||||
|
||||
@@ -46,9 +46,9 @@ class PluginProcessmakerProcess_Profile extends CommonDBTM
|
||||
|
||||
echo "<tr class='tab_bg_2'><td class='center'>";
|
||||
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>";
|
||||
Profile::dropdownUnder(array('value' => Profile::getDefault()));
|
||||
Profile::dropdownUnder(['value' => Profile::getDefault()]);
|
||||
echo "</td><td class='center'>".__('Recursive')."</td><td>";
|
||||
Dropdown::showYesNo("is_recursive", 0);
|
||||
echo "</td><td class='center'>";
|
||||
@@ -80,8 +80,8 @@ class PluginProcessmakerProcess_Profile extends CommonDBTM
|
||||
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
|
||||
|
||||
if ($canedit && $num) {
|
||||
$massiveactionparams = array('num_displayed' => $num,
|
||||
'container' => 'mass'.__CLASS__.$rand);
|
||||
$massiveactionparams = ['num_displayed' => $num,
|
||||
'container' => 'mass'.__CLASS__.$rand];
|
||||
Html::showMassiveActions($massiveactionparams);
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -12,16 +12,16 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
||||
* @return array[]
|
||||
*/
|
||||
static function getAllRights() {
|
||||
$rights = array(
|
||||
array('itemtype' => 'PluginProcessmakerConfig',
|
||||
$rights = [
|
||||
['itemtype' => 'PluginProcessmakerConfig',
|
||||
'label' => __('Process configuration', 'processmaker'),
|
||||
'field' => 'plugin_processmaker_config',
|
||||
'rights' => array(READ => __('Read'), UPDATE => __('Update'))),
|
||||
array('itemtype' => 'PluginProcessmakerConfig',
|
||||
'rights' => [READ => __('Read'), UPDATE => __('Update')]],
|
||||
['itemtype' => 'PluginProcessmakerConfig',
|
||||
'label' => __('Cases', 'processmaker'),
|
||||
'field' => 'plugin_processmaker_case',
|
||||
'rights' => array(READ => __('Read'), CANCEL => __('Cancel', 'processmaker'), DELETE => __('Delete')))
|
||||
);
|
||||
'rights' => [READ => __('Read'), CANCEL => __('Cancel', 'processmaker'), DELETE => __('Delete')]]
|
||||
];
|
||||
|
||||
return $rights;
|
||||
}
|
||||
@@ -34,7 +34,7 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
||||
* @param mixed $closeform
|
||||
* @return bool
|
||||
*/
|
||||
function showForm($ID=0, $openform=TRUE, $closeform=TRUE) {
|
||||
function showForm($ID = 0, $openform = true, $closeform = true) {
|
||||
|
||||
if (!Session::haveRight("profile", READ)) {
|
||||
return false;
|
||||
@@ -47,15 +47,15 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
||||
}
|
||||
echo "<form action='".$prof->getFormURL()."' method='post'>";
|
||||
$rights = $this->getAllRights();
|
||||
$prof->displayRightsChoiceMatrix($rights, array('canedit' => $canedit,
|
||||
$prof->displayRightsChoiceMatrix($rights, ['canedit' => $canedit,
|
||||
'default_class' => 'tab_bg_2',
|
||||
'title' => __('ProcessMaker', 'processmaker')));
|
||||
'title' => __('ProcessMaker', 'processmaker')]);
|
||||
|
||||
if ($canedit && $closeform) {
|
||||
echo "<div class='center'>";
|
||||
echo Html::hidden('id', array('value' => $ID));
|
||||
echo Html::hidden('id', ['value' => $ID]);
|
||||
echo Html::submit(_sx('button', 'Save'),
|
||||
array('name' => 'update'));
|
||||
['name' => 'update']);
|
||||
echo "</div>\n";
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
||||
* @param mixed $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
|
||||
* @return string|string[]
|
||||
*/
|
||||
function getTabNameForItem(CommonGLPI $item, $withtemplate=0) {
|
||||
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||
if ($item->getType()=='Profile') {
|
||||
return __('ProcessMaker', 'processmaker');
|
||||
}
|
||||
@@ -92,16 +92,16 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
||||
* @param mixed $withtemplate
|
||||
* @return bool
|
||||
*/
|
||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum=1, $withtemplate=0) {
|
||||
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
|
||||
global $CFG_GLPI;
|
||||
|
||||
if ($item->getType()=='Profile') {
|
||||
$ID = $item->getID();
|
||||
$prof = new self();
|
||||
self::addDefaultProfileInfos($ID,
|
||||
array('plugin_processmaker_config' => 0,
|
||||
['plugin_processmaker_config' => 0,
|
||||
'plugin_processmaker_case' => 0
|
||||
));
|
||||
]);
|
||||
|
||||
$prof->showForm($ID);
|
||||
}
|
||||
@@ -113,14 +113,14 @@ class PluginProcessmakerProfile extends CommonDBTM {
|
||||
**/
|
||||
static function addDefaultProfileInfos($profiles_id, $rights, $drop_existing = false) {
|
||||
global $DB;
|
||||
|
||||
$dbu = new DbUtils;
|
||||
$profileRight = new ProfileRight();
|
||||
foreach ($rights as $right => $value) {
|
||||
if (countElementsInTable('glpi_profilerights',
|
||||
if ($dbu->countElementsInTable('glpi_profilerights',
|
||||
"`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'")) {
|
||||
$myright['profiles_id'] = $profiles_id;
|
||||
$myright['name'] = $right;
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
class PluginProcessmakerTask extends CommonITILTask
|
||||
{
|
||||
private $itemtype;
|
||||
function __construct($itemtype='TicketTask') {
|
||||
function __construct($itemtype = 'TicketTask') {
|
||||
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)
|
||||
**/
|
||||
static function getTypeName($nb=0) {
|
||||
static function getTypeName($nb = 0) {
|
||||
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
|
||||
* @param mixed $case_id
|
||||
*/
|
||||
public static function getToDoTasks( $case_id, $itemtype ) {
|
||||
public static function getToDoTasks($case_id, $itemtype) {
|
||||
global $DB;
|
||||
$ret = array();
|
||||
$selfTable = getTableForItemType( __CLASS__);
|
||||
$ret = [];
|
||||
$dbu = new DbUtils;
|
||||
$selfTable = $dbu->getTableForItemType( __CLASS__);
|
||||
//$itemTypeTaskTable = getTableForItemType( $itemtype );
|
||||
|
||||
$query = "SELECT `$selfTable`.`items_id` as taskID from $selfTable
|
||||
@@ -84,15 +85,15 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
return $ret;
|
||||
}
|
||||
|
||||
static function canView( ) {
|
||||
static function canView() {
|
||||
return true;
|
||||
}
|
||||
|
||||
static function populatePlanning($params) {
|
||||
global $CFG_GLPI;
|
||||
//global $CFG_GLPI;
|
||||
|
||||
$events = [];
|
||||
|
||||
$ret = array();
|
||||
$events = array();
|
||||
if (isset($params['start'])) {
|
||||
$params['begin'] = '2000-01-01 00:00:00';
|
||||
if ($params['type'] == 'group') {
|
||||
@@ -100,13 +101,21 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
$params['whogroup'] = $params['who'];
|
||||
$params['who'] = 0;
|
||||
}
|
||||
$ret = CommonITILTask::genericPopulatePlanning( 'TicketTask', $params );
|
||||
|
||||
$objects = ['TicketTask', 'ChangeTask', 'ProblemTask'];
|
||||
//foreach ($objects as $itemtype) {
|
||||
foreach ($_SESSION['glpi_plannings']['filters'] as $tasktype => $iteminfo) {
|
||||
if (!$iteminfo['display'] || !in_array($tasktype, $objects)) {
|
||||
continue;
|
||||
}
|
||||
$ret = CommonITILTask::genericPopulatePlanning($tasktype, $params);
|
||||
|
||||
foreach ($ret as $key => $event) {
|
||||
if ($event['state'] == 1 || ($params['display_done_events'] == 1 && $event['state'] == 2)) { // if todo or done but need to show them (=planning)
|
||||
// if todo or done but need to show them (=planning)
|
||||
if ($event['state'] == Planning::TODO || $event['state'] == Planning::INFO || ($params['display_done_events'] == 1 && $event['state'] == Planning::DONE)) {
|
||||
// check if task is one within a case
|
||||
$pmTask = new self('TicketTask');
|
||||
if ($pmTask->getFromDB( $event['tickettasks_id'] )) { // $pmTask->getFromDBByQuery( " WHERE itemtype = 'TicketTask' AND items_id = ". $event['tickettasks_id'] ) ) {
|
||||
$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;
|
||||
@@ -121,7 +130,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
}
|
||||
|
||||
$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>
|
||||
$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'];
|
||||
@@ -131,11 +140,12 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return $events;
|
||||
}
|
||||
|
||||
|
||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0){
|
||||
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
|
||||
global $DB, $PM_DB;
|
||||
|
||||
$tab = [];
|
||||
@@ -143,13 +153,13 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
$caseInfo = $case->getCaseInfo();
|
||||
|
||||
if (property_exists($caseInfo, 'currentUsers')) {
|
||||
|
||||
$dbu = new DbUtils;
|
||||
$GLPICurrentPMUserId = PluginProcessmakerUser::getPMUserId(Session::getLoginUserID());
|
||||
|
||||
// get all tasks that are OPEN for this case
|
||||
$tasks = [];
|
||||
$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;
|
||||
}
|
||||
|
||||
@@ -170,7 +180,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
if (isset($tasks[$caseUser->delIndex])) {
|
||||
$hide_claim_button = false;
|
||||
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']);
|
||||
// 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'] )) {
|
||||
@@ -227,8 +237,9 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
* @param integer $tabnum contains the PluginProcessmakerTask id
|
||||
* @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;
|
||||
$dbu = new DbUtils;
|
||||
|
||||
// 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)) {
|
||||
@@ -238,7 +249,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
$sub_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'";
|
||||
foreach($DB->request($query) as $task) {
|
||||
foreach ($DB->request($query) as $task) {
|
||||
$sub_tasks[$task['plugin_processmaker_cases_id']][$task['del_index']] = $task;
|
||||
}
|
||||
$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']}'";
|
||||
$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'];
|
||||
}
|
||||
|
||||
@@ -266,7 +277,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
<th>".__('Task delegation date', 'processmaker')."</th>
|
||||
</tr>";
|
||||
|
||||
foreach($sub_case_info->currentUsers as $currentTask) {
|
||||
foreach ($sub_case_info->currentUsers as $currentTask) {
|
||||
echo "<tr>";
|
||||
$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>";
|
||||
@@ -295,7 +306,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
$rand = rand();
|
||||
|
||||
// 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
|
||||
$caseInfo = $case->getCaseInfo();
|
||||
@@ -327,7 +338,7 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
// manages the claim
|
||||
// current task is to be claimed
|
||||
// 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'] );
|
||||
// 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'] )) {
|
||||
@@ -340,18 +351,55 @@ class PluginProcessmakerTask extends CommonITILTask
|
||||
|
||||
$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']}, "
|
||||
.($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>";
|
||||
.($hide_claim_button?"true":"false").", '$csrf');\" style='border:none;' class='tab_bg_2' width='100%' src='$url'></iframe></div>";
|
||||
|
||||
echo Html::scriptBlock("
|
||||
$('#tabspanel').next('div[id^=\"tabs\"]').on( 'tabsbeforeactivate', function(event, ui) {
|
||||
function urldecode(url) {
|
||||
return decodeURIComponent(url.replace(/\+/g, ' '));
|
||||
}
|
||||
var iframe_id = 'caseiframe-task-{$task[$tabnum]['del_index']}';
|
||||
var iframe = ui.newPanel.children('iframe[id=\"' + iframe_id + '\"]');
|
||||
if (iframe.length != 0) {
|
||||
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
|
||||
{
|
||||
|
||||
function getTabNameForItem( CommonGLPI $item, $withtemplate=0) {
|
||||
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
|
||||
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;
|
||||
|
||||
self::title($item);
|
||||
@@ -94,7 +94,7 @@ class PluginProcessmakerTaskCategory extends CommonDBTM
|
||||
static function title(CommonGLPI $item) {
|
||||
global $CFG_GLPI;
|
||||
|
||||
$buttons = array();
|
||||
$buttons = [];
|
||||
$title = __('Synchronize Task List', 'processmaker');
|
||||
|
||||
if (Session::haveRight('plugin_processmaker_config', UPDATE)) {
|
||||
|
||||
@@ -25,8 +25,8 @@ class PluginProcessmakerUser extends CommonDBTM {
|
||||
*
|
||||
* @return mysql result set.
|
||||
**/
|
||||
static function getSqlSearchResult ($taskId, $count=true, $right="all", $entity_restrict=-1, $value=0,
|
||||
$used=array(), $search='', $limit='') {
|
||||
static function getSqlSearchResult ($taskId, $count = true, $right = "all", $entity_restrict = -1, $value = 0,
|
||||
$used = [], $search = '', $limit = '') {
|
||||
global $DB, $PM_DB, $CFG_GLPI;
|
||||
|
||||
// first need to get all users from $taskId
|
||||
@@ -37,7 +37,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
||||
UNION
|
||||
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 ; ";
|
||||
$pmUsers = array( );
|
||||
$pmUsers = [ ];
|
||||
foreach ($PM_DB->request( $pmQuery ) as $pmUser) {
|
||||
$pmUsers[ ] = $pmUser[ 'pm_user_id' ];
|
||||
}
|
||||
@@ -162,7 +162,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
||||
*
|
||||
* @return int (print out an HTML select box)
|
||||
**/
|
||||
static function dropdown($options=array()) {
|
||||
static function dropdown($options = []) {
|
||||
global $CFG_GLPI;
|
||||
|
||||
$options['url'] = $CFG_GLPI["root_doc"].'/plugins/processmaker/ajax/dropdownUsers.php';
|
||||
@@ -176,7 +176,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
||||
* @param string $pmUserId
|
||||
* @return int GLPI user id, or 0 if not found
|
||||
*/
|
||||
public static function getGLPIUserId( $pmUserId ) {
|
||||
public static function getGLPIUserId($pmUserId) {
|
||||
$obj = new self;
|
||||
if ($obj->getFromDBByQuery("WHERE `pm_users_id` = '$pmUserId'")) {
|
||||
return $obj->fields['id'];
|
||||
@@ -190,7 +190,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
||||
* @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
|
||||
*/
|
||||
public static function getPMUserId( $glpiUserId ) {
|
||||
public static function getPMUserId($glpiUserId) {
|
||||
$obj = new self;
|
||||
if ($obj->getFromDB( Toolbox::cleanInteger($glpiUserId) )) {
|
||||
return $obj->fields['pm_users_id'];
|
||||
|
||||
@@ -1,17 +1,28 @@
|
||||
<?php
|
||||
|
||||
function processmaker_install(){
|
||||
function processmaker_install() {
|
||||
global $DB;
|
||||
|
||||
// installation from scratch
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/setup.php");
|
||||
$info = plugin_version_processmaker();
|
||||
switch($info['version']){
|
||||
//case '3.3.0' :
|
||||
// $version = '3.2.9';
|
||||
// break;
|
||||
switch ($info['version']) {
|
||||
case '3.3.0' :
|
||||
$version = '3.3.0';
|
||||
break;
|
||||
case '3.3.1' :
|
||||
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 = $info['version'];
|
||||
$version = '3.3.8';
|
||||
break;
|
||||
}
|
||||
$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
|
||||
|
||||
function processmaker_update(){
|
||||
function processmaker_update() {
|
||||
global $DB;
|
||||
|
||||
// update from older versions
|
||||
// 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';
|
||||
} else {
|
||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/config.class.php");
|
||||
@@ -13,7 +13,7 @@ function processmaker_update(){
|
||||
$current_version = $config->fields['db_version'];
|
||||
}
|
||||
|
||||
switch($current_version){
|
||||
switch ($current_version) {
|
||||
case '2.4.1' :
|
||||
// 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");
|
||||
@@ -33,11 +33,17 @@ function processmaker_update(){
|
||||
// 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");
|
||||
$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();
|
||||
}
|
||||
|
||||
if (isset($new_version)) {
|
||||
// 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());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
function update_3_2_8_to_3_2_9(){
|
||||
function update_3_2_8_to_3_2_9() {
|
||||
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`
|
||||
ADD COLUMN `db_version` VARCHAR(10) NULL;";
|
||||
$DB->query($query) or die("error adding db_version field to glpi_plugin_processmaker_configs" . $DB->error());
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
<?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;
|
||||
|
||||
|
||||
// to be sure
|
||||
$PM_DB = new PluginProcessmakerDB;
|
||||
|
||||
// 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`
|
||||
ALTER `id` DROP DEFAULT;";
|
||||
$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
|
||||
// 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'];
|
||||
$entities_id = 0;
|
||||
if ($tmp->getFromDB($row['items_id'])) {
|
||||
$entities_id = $tmp->fields['entities_id'];
|
||||
}
|
||||
foreach($PM_DB->request("SELECT CON_VALUE FROM CONTENT WHERE CON_CATEGORY='APP_TITLE' AND CON_LANG='en' AND CON_ID='{$row['case_guid']}'") as $name) {
|
||||
foreach ($PM_DB->request("SELECT CON_VALUE FROM CONTENT WHERE CON_CATEGORY='APP_TITLE' AND CON_LANG='en' AND CON_ID='{$row['case_guid']}'") as $name) {
|
||||
// there is only one record :)
|
||||
$name = $PM_DB->escape($name['CON_VALUE']);
|
||||
$query = "UPDATE ".PluginProcessmakerCase::getTable()." SET `name` = '{$name}', `entities_id` = $entities_id WHERE `id` = {$row['id']};";
|
||||
@@ -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`
|
||||
CHANGE COLUMN `processes_id` `plugin_processmaker_processes_id` INT(11) NOT NULL DEFAULT '0' AFTER `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
|
||||
HAVING COUNT(id) > 1;";
|
||||
|
||||
foreach($DB->request($query) as $rec){
|
||||
foreach ($DB->request($query) as $rec) {
|
||||
// there we have one rec per duplicates
|
||||
// so we may delete all records in the table, and a new one
|
||||
$del_query = "DELETE FROM glpi_plugin_processmaker_processes_profiles WHERE plugin_processmaker_processes_id=".$rec['plugin_processmaker_processes_id']."
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
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`
|
||||
ALTER `itemtype` DROP DEFAULT;";
|
||||
$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
|
||||
$query = "SELECT APP_UID, DEL_INDEX, DEL_THREAD, DEL_THREAD_STATUS FROM APP_DELEGATION WHERE DEL_THREAD_STATUS = 'CLOSED';";
|
||||
$locThreads = [];
|
||||
foreach($PM_DB->request($query) as $thread){
|
||||
foreach ($PM_DB->request($query) as $thread) {
|
||||
$locThreads[$thread['APP_UID']][] = $thread;
|
||||
}
|
||||
$locCase = new PluginProcessmakerCase;
|
||||
foreach($locThreads as $key => $threads){
|
||||
foreach ($locThreads as $key => $threads) {
|
||||
// get GLPI case id
|
||||
$locCase->getFromGUID($key);
|
||||
$del_indexes = [];
|
||||
foreach($threads as $thread){
|
||||
foreach ($threads as $thread) {
|
||||
$del_indexes[] = $thread['DEL_INDEX'];
|
||||
}
|
||||
$del_indexes = implode(", ", $del_indexes);
|
||||
@@ -130,18 +129,18 @@ function update_3_2_9_to_3_3_0(){
|
||||
$app_delegation = [];
|
||||
$query = "SELECT CONCAT(APPLICATION.APP_NUMBER, '-', APP_DELEGATION.DEL_INDEX) AS 'key', APP_DELEGATION.TAS_UID FROM APP_DELEGATION
|
||||
LEFT JOIN APPLICATION ON APPLICATION.APP_UID=APP_DELEGATION.APP_UID";
|
||||
foreach($PM_DB->request($query) as $row) {
|
||||
foreach ($PM_DB->request($query) as $row) {
|
||||
$app_delegation[$row['key']]=$row['TAS_UID'];
|
||||
}
|
||||
|
||||
$taskcats = [];
|
||||
$query = "SELECT * FROM glpi_plugin_processmaker_taskcategories";
|
||||
foreach($DB->request($query) as $row) {
|
||||
foreach ($DB->request($query) as $row) {
|
||||
$taskcats[$row['pm_task_guid']] = $row['id'];
|
||||
}
|
||||
|
||||
$query = "SELECT * FROM glpi_plugin_processmaker_tasks";
|
||||
foreach($DB->request($query) as $row) {
|
||||
foreach ($DB->request($query) as $row) {
|
||||
$key = $row['plugin_processmaker_cases_id']."-".$row['del_index'];
|
||||
if (isset($app_delegation[$key]) && isset($taskcats[$app_delegation[$key]])) {
|
||||
$DB->query("UPDATE glpi_plugin_processmaker_tasks SET plugin_processmaker_taskcategories_id={$taskcats[$app_delegation[$key]]} WHERE id={$row['id']}") or
|
||||
@@ -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`
|
||||
ALTER `processes_id` DROP DEFAULT;";
|
||||
$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());
|
||||
}
|
||||
|
||||
|
||||
if (arFieldExists("glpi_plugin_processmaker_users", "password" )) {
|
||||
if ($DB->fieldExists("glpi_plugin_processmaker_users", "password" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||
DROP COLUMN `password`;
|
||||
";
|
||||
$DB->query($query) or die("error deleting password col from glpi_plugin_processmaker_users" . $DB->error());
|
||||
}
|
||||
|
||||
if (!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`
|
||||
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());
|
||||
|
||||
// data migration
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<?php
|
||||
|
||||
function update_3_3_0_to_3_3_1(){
|
||||
function update_3_3_0_to_3_3_1() {
|
||||
global $DB;
|
||||
|
||||
// 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`
|
||||
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`,
|
||||
@@ -16,7 +16,7 @@ function update_3_3_0_to_3_3_1(){
|
||||
}
|
||||
|
||||
// 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`
|
||||
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`,
|
||||
@@ -26,6 +26,5 @@ function update_3_3_0_to_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,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
function update_to_3_2_8(){
|
||||
function update_to_3_2_8() {
|
||||
global $DB;
|
||||
|
||||
if (arTableExists("glpi_plugin_processmaker_config")) {
|
||||
if ($DB->tableExists("glpi_plugin_processmaker_config")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_config`
|
||||
ADD COLUMN `date_mod` DATETIME NULL DEFAULT NULL AFTER `pm_theme`,
|
||||
ADD COLUMN `comment` TEXT NULL AFTER `date_mod`;
|
||||
@@ -11,7 +11,7 @@ function update_to_3_2_8(){
|
||||
$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`
|
||||
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`,
|
||||
@@ -19,21 +19,21 @@ function update_to_3_2_8(){
|
||||
$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`
|
||||
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());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "maintenance" )) {
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "maintenance" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
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());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_configs", "pm_dbname" )) {
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "pm_dbname" )) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||
ADD COLUMN `pm_dbname` VARCHAR(50) NULL DEFAULT 'wf_workflow' AFTER `pm_dbserver_name`;
|
||||
;";
|
||||
@@ -42,12 +42,12 @@ function update_to_3_2_8(){
|
||||
$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` ;";
|
||||
$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`
|
||||
ADD COLUMN `processes_id` INT(11) NULL DEFAULT NULL;
|
||||
";
|
||||
@@ -62,7 +62,7 @@ function update_to_3_2_8(){
|
||||
$case = new PluginProcessmakerCase;
|
||||
foreach ($DB->request("SELECT * FROM glpi_plugin_processmaker_cases WHERE LENGTH( processes_id ) = 32") as $row) {
|
||||
$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`
|
||||
CHANGE COLUMN `processes_id` `processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`;
|
||||
@@ -71,8 +71,7 @@ function update_to_3_2_8(){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!arFieldExists('glpi_plugin_processmaker_users', 'password')) {
|
||||
if (!$DB->fieldExists('glpi_plugin_processmaker_users', 'password')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||
ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST,
|
||||
ADD COLUMN `password` VARCHAR(32) NULL DEFAULT NULL AFTER `pm_users_id`,
|
||||
@@ -86,7 +85,7 @@ function update_to_3_2_8(){
|
||||
$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`
|
||||
ALTER `glpi_users_id` DROP DEFAULT,
|
||||
DROP PRIMARY KEY,
|
||||
@@ -102,14 +101,13 @@ function update_to_3_2_8(){
|
||||
$DB->query($query) or die("error renaming 'glpi_users_id' into 'id' to glpi_plugin_processmaker_users" . $DB->error());
|
||||
}
|
||||
|
||||
|
||||
if (arFieldExists( 'glpi_plugin_processmaker_processes', 'is_helpdeskvisible')) {
|
||||
if ($DB->fieldExists( 'glpi_plugin_processmaker_processes', 'is_helpdeskvisible')) {
|
||||
$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`;";
|
||||
$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`
|
||||
ADD COLUMN `itilcategories_id` INT(11) NOT NULL DEFAULT '0',
|
||||
ADD COLUMN `type` INT(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets';";
|
||||
@@ -117,40 +115,38 @@ function update_to_3_2_8(){
|
||||
$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`
|
||||
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());
|
||||
}
|
||||
|
||||
if (!arFieldExists('glpi_plugin_processmaker_taskcategories', 'is_active')) {
|
||||
if (!$DB->fieldExists('glpi_plugin_processmaker_taskcategories', 'is_active')) {
|
||||
$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());
|
||||
}
|
||||
|
||||
|
||||
if (arFieldExists('glpi_plugin_processmaker_crontaskactions', 'postdatas')) {
|
||||
if ($DB->fieldExists('glpi_plugin_processmaker_crontaskactions', 'postdatas')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
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());
|
||||
}
|
||||
|
||||
if (!arFieldExists('glpi_plugin_processmaker_crontaskactions', 'logs_out')) {
|
||||
if (!$DB->fieldExists('glpi_plugin_processmaker_crontaskactions', 'logs_out')) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
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());
|
||||
}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_crontaskactions", "is_targettoclaim")) {
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_crontaskactions", "is_targettoclaim")) {
|
||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||
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());
|
||||
}
|
||||
|
||||
|
||||
//if (!arFieldExists("glpi_plugin_processmaker_caselinks", "plugin_processmaker_taskcategories_id_source")) {
|
||||
//if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "plugin_processmaker_taskcategories_id_source")) {
|
||||
// $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_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());
|
||||
//}
|
||||
|
||||
if (!arFieldExists("glpi_plugin_processmaker_caselinks", "is_targettoclaim")) {
|
||||
if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "is_targettoclaim")) {
|
||||
$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());
|
||||
}
|
||||
|
||||
//if( !arTableExists('glpi_plugin_processmaker_selfservicedrafts')){
|
||||
//if( !$DB->tableExists('glpi_plugin_processmaker_selfservicedrafts')){
|
||||
// $query = "CREATE TABLE `glpi_plugin_processmaker_selfservicedrafts` (
|
||||
// `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
// `users_id` INT(11) NOT NULL,
|
||||
|
||||
60
js/cases.js
60
js/cases.js
@@ -181,44 +181,44 @@ function redimTaskFrame(taskFrame, delIndex) {
|
||||
}
|
||||
}
|
||||
|
||||
function onTaskFrameActivation(delIndex) {
|
||||
var taskFrameId = "caseiframe-" + delIndex;
|
||||
var taskFrameTimerCounter = 0;
|
||||
var redimIFrame = false;
|
||||
//function onTaskFrameActivation(delIndex) {
|
||||
// var taskFrameId = "caseiframe-" + delIndex;
|
||||
// var taskFrameTimerCounter = 0;
|
||||
// var redimIFrame = false;
|
||||
|
||||
var taskFrameTimer = window.setInterval(function () {
|
||||
try {
|
||||
var locContentDocument;
|
||||
var taskFrame = document.getElementById(taskFrameId);
|
||||
// var taskFrameTimer = window.setInterval(function () {
|
||||
// try {
|
||||
// var locContentDocument;
|
||||
// var taskFrame = document.getElementById(taskFrameId);
|
||||
|
||||
if (taskFrame != undefined && taskFrame.contentDocument != undefined) {
|
||||
// here we've caught the content of the iframe
|
||||
locContentDocument = taskFrame.contentDocument;
|
||||
// if (taskFrame != undefined && taskFrame.contentDocument != undefined) {
|
||||
// // here we've caught the content of the iframe
|
||||
// locContentDocument = taskFrame.contentDocument;
|
||||
|
||||
// try to redim caseIFrame
|
||||
if (!redimIFrame) {
|
||||
var newHeight;
|
||||
var locElt = locContentDocument.getElementsByTagName("html")[0];
|
||||
newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||
// // try to redim caseIFrame
|
||||
// if (!redimIFrame) {
|
||||
// var newHeight;
|
||||
// var locElt = locContentDocument.getElementsByTagName("html")[0];
|
||||
// newHeight = parseInt(getComputedStyle(locElt, null).getPropertyValue('height'), 10);
|
||||
|
||||
tabs.getItem('task-' + delIndex).setHeight(newHeight);
|
||||
taskFrame.height = newHeight;
|
||||
redimIFrame = true;
|
||||
}
|
||||
}
|
||||
// tabs.getItem('task-' + delIndex).setHeight(newHeight);
|
||||
// taskFrame.height = newHeight;
|
||||
// redimIFrame = true;
|
||||
// }
|
||||
// }
|
||||
|
||||
taskFrameTimerCounter = taskFrameTimerCounter + 1;
|
||||
// taskFrameTimerCounter = taskFrameTimerCounter + 1;
|
||||
|
||||
if (taskFrameTimerCounter > 3000 || redimIFrame) { // timeout
|
||||
window.clearInterval(taskFrameTimer);
|
||||
}
|
||||
// if (taskFrameTimerCounter > 3000 || redimIFrame) { // timeout
|
||||
// window.clearInterval(taskFrameTimer);
|
||||
// }
|
||||
|
||||
} catch (evt) {
|
||||
// nothing to do here for the moment
|
||||
}
|
||||
// } catch (evt) {
|
||||
// // nothing to do here for the moment
|
||||
// }
|
||||
|
||||
}, 10);
|
||||
}
|
||||
// }, 10);
|
||||
//}
|
||||
function clearClass(lociFrame) {
|
||||
|
||||
try {
|
||||
|
||||
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,10 +1,11 @@
|
||||
<?php
|
||||
define('GLPI_ROOT','../../..');
|
||||
define('GLPI_ROOT', '../../..');
|
||||
include (GLPI_ROOT."/inc/includes.php");
|
||||
header("Content-type: application/javascript");
|
||||
|
||||
$config = PluginProcessmakerConfig::getInstance() ;
|
||||
if( isset($config->fields['domain']) && $config->fields['domain'] != '' ) {
|
||||
$plugin = new Plugin();
|
||||
if ($plugin->isActivated('processmaker')) {
|
||||
$config = PluginProcessmakerConfig::getInstance();
|
||||
if (isset($config->fields['domain']) && $config->fields['domain'] != '') {
|
||||
echo "
|
||||
//debugger;
|
||||
var d = document,
|
||||
@@ -13,5 +14,6 @@ if( isset($config->fields['domain']) && $config->fields['domain'] != '' ) {
|
||||
g.type = 'text/javascript';
|
||||
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();
|
||||
});
|
||||
});
|
||||
@@ -6,12 +6,12 @@
|
||||
<logo>https://raw.githubusercontent.com/tomolimo/processmaker/master/processmaker.png</logo>
|
||||
<description>
|
||||
<short>
|
||||
<fr>Ce plugin fournit la possibilité d'intégrer un processus (workflow) aux tickets.</fr>
|
||||
<en>This plugin provides a process (workflow) management linked to tickets.</en>
|
||||
<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 ITIL objects (Tickets, Changes and Problems).</en>
|
||||
</short>
|
||||
<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>
|
||||
<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>
|
||||
<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 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>
|
||||
</description>
|
||||
<homepage>https://github.com/tomolimo/processmaker</homepage>
|
||||
@@ -23,12 +23,12 @@
|
||||
</authors>
|
||||
<versions>
|
||||
<version>
|
||||
<num>3.3.1</num>
|
||||
<compatibility>9.2</compatibility>
|
||||
<num>3.3.8</num>
|
||||
<compatibility>9.1</compatibility>
|
||||
</version>
|
||||
<version>
|
||||
<num>3.3.1</num>
|
||||
<compatibility>9.1</compatibility>
|
||||
<num>3.4.5</num>
|
||||
<compatibility>9.2</compatibility>
|
||||
</version>
|
||||
</versions>
|
||||
<langs>
|
||||
@@ -40,12 +40,14 @@
|
||||
<tags>
|
||||
<fr>
|
||||
<tag>Processus</tag>
|
||||
<tag>BPMN 2.0</tag>
|
||||
<tag>Workflow</tag>
|
||||
<tag>Helpdesk</tag>
|
||||
<tag>Ticket</tag>
|
||||
</fr>
|
||||
<en>
|
||||
<tag>Processes</tag>
|
||||
<tag>BPMN 2.0</tag>
|
||||
<tag>Helpdesk</tag>
|
||||
<tag>Workflows</tag>
|
||||
<tag>Ticket</tag>
|
||||
|
||||
@@ -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" ;
|
||||
|
||||
|
||||
|
||||
?>
|
||||
90
setup.php
90
setup.php
@@ -2,6 +2,7 @@
|
||||
|
||||
// used for case cancellation
|
||||
define("CANCEL", 256);
|
||||
define('PROCESSMAKER_VERSION', '3.4.5');
|
||||
|
||||
// Init the hooks of the plugins -Needed
|
||||
function plugin_init_processmaker() {
|
||||
@@ -10,29 +11,27 @@ function plugin_init_processmaker() {
|
||||
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
|
||||
|
||||
$objects = ['Ticket', 'Change', 'Problem'];
|
||||
// $objects = ['Ticket'];
|
||||
// $objects = ['Ticket'];
|
||||
|
||||
Plugin::registerClass('PluginProcessmakerProcessmaker');
|
||||
|
||||
Plugin::registerClass('PluginProcessmakerCase', array('addtabon' => $objects));
|
||||
Plugin::registerClass('PluginProcessmakerCase', ['addtabon' => $objects]);
|
||||
|
||||
Plugin::registerClass('PluginProcessmakerTaskCategory');
|
||||
|
||||
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::registerClass('PluginProcessmakerProfile', array('addtabon' => 'Profile'));
|
||||
|
||||
$PLUGIN_HOOKS['change_profile']['processmaker'] = array('PluginProcessmakerProfile','select');
|
||||
Plugin::registerClass('PluginProcessmakerProfile', ['addtabon' => 'Profile']);
|
||||
|
||||
Plugin::registerClass('PluginProcessmakerProcess_Profile');
|
||||
|
||||
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
|
||||
|
||||
$PLUGIN_HOOKS['pre_show_item']['processmaker']
|
||||
= array('PluginProcessmakerProcessmaker', 'pre_show_item_processmaker');
|
||||
= ['PluginProcessmakerProcessmaker', 'pre_show_item_processmaker'];
|
||||
|
||||
//$PLUGIN_HOOKS['pre_item_form']['processmaker']
|
||||
// = array('PluginProcessmakerProcessmaker', 'pre_item_form_processmakerticket');
|
||||
@@ -40,9 +39,9 @@ function plugin_init_processmaker() {
|
||||
// = array('PluginProcessmakerProcessmaker', 'post_item_form_processmakerticket');
|
||||
|
||||
$PLUGIN_HOOKS['pre_show_tab']['processmaker']
|
||||
= array('PluginProcessmakerProcessmaker', 'pre_show_tab_processmaker');
|
||||
= ['PluginProcessmakerProcessmaker', 'pre_show_tab_processmaker'];
|
||||
$PLUGIN_HOOKS['post_show_tab']['processmaker']
|
||||
= array('PluginProcessmakerProcessmaker', 'post_show_tab_processmaker');
|
||||
= ['PluginProcessmakerProcessmaker', 'post_show_tab_processmaker'];
|
||||
|
||||
// Display a menu entry ?
|
||||
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::registerClass('PluginProcessmakerProcess', array( 'massiveaction_nodelete_types' => true) );
|
||||
Plugin::registerClass('PluginProcessmakerProcess', [ 'massiveaction_nodelete_types' => true] );
|
||||
|
||||
$hooks = [];
|
||||
foreach($objects as $obj){
|
||||
foreach ($objects as $obj) {
|
||||
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_pre_item_add_processmaker'];
|
||||
}
|
||||
$PLUGIN_HOOKS['pre_item_add']['processmaker'] = $hooks;
|
||||
|
||||
$hooks = [];
|
||||
foreach($objects as $obj){
|
||||
foreach ($objects as $obj) {
|
||||
$hooks[$obj] = 'plugin_pre_item_update_processmaker';
|
||||
}
|
||||
$PLUGIN_HOOKS['pre_item_update']['processmaker'] = $hooks;
|
||||
|
||||
$hooks = ['TicketSatisfaction' => 'plugin_item_update_processmaker_satisfaction'];
|
||||
foreach($objects as $obj){
|
||||
foreach ($objects as $obj) {
|
||||
$hooks[$obj.'Task'] = 'plugin_item_update_processmaker_tasks';
|
||||
}
|
||||
$PLUGIN_HOOKS['item_update']['processmaker'] = $hooks;
|
||||
|
||||
$hooks = [];
|
||||
foreach($objects as $obj){
|
||||
foreach ($objects as $obj) {
|
||||
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_add_processmaker'];
|
||||
}
|
||||
$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 = [];
|
||||
foreach($objects as $obj){
|
||||
$hooks[$obj.'_User'] = 'plugin_pre_item_purge_processmaker';
|
||||
foreach ($objects as $obj) {
|
||||
$hooks['NotificationTarget'.$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_data_processmaker'];
|
||||
}
|
||||
$PLUGIN_HOOKS['pre_item_purge']['processmaker'] = $hooks;
|
||||
$PLUGIN_HOOKS['item_get_datas']['processmaker'] = $hooks;
|
||||
|
||||
$hooks = [];
|
||||
foreach($objects as $obj){
|
||||
$hooks[$obj.'_User'] = 'plugin_item_purge_processmaker';
|
||||
foreach ($objects as $obj) {
|
||||
$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();
|
||||
if ($plugin->isActivated('processmaker')
|
||||
&& Session::getLoginUserID() ) {
|
||||
$PLUGIN_HOOKS['add_javascript']['processmaker'] = array("js/domain.js.php");
|
||||
|
||||
$url = explode("/", $_SERVER['PHP_SELF']);
|
||||
$pageName = explode("?", array_pop($url));
|
||||
switch ($pageName[0]) {
|
||||
@@ -106,6 +110,16 @@ function plugin_init_processmaker() {
|
||||
case "helpdesk.public.php":
|
||||
$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/helpdesk.public.js.php";
|
||||
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.
|
||||
$PLUGIN_HOOKS['change_profile']['processmaker'] = 'plugin_processmaker_change_profile';
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Get the name and the version of the plugin - Needed
|
||||
function plugin_version_processmaker() {
|
||||
return array ('name' => 'Process Maker',
|
||||
'version' => '3.3.1',
|
||||
return [
|
||||
'name' => 'Process Maker',
|
||||
'version' => PROCESSMAKER_VERSION,
|
||||
'author' => 'Olivier Moron',
|
||||
'license' => 'GPLv3+',
|
||||
'homepage' => 'https://github.com/tomolimo/processmaker',
|
||||
'minGlpiVersion' => '9.1');
|
||||
'requirements' => [
|
||||
'glpi' => [
|
||||
'min' => '9.2',
|
||||
'max' => '9.2.99'
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
// Optional : check prerequisites before install : may print errors or add to message after redirect
|
||||
function plugin_processmaker_check_prerequisites() {
|
||||
if (version_compare(GLPI_VERSION, '9.1', 'lt') || version_compare(GLPI_VERSION, '9.3', 'ge')) {
|
||||
echo "This plugin requires GLPI >= 9.1 and < 9.3";
|
||||
if (version_compare(GLPI_VERSION, '9.2', 'lt') || version_compare(GLPI_VERSION, '9.3', 'ge')) {
|
||||
echo "This plugin requires GLPI >= 9.2 and < 9.3";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user