Added more info in config format
Added possibility to rename PM DB (default to wf_workflow) Fixes #53 Fixes #50 + other fixes Changed version to 3.2.8
This commit is contained in:
@@ -588,7 +588,9 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
|
|||||||
$buffer = htmlspecialchars($buffer, ENT_NOQUOTES);
|
$buffer = htmlspecialchars($buffer, ENT_NOQUOTES);
|
||||||
// will restore '<' to '<' and '>' to '>'
|
// will restore '<' to '<' and '>' to '>'
|
||||||
// so that only the already escaped entites will get the double encoding
|
// so that only the already escaped entites will get the double encoding
|
||||||
$buffer = str_replace(['<', '>'], ['<', '>'], $buffer);
|
// will also change </b> end of bold into a local identifier
|
||||||
|
$endOfBold = 'end_of_bold'.rand();
|
||||||
|
$buffer = str_replace(['<', '>', '</b>'], ['<', '>', $endOfBold], $buffer);
|
||||||
|
|
||||||
// will convert any UTF-8 char that can't be expressed in ASCII into an HTML entity
|
// will convert any UTF-8 char that can't be expressed in ASCII into an HTML entity
|
||||||
$buffer = mb_convert_encoding($buffer, 'HTML-ENTITIES');
|
$buffer = mb_convert_encoding($buffer, 'HTML-ENTITIES');
|
||||||
@@ -604,6 +606,14 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
|
|||||||
$elt->setAttribute( 'style', 'display:none;');
|
$elt->setAttribute( 'style', 'display:none;');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// add an input for processId in the form
|
||||||
|
// echo "<input type='hidden' name='processId' value='".$caseInfo->processId."'>";
|
||||||
|
$res = $xpath->query('//form[@name="helpdeskform"]');
|
||||||
|
$input = $res->item(0)->appendChild(new DOMElement('input'));
|
||||||
|
$input->setAttribute('name', 'processId');
|
||||||
|
$input->setAttribute('type', 'hidden');
|
||||||
|
$input->setAttribute('value', $caseInfo->processId);
|
||||||
|
|
||||||
// special case for content textarea which is in the same tr than the file upload
|
// special case for content textarea which is in the same tr than the file upload
|
||||||
$res = $xpath->query('//*[@name="content"]/ancestor::div[1] | //*[@name="content"]/ancestor::tr[1]/td[1]');
|
$res = $xpath->query('//*[@name="content"]/ancestor::div[1] | //*[@name="content"]/ancestor::tr[1]/td[1]');
|
||||||
foreach($res as $elt) {
|
foreach($res as $elt) {
|
||||||
@@ -644,6 +654,9 @@ function processMakerShowCase( $ID, $from_helpdesk ) {
|
|||||||
|
|
||||||
$buffer = $dom->saveHTML();
|
$buffer = $dom->saveHTML();
|
||||||
|
|
||||||
|
// revert back </b>
|
||||||
|
$buffer = str_replace($endOfBold, '</b>', $buffer);
|
||||||
|
|
||||||
// will revert back any char converted above
|
// will revert back any char converted above
|
||||||
$buffer = mb_convert_encoding($buffer, 'UTF-8', 'HTML-ENTITIES');
|
$buffer = mb_convert_encoding($buffer, 'UTF-8', 'HTML-ENTITIES');
|
||||||
echo $buffer;
|
echo $buffer;
|
||||||
|
|||||||
@@ -7,6 +7,9 @@
|
|||||||
if( isset( $_REQUEST['_glpi_csrf_token'] ) ) {
|
if( isset( $_REQUEST['_glpi_csrf_token'] ) ) {
|
||||||
define('GLPI_KEEP_CSRF_TOKEN', true) ;
|
define('GLPI_KEEP_CSRF_TOKEN', true) ;
|
||||||
}
|
}
|
||||||
|
$PM_POST = $_POST;
|
||||||
|
$PM_REQUEST = $_REQUEST;
|
||||||
|
$PM_GET = $_GET;
|
||||||
include( "../../../inc/includes.php" );
|
include( "../../../inc/includes.php" );
|
||||||
|
|
||||||
if (empty($_POST["_type"])
|
if (empty($_POST["_type"])
|
||||||
@@ -58,4 +61,8 @@ if( isset($_POST["_from_helpdesk"]) && $_POST["_from_helpdesk"] == 1
|
|||||||
// prepare environment for std tracking.injector.php
|
// prepare environment for std tracking.injector.php
|
||||||
// switch to front dir
|
// switch to front dir
|
||||||
chdir(GLPI_ROOT."/front");
|
chdir(GLPI_ROOT."/front");
|
||||||
|
// revert back $_POST, $_GET and $_REQUEST
|
||||||
|
$_GET = $PM_GET;
|
||||||
|
$_POST = $PM_POST;
|
||||||
|
$_REQUEST = $PM_REQUEST;
|
||||||
include (GLPI_ROOT . "/front/tracking.injector.php");
|
include (GLPI_ROOT . "/front/tracking.injector.php");
|
||||||
|
|||||||
8
hook.php
8
hook.php
@@ -123,6 +123,7 @@ function plugin_processmaker_install() {
|
|||||||
`pm_group_guid` VARCHAR(32) NULL DEFAULT NULL,
|
`pm_group_guid` VARCHAR(32) NULL DEFAULT NULL,
|
||||||
`comment` TEXT NULL,
|
`comment` TEXT NULL,
|
||||||
`pm_dbserver_name` VARCHAR(255) NULL DEFAULT 'localhost',
|
`pm_dbserver_name` VARCHAR(255) NULL DEFAULT 'localhost',
|
||||||
|
`pm_dbname` VARCHAR(50) NULL DEFAULT 'wf_workflow',
|
||||||
`pm_dbserver_user` VARCHAR(255) NULL DEFAULT NULL,
|
`pm_dbserver_user` VARCHAR(255) NULL DEFAULT NULL,
|
||||||
`pm_dbserver_passwd` VARCHAR(255) NULL DEFAULT NULL,
|
`pm_dbserver_passwd` VARCHAR(255) NULL DEFAULT NULL,
|
||||||
`domain` VARCHAR(50) NULL DEFAULT '',
|
`domain` VARCHAR(50) NULL DEFAULT '',
|
||||||
@@ -164,6 +165,13 @@ function plugin_processmaker_install() {
|
|||||||
$DB->query($query) or die("error adding fields maintenance to glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error adding fields maintenance to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!arFieldExists("glpi_plugin_processmaker_configs", "pm_dbname" )) {
|
||||||
|
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||||
|
ADD COLUMN `pm_dbname` VARCHAR(50) NULL DEFAULT 'wf_workflow' AFTER `pm_dbserver_name`;
|
||||||
|
;";
|
||||||
|
$DB->query($query) or die("error adding field pm_dbname to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
|
}
|
||||||
|
|
||||||
if (arTableExists("glpi_plugin_processmaker_profiles")) {
|
if (arTableExists("glpi_plugin_processmaker_profiles")) {
|
||||||
$query = "DROP TABLE `glpi_plugin_processmaker_profiles` ;";
|
$query = "DROP TABLE `glpi_plugin_processmaker_profiles` ;";
|
||||||
$DB->query($query) or die("error dropping glpi_plugin_processmaker_profiles" . $DB->error());
|
$DB->query($query) or die("error dropping glpi_plugin_processmaker_profiles" . $DB->error());
|
||||||
|
|||||||
@@ -143,6 +143,8 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
static function showConfigForm($item) {
|
static function showConfigForm($item) {
|
||||||
global $LANG, $PM_DB, $CFG_GLPI;
|
global $LANG, $PM_DB, $CFG_GLPI;
|
||||||
|
|
||||||
|
$setup_ok = false;
|
||||||
|
|
||||||
$ui_theme = array(
|
$ui_theme = array(
|
||||||
'glpi_classic' => 'glpi_classic',
|
'glpi_classic' => 'glpi_classic',
|
||||||
'glpi_neoclassic' => 'glpi_neoclassic'
|
'glpi_neoclassic' => 'glpi_neoclassic'
|
||||||
@@ -150,7 +152,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
|
|
||||||
$config = self::getInstance();
|
$config = self::getInstance();
|
||||||
|
|
||||||
$config->showFormHeader();
|
$config->showFormHeader(['colspan' => 4]);
|
||||||
|
|
||||||
echo "<tr class='tab_bg_1'>";
|
echo "<tr class='tab_bg_1'>";
|
||||||
echo "<td >".$LANG['processmaker']['config']['URL']."</td><td >";
|
echo "<td >".$LANG['processmaker']['config']['URL']."</td><td >";
|
||||||
@@ -220,6 +222,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
&& $config->fields["pm_admin_user"] != ''
|
&& $config->fields["pm_admin_user"] != ''
|
||||||
&& ($pm->login(true))) {
|
&& ($pm->login(true))) {
|
||||||
echo "<font color='green'>".__('Test successful');
|
echo "<font color='green'>".__('Test successful');
|
||||||
|
$setup_ok = true;
|
||||||
} else {
|
} else {
|
||||||
echo "<font color='red'>".__('Test failed')."<br>".print_r($pm->lasterror, true);
|
echo "<font color='red'>".__('Test failed')."<br>".print_r($pm->lasterror, true);
|
||||||
}
|
}
|
||||||
@@ -232,6 +235,11 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
echo "<td ><input type='text' size=50 name='pm_dbserver_name' value='".$config->fields["pm_dbserver_name"]."'>";
|
echo "<td ><input type='text' size=50 name='pm_dbserver_name' value='".$config->fields["pm_dbserver_name"]."'>";
|
||||||
echo "</td></tr>\n";
|
echo "</td></tr>\n";
|
||||||
|
|
||||||
|
echo "<tr class='tab_bg_1'>";
|
||||||
|
echo "<td >" . __('Database name') . "</td>";
|
||||||
|
echo "<td ><input type='text' size=50 name='pm_dbname' value='".$config->fields["pm_dbname"]."'>";
|
||||||
|
echo "</td></tr>\n";
|
||||||
|
|
||||||
echo "<tr class='tab_bg_1'>";
|
echo "<tr class='tab_bg_1'>";
|
||||||
echo "<td >" . __('SQL user') . "</td>";
|
echo "<td >" . __('SQL user') . "</td>";
|
||||||
echo "<td ><input type='text' name='pm_dbserver_user' value='".$config->fields["pm_dbserver_user"]."'>";
|
echo "<td ><input type='text' name='pm_dbserver_user' value='".$config->fields["pm_dbserver_user"]."'>";
|
||||||
@@ -310,6 +318,23 @@ class PluginProcessmakerConfig extends CommonDBTM {
|
|||||||
Dropdown::showYesNo("maintenance", $config->fields['maintenance']);
|
Dropdown::showYesNo("maintenance", $config->fields['maintenance']);
|
||||||
echo "</td></tr>";
|
echo "</td></tr>";
|
||||||
|
|
||||||
|
echo "<tr><td colspan='4'></td></tr>";
|
||||||
|
|
||||||
|
echo "<tr><th colspan='4'>".__('Processmaker system information')."</th></tr>";
|
||||||
|
if ($setup_ok) {
|
||||||
|
$info = $pm->systemInformation( );
|
||||||
|
echo '<tr><td>'._('Version').'</td><td>'.$info->version.'</td></tr>';
|
||||||
|
echo '<tr><td>'._('Web server').'</td><td>'.$info->webServer.'</td></tr>';
|
||||||
|
echo '<tr><td>'._('Server name').'</td><td>'.$info->serverName.'</td></tr>';
|
||||||
|
echo '<tr><td>'._('PHP version').'</td><td>'.$info->phpVersion.'</td></tr>';
|
||||||
|
echo '<tr><td>'._('DB version').'</td><td>'.$info->databaseVersion.'</td></tr>';
|
||||||
|
echo '<tr><td>'._('DB server IP').'</td><td>'.$info->databaseServerIp.'</td></tr>';
|
||||||
|
echo '<tr><td>'._('DB name').'</td><td>'.$info->databaseName.'</td></tr>';
|
||||||
|
echo '<tr><td>'._('User browser').'</td><td>'.$info->userBrowser.'</td></tr>';
|
||||||
|
echo '<tr><td>'._('User IP').'</td><td>'.$info->userIp.'</td></tr>';
|
||||||
|
} else {
|
||||||
|
echo '<tr><td>'._('Version').'</td><td>'.__('Not yet!').'</td></tr>';
|
||||||
|
}
|
||||||
$config->showFormButtons(array('candel'=>false));
|
$config->showFormButtons(array('candel'=>false));
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ class PluginProcessmakerDB extends DBmysql {
|
|||||||
$this->dbhost = $config->fields['pm_dbserver_name'];
|
$this->dbhost = $config->fields['pm_dbserver_name'];
|
||||||
$this->dbuser = $config->fields['pm_dbserver_user'];
|
$this->dbuser = $config->fields['pm_dbserver_user'];
|
||||||
$this->dbpassword = Toolbox::decrypt($config->fields['pm_dbserver_passwd'], GLPIKEY);
|
$this->dbpassword = Toolbox::decrypt($config->fields['pm_dbserver_passwd'], GLPIKEY);
|
||||||
$this->dbdefault = "wf_".$config->fields['pm_workspace'];
|
$this->dbdefault = $config->fields['pm_dbname'];
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -451,6 +451,24 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Summary of systemInformation
|
||||||
|
* returns information about the PM system
|
||||||
|
* Embedded systemInformation() PM web service call (definition: http://wiki.processmaker.com/index.php/ProcessMaker_WSDL_Web_Services#systemInformation.28.29)
|
||||||
|
* A session must be open before with login()
|
||||||
|
* @return an object containing information, or false when exception occured
|
||||||
|
*/
|
||||||
|
function systemInformation( ) {
|
||||||
|
try {
|
||||||
|
$pmSystemInfo = $this->pmSoapClient->systemInformation( array( 'sessionId' => $_SESSION["pluginprocessmaker"]["session"]["id"]) );
|
||||||
|
return $pmSystemInfo;
|
||||||
|
}
|
||||||
|
catch (Exception $e) {
|
||||||
|
Toolbox::logDebug( $e );
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Summary of reassignCase
|
* Summary of reassignCase
|
||||||
* reassigns a case to a different user. Note that the logged-in user needs to have the PM_REASSIGNCASE permission in his/her role in order to be able to reassign the case.
|
* reassigns a case to a different user. Note that the logged-in user needs to have the PM_REASSIGNCASE permission in his/her role in order to be able to reassign the case.
|
||||||
@@ -1380,7 +1398,10 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
if (property_exists( $pmRouteCaseResponse, 'routing' )) {
|
if (property_exists( $pmRouteCaseResponse, 'routing' )) {
|
||||||
// now tries to get some variables to setup content for new task and to append text to solved task
|
// now tries to get some variables to setup content for new task and to append text to solved task
|
||||||
$txtForTasks = $myProcessMaker->getVariables( $myCase->getID(), array( "GLPI_ITEM_APPEND_TO_TASK",
|
$txtForTasks = $myProcessMaker->getVariables( $myCase->getID(), array( "GLPI_ITEM_APPEND_TO_TASK",
|
||||||
"GLPI_ITEM_SET_STATUS" ) );
|
"GLPI_ITEM_SET_STATUS",
|
||||||
|
"GLPI_TICKET_FOLLOWUP_CONTENT",
|
||||||
|
"GLPI_TICKET_FOLLOWUP_IS_PRIVATE",
|
||||||
|
"GLPI_TICKET_FOLLOWUP_REQUESTTYPES_ID" ) );
|
||||||
$itemSetStatus = '';
|
$itemSetStatus = '';
|
||||||
if (array_key_exists( 'GLPI_ITEM_SET_STATUS', $txtForTasks )) {
|
if (array_key_exists( 'GLPI_ITEM_SET_STATUS', $txtForTasks )) {
|
||||||
$itemSetStatus = $txtForTasks[ 'GLPI_ITEM_SET_STATUS' ];
|
$itemSetStatus = $txtForTasks[ 'GLPI_ITEM_SET_STATUS' ];
|
||||||
@@ -1390,14 +1411,26 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
} else {
|
} else {
|
||||||
$txtToAppendToTask = '';
|
$txtToAppendToTask = '';
|
||||||
}
|
}
|
||||||
|
$createFollowup = false; // by default
|
||||||
|
if (array_key_exists( 'GLPI_TICKET_FOLLOWUP_CONTENT', $txtForTasks ) && $txtForTasks[ 'GLPI_TICKET_FOLLOWUP_CONTENT' ] != '') {
|
||||||
|
$createFollowup = true;
|
||||||
|
}
|
||||||
|
|
||||||
// reset those variables
|
// reset those variables
|
||||||
$resultSave = $myProcessMaker->sendVariables( $myCase->getID(), array( "GLPI_ITEM_APPEND_TO_TASK" => '',
|
$resultSave = $myProcessMaker->sendVariables( $myCase->getID(), array( "GLPI_ITEM_APPEND_TO_TASK" => '',
|
||||||
"GLPI_ITEM_SET_STATUS" => '' ) );
|
"GLPI_ITEM_SET_STATUS" => '',
|
||||||
|
"GLPI_TICKET_FOLLOWUP_CONTENT" => '',
|
||||||
|
"GLPI_TICKET_FOLLOWUP_IS_PRIVATE" => '',
|
||||||
|
"GLPI_TICKET_FOLLOWUP_REQUESTTYPES_ID" => '' ) );
|
||||||
|
|
||||||
// routing has been done, then solve 1st task
|
// routing has been done, then solve 1st task
|
||||||
$myProcessMaker->solveTask( $myCase->getID(), $parm->input['processmaker_delindex'], array( 'txtToAppend' => $txtToAppendToTask, 'notif' => false) );
|
$myProcessMaker->solveTask( $myCase->getID(), $parm->input['processmaker_delindex'], array( 'txtToAppend' => $txtToAppendToTask, 'notif' => false) );
|
||||||
|
|
||||||
|
// create a followup if requested
|
||||||
|
if ($createFollowup && $itemType == 'Ticket') {
|
||||||
|
$myProcessMaker->addTicketFollowup( $itemId, $txtForTasks );
|
||||||
|
}
|
||||||
|
|
||||||
// and create GLPI tasks for the newly created PM tasks.
|
// and create GLPI tasks for the newly created PM tasks.
|
||||||
foreach ($pmRouteCaseResponse->routing as $route) {
|
foreach ($pmRouteCaseResponse->routing as $route) {
|
||||||
$myProcessMaker->addTask( $myCase->fields['itemtype'],
|
$myProcessMaker->addTask( $myCase->fields['itemtype'],
|
||||||
|
|||||||
@@ -23,11 +23,11 @@
|
|||||||
</authors>
|
</authors>
|
||||||
<versions>
|
<versions>
|
||||||
<version>
|
<version>
|
||||||
<num>3.2.5</num>
|
<num>3.2.8</num>
|
||||||
<compatibility>9.2</compatibility>
|
<compatibility>9.2</compatibility>
|
||||||
</version>
|
</version>
|
||||||
<version>
|
<version>
|
||||||
<num>3.2.5</num>
|
<num>3.2.8</num>
|
||||||
<compatibility>9.1</compatibility>
|
<compatibility>9.1</compatibility>
|
||||||
</version>
|
</version>
|
||||||
</versions>
|
</versions>
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ function plugin_version_processmaker() {
|
|||||||
global $LANG;
|
global $LANG;
|
||||||
|
|
||||||
return array ('name' => 'Process Maker',
|
return array ('name' => 'Process Maker',
|
||||||
'version' => '3.2.5',
|
'version' => '3.2.8',
|
||||||
'author' => 'Olivier Moron',
|
'author' => 'Olivier Moron',
|
||||||
'homepage' => 'https://github.com/tomolimo/processmaker',
|
'homepage' => 'https://github.com/tomolimo/processmaker',
|
||||||
'minGlpiVersion' => '9.1');
|
'minGlpiVersion' => '9.1');
|
||||||
|
|||||||
Reference in New Issue
Block a user