3
0

To be compliant with GLPI 10.0

Set version to 5.0.0
This commit is contained in:
Moron, Olivier
2023-10-16 14:53:46 +02:00
parent eeed2b061b
commit c6cd509511
64 changed files with 327 additions and 380 deletions

View File

@@ -14,5 +14,7 @@ version 4.3.x is compatible with GLPI 9.5 and needs ProcessMaker 3.3.0-RE-1.13 (
version 4.4.x is compatible with GLPI 9.5 and needs ProcessMaker 3.3.0-RE-2.0 (https://github.com/tomolimo/processmaker-server/releases/latest)
version 5.0.x is compatible with GLPI 10.0 and needs ProcessMaker 3.3.0-RE-2.0 (https://github.com/tomolimo/processmaker-server/releases/latest)
This plugin can run classic (ProcessMaker server v2) and BPMN (ProcessMaker server v3 and later) processes

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -97,7 +97,7 @@ $res = $DB->request([
]);
// there is only one row
$taskCat = $res->next();
$taskCat = $res->current();
$ask_for_reason = PluginProcessmakerTaskCategory::inheritedReAssignReason($taskCat['pm_is_reassignreason_mandatory'], $taskCat['gppp_is_reassignreason_mandatory']);
PluginProcessmakerUser::dropdown( ['name' => 'users_id_recipient',
@@ -121,43 +121,47 @@ echo HTML::scriptBlock("
// Dialog helpers
// Create the dialog with \"Re-assign\" button
function showCommentDlg(title, content, alttext) {
var dlgContents = {
title: title,
modal: true,
width: 'auto',
height: 'auto',
resizable: false,
close: function (event, ui) {
$(this).dialog('destroy').remove();
},
buttons: [{
text: alttext,
id: 'submit$rand',
disabled: 'disabled',
click: function() {
$('#comment$rand').val($('#commenttxtarea$rand').val());
$('#reassign$rand').click();
$('#submit$rand').button('disable');
modalId = title.replaceAll(' ', '_')
var modal = $('#'+title);
if (modal && modal.length == 0) {
var modal = '<div class=\"modal fade testmodalprocess\" id=\"'+ modalId +'\" tabindex=\"-1\" role=\"dialog\" aria-labelledby=\"exampleModalCenterTitle\" aria-hidden=\"true\">'
+ '<div class=\"modal-dialog modal-dialog-centered\"role=\"document\">'
+ '<div class=\"modal-content\">'
+ '<div class=\"modal-header\">'
+ '<h5 class=\"modal-modalId\" id=\"changeChoiceTitle\">'+ title +'</h5>'
+ '<button type=\"button\" class=\"btn-close\" data-bs-dismiss=\"modal\" aria-label=\"Close\"></button>'
+ '</div >'
+ '<div class=\"modal-body\">'
+ '</div>'
+ '<div class=\"modal-footer\">'
+ '<button type=\"button\" class=\"btn btn-primary\" id=\"submit$rand\" disabled>'+alttext+'</button>'
+ '</div>'
+ '</div>'
+ '</div>';
$('body').append(modal);
}
}],
show: true,
hide: true
}
$('<div id=divreassign$rand></div>').appendTo($('#processmaker_form_task$rand-".$_REQUEST['delIndex']."'));
var locDlg = $('#divreassign$rand').html(content + '<p><textarea id=commenttxtarea$rand rows=6 cols=60></textarea></p><font color=red>".addslashes(__('Input at least 10 words to justify.','processmaker'))."</font>').dialog(dlgContents);
$('#'+modalId).modal('show');
$('#'+modalId+' .modal-body').append('<label for=\"message-text\" class=\"col-form-label\">'+content+'</label><textarea class=\"form-control\" id=\"commenttxtarea$rand\" style=\"height: 100px\"></textarea></p><font color=red>".addslashes(__('Input at least 10 words to justify.','processmaker'))."</font>');
$('#commenttxtarea$rand').focus();
$('#commenttxtarea$rand').on('keydown keyup', function(e) {
if ($('#commenttxtarea$rand').val().split(/\W+/).length > 10) {
$('#submit$rand').button('enable');
$('#submit$rand').prop('disabled', false);
} else {
$('#submit$rand').button('disable');
$('#submit$rand').prop('disabled', true);
}
});
return locDlg;
$('#'+modalId).on('hide.bs.modal', function () {
$('#'+modalId).remove();
})
$('#submit$rand').click(() => {
$('#comment$rand').val($('#commenttxtarea$rand').val());
$('#reassign$rand').click();
$('#submit$rand').button('disable');
$('#'+modalId).modal('hide').remove();
});
};
$('input[name=reassign$rand]').click(function (e) {
//debugger;
let post = true;
@@ -176,7 +180,6 @@ echo HTML::scriptBlock("
// un-claim
if (".($can_unclaim ? 1 : 0)." && users_id_val != 0) {
if (" . ($ask_for_reason ? 1 : 0) . ") {
//e.preventDefault();
showCommentDlg('".addslashes(__('Un-claim task', 'processmaker'))."',
'".addslashes(__('Please input reason to un-claim<br/>(task will be re-assigned to former group):', 'processmaker'))."',
'".addslashes(__('Un-claim', 'processmaker'))."');

View File

@@ -1,7 +1,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -34,10 +34,13 @@ span.pm_task, a.pm_task {
a.pm_task_badge {
background-color: #4185F4 !important;
display: flex;
}
span.pm_task_case {
background-color: red !important;
padding-right: 8px;
margin-left: 8px;
flex: none;
align-self: flex-start;
}

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -1,8 +1,9 @@
<?php
use Symfony\Component\DomCrawler\Crawler;
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -109,96 +110,70 @@ function processMakerShowCase($users_id, $from_helpdesk) {
$buffer = ob_get_clean();
// to change this HTML code
$dom = new DOMDocument();
// will convert '&' to '&amp;', '<' to '&lt;' and '>' to '&gt;'
$buffer = htmlspecialchars($buffer, ENT_NOQUOTES);
// will restore '&lt;' to '<' and '&gt;' to '>'
// so that only the already escaped entites will get the double encoding
// will also change </b> end of bold into a local identifier
$endOfBold = 'end_of_bold'.rand();
$endOfSpan = 'end_of_span'.rand();
$buffer = str_replace(['&lt;', '&gt;', '</b>', '</span>'], ['<', '>', $endOfBold, $endOfSpan], $buffer);
// will convert any UTF-8 char that can't be expressed in ASCII into an HTML entity
$buffer = mb_convert_encoding($buffer, 'HTML-ENTITIES');
$dom->loadHTML($buffer, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD );
$xpath = new DOMXPath($dom);
$crawler = new Crawler();
$crawler->addHtmlContent($buffer);
// hide some fields
$list = [ 'name', 'type', 'locations_id', 'itilcategories_id', 'items_id', 'add' ];
$xpath_str = '//*[@name="'.implode( '"]/ancestor::tr[1] | //*[@name="', $list ).'"]/ancestor::tr[1]';
$res = $xpath->query($xpath_str);
foreach ($res as $elt) {
$elt->setAttribute( 'style', 'display:none;');
}
$list = [ 'name', 'type', 'locations_id', 'itilcategories_id', 'items_id'];
$crawler->filter('[name='. implode('], [name=', $list) .']')->each(function (Crawler $node) {
$node->closest('.form-field')->getNode(0)->setAttribute('style', 'display:none;');
});
$crawler->filter('[name=add]')->getNode(0)->setAttribute('style', 'display:none;');
// add an input for processguid in the form
$res = $xpath->query('//form[@name="helpdeskform"]');
$input = $res->item(0)->appendChild(new DOMElement('input'));
$formNode = $crawler->filter('#itil-form');
$input = $formNode->getNode(0)->appendChild(new DOMElement('input'));
$input->setAttribute('name', 'processmaker_process_guid');
$input->setAttribute('type', 'hidden');
$input->setAttribute('value', $caseInfo->processId);
// add an input for processid in the form
$input = $res->item(0)->appendChild(new DOMElement('input'));
$input = $formNode->getNode(0)->appendChild(new DOMElement('input'));
$input->setAttribute('name', 'processmaker_processes_id');
$input->setAttribute('type', 'hidden');
$input->setAttribute('value', $_REQUEST['processes_id']);
// let insert in form the guid of the case
$input = $res->item(0)->appendChild(new DOMElement('input'));
$input = $formNode->getNode(0)->appendChild(new DOMElement('input'));
$input->setAttribute('name', 'processmaker_caseguid');
$input->setAttribute('type', 'hidden');
$input->setAttribute('value', $caseInfo->caseId);
// let insert in form the number of the case
$input = $res->item(0)->appendChild(new DOMElement('input'));
$input = $formNode->getNode(0)->appendChild(new DOMElement('input'));
$input->setAttribute('name', 'processmaker_casenum');
$input->setAttribute('type', 'hidden');
$input->setAttribute('value', $caseInfo->caseNumber);
// let insert in form the delindex of the case
$input = $res->item(0)->appendChild(new DOMElement('input'));
$input = $formNode->getNode(0)->appendChild(new DOMElement('input'));
$input->setAttribute('name', 'processmaker_delindex');
$input->setAttribute('type', 'hidden');
$input->setAttribute('value', $caseInfo->currentUsers[0]->delIndex);
// let insert in form the action
$input = $res->item(0)->appendChild(new DOMElement('input'));
$input = $formNode->getNode(0)->appendChild(new DOMElement('input'));
$input->setAttribute('name', 'processmaker_action');
$input->setAttribute('type', 'hidden');
$input->setAttribute('value', 'routecase');
// special case for content textarea which is in the same tr than the file upload
$res = $xpath->query('//*[@name="content"]/ancestor::div[1] | //*[@name="content"]/ancestor::tr[1]/td[1]');
foreach ($res as $elt) {
$elt->setAttribute( 'style', 'display:none;');
}
$res = $xpath->query('//*[@name="content"]/ancestor::td[1]');
foreach ($res as $elt) {
// there should be only one td
$elt->setAttribute( 'colspan', '2');
}
$res = $xpath->query('//*[@name="content"]/ancestor::tr[1]');
$table = $xpath->query('//*[@name="add"]/ancestor::table[1]');
$tr = $table->item(0)->insertBefore(new DOMElement('tr'), $res->item(0));
$td = $tr->appendChild(new DOMElement('td'));
$td->setAttribute('colspan', '2');
$iframe = $td->appendChild(new DOMElement('iframe'));
$crawler->filter('textarea[name=content]')->closest('div.field-container')->children()->getNode(0)->setAttribute('style', 'display:none');
$descriptionContainer = $crawler->filter('textarea[name=content]')->closest('div.field-container');
$formField = $descriptionContainer->closest('div.form-field');
$cardBody = $formField->closest('div.card-body');
$cardBody->children()->getNode(0)->setAttribute('class', 'col-md-12');
$formField->children('label')->getNode(0)->setAttribute('style', 'display:none');
$descriptionContainer->getNode(0)->setAttribute('class', 'col-md-12');
$containerDivNode = $descriptionContainer->getNode(0)->insertBefore(new DOMElement('div'), $descriptionContainer->getNode(0)->firstChild);
$iframeParentDiv = $containerDivNode->appendChild(new DOMElement('div'));
$iframe = $iframeParentDiv->appendChild(new DOMElement('iframe'));
$pmCaseUser = $caseInfo->currentUsers[0]; // by default
$paramsURL = "DEL_INDEX={$pmCaseUser->delIndex}&action={$caseInfo->caseStatus}";
$iframeId = 'caseiframe';
$iframe->setAttribute('id', $iframeId);
$iframe->setAttribute('width', '100%' );
$iframe->setAttribute('style', 'border:none;' );
@@ -219,19 +194,7 @@ function processMakerShowCase($users_id, $from_helpdesk) {
"{$PM_SOAP->serverURL}/cases/cases_Open?sid={$PM_SOAP->getPMSessionID()}&APP_UID={$caseInfo->caseId}&{$paramsURL}&glpi_data={$glpi_data}"
);
// set the width and the title of the first table th
$th = $xpath->query('//*[@name="add"]/ancestor::table[1]/*/th[1]');
$th->item(0)->setAttribute('width', '30%');
$th->item(0)->nodeValue = $caseInfo->processName;
$buffer = $dom->saveHTML();
// revert back </b> and </span>
$buffer = str_replace([$endOfSpan, $endOfBold], ['</span>', '</b>'], $buffer);
// will revert back any char converted above
$buffer = mb_convert_encoding($buffer, 'UTF-8', 'HTML-ENTITIES');
echo $buffer;
echo $crawler->html();
}
}

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -285,8 +285,8 @@ class PluginProcessmakerCase extends CommonDBTM {
$info = sprintf($info,
$this->getNameID(['forceid' => true]),
DropdownTranslation::getTranslatedValue($glpi_task->fields['taskcategories_id'], 'TaskCategory', 'name', $_SESSION['glpilanguage'], $taskCat->fields['name']),
Html::clean($dbu->getUserName(isset($glpi_task->oldvalues['users_id_tech']) ? $glpi_task->oldvalues['users_id_tech'] : 0)),
Html::clean($groups_id_tech['name']),
$dbu->getUserName(isset($glpi_task->oldvalues['users_id_tech']) ? $glpi_task->oldvalues['users_id_tech'] : 0),
$groups_id_tech['name'],
$options['comment']
);
// unescape some chars and replace CRLF, CR or LF by <br/>
@@ -398,18 +398,18 @@ class PluginProcessmakerCase extends CommonDBTM {
$taskCat = new TaskCategory;
$taskCat->getFromDB( $glpi_task->fields['taskcategories_id'] );
$task_name = DropdownTranslation::getTranslatedValue($glpi_task->fields['taskcategories_id'], 'TaskCategory', 'name', $_SESSION['glpilanguage'], $taskCat->fields['name']);
$new_tech_name = Html::clean($dbu->getUserName($newTech));
$new_tech_name = $dbu->getUserName($newTech);
if ($old_users_tech_id) {
$info = __('<b>Task re-assigned!</b><br/><b>Case: </b>%s<br/><b>Task: </b>"%s" has been re-assigned from "%s" to "%s".<br/><b>Reason: </b>%s', 'processmaker');
$info = __('<b>Task re-assigned!</b><br><b>Case: </b>%s<br><b>Task: </b>"%s" has been re-assigned from "%s" to "%s".<br><b>Reason: </b>%s', 'processmaker');
$info = sprintf($info,
$this->getNameID(['forceid' => true]),
$task_name,
Html::clean($dbu->getUserName(isset($glpi_task->oldvalues['users_id_tech']) ? $glpi_task->oldvalues['users_id_tech'] : 0)),
$dbu->getUserName(isset($glpi_task->oldvalues['users_id_tech']) ? $glpi_task->oldvalues['users_id_tech'] : 0),
$new_tech_name,
$options['comment']
);
} else {
$info = __('<b>Task assigned!</b><br/><b>Case: </b>%s<br/><b>Task: </b>"%s" has been assigned to "%s".<br/><b>Reason: </b>%s', 'processmaker');
$info = __('<b>Task assigned!</b><br><b>Case: </b>%s<br><b>Task: </b>"%s" has been assigned to "%s".<br><b>Reason: </b>%s', 'processmaker');
$info = sprintf($info,
$this->getNameID(['forceid' => true]),
$task_name,
@@ -420,7 +420,8 @@ class PluginProcessmakerCase extends CommonDBTM {
$info .= "<input name='caseid' type='hidden' value='".$this->getID()."'><input name='taskid' type='hidden' value='".$pm_task->getID()."'>";
// unescape some chars and replace CRLF, CR or LF by <br/>
$info = str_replace(["\\'", '\\"', '\r\n', '\r', '\n'], ["'", '"', '<br>', '<br>', '<br>'], $info);
$info = str_replace(["\\'", '\\"'], ["'", '"'], $info);
$info = nl2br($info);
$glpi_task->add([$foreignkey => $glpi_task->fields[$foreignkey],
'date' => $glpi_task->fields['date'],
@@ -546,7 +547,7 @@ class PluginProcessmakerCase extends CommonDBTM {
//$res = $PM_DB->query("SELECT APP_UID FROM SUB_APPLICATION WHERE APP_PARENT='{$this->fields['case_guid']}' AND DEL_INDEX_PARENT={$currentTask->delIndex} AND SA_STATUS='ACTIVE'");
//if ($res && $PM_DB->numrows($res) == 1) {
// $row = $PM_DB->fetch_assoc($res);
if ($res->numrows() == 1 && $row = $res->next()) {
if ($res->numrows() == 1 && $row = $res->current()) {
$sub_case = new PluginProcessmakerCase;
$sub_case->getFromGUID($row['APP_UID']);
$case_url .= $sub_case->getID()."-".$currentTask->delIndex;
@@ -700,7 +701,7 @@ class PluginProcessmakerCase extends CommonDBTM {
echo "<tr><th colspan=12 >".sprintf($maintitle, $itemtype::getTypeName(1))."</th></tr>";
Ticket::commonListHeader(Search::HTML_OUTPUT);
$itemtype::commonListHeader(Search::HTML_OUTPUT);
$itemtype::showShort($case->fields['items_id']);
@@ -728,7 +729,7 @@ class PluginProcessmakerCase extends CommonDBTM {
// will not show delete button if case is a sub-process
// and will show it only if it is a draft or if current glpi user has the right to delete cases and session is central
if ($case->canPurgeItem($case->getID())) {
if ($case->canPurgeItem()) {
// then propose a button to delete case
// the button will be effectively shown by the showFormButtons()
@@ -1119,14 +1120,14 @@ class PluginProcessmakerCase extends CommonDBTM {
return [];
}
$pm_plugin_url = Plugin::getWebDir('processmaker');
$front_page = "$pm_plugin_url/front";
//$pm_plugin_url = Plugin::getWebDir('processmaker');
//$front_page = "$pm_plugin_url/front";
$menu = [];
$menu['title'] = self::getTypeName(Session::getPluralNumber());
$menu['page'] = "$front_page/case.php";
$menu['icon'] = "'></i><img src=\"$pm_plugin_url/pics/processmaker-xxs.png\" style=\"vertical-align: middle;\"/><i class='";
$menu['links']['search'] = PluginProcessmakerCase::getSearchURL(false);
$menu['page'] = self::getSearchURL(false);
//$menu['icon'] = '"></i><img src="'.$pm_plugin_url.'/pics/processmaker-xxs.png" style="vertical-align: middle;"/><i class="';
//$menu['icon'] = "\"src=\"$pm_plugin_url/pics/processmaker-xxs.png\" style=\"vertical-align: middle;";
$menu['links']['search'] = self::getSearchURL(false);
if (Session::haveRightsOr("config", [READ, UPDATE])) {
$menu['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
}
@@ -1509,17 +1510,17 @@ class PluginProcessmakerCase extends CommonDBTM {
$process->getFromDB($this->fields['plugin_processmaker_processes_id']);
$ong = [];
if (self::isLayoutWithMain()) {
$this->addDefaultFormTab($ong);
}
//if (self::isLayoutWithMain()) {
// $this->addDefaultFormTab($ong);
//}
if (!$process->fields['maintenance']) {
$this->addStandardTab('PluginProcessmakerTask', $ong, $options);
}
if (!self::isLayoutWithMain()) {
//if (!self::isLayoutWithMain()) {
$this->addStandardTab(__CLASS__, $ong, $options);
}
//}
if (!$process->fields['maintenance']) {
$this->addStandardTab('PluginProcessmakerCasemap', $ong, $options);

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -45,7 +45,8 @@ class PluginProcessmakerDB extends DBmysql {
&& $config['pm_workspace'] != '' ) {
$this->dbhost = $config['pm_dbserver_name'];
$this->dbuser = $config['pm_dbserver_user'];
$this->dbpassword = Toolbox::sodiumDecrypt($config['pm_dbserver_passwd']);
$glpikey = new GLPIKey();
$this->dbpassword = $glpikey->decrypt($config['pm_dbserver_passwd']);
$this->dbdefault = isset($config['pm_dbname']) ? $config['pm_dbname'] : '';
parent::__construct();
}

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -26,7 +26,7 @@ along with this plugin. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
use function GuzzleHttp\Psr7\mimetype_from_filename;
use GuzzleHttp\Psr7\MimeType;
/**
@@ -140,7 +140,7 @@ class PluginProcessmakerDocument extends CommonDBTM {
'is_recursive' => 1,
'name' => $doc->filename,
'users_id' => $users_id,
'mime' => mimetype_from_filename($doc->filename),
'mime' => MimeType::fromFilename($doc->filename),
]);
$this->add([
'plugin_processmaker_cases_id' => $cases_id,

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -38,17 +38,17 @@ class PluginProcessmakerMenu extends CommonGLPI {
return [];
}
$pm_plugin_url = Plugin::getWebDir('processmaker');
$front_page = "$pm_plugin_url/front";
//$pm_plugin_url = Plugin::getWebDir('processmaker');
$menu = [];
$menu['title'] = self::getMenuName();
$menu['page'] = "$front_page/process.php";
$menu['page'] = PluginProcessmakerProcess::getSearchURL(false);
$menu['links']['search'] = PluginProcessmakerProcess::getSearchURL(false);
if (Session::haveRightsOr("config", [READ, UPDATE])) {
$menu['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
}
$menu['icon'] = "'></i><img src=\"$pm_plugin_url/pics/processmaker-xxs.png\" style=\"vertical-align: middle;\"/><i class='";
//$menu['icon'] = '{% verbatim %}"></i><img src="'.$pm_plugin_url.'/pics/processmaker-xxs.png" style="vertical-align: middle;"/><i class="{% endverbatim %}';
//$menu['icon'] = "\"src=\"$pm_plugin_url/pics/processmaker-xxs.png\" style=\"vertical-align: middle;";
$itemtypes = ['PluginProcessmakerProcess' => 'processes',
'PluginProcessmakerCaselink' => 'caselinks'
];

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -1,8 +1,9 @@
<?php
use Glpi\Toolbox\Sanitizer;
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -97,7 +98,7 @@ class PluginProcessmakerNotificationTargetTask extends PluginProcessmakerNotific
foreach ($DB->request($query) as $row) {
if (!isset($ptaskcats[$row['ptaskcat']])) {
$temp->getFromDB($row['ptaskcat']);
$ptaskcats[$row['ptaskcat']] = $temp->fields['name'];
$ptaskcats[$row['ptaskcat']] = isset($temp->fields['name']) ? $temp->fields['name'] : '';
}
$temp->getFromDB($row['taskcat']);
@@ -161,10 +162,10 @@ class PluginProcessmakerNotificationTargetTask extends PluginProcessmakerNotific
// task creator
// should always be Process Maker user
$dbu = new DbUtils();
$this->data['##task.author##'] = Html::clean($dbu->getUserName($taskobj->fields['users_id']));
$this->data['##task.author##'] = $dbu->getUserName($taskobj->fields['users_id']);
// task editor
$this->data['##task.lastupdater##'] = Html::clean($dbu->getUserName($taskobj->fields['users_id_editor']));
$this->data['##task.lastupdater##'] = $dbu->getUserName($taskobj->fields['users_id_editor']);
// task technician
$this->data['##task.user##'] = '';
@@ -172,19 +173,19 @@ class PluginProcessmakerNotificationTargetTask extends PluginProcessmakerNotific
$tech = new User;
if ($taskobj->fields['users_id_tech'] > 0
&& $tech->getFromDB($taskobj->fields['users_id_tech'])) {
$this->data['##task.user##'] = Html::clean($dbu->getUserName($taskobj->fields['users_id_tech']));
$this->data['##task.user##'] = $dbu->getUserName($taskobj->fields['users_id_tech']);
$this->data['##task.user.login##'] = $tech->fields['name'];
}
$oldtech = new User;
if (isset($options['old_users_id_tech'])
&& $options['old_users_id_tech'] > 0
&& $oldtech->getFromDB($options['old_users_id_tech'])) {
$this->data['##task.former.user##'] = Html::clean($dbu->getUserName($options['old_users_id_tech']));
$this->data['##task.former.user##'] = $dbu->getUserName($options['old_users_id_tech']);
$this->data['##task.former.user.login##'] = $oldtech->fields['name'];
}
// task group technician
$this->data['##task.group##'] = Html::clean(Toolbox::clean_cross_side_scripting_deep(Dropdown::getDropdownName("glpi_groups", $taskobj->fields['groups_id_tech'])), true, 2, false);
$this->data['##task.group##'] = implode(Sanitizer::encodeHtmlSpecialCharsRecursive(Dropdown::getDropdownArrayNames("glpi_groups", [$taskobj->fields['groups_id_tech']])));
// task planning
$this->data['##task.begin##'] = '';

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -188,7 +188,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
$objs = ['TicketTask', 'ProblemTask', 'ChangeTask'];
$countElt = 0;
foreach ($objs as $obj) {
$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) {
// just set 'is_active' to 0
$pmtask->Update(['id' => $task['id'], 'is_start' => 0, 'is_active' => 0]);
@@ -334,7 +334,6 @@ class PluginProcessmakerProcess extends CommonDBTM {
$PM_SOAP->login( true );
$pmProcessList = $PM_SOAP->processList();
//$config = $PM_SOAP->config; // $PM_PluginProcessmakerConfig::getInstance();
$pmMainTaskCat = $PM_SOAP->config['taskcategories_id'];
// and get processlist from GLPI
@@ -488,28 +487,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
* @return bool true if succeed else false
**/
public function getFromGUID($process_guid) {
global $DB;
$res = $DB->request(
$this->getTable(), [
'process_guid' => $process_guid
]
);
//$query = "SELECT *
// FROM `".$this->getTable()."`
// WHERE `process_guid` = '$process_guid'";
//if ($result = $DB->query($query)) {
if ($res) {
if ($res->numrows() != 1) {//if ($DB->numrows($result) != 1) {
return false;
}
$this->fields = $res->next(); //$DB->fetch_assoc($result);
if (is_array($this->fields) && count($this->fields)) {
return true;
}
}
return false;
return $this->getFromDBByCrit(['process_guid' => $process_guid]);
}
@@ -968,7 +946,7 @@ class PluginProcessmakerProcess extends CommonDBTM {
// $data = $DB->fetch_assoc($result);
if ($res && $res->numrows() == 1) {
// $processname = $res['name'];//$data["name"];
$data = $res->next();
$data = $res->current();
$processname = $data["name"];
if ($link == 2) {
$process["name"] = $processname;

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -85,11 +85,11 @@ if (!function_exists('stripcslashes_deep')) {
* @return stripcslashes item
**/
function stripcslashes_deep($value) {
if (isset($value)) {
$value = is_array($value) ?
array_map('stripcslashes_deep', $value) :
stripcslashes($value);
}
return $value;
}
}
@@ -260,7 +260,8 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
$cookie_lifetime = 15 * 60; //= 15 minutes
}
if ($admin_or_user === true) { // admin rights has been requested, then force new login
$locSession = $this->pmSoapClient->login([ 'userid' => $this->config['pm_admin_user'], 'password' => Toolbox::sodiumDecrypt($this->config['pm_admin_passwd'])]);
$glpikey = new GLPIKey();
$locSession = $this->pmSoapClient->login([ 'userid' => $this->config['pm_admin_user'], 'password' => $glpikey->decrypt($this->config['pm_admin_passwd'])]);
if (is_object($locSession) && $locSession->status_code == 0) {
$_SESSION["pluginprocessmaker"]["session"]["admin"] = true;
$_SESSION["pluginprocessmaker"]["session"]["id"] = $locSession->message;
@@ -290,8 +291,9 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
$pmusr = new PluginProcessmakerUser;
$pmusr->getFromDB($gusr->getID());
if (is_object($pmusr) && array_key_exists('pm_users_id', $pmusr->fields)) {
$pass = md5(Toolbox::sodiumEncrypt($gusr->getID().$gusr->getName().time()));
// and must be updated also in PM db
$glpikey = new GLPIKey();
$pass = md5($glpikey->encrypt($gusr->getID().$gusr->getName().time()));
$PM_DB->update('RBAC_USERS', ['USR_PASSWORD' => $pass], ['USR_UID' => $pmusr->fields['pm_users_id']]);
$PM_DB->update('USERS', ['USR_PASSWORD' => $pass], ['USR_UID' => $pmusr->fields['pm_users_id']]);
// and then login with this user/password
@@ -1350,9 +1352,6 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
$pmGroupList = $PM_SOAP->groupList();
$pmGroup = null;
//if($pmgrp_key = array_search($PM_SOAP->pm_group_guid, array_column($pmGroupList, 'guid'))) {
// $pmgroup = $pmGroupList[$pmgrp_key];
//}
foreach ($pmGroupList as $pmGrp) {
if ($pmGrp->guid == $PM_SOAP->pm_group_guid) {
$pmGroup = $pmGrp;
@@ -1372,21 +1371,17 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
'LEFT JOIN' => ['glpi_plugin_processmaker_users' => ['FKEY' => ['glpi_plugin_processmaker_users' => 'id', 'glpi_users' => 'id']]],
'WHERE' => ['name' => ['NOT LIKE', '*%']]
]);
//foreach ($DB->request("SELECT glpi_users.id, glpi_users.name, glpi_users.realname, glpi_users.firstname, glpi_users.is_active, glpi_users.is_deleted, glpi_plugin_processmaker_users.pm_users_id as pmUserId
// FROM glpi_users
// LEFT JOIN glpi_plugin_processmaker_users on glpi_plugin_processmaker_users.id = glpi_users.id
// WHERE name not like '*%'") as $dbgroup) {
foreach ($res as $dbgroup) {
$glpiUserList[ strtolower($dbgroup['name'])] = $dbgroup;
}
$glpikey = new GLPIKey();
$arrayDiff = array_diff_key($glpiUserList, $pmUserList);
foreach ($arrayDiff as $user) {
if ($user['is_active'] != 0 && $user['is_deleted'] != 1) {
$status = "ACTIVE";
$task->addVolume(1);
$pass = substr(Toolbox::sodiumEncrypt($user['id'].$user['name'].time()), 0, 20); // must keep only 20 chars as the web service is limited to 20 for the password
$pass = substr($glpikey->encrypt($user['id'].$user['name'].time()), 0, 20); // must keep only 20 chars as the web service is limited to 20 for the password
$pmResult = $PM_SOAP->createUser($user['name'], $user['firstname'], $user['realname'], "", "PROCESSMAKER_OPERATOR", $pass, $status);
if ($pmResult->status_code == 0) {
$task->log("Added user: '".$user['name']."'");
@@ -1440,8 +1435,6 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
$ret = $pmuser->add([ 'id' => $user['id'], 'pm_users_id' => $pmuserlistGuid ]);
}
//$query = "REPLACE INTO glpi_plugin_processmaker_users (glpi_users_id, pm_users_id) VALUES (".$user['id'].", '". $pmUserList[strtolower($user['name'])]['guid']."');" ;
//$DB->query($query) or
if (!$ret) {
$task->log("Cannot update user: '".$user['id']."' into glpi_plugin_processmaker_users!");
}
@@ -1496,7 +1489,6 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
'FROM' => 'glpi_groups',
'WHERE' => ['AND' => ['is_task' => 1, 'is_usergroup' => 1]]
]);
//foreach ($DB->request("SELECT id, name, is_task, is_usergroup FROM glpi_groups WHERE is_task=1 AND is_usergroup=1") as $dbgroup) {
foreach ($res as $dbgroup) {
$glpiGroupList[$dbgroup['name']] = $dbgroup;
}
@@ -1527,8 +1519,6 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
// not really optimized, but this way we are sure that groups are synchronized
// must be redesigned
$PM_DB->delete('GROUP_USER', ['GROUP_USER.GRP_UID' => $pmGroupList[$group['name']]['CON_ID']]);
//$query = "DELETE FROM GROUP_USER WHERE GROUP_USER.GRP_UID='".$pmGroupList[$group['name']]['CON_ID']."';";
//$PM_DB->query($query);
// and insert all users from real GLPI group
$res = $DB->request(['SELECT' => ['glpi_groups_users.users_id', 'glpi_plugin_processmaker_users.pm_users_id'],
'FROM' => 'glpi_groups',
@@ -1536,14 +1526,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
'glpi_plugin_processmaker_users' => ['FKEY' => ['glpi_plugin_processmaker_users' => 'id', 'glpi_groups_users' => 'users_id']]],
'WHERE' => ['glpi_groups.name' => $group['name']]]);
//foreach ($DB->request("SELECT glpi_groups_users.users_id, glpi_plugin_processmaker_users.pm_users_id
// FROM glpi_groups
// JOIN glpi_groups_users ON glpi_groups_users.groups_id=glpi_groups.id
// JOIN glpi_plugin_processmaker_users ON glpi_plugin_processmaker_users.id=glpi_groups_users.users_id
// WHERE glpi_groups.name='".$group['name']."'") as $user) {
foreach ($res as $user) {
//$query = "INSERT INTO GROUP_USER (`GRP_UID`, `USR_UID`) VALUES ( '".$pmGroupList[$group['name']]['CON_ID']."', '".$user['pm_users_id']."')";
//$PM_DB->query($query);
$PM_DB->insert('GROUP_USER', ['GRP_UID' => $pmGroupList[$group['name']]['CON_ID'],
'USR_UID' => $user['pm_users_id']
]
@@ -1554,8 +1537,6 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
}
// now should renew the duedate of the users
//$PM_DB->query("UPDATE USERS SET USR_DUE_DATE='2035-12-31' WHERE USR_DUE_DATE<>'2035-12-31'; ");
//$PM_DB->query("UPDATE RBAC_USERS SET USR_DUE_DATE='2035-12-31' WHERE USR_DUE_DATE<>'2035-12-31'; ");
$PM_DB->update('USERS',
['USR_DUE_DATE' => '2035-12-31'],
['USR_DUE_DATE' => ['!=', '2035-12-31']]
@@ -2163,7 +2144,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
*/
function computeTaskDuration($begin, $end, $entity) {
$calendars_id = Entity::getUsedConfig('calendars_id', $entity);
$calendars_id = Entity::getUsedConfig('calendars_strategy', $entity, 'calendars_id', 0);
$calendar = new Calendar();
// Using calendar
@@ -2196,7 +2177,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
//$res = $DB->query($query);
$res = $DB->request('glpi_plugin_processmaker_tasks', ['AND' => ['plugin_processmaker_cases_id' => $cases_id, 'del_index' => $delIndex]]);
//if ($DB->numrows($res) > 0) {
if ($row = $res->next()) {
if ($row = $res->current()) {
$dbu = new DbUtils;
//$row = $DB->fetch_array($res);
@@ -2282,7 +2263,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
//$query = "SELECT * FROM glpi_plugin_processmaker_tasks WHERE plugin_processmaker_cases_id='$cases_id' and del_index=$delIndex; ";
//$res = $DB->query($query);
//if ($DB->numrows($res) > 0) {
if ($row = $res->next()) {
if ($row = $res->current()) {
$dbu = new DbUtils;
//$row = $DB->fetch_array($res);
$glpi_task = new $row['itemtype'];
@@ -2407,6 +2388,40 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
*/
public static function pre_show_item_processmaker($params) {
$plugin = new Plugin();
$itemtype = $params['item']->getType();
if (in_array($itemtype, ['Ticket', 'Problem', 'Change'])
&& $params['options']['id']
&& !PluginProcessmakerCase::canSolve($params)
&& Session::getCurrentInterface() == "central") {
// then we are in an ITIL Object
// tabnum 1 : Processing Ticket
// a case may be solved or not (ex: PIR tasks for Change Management)
// don't display message if arbehaviours is install and activated
$itemtype = strtolower($itemtype);
if ((!$plugin->isInstalled('arbehaviours') || !$plugin->isActivated('arbehaviours'))
&& isset($_SESSION['glpiactiveprofile'][$itemtype.'_status'])) {
echo Html::scriptBlock("
//$('head').append('<style type=\"text/css\">li.solution {pointer-events:none; opacity:0.3;}</style>');
//debugger;
$('a.action-solution').css({pointerEvents: 'none', opacity: 0.3});
glpi_toast_info('At least one \'Process case\' is running!<br> Adding a solution is currently disabled!', 'Solution disabled', {delay: Math.pow(2, 31) - 1});
");
//self::displayMessage(__('At least one \'Process case\' is running!<br/>Adding a solution is currently disabled!', 'processmaker'), false, INFO);
////backup current $_SESSION['glpiactiveprofile'][$itemtype.'_status']
//$_SESSION['glpiactiveprofile'][$itemtype.'_status_pm_save'] = $_SESSION['glpiactiveprofile'][$itemtype.'_status'];
//// for all $params['options']['itemtype'].status, we must disable solved (life cycles)
//foreach ($_SESSION['glpiactiveprofile'][$itemtype.'_status'] as $key => $value) {
// //$_SESSION['glpiactiveprofile'][$itemtype.'_status'][$key][CommonITILObject::SOLVED] = 0;
//}
}
}
if (!is_array($params['item']) && is_subclass_of($params['item'], 'CommonITILTask')) {
// must check if Task is bound to a PM task
$pmTask = new PluginProcessmakerTask($params['item']->getType());
@@ -2431,36 +2446,23 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
}
}
if ($is_pmtask) {
$params['item']->fields['can_edit'] = false; // to prevent task edition
// replace ##ticket.url##_PluginProcessmakerCase$processmakercases by a setActiveTab to the Case panel
$taskCat = new TaskCategory;
$taskCat->getFromDB($params['item']->fields['taskcategories_id']);
$taskComment = isset($taskCat->fields['comment']) ? $taskCat->fields['comment'] : '';
if (Session::haveTranslations('TaskCategory', 'comment')) {
$params['item']->fields['content'] = str_replace('##processmaker.taskcomment##',
DropdownTranslation::getTranslatedValue($taskCat->getID(), 'TaskCategory', 'comment', $_SESSION['glpilanguage'], $taskComment), $params['item']->fields['content']);
} else {
$params['item']->fields['content'] = str_replace('##processmaker.taskcomment##', $taskComment, $params['item']->fields['content']);
}
$taskJSId = strtolower("viewitem".$params['item']->getType().$params['item']->getId()); //.$params['options']['rand']);
$dataItemId = $params['item']->getId();
$tmpCase = new PluginProcessmakerCase;
$tmpCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']);
$urlLink = $tmpCase->getLinkURL().'&forcetab=PluginProcessmakerTask$'.$pmTask->fields['items_id'];
echo Html::scriptBlock("
function $taskJSId(ev) {
//debugger;
if ($(ev.target).parent('.read_more').length == 0) {
document.location='$urlLink';
}
};
$('#$taskJSId').find('.item_content').on('click', $taskJSId).css('cursor', 'pointer');
$('#$taskJSId').find('.read_more').css('cursor', 'auto');
$('div[data-items-id=\"$dataItemId\"]').find('.text-content').on('click', $taskJSId).css('cursor', 'pointer');
$('div[data-items-id=\"$dataItemId\"]').find('.read_more').css('cursor', 'auto');
$('tr[id=\"$taskJSId\"]').children().on('click', $taskJSId).css('cursor', 'pointer');
$(function() {
$('#{$taskJSId}').find('.displayed_content span.state').parent().append(
$('div[data-items-id=\"$dataItemId\"]').find('.timeline-item-buttons').prepend(
'<a class=\"pm_task pm_task_badge\" href=\"{$urlLink}\">".str_replace("'", "\\'", $tmpCase->fields['name'])."' +
'<span class=\"pm_task pm_task_case\" case-id=\"{$tmpCase->fields['id']}\">{$tmpCase->fields['id']}</span>' +
'</a>'
@@ -2470,9 +2472,6 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
// $('#$taskJSId').find('.displayed_content > div').last().html().replace(/(.*?)(<br>.*)/, '<span class=\"pm_task pm_task_category\">$1</span>$2')
//);
");
$params['item']->fields['content'] = str_replace(["\n##processmakercase.url##", '\n##processmakercase.url##', '##processmakercase.url##'], "", $params['item']->fields['content']);
// in order to set NavigationList
Session::initNavigateListItems('PluginProcessmakerCase',
//TRANS : %1$s is the itemtype name,
@@ -2483,65 +2482,56 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
}
}
/**
* Summary of pre_show_tab_arbehaviours
* @param array $params info about tab to be shown
* @return void
*/
static function pre_show_tab_processmaker($params) {
//global $pmHideSolution;
$plugin = new Plugin();
$itemtype = $params['item']->getType();
if (in_array($itemtype, ['Ticket', 'Problem', 'Change'])
&& $params['options']['id']
&& $params['options']['itemtype'] == $itemtype
&& $params['options']['tabnum'] == 1
&& !PluginProcessmakerCase::canSolve($params)
&& Session::getCurrentInterface() == "central") {
// then we are in an ITIL Object
// tabnum 1 : Processing Ticket
// a case may be solved or not (ex: PIR tasks for Change Management)
// don't display message if arbehaviours is install and activated
$itemtype = strtolower($itemtype);
if ((!$plugin->isInstalled('arbehaviours') || !$plugin->isActivated('arbehaviours'))
&& isset($_SESSION['glpiactiveprofile'][$itemtype.'_status'])) {
echo Html::scriptBlock("
//$('head').append('<style type=\"text/css\">li.solution {pointer-events:none; opacity:0.3;}</style>');
//debugger;
$('li.solution').css({pointerEvents: 'none', opacity: 0.3});
");
self::displayMessage(__('At least one \'Process case\' is running!<br/>Adding a solution is currently disabled!', 'processmaker'), false, INFO);
////backup current $_SESSION['glpiactiveprofile'][$itemtype.'_status']
//$_SESSION['glpiactiveprofile'][$itemtype.'_status_pm_save'] = $_SESSION['glpiactiveprofile'][$itemtype.'_status'];
//// for all $params['options']['itemtype'].status, we must disable solved (life cycles)
//foreach ($_SESSION['glpiactiveprofile'][$itemtype.'_status'] as $key => $value) {
// //$_SESSION['glpiactiveprofile'][$itemtype.'_status'][$key][CommonITILObject::SOLVED] = 0;
//}
static function show_in_timeline_processmaker($params) {
foreach($params['timeline'] as $key => $timelineObject) {
if (is_subclass_of($timelineObject['type'], 'CommonITILTask')) {
$pmTask = new PluginProcessmakerTask($timelineObject['type']);
$is_pmtask = $pmTask->getFromDB($timelineObject['item']['id']);
if (!$is_pmtask && $timelineObject['item']['state'] == Planning::INFO) {
// look if it is a meta task for this process
// means a re-assign or an un-claim task info
$pm_process = new PluginProcessmakerProcess;
$restrict=[
'WHERE' => [
'taskcategories_id' => $timelineObject['item']['taskcategories_id']
],
];
//if ($pm_process->getFromDBByQuery(" WHERE `taskcategories_id` = ".$params['item']->fields['taskcategories_id'])) {
if ($pm_process->getFromDBByRequest($restrict)) {
// then look into content to get case id
$re = '/<input name=\'caseid\' type=\'hidden\' value=\'(?\'caseid\'\d+)\'><input name=\'taskid\' type=\'hidden\' value=\'(?\'taskid\'\d+)\'>/';
if (preg_match($re, $timelineObject['item']['content'], $matches)) {
// here we get the case id and the task id
$is_pmtask = $pmTask->getFromDB($matches['taskid']);
}
}
}
if ($is_pmtask) {
$timelineObject['item']['can_edit'] = false; // to prevent task edition
$timelineObject['item']['can_promote'] = false; // to prevent task promote to ticket
//public static function post_show_tab_processmaker($params) {
// //$itemtype = strtolower($params['item']->getType());
// //if (isset($_SESSION['glpiactiveprofile'][$itemtype.'_status_pm_save'])) {
// // // we must restore rigths
// // // replace $_SESSION['glpiactiveprofile'][$itemtype.'_status'] with saved value
// // $_SESSION['glpiactiveprofile'][$itemtype.'_status'] = $_SESSION['glpiactiveprofile'][$itemtype.'_status_pm_save'];
// // unset($_SESSION['glpiactiveprofile'][$itemtype.'_status_save']);
// //}
//}
// replace ##ticket.url##_PluginProcessmakerCase$processmakercases by a setActiveTab to the Case panel
$taskCat = new TaskCategory;
$taskCat->getFromDB($timelineObject['item']['taskcategories_id']);
$taskComment = isset($taskCat->fields['comment']) ? $taskCat->fields['comment'] : '';
if (Session::haveTranslations('TaskCategory', 'comment')) {
$taskCategorytranslation = DropdownTranslation::getTranslatedValue($taskCat->getID(), 'TaskCategory', 'comment', $_SESSION['glpilanguage'], $taskComment);
$timelineObject['item']['content'] = str_replace('##processmaker.taskcomment##',
!is_null($taskCategorytranslation) ? $taskCategorytranslation : '' ,
$timelineObject['item']['content']
);
} else {
$timelineObject['item']['content'] = str_replace('##processmaker.taskcomment##', $taskComment, $timelineObject['item']['content']);
}
//$tmpCase = new PluginProcessmakerCase;
//$tmpCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']);
$timelineObject['item']['content'] = str_replace(["\n##processmakercase.url##", '\n##processmakercase.url##', '##processmakercase.url##'], "", $timelineObject['item']['content']);
$timelineObject['item']['content'] = nl2br($timelineObject['item']['content']);
$params['timeline'][$key] = $timelineObject;
}
}
}
}
/**
* Summary of getItemUsers
@@ -2758,12 +2748,12 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
//if ($pmtask->getFromDBByQuery("WHERE itemtype = '$pmtask_itemtype' AND items_id = $pmtask_items_id")) {
if ($pmtask->getFromDBByRequest($restrict)) {
if (!in_array("tasks", $item->html_tags)) {
if (!in_array("tasks", $item->tag_descriptions)) {
$item->html_tags[] = "tasks"; // to force GLPI to keep the below HTML tags, otherwise it will apply a Html::entities_deep() to the task.description
}
$task['##task.description##'] = str_replace('##processmaker.taskcomment##', $task['##task.categorycomment##'], $task['##task.description##']);
$task['##task.description##'] = Html::nl2br_deep($task['##task.description##']);
$task['##task.description##'] = nl2br($task['##task.description##']);
//$restrict=[
// 'WHERE' => [
@@ -3313,7 +3303,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
]);
//$res = $PM_DB->query("SELECT APP_UID FROM SUB_APPLICATION WHERE APP_PARENT='{$myCase->fields['case_guid']}' AND DEL_INDEX_PARENT={$route->delIndex} AND SA_STATUS='ACTIVE'"); // AND DEL_THREAD_PARENT={$route->delThread} seems like it is not set to correct threadIndex
//if ($row = $res->next() && $PM_DB->numrows($res) == 1) {
if ($res->numrows() == 1 && $row = $res->next()) {
if ($res->numrows() == 1 && $row = $res->current()) {
// then new task is a sub-process,
//$row = $PM_DB->fetch_assoc($res);

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -239,7 +239,7 @@ class PluginProcessmakerTask extends CommonITILTask
]
]
]);
if ($res->numrows() == 1 && $row = $res->next()) {
if ($res->numrows() == 1 && $row = $res->current()) {
//$row = $PM_DB->fetch_assoc($res);
$loc_case = new PluginProcessmakerCase;
$loc_case->getFromGUID($row['APP_UID']);
@@ -344,7 +344,7 @@ class PluginProcessmakerTask extends CommonITILTask
// get infos for the current task
$restrict = [
"id" => $tabnum
'id' => $tabnum
];
$task = $dbu->getAllDataFromTable('glpi_plugin_processmaker_tasks', $restrict);

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -223,7 +223,7 @@ class PluginProcessmakerTaskCategory extends CommonDBTM
]);
// there is only one row
$taskCat = $res->next();
$taskCat = $res->current();
$pmtaskcat->showFormHeader();
echo "<input type=hidden name=categories_id value='".$item->getID()."'/>";
@@ -345,38 +345,7 @@ class PluginProcessmakerTaskCategory extends CommonDBTM
* @return true if succeed else false
**/
function getFromGUID($task_guid) {
global $DB;
$res = $DB->request(
$this->getTable(),
[
'pm_task_guid' => $task_guid
]
);
if ($res) {
if ($res->numrows() != 1) {
return false;
}
$this->fields = $res->next();
if (is_array($this->fields) && count($this->fields)) {
return true;
}
}
//$query = "SELECT *
// FROM `".$this->getTable()."`
// WHERE `pm_task_guid` = '$task_guid'";
//if ($result = $DB->query($query)) {
// if ($DB->numrows($result) != 1) {
// return false;
// }
// $this->fields = $DB->fetch_assoc($result);
// if (is_array($this->fields) && count($this->fields)) {
// return true;
// }
//}
return false;
return $this->getFromDBByCrit(['pm_task_guid' => $task_guid]);
}
/**
@@ -402,7 +371,7 @@ class PluginProcessmakerTaskCategory extends CommonDBTM
if ($res->numrows() != 1) {
return false;
}
$this->fields = $res->next();
$this->fields = $res->current();
if (is_array($this->fields) && count($this->fields)) {
return true;
}

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -33,11 +33,10 @@ function update_3_4_10_to_4_0_0() {
$glpikey = new GLPIKey;
// Fetch old key and migrate
$sodium_key = null;
$old_key = $glpikey->getLegacyKey();
if ($DB instanceof DBmysql) {
return $glpikey->migrateFieldsInDb($sodium_key, $old_key);
return $glpikey->migrateFieldsInDb($old_key);
}
return false;

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

View File

@@ -1,7 +1,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -29,8 +29,7 @@ $(function () {
//debugger;
var pattern = /##processmaker.*(##|...)/g;
$('tr.tab_bg_2 td a').each(function (index) {
$('.grid-item table tbody tr td a').each(function (index) {
var textToChange = $(this).text();
var matches = textToChange.match(pattern);
if (matches) {

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -43,7 +43,7 @@ if (!$config['maintenance']) {
echo "$(function () {
// look if name='helpdeskform' is present. If yes replace the form.location
var ahrefTI = '".Plugin::getWebDir('processmaker')."/front/tracking.injector.php';
var formLink = $(\"form[name='helpdeskform']\")[0];
var formLink = $(\"#itil-form\")[0];
if (formLink != undefined) {
formLink.action = ahrefTI;
}

View File

@@ -1,7 +1,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------

30
js/processmaker_icon.js Normal file
View File

@@ -0,0 +1,30 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
LICENSE
This file is part of ProcessMaker plugin for GLPI.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this plugin. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
$('document').ready(() => {
$('aside.navbar #navbar-menu li.nav-item .dropdown-menu a[href*="/plugins/processmaker/front/"] i').append('<img src="' + CFG_GLPI.root_doc + '/plugins/processmaker/pics/processmaker-xxs.png" style="vertical-align: middle;"/>');
});

View File

@@ -44,6 +44,10 @@
<num>4.4.0</num>
<compatibility>9.5</compatibility>
</version>
<version>
<num>5.0.0</num>
<compatibility>10.0</compatibility>
</version>
</versions>
<langs>
<lang>en_gb</lang>

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2022 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -25,12 +25,12 @@ You should have received a copy of the GNU General Public License
along with this plugin. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
define('PROCESSMAKER_VERSION', '4.4.0');
define('PROCESSMAKER_VERSION', '5.0.0');
// Minimal GLPI version, inclusive
define('PLUGIN_PROCESSMAKER_MIN_GLPI', '9.5');
define('PLUGIN_PROCESSMAKER_MIN_GLPI', '10.0');
// Maximum GLPI version, exclusive
define('PLUGIN_PROCESSMAKER_MAX_GLPI', '9.6');
define('PLUGIN_PROCESSMAKER_MAX_GLPI', '10.1');
// Minimal PM version, inclusive
define('PLUGIN_PROCESSMAKER_MIN_PM', '3.3.0-community-RE-2.0');
@@ -80,6 +80,9 @@ function plugin_init_processmaker() {
$PLUGIN_HOOKS['pre_show_tab']['processmaker']
= ['PluginProcessmakerProcessmaker', 'pre_show_tab_processmaker'];
$PLUGIN_HOOKS['show_in_timeline']['processmaker']
= ['PluginProcessmakerProcessmaker', 'show_in_timeline_processmaker'];
//$PLUGIN_HOOKS['post_show_tab']['processmaker']
// = ['PluginProcessmakerProcessmaker', 'post_show_tab_processmaker'];
@@ -94,7 +97,7 @@ function plugin_init_processmaker() {
$PLUGIN_HOOKS['menu_toadd']['processmaker']['helpdesk'] = 'PluginProcessmakerCase';
}
Plugin::registerClass('PluginProcessmakerProcess', [ 'massiveaction_nodelete_types' => true] );
Plugin::registerClass('PluginProcessmakerProcess'); // , [ 'massiveaction_nodelete_types' => true] );
$hooks = [];
foreach ($objects as $obj) {
@@ -152,6 +155,7 @@ function plugin_init_processmaker() {
$PLUGIN_HOOKS['add_javascript']['processmaker'] = ["js/central.js"];
break;
}
$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/processmaker_icon.js";
//$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/jsloader.js";
$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/cases.js";
@@ -202,8 +206,8 @@ function plugin_version_processmaker() {
// Optional : check prerequisites before install : may print errors or add to message after redirect
function plugin_processmaker_check_prerequisites() {
if (version_compare(GLPI_VERSION, '9.5', 'lt') || version_compare(GLPI_VERSION, '9.6', 'ge')) {
echo "This plugin requires GLPI >= 9.5 and < 9.6";
if (version_compare(GLPI_VERSION, PLUGIN_PROCESSMAKER_MIN_GLPI, 'lt') || version_compare(GLPI_VERSION, PLUGIN_PROCESSMAKER_MAX_GLPI, 'ge')) {
echo "This plugin requires GLPI >= ". PLUGIN_PROCESSMAKER_MIN_GLPI ." and < " . PLUGIN_PROCESSMAKER_MAX_GLPI;
return false;
}