Fixed add solution that was not compliant with GLPI9.5
Fixed curl issue at form save Fixed task cat that were active after add or updates Added a $DB->escape() to escape special chars before query fixes Added a test to prevent empty IN Removed deprecated functions Set version to 4.0.11
This commit is contained in:
@@ -10,6 +10,5 @@ version 3.6.x is compatible with GLPI 9.4 and needs ProcessMaker 3.3.0-RE-1.x (h
|
|||||||
|
|
||||||
version 4.0.x is compatible with GLPI 9.5 and needs ProcessMaker 3.3.0-RE-1.x (https://github.com/tomolimo/processmaker-server/releases/latest)
|
version 4.0.x is compatible with GLPI 9.5 and needs ProcessMaker 3.3.0-RE-1.x (https://github.com/tomolimo/processmaker-server/releases/latest)
|
||||||
|
|
||||||
This plugin can run classic and bpmn processes
|
This plugin can run classic (ProcessMaker server v2) and BPMN (ProcessMaker server v3 and later) processes
|
||||||
|
|
||||||
An IRC channel is available: #processmaker-glpi on https://webchat.freenode.net/
|
|
||||||
|
|||||||
68
hook.php
68
hook.php
@@ -127,7 +127,7 @@ function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
|
|||||||
//global $DB;//, $PM_SOAP;
|
//global $DB;//, $PM_SOAP;
|
||||||
|
|
||||||
// look at previous status
|
// look at previous status
|
||||||
if (isset($parm->input['status'])
|
if (isset($parm->input['status'])
|
||||||
&& $parm->input['status'] == CommonITILObject::SOLVED
|
&& $parm->input['status'] == CommonITILObject::SOLVED
|
||||||
&& !in_array($parm->fields['status'], [CommonITILObject::SOLVED, CommonITILObject::CLOSED])
|
&& !in_array($parm->fields['status'], [CommonITILObject::SOLVED, CommonITILObject::CLOSED])
|
||||||
&& !PluginProcessmakerCase::canSolve(['item' => $parm])) {
|
&& !PluginProcessmakerCase::canSolve(['item' => $parm])) {
|
||||||
@@ -194,7 +194,7 @@ function plugin_item_update_processmaker_satisfaction($parm) {
|
|||||||
global $PM_SOAP;
|
global $PM_SOAP;
|
||||||
if (Session::isCron()) { // Task cron log with user admin
|
if (Session::isCron()) { // Task cron log with user admin
|
||||||
$PM_SOAP->login(true);
|
$PM_SOAP->login(true);
|
||||||
}
|
}
|
||||||
$cases = PluginProcessmakerCase::getIDsFromItem('Ticket', $parm->fields['tickets_id']);
|
$cases = PluginProcessmakerCase::getIDsFromItem('Ticket', $parm->fields['tickets_id']);
|
||||||
foreach ($cases as $cases_id) {
|
foreach ($cases as $cases_id) {
|
||||||
$locCase = new PluginProcessmakerCase;
|
$locCase = new PluginProcessmakerCase;
|
||||||
@@ -282,7 +282,6 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
$locCase = new PluginProcessmakerCase;
|
$locCase = new PluginProcessmakerCase;
|
||||||
$locCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']);
|
$locCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']);
|
||||||
$srccase_guid = $locCase->fields['case_guid'];
|
$srccase_guid = $locCase->fields['case_guid'];
|
||||||
|
|
||||||
//$msg = Toolbox::backtrace(false);
|
//$msg = Toolbox::backtrace(false);
|
||||||
//$msg .= ' $locCase: '.str_replace("\n", "\n ", print_r($locCase, true))."\n";
|
//$msg .= ' $locCase: '.str_replace("\n", "\n ", print_r($locCase, true))."\n";
|
||||||
//$msg .= ' $task: '.str_replace("\n", "\n ", print_r($parm, true))."\n";
|
//$msg .= ' $task: '.str_replace("\n", "\n ", print_r($parm, true))."\n";
|
||||||
@@ -320,6 +319,15 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
$casevariables = array_merge( $casevariables, $matches[1] );
|
$casevariables = array_merge( $casevariables, $matches[1] );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (preg_match_all( "/@@(\w+)/u", $externalapplication['url'], $matches )) {
|
||||||
|
$casevariables = array_merge( $casevariables, $matches[1] );
|
||||||
|
}
|
||||||
|
if(isset($externalapplication['headers']) && $externalapplication['headers'] != "") {
|
||||||
|
if (preg_match_all( "/@@(\w+)/u", $externalapplication['headers'], $matches )) {
|
||||||
|
$casevariables = array_merge( $casevariables, $matches[1] );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ask for those case variables
|
// ask for those case variables
|
||||||
@@ -327,8 +335,10 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
//$PM_SOAP->login( );
|
//$PM_SOAP->login( );
|
||||||
// now tries to get the variables to check condition
|
// now tries to get the variables to check condition
|
||||||
$infoForTasks = $locCase->getVariables($casevariables);
|
$infoForTasks = $locCase->getVariables($casevariables);
|
||||||
|
$infoForURL = [];
|
||||||
foreach ($infoForTasks as $casevar => $varval) {
|
foreach ($infoForTasks as $casevar => $varval) {
|
||||||
$infoForTasks[ "@@$casevar" ] = "'$varval'";
|
$infoForTasks[ "@@$casevar" ] = "'$varval'";
|
||||||
|
$infoForURL[ "@@$casevar" ] = $varval;
|
||||||
unset( $infoForTasks[ $casevar ] );
|
unset( $infoForTasks[ $casevar ] );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -336,9 +346,7 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
//$msg .= ' $targetTask: '.str_replace("\n", "\n ", print_r($targetTask, true))."\n";
|
//$msg .= ' $targetTask: '.str_replace("\n", "\n ", print_r($targetTask, true))."\n";
|
||||||
|
|
||||||
$targetTask['sourcecondition'] = str_replace( array_keys($infoForTasks), $infoForTasks, $targetTask['sourcecondition'] );
|
$targetTask['sourcecondition'] = str_replace( array_keys($infoForTasks), $infoForTasks, $targetTask['sourcecondition'] );
|
||||||
|
|
||||||
$eval = eval( "return (".$targetTask['sourcecondition']." ? 1 : 0);" );
|
$eval = eval( "return (".$targetTask['sourcecondition']." ? 1 : 0);" );
|
||||||
|
|
||||||
//$msg .= ' $infoForTasks: '.str_replace("\n", "\n ", print_r($infoForTasks, true))."\n";
|
//$msg .= ' $infoForTasks: '.str_replace("\n", "\n ", print_r($infoForTasks, true))."\n";
|
||||||
//$msg .= ' $targetTask[\'sourcecondition\']: '.str_replace("\n", "\n ", print_r($targetTask['sourcecondition'], true))."\n";
|
//$msg .= ' $targetTask[\'sourcecondition\']: '.str_replace("\n", "\n ", print_r($targetTask['sourcecondition'], true))."\n";
|
||||||
//$msg .= ' $result: '."$eval\n";
|
//$msg .= ' $result: '."$eval\n";
|
||||||
@@ -366,7 +374,8 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
}
|
}
|
||||||
$externalapplicationparams['callback'] = $CFG_GLPI["url_base"]."/plugins/processmaker/ajax/asynchronousdatas.php";
|
$externalapplicationparams['callback'] = $CFG_GLPI["url_base"]."/plugins/processmaker/ajax/asynchronousdatas.php";
|
||||||
$ch = curl_init();
|
$ch = curl_init();
|
||||||
$externalapplication['url'] = eval( "return '".str_replace( array_keys($infoForTasks), $infoForTasks, $externalapplication['url'])."' ;" ); // '???
|
|
||||||
|
$externalapplication['url'] = str_replace( array_keys($infoForURL), $infoForURL, $externalapplication['url']);
|
||||||
curl_setopt($ch, CURLOPT_URL, $externalapplication['url'] );
|
curl_setopt($ch, CURLOPT_URL, $externalapplication['url'] );
|
||||||
if (isset($externalapplication['method']) && $externalapplication['method'] == 'POST') {
|
if (isset($externalapplication['method']) && $externalapplication['method'] == 'POST') {
|
||||||
curl_setopt($ch, CURLOPT_POST, 1);
|
curl_setopt($ch, CURLOPT_POST, 1);
|
||||||
@@ -391,18 +400,17 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
$pmconfig = $PM_SOAP->config; //PluginProcessmakerConfig::getInstance();
|
$pmconfig = $PM_SOAP->config; //PluginProcessmakerConfig::getInstance();
|
||||||
|
|
||||||
$cronaction = new PluginProcessmakerCrontaskaction;
|
$cronaction = new PluginProcessmakerCrontaskaction;
|
||||||
$cronaction->add( [ 'plugin_processmaker_caselinks_id' => $targetTask['id'],
|
$cronaction->add([
|
||||||
'plugin_processmaker_cases_id' => $locCase->getID(),
|
'plugin_processmaker_caselinks_id' => $targetTask['id'],
|
||||||
//'itemtype' => $itemtype,
|
'plugin_processmaker_cases_id' => $locCase->getID(),
|
||||||
//'items_id' => $parm->fields['tickets_id'],
|
//'itemtype' => $itemtype,
|
||||||
'users_id' => $pmconfig->fields['users_id'],
|
//'items_id' => $parm->fields['tickets_id'],
|
||||||
'is_targettoclaim' => $targetTask['is_targettoclaim'],
|
'users_id' => $pmconfig->fields['users_id'],
|
||||||
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
|
'is_targettoclaim' => $targetTask['is_targettoclaim'],
|
||||||
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
|
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
|
||||||
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
|
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
|
||||||
],
|
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
|
||||||
null,
|
], [], false);
|
||||||
false);
|
|
||||||
|
|
||||||
if ($externalapplication) {
|
if ($externalapplication) {
|
||||||
// must call external application in order to get the needed data asynchroneously
|
// must call external application in order to get the needed data asynchroneously
|
||||||
@@ -415,12 +423,26 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
$externalapplicationparams = json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT);
|
$externalapplicationparams = json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT);
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS, $externalapplicationparams);
|
curl_setopt($ch, CURLOPT_POSTFIELDS, $externalapplicationparams);
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Content-Length: ' . strlen($externalapplicationparams), 'Expect:']);
|
$headers = [
|
||||||
|
'Content-Type: application/json',
|
||||||
|
'Content-Length: ' . strlen($externalapplicationparams),
|
||||||
|
'Expect:'];
|
||||||
|
if(isset($externalapplication['headers']) && $externalapplication['headers'] != "") {
|
||||||
|
$externalapplication['headers'] = eval( "return ".str_replace( array_keys($infoForTasks), $infoForTasks, $externalapplication['headers'])." ;" ); // '???
|
||||||
|
//Can't add an assoicative array in curlopt_httpheader
|
||||||
|
foreach($externalapplication['headers'] as $key => $h) {
|
||||||
|
array_push($headers, $key.": ".$h);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//$headers = array_merge($headers, $externalapplication['headers']);
|
||||||
|
|
||||||
|
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
|
||||||
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
curl_setopt($ch, CURLOPT_VERBOSE, 1);
|
||||||
|
|
||||||
if (isset($externalapplication['ssl_verify'])) {
|
if (isset($externalapplication['ssl_verify']) && $externalapplication['ssl_verify'] > 0) {
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $externalapplication['ssl_verify']);
|
//curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $externalapplication['ssl_verify']);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $externalapplication['ssl_verify']);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $externalapplication['ssl_verify']);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -432,7 +454,9 @@ function plugin_item_update_processmaker_tasks($parm) {
|
|||||||
$response = curl_exec ($ch);
|
$response = curl_exec ($ch);
|
||||||
if ($response === false) {
|
if ($response === false) {
|
||||||
//throw new Exception(curl_error($ch), curl_errno($ch));
|
//throw new Exception(curl_error($ch), curl_errno($ch));
|
||||||
Toolbox::logDebug( curl_error($ch).":".curl_errno($ch) );
|
Toolbox::logDebug(curl_error($ch) . ":" . curl_errno($ch));
|
||||||
|
// Set 0 to the crontask action status
|
||||||
|
$cronaction->update(['id ' => $cronaction->getID(), 'state' => PluginProcessmakerCrontaskaction::CURL_ERROR]);
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_close ($ch);
|
curl_close ($ch);
|
||||||
|
|||||||
@@ -1,23 +1,23 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PluginProcessmakerCrontaskaction is used to manage actions between cases
|
* PluginProcessmakerCrontaskaction is used to manage actions between cases
|
||||||
*
|
*
|
||||||
* Allows actions: routing cases (called slaves) from another case (called master)
|
* Allows actions: routing cases (called slaves) from another case (called master)
|
||||||
*
|
*
|
||||||
*
|
*
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
* @author MoronO
|
* @author MoronO
|
||||||
*/
|
*/
|
||||||
class PluginProcessmakerCrontaskaction extends CommonDBTM {
|
class PluginProcessmakerCrontaskaction extends CommonDBTM {
|
||||||
|
|
||||||
// postdata are of the form:
|
// postdata are of the form:
|
||||||
// {"form":{"RELEASE_DONE":"0","btnGLPISendRequest":"submit"},"UID":"28421020557bffc5b374850018853291","__DynaformName__":"51126098657bd96b286ded7016691792_28421020557bffc5b374850018853291","__notValidateThisFields__":"[]","DynaformRequiredFields":"[]","APP_UID":"6077575685836f7d89cabe6013770123","DEL_INDEX":"4"}
|
// {"form":{"RELEASE_DONE":"0","btnGLPISendRequest":"submit"},"UID":"28421020557bffc5b374850018853291","__DynaformName__":"51126098657bd96b286ded7016691792_28421020557bffc5b374850018853291","__notValidateThisFields__":"[]","DynaformRequiredFields":"[]","APP_UID":"6077575685836f7d89cabe6013770123","DEL_INDEX":"4"}
|
||||||
|
|
||||||
|
const CURL_ERROR = 0;
|
||||||
const WAITING_DATA = 1;
|
const WAITING_DATA = 1;
|
||||||
const DATA_READY = 2;
|
const DATA_READY = 2;
|
||||||
const DONE = 3;
|
const DONE = 3;
|
||||||
const NOT_DONE = 4;
|
const NOT_DONE = 4;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,10 +45,10 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// static function getIcon() {
|
// static function getIcon() {
|
||||||
//// return "fas fa-code-branch fa-rotate-90";
|
//// return "fas fa-code-branch fa-rotate-90";
|
||||||
// return "fas fa-blog fa-flip-vertical";
|
// return "fas fa-blog fa-flip-vertical";
|
||||||
//// return "fas fa-cogs fa-flip-vertical";
|
//// return "fas fa-cogs fa-flip-vertical";
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
|
||||||
@@ -151,16 +151,16 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
$countElt += $dbu->countElementsInTable( $dbu->getTableForItemType($obj), "taskcategories_id = ".$task['taskcategories_id'] );
|
$countElt += $dbu->countElementsInTable( $dbu->getTableForItemType($obj), "taskcategories_id = ".$task['taskcategories_id'] );
|
||||||
if ($countElt != 0) {
|
if ($countElt != 0) {
|
||||||
// just set 'is_active' to 0
|
// just set 'is_active' to 0
|
||||||
$pmtask->Update( [ 'id' => $task['id'], 'is_start' => 0, 'is_active' => 0 ] );
|
$pmtask->Update(['id' => $task['id'], 'is_start' => 0, 'is_active' => 0]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($countElt == 0) {
|
if ($countElt == 0) {
|
||||||
// purge this category as it is not used anywhere
|
// purge this category as it is not used anywhere
|
||||||
$taskCat = new TaskCategory;
|
$taskCat = new TaskCategory;
|
||||||
$taskCat->delete([ 'id' => $task['taskcategories_id'] ], 1);
|
$taskCat->delete(['id' => $task['taskcategories_id']], 1);
|
||||||
$pmTaskCat = new PluginProcessmakerTaskCategory;
|
$pmTaskCat = new PluginProcessmakerTaskCategory;
|
||||||
$pmTaskCat->delete([ 'id' => $task['id'] ], 1);
|
$pmTaskCat->delete(['id' => $task['id']], 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,32 +169,52 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
$taskCat = new TaskCategory;
|
$taskCat = new TaskCategory;
|
||||||
if ($pmTaskCat->getFromGUID( $taskGUID )) {
|
if ($pmTaskCat->getFromGUID( $taskGUID )) {
|
||||||
// got it then check names, and if != update
|
// got it then check names, and if != update
|
||||||
if ($taskCat->getFromDB( $pmTaskCat->fields['taskcategories_id'] )) {
|
if ($taskCat->getFromDB($pmTaskCat->fields['taskcategories_id'])) {
|
||||||
// found it must test if should be updated
|
// found it must test if should be updated
|
||||||
if ($taskCat->fields['name'] != $task['TAS_TITLE'] || $taskCat->fields['comment'] != $task['TAS_DESCRIPTION']) {
|
if ($taskCat->fields['name'] != $task['TAS_TITLE']
|
||||||
$taskCat->update( [ 'id' => $taskCat->getID(), 'name' => $PM_DB->escape($task['TAS_TITLE']), 'comment' => $PM_DB->escape($task['TAS_DESCRIPTION']), 'taskcategories_id' => $this->fields['taskcategories_id'] ] );
|
|| $taskCat->fields['comment'] != $task['TAS_DESCRIPTION']) {
|
||||||
|
$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'],
|
||||||
|
'is_active' => 0 // to prevent use of this task cat in manual tasks
|
||||||
|
] );
|
||||||
}
|
}
|
||||||
if ($pmTaskCat->fields['is_start'] != $task['is_start']) {
|
if ($pmTaskCat->fields['is_start'] != $task['is_start']) {
|
||||||
$pmTaskCat->update( [ 'id' => $pmTaskCat->getID(), 'is_start' => $task['is_start'] ] );
|
$pmTaskCat->update(['id' => $pmTaskCat->getID(), 'is_start' => $task['is_start']]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// taskcat must be created
|
// taskcat must be created
|
||||||
$taskCat->add( [ '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'],
|
||||||
|
'is_active' => 0 // to prevent use of this task cat in manual tasks
|
||||||
|
] );
|
||||||
// update pmTaskCat
|
// update pmTaskCat
|
||||||
$pmTaskCat->update( [ 'id' => $pmTaskCat->getID(), 'taskcategories_id' => $taskCat->getID(), 'is_start' => $task['is_start'] ] );
|
$pmTaskCat->update(['id' => $pmTaskCat->getID(), 'taskcategories_id' => $taskCat->getID(), 'is_start' => $task['is_start']]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// should create a new one
|
// should create a new one
|
||||||
// taskcat must be created
|
// taskcat must be created
|
||||||
$taskCat->add( [ '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'],
|
||||||
|
'is_active' => 0 // to prevent use of this task cat in manual tasks
|
||||||
|
] );
|
||||||
// pmTaskCat must be created too
|
// pmTaskCat must be created too
|
||||||
$pmTaskCat->add( ['plugin_processmaker_processes_id' => $this->getID(),
|
$pmTaskCat->add([
|
||||||
'pm_task_guid' => $taskGUID,
|
'plugin_processmaker_processes_id' => $this->getID(),
|
||||||
'taskcategories_id' => $taskCat->getID(),
|
'pm_task_guid' => $taskGUID,
|
||||||
'is_start' => $task['is_start'],
|
'taskcategories_id' => $taskCat->getID(),
|
||||||
'is_active' => 1,
|
'is_start' => $task['is_start'],
|
||||||
'is_subprocess' => $task['is_subprocess']
|
'is_active' => 1,
|
||||||
] );
|
'is_subprocess' => $task['is_subprocess']
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
// here we should take into account translations if any
|
// here we should take into account translations if any
|
||||||
if (isset($taskArray[ $taskGUID ])) {
|
if (isset($taskArray[ $taskGUID ])) {
|
||||||
@@ -371,7 +391,12 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
global $PM_DB;
|
global $PM_DB;
|
||||||
$taskCat = new TaskCategory;
|
$taskCat = new TaskCategory;
|
||||||
if ($taskCat->getFromDB( $this->fields['taskcategories_id'] ) && $taskCat->fields['name'] != $this->fields['name']) {
|
if ($taskCat->getFromDB( $this->fields['taskcategories_id'] ) && $taskCat->fields['name'] != $this->fields['name']) {
|
||||||
return $taskCat->update( [ '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']),
|
||||||
|
'is_active' => 0 // to prevent use of this task cat in a manual task
|
||||||
|
] );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -385,7 +410,12 @@ class PluginProcessmakerProcess extends CommonDBTM {
|
|||||||
function addTaskCategory($pmMainTaskCat) {
|
function addTaskCategory($pmMainTaskCat) {
|
||||||
global $PM_DB;
|
global $PM_DB;
|
||||||
$taskCat = new TaskCategory;
|
$taskCat = new TaskCategory;
|
||||||
if ($taskCat->add( [ 'is_recursive' => true, 'taskcategories_id' => $pmMainTaskCat, 'name' => $PM_DB->escape($this->fields['name'])] )) {
|
if ($taskCat->add([
|
||||||
|
'is_recursive' => true,
|
||||||
|
'taskcategories_id' => $pmMainTaskCat,
|
||||||
|
'name' => $PM_DB->escape($this->fields['name']),
|
||||||
|
'is_active' => 0 // to prevent use of this task cat in a manual task
|
||||||
|
])) {
|
||||||
return $this->update( [ 'id' => $this->getID(), 'taskcategories_id' => $taskCat->getID() ] );
|
return $this->update( [ 'id' => $this->getID(), 'taskcategories_id' => $taskCat->getID() ] );
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -1569,7 +1569,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
'itemtype' => $itemtype,
|
'itemtype' => $itemtype,
|
||||||
'items_id' => $items_id,
|
'items_id' => $items_id,
|
||||||
'entities_id' => $parm->fields['entities_id'],
|
'entities_id' => $parm->fields['entities_id'],
|
||||||
'name' => $caseInfo->caseName,
|
'name' => $DB->escape($caseInfo->caseName),
|
||||||
'case_guid' => $case_guid,
|
'case_guid' => $case_guid,
|
||||||
'case_status' => $caseInfo->caseStatus,
|
'case_status' => $caseInfo->caseStatus,
|
||||||
'plugin_processmaker_processes_id' => $parm->input['processmaker_processes_id']
|
'plugin_processmaker_processes_id' => $parm->input['processmaker_processes_id']
|
||||||
@@ -1831,7 +1831,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
* Summary of getGLPIGroupId
|
* Summary of getGLPIGroupId
|
||||||
* returns GLPI group id from pm group name
|
* returns GLPI group id from pm group name
|
||||||
* returns false when not found
|
* returns false when not found
|
||||||
* @param string $pmGroupName
|
* @param string $pmGroupName
|
||||||
* @return bool|integer
|
* @return bool|integer
|
||||||
*/
|
*/
|
||||||
static function getGLPIGroupId(string $pmGroupName) {
|
static function getGLPIGroupId(string $pmGroupName) {
|
||||||
@@ -1840,7 +1840,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
$query = "SELECT id AS glpi_group_id FROM glpi_groups WHERE name LIKE '$pmGroupName';";
|
$query = "SELECT id AS glpi_group_id FROM glpi_groups WHERE name LIKE '$pmGroupName';";
|
||||||
$res = $DB->query($query);
|
$res = $DB->query($query);
|
||||||
if ($DB->numrows($res) > 0) {
|
if ($DB->numrows($res) > 0) {
|
||||||
$row = $DB->fetch_array($res);
|
$row = $DB->fetchArray($res);
|
||||||
return $row['glpi_group_id'];
|
return $row['glpi_group_id'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1950,13 +1950,12 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
$dbu = new DbUtils;
|
$dbu = new DbUtils;
|
||||||
$item = $dbu->getItemForItemtype( $itemType );
|
$item = $dbu->getItemForItemtype($itemType);
|
||||||
if ($item->getFromDB( $itemId )) {
|
if ($item->getFromDB($itemId)) {
|
||||||
// default values
|
// default values
|
||||||
$solutiontemplates_id = 0;
|
|
||||||
$solutiontypes_id = 0;
|
$solutiontypes_id = 0;
|
||||||
$solution = '';
|
$solution_content = '';
|
||||||
$to_update = false;
|
$to_add = false;
|
||||||
|
|
||||||
// check solution template
|
// check solution template
|
||||||
if (array_key_exists( 'GLPI_ITEM_SET_SOLUTION_TEMPLATE_ID', $casevariablevalues )
|
if (array_key_exists( 'GLPI_ITEM_SET_SOLUTION_TEMPLATE_ID', $casevariablevalues )
|
||||||
@@ -1968,10 +1967,9 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
$entities = $template->isRecursive() ? $dbu->getSonsOf(Entity::getTable(), $template->getEntityID()) : [$template->getEntityID()];
|
$entities = $template->isRecursive() ? $dbu->getSonsOf(Entity::getTable(), $template->getEntityID()) : [$template->getEntityID()];
|
||||||
// and check entities
|
// and check entities
|
||||||
if (in_array($item->getEntityID(), $entities)) {
|
if (in_array($item->getEntityID(), $entities)) {
|
||||||
$solutiontemplates_id = $template->getID();
|
|
||||||
$solutiontypes_id = $template->fields['solutiontypes_id'];
|
$solutiontypes_id = $template->fields['solutiontypes_id'];
|
||||||
$solution = $template->fields['content'];
|
$solution_content = $template->fields['content'];
|
||||||
$to_update = true;
|
$to_add = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1986,22 +1984,28 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
// and check entities
|
// and check entities
|
||||||
if (in_array($item->getEntityID(), $entities)) {
|
if (in_array($item->getEntityID(), $entities)) {
|
||||||
$solutiontypes_id = $type->getID();
|
$solutiontypes_id = $type->getID();
|
||||||
$to_update = true;
|
$to_add = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check solution description
|
// Check solution description
|
||||||
if (array_key_exists( 'GLPI_ITEM_APPEND_TO_SOLUTION_DESCRIPTION', $casevariablevalues )
|
if (array_key_exists( 'GLPI_ITEM_APPEND_TO_SOLUTION_DESCRIPTION', $casevariablevalues )
|
||||||
&& $casevariablevalues[ 'GLPI_ITEM_APPEND_TO_SOLUTION_DESCRIPTION' ] != '') {
|
&& $casevariablevalues[ 'GLPI_ITEM_APPEND_TO_SOLUTION_DESCRIPTION' ] != '') {
|
||||||
if ($solution != '') {
|
if ($solution_content != '') {
|
||||||
$solution .= "\n";
|
$solution_content .= "\n";
|
||||||
}
|
}
|
||||||
$solution .= $DB->escape($casevariablevalues[ 'GLPI_ITEM_APPEND_TO_SOLUTION_DESCRIPTION' ]);
|
$solution_content .= $DB->escape($casevariablevalues[ 'GLPI_ITEM_APPEND_TO_SOLUTION_DESCRIPTION' ]);
|
||||||
$to_update = true;
|
$to_add = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($to_update) {
|
if ($to_add) {
|
||||||
$item->update( ['id' => $itemId, 'solutiontemplates_id' => $solutiontemplates_id, 'solutiontypes_id' => $solutiontypes_id, 'solution' => $solution] );
|
$solution = new ITILSolution();
|
||||||
|
$solution->add([
|
||||||
|
'itemtype' => $itemType,
|
||||||
|
'items_id' => $itemId,
|
||||||
|
'solutiontypes_id' => $solutiontypes_id,
|
||||||
|
'content' => $solution_content
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2335,8 +2339,8 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
//global $pmHideSolution;
|
//global $pmHideSolution;
|
||||||
$plugin = new Plugin();
|
$plugin = new Plugin();
|
||||||
$itemtype = $params['item']->getType();
|
$itemtype = $params['item']->getType();
|
||||||
if (in_array($itemtype, ['Ticket', 'Problem', 'Change'])
|
if (in_array($itemtype, ['Ticket', 'Problem', 'Change'])
|
||||||
&& $params['options']['id']
|
&& $params['options']['id']
|
||||||
&& $params['options']['itemtype'] == $itemtype
|
&& $params['options']['itemtype'] == $itemtype
|
||||||
&& $params['options']['tabnum'] == 1
|
&& $params['options']['tabnum'] == 1
|
||||||
&& !PluginProcessmakerCase::canSolve($params)
|
&& !PluginProcessmakerCase::canSolve($params)
|
||||||
@@ -2347,7 +2351,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
|
|||||||
|
|
||||||
// don't display message if arbehaviours is install and activated
|
// don't display message if arbehaviours is install and activated
|
||||||
$itemtype = strtolower($itemtype);
|
$itemtype = strtolower($itemtype);
|
||||||
if ((!$plugin->isInstalled('arbehaviours') || !$plugin->isActivated('arbehaviours'))
|
if ((!$plugin->isInstalled('arbehaviours') || !$plugin->isActivated('arbehaviours'))
|
||||||
&& isset($_SESSION['glpiactiveprofile'][$itemtype.'_status'])) {
|
&& isset($_SESSION['glpiactiveprofile'][$itemtype.'_status'])) {
|
||||||
|
|
||||||
echo Html::scriptBlock("
|
echo Html::scriptBlock("
|
||||||
@@ -2452,10 +2456,10 @@ debugger;
|
|||||||
fflush($curl_log);
|
fflush($curl_log);
|
||||||
curl_setopt($ch, CURLOPT_STDERR, $curl_log);
|
curl_setopt($ch, CURLOPT_STDERR, $curl_log);
|
||||||
}
|
}
|
||||||
|
|
||||||
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Expect:"]);
|
curl_setopt($ch, CURLOPT_HTTPHEADER, ["Expect:"]);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->config->fields['ssl_verify']);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $this->config->fields['ssl_verify']);
|
||||||
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $this->config->fields['ssl_verify']);
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, ($this->config->fields['ssl_verify'] > 0 ? 2 : 0));
|
||||||
|
|
||||||
//curl_setopt($ch, CURLOPT_HEADERFUNCTION, "HandleHeaderLine");
|
//curl_setopt($ch, CURLOPT_HEADERFUNCTION, "HandleHeaderLine");
|
||||||
// to store cookies in memory
|
// to store cookies in memory
|
||||||
@@ -3039,7 +3043,7 @@ debugger;
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ($itemSetStatus != '') {
|
if ($itemSetStatus != '') {
|
||||||
$this->setItemStatus($itemtype, $items_id, $itemSetStatus );
|
$this->setItemStatus($itemtype, $items_id, $itemSetStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the new case info
|
// get the new case info
|
||||||
@@ -3053,7 +3057,7 @@ debugger;
|
|||||||
$taskCat = new TaskCategory;
|
$taskCat = new TaskCategory;
|
||||||
$taskCat->getFromDB($glpi_task->fields['taskcategories_id']);
|
$taskCat->getFromDB($glpi_task->fields['taskcategories_id']);
|
||||||
// we may replace ##casename## by the name of the case, and ##taskname## by the task name
|
// we may replace ##casename## by the name of the case, and ##taskname## by the task name
|
||||||
$search = ['##casename##',
|
$search = ['##casename##',
|
||||||
'##taskname##'
|
'##taskname##'
|
||||||
];
|
];
|
||||||
$replace = [$caseInfo->caseName." (".$myCase->getID().")",
|
$replace = [$caseInfo->caseName." (".$myCase->getID().")",
|
||||||
@@ -3347,7 +3351,7 @@ debugger;
|
|||||||
$class = 'warn_msg';
|
$class = 'warn_msg';
|
||||||
break;
|
break;
|
||||||
case INFO:
|
case INFO:
|
||||||
$title = _sn('Information', 'Information', 1);
|
$title = _sn('Information', 'Information', 1);
|
||||||
$class = 'info_msg';
|
$class = 'info_msg';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3465,7 +3469,7 @@ debugger;
|
|||||||
|
|
||||||
// we must differentiate if rule assignement is self-service or self-service value based
|
// we must differentiate if rule assignement is self-service or self-service value based
|
||||||
//$query = "SELECT TAS_GROUP_VARIABLE
|
//$query = "SELECT TAS_GROUP_VARIABLE
|
||||||
// FROM TASK
|
// FROM TASK
|
||||||
// WHERE TAS_UID='$pmTaskId'
|
// WHERE TAS_UID='$pmTaskId'
|
||||||
// AND TAS_ASSIGN_TYPE='SELF_SERVICE';";
|
// AND TAS_ASSIGN_TYPE='SELF_SERVICE';";
|
||||||
$query = ['SELECT' => 'TAS_GROUP_VARIABLE',
|
$query = ['SELECT' => 'TAS_GROUP_VARIABLE',
|
||||||
@@ -3483,8 +3487,8 @@ debugger;
|
|||||||
// TU_RELATION=2 is groups and TU_TYPE=1 means normal (= not adhoc)
|
// TU_RELATION=2 is groups and TU_TYPE=1 means normal (= not adhoc)
|
||||||
$queryname = "SELECT GROUPWF.GRP_TITLE AS 'GRP_TITLE', GROUPWF.GRP_UID AS 'GRP_UID' FROM TASK_USER
|
$queryname = "SELECT GROUPWF.GRP_TITLE AS 'GRP_TITLE', GROUPWF.GRP_UID AS 'GRP_UID' FROM TASK_USER
|
||||||
JOIN GROUPWF ON GROUPWF.GRP_UID = TASK_USER.USR_UID
|
JOIN GROUPWF ON GROUPWF.GRP_UID = TASK_USER.USR_UID
|
||||||
WHERE TASK_USER.TAS_UID = '$pmTaskId'
|
WHERE TASK_USER.TAS_UID = '$pmTaskId'
|
||||||
AND TASK_USER.TU_RELATION = 2
|
AND TASK_USER.TU_RELATION = 2
|
||||||
AND TASK_USER.TU_TYPE = 1
|
AND TASK_USER.TU_TYPE = 1
|
||||||
LIMIT 1;";
|
LIMIT 1;";
|
||||||
} else {
|
} else {
|
||||||
@@ -3507,13 +3511,15 @@ debugger;
|
|||||||
// or
|
// or
|
||||||
// as there is only one group per guid
|
// as there is only one group per guid
|
||||||
// then we should have at maximun 1 record
|
// then we should have at maximun 1 record
|
||||||
foreach ($PM_DB->request($queryname) as $onlyrec) {
|
if (isset($queryname)) {
|
||||||
$groupname = $onlyrec;
|
foreach ($PM_DB->request($queryname) as $onlyrec) {
|
||||||
|
$groupname = $onlyrec;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($groupname)) {
|
if (isset($groupname)) {
|
||||||
return ['name' => $groupname['GRP_TITLE'],
|
return ['name' => $groupname['GRP_TITLE'],
|
||||||
'id' => self::getGLPIGroupId($groupname['GRP_TITLE']),
|
'id' => self::getGLPIGroupId($groupname['GRP_TITLE']),
|
||||||
'uid' => $groupname['GRP_UID']
|
'uid' => $groupname['GRP_UID']
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,13 +23,13 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
* @param integer $value default value
|
* @param integer $value default value
|
||||||
* @param integer[] $used array: Already used items ID: not to display in dropdown
|
* @param integer[] $used array: Already used items ID: not to display in dropdown
|
||||||
* @param string $search pattern
|
* @param string $search pattern
|
||||||
* @param integer $start start LIMIT value (default 0)
|
* @param integer $start start LIMIT value (default 0)
|
||||||
* @param integer $limit limit LIMIT value (default -1 no limit)
|
* @param integer $limit limit LIMIT value (default -1 no limit)
|
||||||
* @param boolean $inactive_deleted true to retreive also inactive or deleted users
|
* @param boolean $inactive_deleted true to retreive also inactive or deleted users
|
||||||
* @return DBmysqlIterator
|
* @return DBmysqlIterator
|
||||||
**/
|
**/
|
||||||
static function getSqlSearchResult (array $tags, $count = true, $right = "all", $entity_restrict = -1, $value = 0,
|
static function getSqlSearchResult (array $tags, $count = true, $right = "all", $entity_restrict = -1, $value = 0,
|
||||||
array $used = [], $search = '',$start = 0, $limit = -1,
|
array $used = [], $search = '',$start = 0, $limit = -1,
|
||||||
$inactive_deleted = 0) {
|
$inactive_deleted = 0) {
|
||||||
global $DB, $PM_DB, $CFG_GLPI;
|
global $DB, $PM_DB, $CFG_GLPI;
|
||||||
|
|
||||||
@@ -83,7 +83,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
'WHERE' => ['GROUP_USER.GRP_UID' => $tags['grpGuid']]
|
'WHERE' => ['GROUP_USER.GRP_UID' => $tags['grpGuid']]
|
||||||
|
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$subqueries[] = $res3;
|
$subqueries[] = $res3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -110,6 +110,9 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (count($pmUsers) == 0) { // to prevent add of empty array in where clause
|
||||||
|
$pmUsers = 0;
|
||||||
|
}
|
||||||
$query['WHERE']['AND']['glpi_plugin_processmaker_users.pm_users_id'] = $pmUsers;
|
$query['WHERE']['AND']['glpi_plugin_processmaker_users.pm_users_id'] = $pmUsers;
|
||||||
$query['WHERE']['AND']['glpi_users.is_deleted'] = 0;
|
$query['WHERE']['AND']['glpi_users.is_deleted'] = 0;
|
||||||
$query['WHERE']['AND']['glpi_users.is_active'] = 1;
|
$query['WHERE']['AND']['glpi_users.is_active'] = 1;
|
||||||
@@ -132,7 +135,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
$query['DISTINCT'] = true;
|
$query['DISTINCT'] = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
$query['FROM'] = 'glpi_plugin_processmaker_users';
|
|
||||||
$query['FROM'] = 'glpi_plugin_processmaker_users';
|
$query['FROM'] = 'glpi_plugin_processmaker_users';
|
||||||
$query['INNER JOIN'] = [
|
$query['INNER JOIN'] = [
|
||||||
'glpi_users' => [
|
'glpi_users' => [
|
||||||
@@ -177,16 +180,16 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
$query['WHERE']['AND']['NOT']['glpi_users.id'] = $used;
|
$query['WHERE']['AND']['NOT']['glpi_users.id'] = $used;
|
||||||
} else {
|
} else {
|
||||||
if (strlen($search)>0 && $search!=$CFG_GLPI["ajax_wildcard"]) {
|
if (strlen($search)>0 && $search!=$CFG_GLPI["ajax_wildcard"]) {
|
||||||
$txt_search = Search::makeTextSearchValue($search);
|
$txt_search = Search::makeTextSearchValue($search);
|
||||||
|
|
||||||
$firstname_field = $DB->quoteName(User::getTableField('firstname'));
|
$firstname_field = $DB->quoteName(User::getTableField('firstname'));
|
||||||
$realname_field = $DB->quoteName(User::getTableField('realname'));
|
$realname_field = $DB->quoteName(User::getTableField('realname'));
|
||||||
$fields = $_SESSION["glpinames_format"] == User::FIRSTNAME_BEFORE
|
$fields = $_SESSION["glpinames_format"] == User::FIRSTNAME_BEFORE
|
||||||
? [$firstname_field, $realname_field]
|
? [$firstname_field, $realname_field]
|
||||||
: [$realname_field, $firstname_field];
|
: [$realname_field, $firstname_field];
|
||||||
$concat = new \QueryExpression(
|
$concat = new \QueryExpression(
|
||||||
'CONCAT(' . implode(',' . $DB->quoteValue(' ') . ',', $fields) . ')'
|
'CONCAT(' . implode(',' . $DB->quoteValue(' ') . ',', $fields) . ')'
|
||||||
. ' LIKE ' . $DB->quoteValue($txt_search)
|
. ' LIKE ' . $DB->quoteValue($txt_search)
|
||||||
);
|
);
|
||||||
$query['WHERE']['AND'] = [
|
$query['WHERE']['AND'] = [
|
||||||
'glpi_users.name' => ['LIKE', $txt_search],
|
'glpi_users.name' => ['LIKE', $txt_search],
|
||||||
@@ -296,7 +299,7 @@ class PluginProcessmakerUser extends CommonDBTM {
|
|||||||
* Summary of getGlpiIdFromAny
|
* Summary of getGlpiIdFromAny
|
||||||
* Returns the GLPI id of the user or false if not found
|
* Returns the GLPI id of the user or false if not found
|
||||||
* Accept either PM GUID, GLPI logon, or GLPI ID
|
* Accept either PM GUID, GLPI logon, or GLPI ID
|
||||||
* @param $any
|
* @param $any
|
||||||
* @return mixed GLPI ID of the user or false if not found
|
* @return mixed GLPI ID of the user or false if not found
|
||||||
*/
|
*/
|
||||||
public static function getGlpiIdFromAny($any) {
|
public static function getGlpiIdFromAny($any) {
|
||||||
|
|||||||
@@ -1,194 +1,194 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
function update_to_3_2_8() {
|
function update_to_3_2_8() {
|
||||||
global $DB;
|
global $DB;
|
||||||
|
|
||||||
if ($DB->tableExists("glpi_plugin_processmaker_config")) {
|
if ($DB->tableExists("glpi_plugin_processmaker_config")) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_config`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_config`
|
||||||
ADD COLUMN `date_mod` DATETIME NULL DEFAULT NULL AFTER `pm_theme`,
|
ADD COLUMN `date_mod` DATETIME NULL DEFAULT NULL AFTER `pm_theme`,
|
||||||
ADD COLUMN `comment` TEXT NULL AFTER `date_mod`;
|
ADD COLUMN `comment` TEXT NULL AFTER `date_mod`;
|
||||||
RENAME TABLE `glpi_plugin_processmaker_config` TO `glpi_plugin_processmaker_configs`;";
|
RENAME TABLE `glpi_plugin_processmaker_config` TO `glpi_plugin_processmaker_configs`;";
|
||||||
$DB->query($query) or die("error creating glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error creating glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "pm_dbserver_name" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "pm_dbserver_name" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||||
ADD COLUMN `pm_dbserver_name` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_group_guid`,
|
ADD COLUMN `pm_dbserver_name` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_group_guid`,
|
||||||
ADD COLUMN `pm_dbserver_user` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_name`,
|
ADD COLUMN `pm_dbserver_user` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_name`,
|
||||||
ADD COLUMN `pm_dbserver_passwd` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_user`;";
|
ADD COLUMN `pm_dbserver_passwd` VARCHAR(255) NULL DEFAULT NULL AFTER `pm_dbserver_user`;";
|
||||||
$DB->query($query) or die("error adding fields pm_dbserver_name, pm_dbserver_user, pm_dbserver_passwd to glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error adding fields pm_dbserver_name, pm_dbserver_user, pm_dbserver_passwd to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "domain" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "domain" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||||
ADD COLUMN `domain` VARCHAR(50) NULL DEFAULT '' AFTER `pm_dbserver_passwd`;
|
ADD COLUMN `domain` VARCHAR(50) NULL DEFAULT '' AFTER `pm_dbserver_passwd`;
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error adding field domain to glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error adding field domain to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "maintenance" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "maintenance" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||||
ADD COLUMN `maintenance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `domain`;
|
ADD COLUMN `maintenance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `domain`;
|
||||||
;";
|
;";
|
||||||
$DB->query($query) or die("error adding fields maintenance to glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error adding fields maintenance to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "pm_dbname" )) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "pm_dbname" )) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_configs`
|
||||||
ADD COLUMN `pm_dbname` VARCHAR(50) NULL DEFAULT 'wf_workflow' AFTER `pm_dbserver_name`;
|
ADD COLUMN `pm_dbname` VARCHAR(50) NULL DEFAULT 'wf_workflow' AFTER `pm_dbserver_name`;
|
||||||
;";
|
;";
|
||||||
$DB->query($query) or die("error adding field pm_dbname to glpi_plugin_processmaker_configs" . $DB->error());
|
$DB->query($query) or die("error adding field pm_dbname to glpi_plugin_processmaker_configs" . $DB->error());
|
||||||
|
|
||||||
$DB->query("UPDATE glpi_plugin_processmaker_configs SET `pm_dbname` = CONCAT('wf_', `pm_workspace`) WHERE `id` = 1");
|
$DB->query("UPDATE glpi_plugin_processmaker_configs SET `pm_dbname` = CONCAT('wf_', `pm_workspace`) WHERE `id` = 1");
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($DB->tableExists("glpi_plugin_processmaker_profiles")) {
|
if ($DB->tableExists("glpi_plugin_processmaker_profiles")) {
|
||||||
$query = "DROP TABLE `glpi_plugin_processmaker_profiles` ;";
|
$query = "DROP TABLE `glpi_plugin_processmaker_profiles` ;";
|
||||||
$DB->query($query) or die("error dropping glpi_plugin_processmaker_profiles" . $DB->error());
|
$DB->query($query) or die("error dropping glpi_plugin_processmaker_profiles" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists("glpi_plugin_processmaker_cases", "processes_id")) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_cases", "processes_id")) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||||
ADD COLUMN `processes_id` INT(11) NULL DEFAULT NULL;
|
ADD COLUMN `processes_id` INT(11) NULL DEFAULT NULL;
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error adding column processes_id into glpi_plugin_processmaker_cases" . $DB->error());
|
$DB->query($query) or die("error adding column processes_id into glpi_plugin_processmaker_cases" . $DB->error());
|
||||||
} else {
|
} else {
|
||||||
$flds = $DB->list_fields('glpi_plugin_processmaker_cases');
|
$flds = $DB->listFields('glpi_plugin_processmaker_cases');
|
||||||
if (strcasecmp( $flds['processes_id']['Type'], 'varchar(32)' ) == 0) {
|
if (strcasecmp( $flds['processes_id']['Type'], 'varchar(32)' ) == 0) {
|
||||||
// required because autoload doesn't work for unactive plugin'
|
// required because autoload doesn't work for unactive plugin'
|
||||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/process.class.php");
|
include_once(GLPI_ROOT."/plugins/processmaker/inc/process.class.php");
|
||||||
include_once(GLPI_ROOT."/plugins/processmaker/inc/case.class.php");
|
include_once(GLPI_ROOT."/plugins/processmaker/inc/case.class.php");
|
||||||
$proc = new PluginProcessmakerProcess;
|
$proc = new PluginProcessmakerProcess;
|
||||||
$case = new PluginProcessmakerCase;
|
$case = new PluginProcessmakerCase;
|
||||||
foreach ($DB->request("SELECT * FROM glpi_plugin_processmaker_cases WHERE LENGTH( processes_id ) = 32") as $row) {
|
foreach ($DB->request("SELECT * FROM glpi_plugin_processmaker_cases WHERE LENGTH( processes_id ) = 32") as $row) {
|
||||||
$proc->getFromGUID( $row['processes_id'] );
|
$proc->getFromGUID( $row['processes_id'] );
|
||||||
$case->update([ 'id' => $row['id'], 'processes_id' => $proc->getID() ] );
|
$case->update([ 'id' => $row['id'], 'processes_id' => $proc->getID() ] );
|
||||||
}
|
}
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_cases`
|
||||||
CHANGE COLUMN `processes_id` `processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`;
|
CHANGE COLUMN `processes_id` `processes_id` INT(11) NULL DEFAULT NULL AFTER `case_status`;
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error converting column processes_id into INT(11) in glpi_plugin_processmaker_cases" . $DB->error());
|
$DB->query($query) or die("error converting column processes_id into INT(11) in glpi_plugin_processmaker_cases" . $DB->error());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists('glpi_plugin_processmaker_users', 'password') && !$DB->fieldExists('glpi_plugin_processmaker_users', 'id')) {
|
if (!$DB->fieldExists('glpi_plugin_processmaker_users', 'password') && !$DB->fieldExists('glpi_plugin_processmaker_users', 'id')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||||
ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST,
|
ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST,
|
||||||
ADD COLUMN `password` VARCHAR(32) NULL DEFAULT NULL AFTER `pm_users_id`,
|
ADD COLUMN `password` VARCHAR(32) NULL DEFAULT NULL AFTER `pm_users_id`,
|
||||||
ADD PRIMARY KEY (`id`);
|
ADD PRIMARY KEY (`id`);
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error adding column 'password' to glpi_plugin_processmaker_users" . $DB->error());
|
$DB->query($query) or die("error adding column 'password' to glpi_plugin_processmaker_users" . $DB->error());
|
||||||
|
|
||||||
// also need to change text of tasks for tasks linked to cases
|
// also need to change text of tasks for tasks linked to cases
|
||||||
$query = "UPDATE glpi_tickettasks SET content=REPLACE(content,'##_PluginProcessmakerCases\$processmakercases','##_PluginProcessmakerCase\$processmakercases')
|
$query = "UPDATE glpi_tickettasks SET content=REPLACE(content,'##_PluginProcessmakerCases\$processmakercases','##_PluginProcessmakerCase\$processmakercases')
|
||||||
WHERE glpi_tickettasks.id IN (SELECT items_id FROM glpi_plugin_processmaker_tasks WHERE itemtype='TicketTask') AND content LIKE '%_PluginProcessmakerCases\$processmakercases%'";
|
WHERE glpi_tickettasks.id IN (SELECT items_id FROM glpi_plugin_processmaker_tasks WHERE itemtype='TicketTask') AND content LIKE '%_PluginProcessmakerCases\$processmakercases%'";
|
||||||
$DB->query($query) or die("error updating TicketTask" . $DB->error());
|
$DB->query($query) or die("error updating TicketTask" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($DB->fieldExists('glpi_plugin_processmaker_users', 'glpi_users_id')) {
|
if ($DB->fieldExists('glpi_plugin_processmaker_users', 'glpi_users_id')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||||
ALTER `glpi_users_id` DROP DEFAULT,
|
ALTER `glpi_users_id` DROP DEFAULT,
|
||||||
DROP PRIMARY KEY,
|
DROP PRIMARY KEY,
|
||||||
DROP COLUMN `id`,
|
DROP COLUMN `id`,
|
||||||
DROP INDEX `glpi_users_id`;
|
DROP INDEX `glpi_users_id`;
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error droping 'defaults' from 'glpi_users_id' to glpi_plugin_processmaker_users" . $DB->error());
|
$DB->query($query) or die("error droping 'defaults' from 'glpi_users_id' to glpi_plugin_processmaker_users" . $DB->error());
|
||||||
|
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_users`
|
||||||
CHANGE COLUMN `glpi_users_id` `id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
CHANGE COLUMN `glpi_users_id` `id` INT(11) NOT NULL AUTO_INCREMENT FIRST,
|
||||||
ADD PRIMARY KEY (`id`);
|
ADD PRIMARY KEY (`id`);
|
||||||
";
|
";
|
||||||
$DB->query($query) or die("error renaming 'glpi_users_id' into 'id' to glpi_plugin_processmaker_users" . $DB->error());
|
$DB->query($query) or die("error renaming 'glpi_users_id' into 'id' to glpi_plugin_processmaker_users" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($DB->fieldExists( 'glpi_plugin_processmaker_processes', 'is_helpdeskvisible')) {
|
if ($DB->fieldExists( 'glpi_plugin_processmaker_processes', 'is_helpdeskvisible')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||||
CHANGE COLUMN `is_helpdeskvisible` `is_helpdeskvisible_notusedanymore` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'Not used any more since version 2.2' AFTER `name`;";
|
CHANGE COLUMN `is_helpdeskvisible` `is_helpdeskvisible_notusedanymore` TINYINT(1) NOT NULL DEFAULT '0' COMMENT 'Not used any more since version 2.2' AFTER `name`;";
|
||||||
$DB->query($query);
|
$DB->query($query);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists( 'glpi_plugin_processmaker_processes', 'itilcategories_id')) {
|
if (!$DB->fieldExists( 'glpi_plugin_processmaker_processes', 'itilcategories_id')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||||
ADD COLUMN `itilcategories_id` INT(11) NOT NULL DEFAULT '0',
|
ADD COLUMN `itilcategories_id` INT(11) NOT NULL DEFAULT '0',
|
||||||
ADD COLUMN `type` INT(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets';";
|
ADD COLUMN `type` INT(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets';";
|
||||||
|
|
||||||
$DB->query($query) or die("error adding columns 'itilcategories_id' and 'type' to glpi_plugin_processmaker_processes" . $DB->error());
|
$DB->query($query) or die("error adding columns 'itilcategories_id' and 'type' to glpi_plugin_processmaker_processes" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists( 'glpi_plugin_processmaker_processes', 'project_type')) {
|
if (!$DB->fieldExists( 'glpi_plugin_processmaker_processes', 'project_type')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_processes`
|
||||||
ADD COLUMN `project_type` VARCHAR(50) NOT NULL DEFAULT 'classic';";
|
ADD COLUMN `project_type` VARCHAR(50) NOT NULL DEFAULT 'classic';";
|
||||||
|
|
||||||
$DB->query($query) or die("error adding columns 'project_type' to glpi_plugin_processmaker_processes" . $DB->error());
|
$DB->query($query) or die("error adding columns 'project_type' to glpi_plugin_processmaker_processes" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists('glpi_plugin_processmaker_taskcategories', 'is_active')) {
|
if (!$DB->fieldExists('glpi_plugin_processmaker_taskcategories', 'is_active')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_taskcategories`
|
||||||
ADD COLUMN `is_active` TINYINT(1) NOT NULL DEFAULT '1' AFTER `start`;";
|
ADD COLUMN `is_active` TINYINT(1) NOT NULL DEFAULT '1' AFTER `start`;";
|
||||||
$DB->query($query) or die("error adding field is_active to glpi_plugin_processmaker_taskcategories table" . $DB->error());
|
$DB->query($query) or die("error adding field is_active to glpi_plugin_processmaker_taskcategories table" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($DB->fieldExists('glpi_plugin_processmaker_crontaskactions', 'postdatas')) {
|
if ($DB->fieldExists('glpi_plugin_processmaker_crontaskactions', 'postdatas')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||||
CHANGE COLUMN `postdatas` `postdata` MEDIUMTEXT NULL DEFAULT NULL AFTER `toclaim`;";
|
CHANGE COLUMN `postdatas` `postdata` MEDIUMTEXT NULL DEFAULT NULL AFTER `toclaim`;";
|
||||||
$DB->query($query) or die("error changing 'postdatas' from glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
$DB->query($query) or die("error changing 'postdatas' from glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists('glpi_plugin_processmaker_crontaskactions', 'logs_out')) {
|
if (!$DB->fieldExists('glpi_plugin_processmaker_crontaskactions', 'logs_out')) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||||
ADD COLUMN `logs_out` MEDIUMTEXT NULL AFTER `postdata`;";
|
ADD COLUMN `logs_out` MEDIUMTEXT NULL AFTER `postdata`;";
|
||||||
$DB->query($query) or die("error adding 'logs_out' field into glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
$DB->query($query) or die("error adding 'logs_out' field into glpi_plugin_processmaker_crontaskactions table" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$DB->fieldExists("glpi_plugin_processmaker_crontaskactions", "is_targettoclaim")) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_crontaskactions", "is_targettoclaim")) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_crontaskactions`
|
||||||
CHANGE COLUMN `toclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `users_id`;";
|
CHANGE COLUMN `toclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `users_id`;";
|
||||||
$DB->query($query) or die("error renaming toclaim in glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
$DB->query($query) or die("error renaming toclaim in glpi_plugin_processmaker_crontaskactions" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "plugin_processmaker_taskcategories_id_source")) {
|
//if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "plugin_processmaker_taskcategories_id_source")) {
|
||||||
// $query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
// $query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||||
// ADD COLUMN `plugin_processmaker_taskcategories_id_source` INT(11) NULL DEFAULT NULL AFTER `sourcetask_guid`,
|
// ADD COLUMN `plugin_processmaker_taskcategories_id_source` INT(11) NULL DEFAULT NULL AFTER `sourcetask_guid`,
|
||||||
// ADD COLUMN `plugin_processmaker_taskcategories_id_target` INT(11) NULL DEFAULT NULL AFTER `targettask_guid`,
|
// ADD COLUMN `plugin_processmaker_taskcategories_id_target` INT(11) NULL DEFAULT NULL AFTER `targettask_guid`,
|
||||||
// ADD COLUMN `plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL AFTER `targetprocess_guid`;";
|
// ADD COLUMN `plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL AFTER `targetprocess_guid`;";
|
||||||
// $DB->query($query) or die("error adding col plugin_processmaker_taskcategories_id_source to glpi_plugin_processmaker_caselinks" . $DB->error());
|
// $DB->query($query) or die("error adding col plugin_processmaker_taskcategories_id_source to glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||||
|
|
||||||
// $query = "UPDATE glpi_plugin_processmaker_caselinks AS pm_cl
|
// $query = "UPDATE glpi_plugin_processmaker_caselinks AS pm_cl
|
||||||
// LEFT JOIN glpi_plugin_processmaker_taskcategories AS pm_tcsource ON pm_tcsource.pm_task_guid=pm_cl.sourcetask_guid
|
// LEFT JOIN glpi_plugin_processmaker_taskcategories AS pm_tcsource ON pm_tcsource.pm_task_guid=pm_cl.sourcetask_guid
|
||||||
// LEFT JOIN glpi_plugin_processmaker_taskcategories AS pm_tctarget ON pm_tctarget.pm_task_guid=pm_cl.targettask_guid
|
// LEFT JOIN glpi_plugin_processmaker_taskcategories AS pm_tctarget ON pm_tctarget.pm_task_guid=pm_cl.targettask_guid
|
||||||
// LEFT JOIN glpi_plugin_processmaker_processes AS pm_pr ON pm_pr.process_guid=pm_cl.targetprocess_guid
|
// LEFT JOIN glpi_plugin_processmaker_processes AS pm_pr ON pm_pr.process_guid=pm_cl.targetprocess_guid
|
||||||
// SET pm_cl.plugin_processmaker_taskcategories_id_source = pm_tcsource.id,
|
// SET pm_cl.plugin_processmaker_taskcategories_id_source = pm_tcsource.id,
|
||||||
// pm_cl.plugin_processmaker_taskcategories_id_target = pm_tctarget.id,
|
// pm_cl.plugin_processmaker_taskcategories_id_target = pm_tctarget.id,
|
||||||
// pm_cl.plugin_processmaker_processes_id = pm_pr.id;";
|
// pm_cl.plugin_processmaker_processes_id = pm_pr.id;";
|
||||||
// $DB->query($query) or die("error migrating data into col plugin_processmaker_taskcategories_id_source in glpi_plugin_processmaker_caselinks" . $DB->error());
|
// $DB->query($query) or die("error migrating data into col plugin_processmaker_taskcategories_id_source in glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||||
|
|
||||||
// $query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
// $query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||||
// DROP COLUMN `sourcetask_guid`,
|
// DROP COLUMN `sourcetask_guid`,
|
||||||
// DROP COLUMN `targettask_guid`,
|
// DROP COLUMN `targettask_guid`,
|
||||||
// DROP COLUMN `targetprocess_guid`;";
|
// DROP COLUMN `targetprocess_guid`;";
|
||||||
// $DB->query($query) or die("error dropping col plugin_processmaker_taskcategories_id_source from glpi_plugin_processmaker_caselinks" . $DB->error());
|
// $DB->query($query) or die("error dropping col plugin_processmaker_taskcategories_id_source from glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "is_targettoclaim")) {
|
if (!$DB->fieldExists("glpi_plugin_processmaker_caselinks", "is_targettoclaim")) {
|
||||||
$query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
$query = "ALTER TABLE `glpi_plugin_processmaker_caselinks`
|
||||||
CHANGE COLUMN `targettoclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `sourcecondition`;";
|
CHANGE COLUMN `targettoclaim` `is_targettoclaim` TINYINT(1) NOT NULL DEFAULT '0' AFTER `sourcecondition`;";
|
||||||
$DB->query($query) or die("error renaming targettoclaim in glpi_plugin_processmaker_caselinks" . $DB->error());
|
$DB->query($query) or die("error renaming targettoclaim in glpi_plugin_processmaker_caselinks" . $DB->error());
|
||||||
}
|
}
|
||||||
|
|
||||||
//if( !$DB->tableExists('glpi_plugin_processmaker_selfservicedrafts')){
|
//if( !$DB->tableExists('glpi_plugin_processmaker_selfservicedrafts')){
|
||||||
// $query = "CREATE TABLE `glpi_plugin_processmaker_selfservicedrafts` (
|
// $query = "CREATE TABLE `glpi_plugin_processmaker_selfservicedrafts` (
|
||||||
// `id` INT(11) NOT NULL AUTO_INCREMENT,
|
// `id` INT(11) NOT NULL AUTO_INCREMENT,
|
||||||
// `users_id` INT(11) NOT NULL,
|
// `users_id` INT(11) NOT NULL,
|
||||||
// `plugin_processmaker_processes_id` INT(11) NOT NULL,
|
// `plugin_processmaker_processes_id` INT(11) NOT NULL,
|
||||||
// `url` TEXT NOT NULL,
|
// `url` TEXT NOT NULL,
|
||||||
// PRIMARY KEY (`id`),
|
// PRIMARY KEY (`id`),
|
||||||
// INDEX `users_id` (`users_id`)
|
// INDEX `users_id` (`users_id`)
|
||||||
// )
|
// )
|
||||||
// COLLATE='utf8_general_ci'
|
// COLLATE='utf8_general_ci'
|
||||||
// ENGINE=InnoDB
|
// ENGINE=InnoDB
|
||||||
// ;" ;
|
// ;" ;
|
||||||
// $DB->query($query) or die("error creating glpi_plugin_processmaker_selfservicedrafts" . $DB->error());
|
// $DB->query($query) or die("error creating glpi_plugin_processmaker_selfservicedrafts" . $DB->error());
|
||||||
//}
|
//}
|
||||||
|
|
||||||
return '3.2.8';
|
return '3.2.8';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
<compatibility>9.4</compatibility>
|
<compatibility>9.4</compatibility>
|
||||||
</version>
|
</version>
|
||||||
<version>
|
<version>
|
||||||
<num>4.0.8</num>
|
<num>4.0.11</num>
|
||||||
<compatibility>9.5</compatibility>
|
<compatibility>9.5</compatibility>
|
||||||
</version>
|
</version>
|
||||||
</versions>
|
</versions>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
define('PROCESSMAKER_VERSION', '4.0.8');
|
define('PROCESSMAKER_VERSION', '4.0.11');
|
||||||
|
|
||||||
// used for case cancellation
|
// used for case cancellation
|
||||||
define("CANCEL", 256);
|
define("CANCEL", 256);
|
||||||
@@ -130,7 +130,7 @@ function plugin_init_processmaker() {
|
|||||||
// in order to manage the password encryption
|
// in order to manage the password encryption
|
||||||
$pmglpikey = new PluginProcessmakerGlpikey;
|
$pmglpikey = new PluginProcessmakerGlpikey;
|
||||||
foreach ($pmglpikey->getFields() as $fld) {
|
foreach ($pmglpikey->getFields() as $fld) {
|
||||||
$PLUGIN_HOOKS['secured_fields'][] = $fld;
|
$PLUGIN_HOOKS['secured_fields'][] = [$fld];
|
||||||
}
|
}
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user