3
0

Version 3.4.5

Compatibility with GLPI 9.2
This commit is contained in:
tomolimo
2019-01-14 16:19:24 +01:00
parent 77d2871388
commit f8dde22c50
41 changed files with 1764 additions and 1186 deletions

View File

@@ -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/

View File

@@ -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 );
}
}

View File

@@ -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++;
}
}

View File

@@ -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++;
}
}

View File

@@ -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 "&nbsp;&nbsp;";
echo "<input type='submit' name='reassign' value='".__('Re-assign', 'processmaker')."' class='submit'>";
Html::closeForm(true);

View File

@@ -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"]);

View File

@@ -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();

View File

@@ -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();

View File

@@ -2,6 +2,8 @@
include_once ("../../../inc/includes.php");
Session::checkLoginUser();
Plugin::load('processmaker', true); // ???
if (!isset($_REQUEST["id"])) {

View File

@@ -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...
@@ -52,7 +52,7 @@ switch ($_POST["action"]) {
Html::redirect($CFG_GLPI['root_doc']."/plugins/processmaker/front/processmaker.helpdesk.form.php?processes_id=".$_POST['plugin_processmaker_processes_id']."&case_guid=".$resultCase->caseId."&rand=$rand&itilcategories_id=".$_POST["itilcategories_id"]."&type=".$_REQUEST["type"]."&entities_id=".$_REQUEST['entities_id']);
} else {
Session::addMessageAfterRedirect( PluginProcessmakerProcessmaker::getPMErrorMessage($resultCase->status_code)."<br>$resultCase->message ($resultCase->status_code)", true, ERROR);
Session::addMessageAfterRedirect( PluginProcessmakerProcessmaker::getPMErrorMessage($resultCase->status_code)."<br>$resultCase->message ($resultCase->status_code)", true, ERROR);
Html::redirect($CFG_GLPI["root_doc"]."/front/helpdesk.public.php?create_ticket=1");
}
@@ -87,54 +87,54 @@ 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
// $locCase = new PluginProcessmakerCase;
// if ($locCase->getFromDB($_POST['cases_id']) && $locCase->deleteCase()) {
// // request delete from pm itself
// $PM_SOAP->login(true);
//} else if (isset($_POST['delete'])) {
// // delete case from case table, this will also delete the tasks
// $locCase = new PluginProcessmakerCase;
// if ($locCase->getFromDB($_POST['cases_id']) && $locCase->deleteCase()) {
// // request delete from pm itself
// $PM_SOAP->login(true);
// $resultPM = $PM_SOAP->deleteCase($locCase->fields['case_guid']);
// $resultPM = $PM_SOAP->deleteCase($locCase->fields['case_guid']);
// if ($resultPM->status_code == 0) {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO);
// } else {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
// }
// } else {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
// }
//} else if (isset($_POST['cancel'])) {
// // cancel case from PM
// $locCase = new PluginProcessmakerCase;
// $locCase->getFromDB($_POST['cases_id']);
// $resultPM = $PM_SOAP->cancelCase($locCase->fields['case_guid']); //, $_POST['plugin_processmaker_del_index'], $_POST['plugin_processmaker_users_id'] ) ;
// if ($resultPM->status_code === 0) {
// //$locCase = new PluginProcessmakerCase;
// //$locCase->getFromDB($_POST['cases_id']);
// if ($locCase->cancelCase()) {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['cancelled'], true, INFO);
// } else {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR);
// }
// } else {
// if ($resultPM->status_code == 100 && $locCase->deleteCase()) { // case is draft then delete it
// // request delete from pm itself
// $PM_SOAP->login(true);
// if ($resultPM->status_code == 0) {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO);
// } else {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
// }
// } else {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
// }
//} else if (isset($_POST['cancel'])) {
// // cancel case from PM
// $locCase = new PluginProcessmakerCase;
// $locCase->getFromDB($_POST['cases_id']);
// $resultPM = $PM_SOAP->cancelCase($locCase->fields['case_guid']); //, $_POST['plugin_processmaker_del_index'], $_POST['plugin_processmaker_users_id'] ) ;
// if ($resultPM->status_code === 0) {
// //$locCase = new PluginProcessmakerCase;
// //$locCase->getFromDB($_POST['cases_id']);
// if ($locCase->cancelCase()) {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['cancelled'], true, INFO);
// } else {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR);
// }
// } else {
// if ($resultPM->status_code == 100 && $locCase->deleteCase()) { // case is draft then delete it
// // request delete from pm itself
// $PM_SOAP->login(true);
// $resultPM = $PM_SOAP->deleteCase($locCase->fields['case_guid']);
// $resultPM = $PM_SOAP->deleteCase($locCase->fields['case_guid']);
// if ($resultPM->status_code == 0) {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO);
// } else {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
// }
// } else {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled']. " " . $resultPM->message, true, ERROR);
// }
// }
// if ($resultPM->status_code == 0) {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO);
// } else {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
// }
// } else {
// Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled']. " " . $resultPM->message, true, ERROR);
// }
// }
}
break;

View File

@@ -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)) {

View File

@@ -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");
}
}

210
hook.php

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -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,12 +74,12 @@ 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');
}
}
}

View File

@@ -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;
}
@@ -267,4 +280,4 @@ class PluginProcessmakerCaselink extends CommonDBTM {
// }
// return $menu;
//}
}
}

View File

@@ -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']."'>";
@@ -221,7 +225,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
if ($config->fields['pm_server_URL'] != ''
&& $config->fields['pm_workspace'] != ''
&& $config->fields["pm_admin_user"] != ''
// && ($pm->login(true))) {
// && ($pm->login(true))) {
&& ($PM_SOAP->login(true))) {
echo "<font color='green'>".__('Test successful');
$setup_ok = true;
@@ -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');
}
@@ -329,27 +333,27 @@ class PluginProcessmakerConfig extends CommonDBTM {
echo "<tr><td colspan='4'></td></tr>";
echo "<tr><th colspan='4'>".__('Processmaker system information', 'processmaker')."</th></tr>";
if ($setup_ok) {
$info = $PM_SOAP->systemInformation( );
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.$info->version.'</td></tr>';
echo '<tr><td>'.__('Web server', 'processmaker').'</td><td>'.$info->webServer.'</td></tr>';
echo '<tr><td>'.__('Server name', 'processmaker').'</td><td>'.$info->serverName.'</td></tr>';
echo '<tr><td>'.__('PHP version', 'processmaker').'</td><td>'.$info->phpVersion.'</td></tr>';
echo '<tr><td>'.__('DB version', 'processmaker').'</td><td>'.$info->databaseVersion.'</td></tr>';
echo '<tr><td>'.__('DB server IP', 'processmaker').'</td><td>'.$info->databaseServerIp.'</td></tr>';
echo '<tr><td>'.__('DB name', 'processmaker').'</td><td>'.$info->databaseName.'</td></tr>';
echo '<tr><td>'.__('User browser', 'processmaker').'</td><td>'.$info->userBrowser.'</td></tr>';
echo '<tr><td>'.__('User IP', 'processmaker').'</td><td>'.$info->userIp.'</td></tr>';
} else {
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.__('Not yet!', 'processmaker').'</td></tr>';
}
$config->showFormButtons(array('candel'=>false));
if ($setup_ok) {
$info = $PM_SOAP->systemInformation( );
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.$info->version.'</td></tr>';
echo '<tr><td>'.__('Web server', 'processmaker').'</td><td>'.$info->webServer.'</td></tr>';
echo '<tr><td>'.__('Server name', 'processmaker').'</td><td>'.$info->serverName.'</td></tr>';
echo '<tr><td>'.__('PHP version', 'processmaker').'</td><td>'.$info->phpVersion.'</td></tr>';
echo '<tr><td>'.__('DB version', 'processmaker').'</td><td>'.$info->databaseVersion.'</td></tr>';
echo '<tr><td>'.__('DB server IP', 'processmaker').'</td><td>'.$info->databaseServerIp.'</td></tr>';
echo '<tr><td>'.__('DB name', 'processmaker').'</td><td>'.$info->databaseName.'</td></tr>';
echo '<tr><td>'.__('User browser', 'processmaker').'</td><td>'.$info->userBrowser.'</td></tr>';
echo '<tr><td>'.__('User IP', 'processmaker').'</td><td>'.$info->userIp.'</td></tr>';
} else {
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.__('Not yet!', 'processmaker').'</td></tr>';
}
$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);

View File

@@ -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;
}
}

View File

@@ -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;
}
}
@@ -55,4 +55,4 @@ class PluginProcessmakerMenu extends CommonGLPI {
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -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

View File

@@ -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;

View File

@@ -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,33 +101,42 @@ class PluginProcessmakerTask extends CommonITILTask
$params['whogroup'] = $params['who'];
$params['who'] = 0;
}
$ret = CommonITILTask::genericPopulatePlanning( 'TicketTask', $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)
// 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'] ) ) {
$event['editable'] = false;
//$event['url'] .= '&forcetab=PluginProcessmakerCase$processmakercases';
$tmpCase = new PluginProcessmakerCase;
$tmpCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']);
$event['url'] = $tmpCase->getLinkURL().'&forcetab=PluginProcessmakerTask$'.$pmTask->fields['items_id'];
$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);
$taskCat = new TaskCategory;
$taskCat->getFromDB( $pmTask->fields['taskcategories_id'] );
$taskComment = isset($taskCat->fields['comment']) ? $taskCat->fields['comment'] : '';
if (Session::haveTranslations('TaskCategory', 'comment')) {
$taskComment = DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'comment', $_SESSION['glpilanguage'], $taskComment );
foreach ($ret as $key => $event) {
// 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 PluginProcessmakerTask($tasktype);
if ($pmTask->getFromDB($event[strtolower($tasktype).'s_id'])) { // $pmTask->getFromDBByQuery( " WHERE itemtype = 'TicketTask' AND items_id = ". $event['tickettasks_id'] ) ) {
$event['editable'] = false;
//$event['url'] .= '&forcetab=PluginProcessmakerCase$processmakercases';
$tmpCase = new PluginProcessmakerCase;
$tmpCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']);
$event['url'] = $tmpCase->getLinkURL().'&forcetab=PluginProcessmakerTask$'.$pmTask->fields['items_id'];
$taskCat = new TaskCategory;
$taskCat->getFromDB( $pmTask->fields['taskcategories_id'] );
$taskComment = isset($taskCat->fields['comment']) ? $taskCat->fields['comment'] : '';
if (Session::haveTranslations('TaskCategory', 'comment')) {
$taskComment = DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'comment', $_SESSION['glpilanguage'], $taskComment );
}
$event['content'] = str_replace( '##processmaker.taskcomment##', $taskComment, $event['content'] );
$event['content'] = str_replace( ['\n##processmakercase.url##', '##processmakercase.url##'], "", $event['content'] ); //<a href=\"".$event['url']."\">"."Click to manage task"."</a>
//if( $event['state'] == 1 && $event['end'] < $params['start'] ) { // if todo and late
// $event['name'] = $event['end'].' '.$event['name'] ; //$event['begin'].' to '.$event['end'].' '.$event['name'] ;
// $event['end'] = $params['start'].' 24:00:00'; //.$CFG_GLPI['planning_end'];
//}
$events[$key] = $event;
}
$event['content'] = str_replace( '##processmaker.taskcomment##', $taskComment, $event['content'] );
$event['content'] = str_replace( '##processmakercase.url##', "", $event['content'] ); //<a href=\"".$event['url']."\">"."Click to manage task"."</a>
//if( $event['state'] == 1 && $event['end'] < $params['start'] ) { // if todo and late
// $event['name'] = $event['end'].' '.$event['name'] ; //$event['begin'].' to '.$event['end'].' '.$event['name'] ;
// $event['end'] = $params['start'].' 24:00:00'; //.$CFG_GLPI['planning_end'];
//}
$events[$key] = $event;
}
}
}
@@ -135,7 +145,7 @@ class PluginProcessmakerTask extends CommonITILTask
}
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0){
function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) {
global $DB, $PM_DB;
$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
}
);
}
});
");
}

View File

@@ -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);
@@ -67,7 +67,7 @@ class PluginProcessmakerTaskCategory extends CommonDBTM
echo "<td class='center'>";
if ($taskCat['is_active']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Active')."\">";
}
echo "</td>";
@@ -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)) {

View File

@@ -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'];

View File

@@ -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;
default :
$version = $info['version'];
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 = '3.3.8';
break;
}
$DB->runFile(GLPI_ROOT . "/plugins/processmaker/install/mysql/$version-empty.sql");

View 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 */;

View File

@@ -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();
}
// end update by updating the db version number
$query = "UPDATE `glpi_plugin_processmaker_configs` SET `db_version` = '$new_version' WHERE `id` = 1;";
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());
$DB->query($query) or die("error when updating db_version field in glpi_plugin_processmaker_configs" . $DB->error());
}
}

View File

@@ -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());

Some files were not shown because too many files have changed in this diff Show More