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:
Tomolimo
2022-01-24 14:53:44 +01:00
parent 14e7e612c9
commit e5ccb43e95
9 changed files with 378 additions and 316 deletions

View File

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

View File

@@ -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,7 +400,8 @@ 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_caselinks_id' => $targetTask['id'],
'plugin_processmaker_cases_id' => $locCase->getID(), 'plugin_processmaker_cases_id' => $locCase->getID(),
//'itemtype' => $itemtype, //'itemtype' => $itemtype,
//'items_id' => $parm->fields['tickets_id'], //'items_id' => $parm->fields['tickets_id'],
@@ -400,9 +410,7 @@ function plugin_item_update_processmaker_tasks($parm) {
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY), 'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT), 'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT) 'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
], ], [], false);
null,
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']);
} }
@@ -433,6 +455,8 @@ function plugin_item_update_processmaker_tasks($parm) {
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);

View File

@@ -14,7 +14,7 @@ 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;

View File

@@ -171,24 +171,44 @@ class PluginProcessmakerProcess extends CommonDBTM {
// 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([
'plugin_processmaker_processes_id' => $this->getID(),
'pm_task_guid' => $taskGUID, 'pm_task_guid' => $taskGUID,
'taskcategories_id' => $taskCat->getID(), 'taskcategories_id' => $taskCat->getID(),
'is_start' => $task['is_start'], 'is_start' => $task['is_start'],
@@ -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;

View File

@@ -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']
@@ -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'];
} }
} }
@@ -1953,10 +1953,9 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
$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
]);
} }
} }
} }
@@ -2455,7 +2459,7 @@ debugger;
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
@@ -3507,9 +3511,11 @@ 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
if (isset($queryname)) {
foreach ($PM_DB->request($queryname) as $onlyrec) { foreach ($PM_DB->request($queryname) as $onlyrec) {
$groupname = $onlyrec; $groupname = $onlyrec;
} }
}
if (isset($groupname)) { if (isset($groupname)) {
return ['name' => $groupname['GRP_TITLE'], return ['name' => $groupname['GRP_TITLE'],

View File

@@ -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' => [

View File

@@ -53,7 +53,7 @@ function update_to_3_2_8() {
"; ";
$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");

View File

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

View File

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