GLPI 9.5 compliance

Set version to 4.0.0
This commit is contained in:
Tomolimo
2021-03-18 10:01:49 +01:00
parent c895643c5c
commit 93424d51ab
36 changed files with 11047 additions and 10728 deletions

17
.gitattributes vendored
View File

@@ -1,17 +0,0 @@
# Auto detect text files and perform LF normalization
* text=auto
# Custom for Visual Studio
*.cs diff=csharp
# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain

216
.gitignore vendored
View File

@@ -1,216 +0,0 @@
#################
## Eclipse
#################
*.pydevproject
.project
.metadata
bin/
tmp/
*.tmp
*.bak
*.swp
*~.nib
local.properties
.classpath
.settings/
.loadpath
# External tool builders
.externalToolBuilders/
# Locally stored "Eclipse launch configurations"
*.launch
# CDT-specific
.cproject
# PDT-specific
.buildpath
#################
## Visual Studio
#################
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
build/
[Bb]in/
[Oo]bj/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
# TeamCity is a build add-in
_TeamCity*
# DotCover is a Code Coverage Tool
*.dotCover
# NCrunch
*.ncrunch*
.*crunch*.local.xml
# Installshield output folder
[Ee]xpress/
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
DocProject/Help/*.HxC
DocProject/Help/*.hhc
DocProject/Help/*.hhk
DocProject/Help/*.hhp
DocProject/Help/Html2
DocProject/Help/html
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
*.pubxml
*.publishproj
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
#packages/
# Windows Azure Build Output
csx
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.pfx
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
#############
## Windows detritus
#############
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac crap
.DS_Store
#############
## Python
#############
*.py[cod]
# Packages
*.egg
*.egg-info
dist/
build/
eggs/
parts/
var/
sdist/
develop-eggs/
.installed.cfg
# Installer logs
pip-log.txt
# Unit test / coverage reports
.coverage
.tox
#Translations
*.mo
#Mr Developer
.mr.developer.cfg

View File

@@ -1,13 +1,15 @@
# ProcessMaker plugin
GLPI plugin that provides an interface with a customized ProcessMaker server (https://github.com/tomolimo/processmaker-server).
version 3.4.x is compatible with GLPI 9.2 and needs ProcessMaker either 3.0.1.8-RE-1.12 (https://github.com/tomolimo/processmaker-server/releases/tag/3.0.1.8-RE-1.12) or 3.3.0-RE-1.x (https://github.com/tomolimo/processmaker-server/releases/tag/3.3.0-RE-1.5)
version 3.5.x is compatible with GLPI 9.3 and needs ProcessMaker 3.3.0-RE-1.x (https://github.com/tomolimo/processmaker-server/releases/latest)
version 3.6.x is compatible with GLPI 9.4 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
An IRC channel is available: #processmaker-glpi on https://webchat.freenode.net/
# ProcessMaker plugin
GLPI plugin that provides an interface with a customized ProcessMaker server (https://github.com/tomolimo/processmaker-server).
version 3.4.x is compatible with GLPI 9.2 and needs ProcessMaker either 3.0.1.8-RE-1.12 (https://github.com/tomolimo/processmaker-server/releases/tag/3.0.1.8-RE-1.12) or 3.3.0-RE-1.x (https://github.com/tomolimo/processmaker-server/releases/tag/3.3.0-RE-1.5)
version 3.5.x is compatible with GLPI 9.3 and needs ProcessMaker 3.3.0-RE-1.x (https://github.com/tomolimo/processmaker-server/releases/latest)
version 3.6.x is compatible with GLPI 9.4 and needs ProcessMaker 3.3.0-RE-1.x (https://github.com/tomolimo/processmaker-server/releases/latest)
version 4.0.0 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
An IRC channel is available: #processmaker-glpi on https://webchat.freenode.net/

View File

@@ -0,0 +1,40 @@
<?php
/**
*/
if (strpos($_SERVER['PHP_SELF'], "dropdownTicketCategories.php")) {
include ("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
} else if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access this file directly");
}
$opt['entity'] = $_POST["entity_restrict"] ?? -1;
if (isset($_POST["condition"])) {
$opt['condition'] = $_POST["condition"];
}
$currentcateg = new ITILCategory();
$currentcateg->getFromDB($_POST['value']);
if ($_POST["type"]) {
switch ($_POST['type']) {
case Ticket::INCIDENT_TYPE :
$opt['condition']['is_incident'] = '1';
if ($currentcateg->getField('is_incident') == 1) {
$opt['value'] = $_POST['value'];
}
break;
case Ticket::DEMAND_TYPE:
$opt['condition']['is_request'] = '1';
if ($currentcateg->getField('is_request') == 1) {
$opt['value'] = $_POST['value'];
}
break;
}
}
ITILCategory::dropdown($opt);

View File

@@ -1,126 +1,118 @@
<?php
/*
*/
// ----------------------------------------------------------------------
// Original Author of file: Olivier Moron
// Purpose of file:
// ----------------------------------------------------------------------
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "dropdownUsers.php")) {
include ("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
if (!defined('GLPI_ROOT')) {
die("Can not access directly to this file");
}
Session::checkLoginUser();
$PM_DB = new PluginProcessmakerDB;
$dbu = new DbUtils;
if (!isset($_REQUEST['right'])) {
$_REQUEST['right'] = "all";
}
// Default view : Nobody
if (!isset($_REQUEST['all'])) {
$_REQUEST['all'] = 0;
}
$used = [];
if (isset($_REQUEST['used'])) {
$used = $_REQUEST['used'];
}
if (!isset($_REQUEST['value'])) {
$_REQUEST['value'] = 0;
}
$one_item = -1;
if (isset($_REQUEST['_one_id'])) {
$one_item = $_REQUEST['_one_id'];
}
if (!isset($_REQUEST['page'])) {
$_REQUEST['page'] = 1;
$_REQUEST['page_limit'] = $CFG_GLPI['dropdown_max'];
}
if ($one_item < 0) {
$start = ($_REQUEST['page']-1)*$_REQUEST['page_limit'];
$LIMIT = "LIMIT $start,".$_REQUEST['page_limit'];
$searchText = isset($_REQUEST['searchText']) ? $_REQUEST['searchText'] : "";
/*$result*/$res = PluginProcessmakerUser::getSqlSearchResult( $_REQUEST['specific_tags']['taskGuid'], false, $_REQUEST['right'], $_REQUEST["entity_restrict"],
$_REQUEST['value'], $used, $searchText, $LIMIT);
} else {
$res = $DB->request([
'SELECT' => 'glpi_users.*',
'FROM' => 'glpi_users',
'WHERE' => [
'glpi_users.id' => $one_item
]
]);
//$query = "SELECT DISTINCT `glpi_users`.*
// FROM `glpi_users`
// WHERE `glpi_users`.`id` = '$one_item';";
//$result = $DB->query($query);
}
$users = [];
// Count real items returned
$count = 0;
//if ($DB->numrows($result)) {
// while ($data = $DB->fetch_assoc($result)) {
//if ($res->numrows()) {
foreach ($res as $data) {
$users[$data["id"]] = $dbu->formatUserName($data["id"], $data["name"], $data["realname"],
$data["firstname"]);
$logins[$data["id"]] = $data["name"];
}
//}
$datas = [];
// Display first if empty search
if ($_REQUEST['page'] == 1 && empty($_REQUEST['searchText'])) {
if (($one_item < 0) || ($one_item == 0)) {
if ($_REQUEST['all'] == 0) {
array_push($datas, ['id' => 0,
'text' => Dropdown::EMPTY_VALUE]);
} else if ($_REQUEST['all'] == 1) {
array_push($datas, ['id' => 0,
'text' => __('All')]);
}
}
}
if (count($users)) {
foreach ($users as $ID => $output) {
$title = sprintf('%1$s - %2$s', $output, $logins[$ID]);
array_push($datas, ['id' => $ID,
'text' => $output,
'title' => $title]);
$count++;
}
}
if (($one_item >= 0)
&& isset($datas[0])) {
echo json_encode($datas[0]);
} else {
$ret['results'] = $datas;
$ret['count'] = $count;
echo json_encode($ret);
}
<?php
/*
*/
// ----------------------------------------------------------------------
// Original Author of file: Olivier Moron
// Purpose of file:
// ----------------------------------------------------------------------
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "dropdownUsers.php")) {
include ("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
if (!defined('GLPI_ROOT')) {
die("Can not access directly to this file");
}
Session::checkLoginUser();
$PM_DB = new PluginProcessmakerDB;
$dbu = new DbUtils;
if (!isset($_REQUEST['right'])) {
$_REQUEST['right'] = "all";
}
// Default view : Nobody
if (!isset($_REQUEST['all'])) {
$_REQUEST['all'] = 0;
}
$used = [];
if (isset($_REQUEST['used'])) {
$used = $_REQUEST['used'];
}
if (!isset($_REQUEST['value'])) {
$_REQUEST['value'] = 0;
}
$one_item = -1;
if (isset($_REQUEST['_one_id'])) {
$one_item = $_REQUEST['_one_id'];
}
if (!isset($_REQUEST['page'])) {
$_REQUEST['page'] = 1;
$_REQUEST['page_limit'] = $CFG_GLPI['dropdown_max'];
}
if ($one_item < 0) {
$start = ($_REQUEST['page'] - 1) * $_REQUEST['page_limit'];
$searchText = isset($_REQUEST['searchText']) ? $_REQUEST['searchText'] : "";
$res = PluginProcessmakerUser::getSqlSearchResult( $_REQUEST['specific_tags'], false, $_REQUEST['right'], $_REQUEST["entity_restrict"],
$_REQUEST['value'], $used, $searchText, $start, $_REQUEST['page_limit']);
} else {
$res = $DB->request([
'FIELDS' => 'glpi_users.*',
'DISTINCT' => true,
'FROM' => 'glpi_users',
'WHERE' => [
'glpi_users.id' => $one_item
]
]);
}
$users = [];
// Count real items returned
$count = 0;
foreach ($res as $data) {
$users[$data["id"]] = $dbu->formatUserName($data["id"], $data["name"], $data["realname"],
$data["firstname"], 0);
$logins[$data["id"]] = $data["name"];
}
$datas = [];
// Display first if empty search
if ($_REQUEST['page'] == 1 && empty($_REQUEST['searchText'])) {
if (($one_item < 0) || ($one_item == 0)) {
if ($_REQUEST['all'] == 0) {
array_push($datas, ['id' => 0,
'text' => Dropdown::EMPTY_VALUE]);
} else if ($_REQUEST['all'] == 1) {
array_push($datas, ['id' => 0,
'text' => __('All')]);
}
}
}
if (count($users)) {
foreach ($users as $ID => $output) {
$title = sprintf('%1$s - %2$s', $output, $logins[$ID]);
array_push($datas, ['id' => $ID,
'text' => $output,
'title' => $title]);
$count++;
}
}
if (($one_item >= 0)
&& isset($datas[0])) {
echo json_encode($datas[0]);
} else {
$ret['results'] = $datas;
$ret['count'] = $count;
echo json_encode($ret);
}

View File

@@ -1,137 +1,148 @@
<?php
// ----------------------------------------------------------------------
// Original Author of file: Olivier Moron
// Purpose of file:
// ----------------------------------------------------------------------
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "task_users.php")) {
include ("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
if (!defined('GLPI_ROOT')) {
die("Can not access directly to this file");
}
Session::checkLoginUser();
$commoninputs = "<input type='hidden' name='items_id' value='".$_REQUEST['items_id']."'>".
"<input type='hidden' name='itemtype' value='".$_REQUEST['itemtype']."'>".
"<input type='hidden' name='cases_id' value='".$_REQUEST['cases_id']."'>".
"<input type='hidden' name='delIndex' value='".$_REQUEST['delIndex']."'>".
"<input type='hidden' name='users_id' value='".$_REQUEST['users_id']."'>".
"<input type='hidden' name='taskGuid' value='".$_REQUEST['taskGuid']."'>".
"<input type='hidden' name='delThread' value='".$_REQUEST['delThread']."'>".
"<input type='hidden' name='tasktype' value='".$_REQUEST['tasktype']."'>".
"<input type='hidden' name='tasks_id' value='".$_REQUEST['tasks_id']."'>";
$PM_SOAP = new PluginProcessmakerProcessmaker; // not used in this context, just here to define the type of $PM_SOAP
$PM_DB = new PluginProcessmakerDB;
$rand = rand();
echo "<form style='margin-bottom: 0px' name='processmaker_form_task$rand-".$_REQUEST['delIndex']."' id='processmaker_form_task$rand-".$_REQUEST['delIndex']."' method='post' action='".Toolbox::getItemTypeFormURL("PluginProcessmakerProcessmaker")."'>";
echo __('Re-assign task to', 'processmaker')."&nbsp;";
echo "<input type='hidden' name='action' value='reassign_reminder'>";
echo "<input type='hidden' name='comment' value=''>";
echo $commoninputs;
$can_unclaim = false; // by default
$query = "SELECT TAS_GROUP_VARIABLE FROM TASK WHERE TAS_UID='".$_REQUEST['taskGuid']."' AND TAS_ASSIGN_TYPE='SELF_SERVICE';";
$res = $PM_DB->query($query);
if ($PM_DB->numrows($res) > 0) {
$can_unclaim = true;
}
PluginProcessmakerUser::dropdown( ['name' => 'users_id_recipient',
'value' => $_REQUEST['users_id'],
'used' => $_REQUEST['used'],
'entity' => 0, //$item->fields["entities_id"], // not used, as any user can be assigned to any tasks
'entity_sons' => false, // not used, as any user can be assigned to any tasks
'right' => 'all',
'rand' => $rand,
'width' => '',
'specific_tags' => ['taskGuid' => $_REQUEST['taskGuid']]
]);
echo "&nbsp;&nbsp;";
echo "<input type='submit' name='reassign$rand' value='".__('Re-assign', 'processmaker')."' class='submit'>";
echo "<input type='submit' name='reassign' value='".__('Re-assign', 'processmaker')."' class='submit' style='display:none'>";
echo HTML::scriptBlock("
$(function () {
// 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() {
$('#processmaker_form_task$rand-".$_REQUEST['delIndex']." input[name=comment]').val($('#comment$rand').val());
//$('#processmaker_form_task$rand-".$_REQUEST['delIndex']."').submit();
$('input[name=reassign').click();
$('#submit$rand').button('disable');
}
}],
show: true,
hide: true
}
$('<div id=reassign$rand></div>').appendTo($('#processmaker_form_task$rand-".$_REQUEST['delIndex']."'));
var locDlg = $('#reassign$rand').html(content + '<p><textarea id=comment$rand rows=6 cols=60></textarea></p><font color=red>Input at least 10 words in English to justify.</font>').dialog(dlgContents);
$('#comment$rand').focus();
$('#comment$rand').on('keydown keyup', function(e) {
if ($('#comment$rand').val().split(/\W+/).length > 10) {
$('#submit$rand').button('enable');
} else {
$('#submit$rand').button('disable');
}
});
return locDlg;
};
$('input[name=reassign$rand]').click(function (e) {
e.preventDefault();
if ($('input[name=users_id]').val() == $('input[name=users_id_recipient]').val()) {
// task is already assigned to this user
alert('".__('Task is already assigned to this user or group!', 'processmaker')."', '".__('Re-assign task', 'processmaker')."');
} else if ($('input[name=users_id_recipient]').val() == 0) {
// un-claim
if (".($can_unclaim ? 1 : 0)." && $('input[name=users_id]').val() != 0) {
showCommentDlg('".__('Un-claim task', 'processmaker')."',
'".__('Please input reason to un-claim<br/>(task will be re-assigned to former group):', 'processmaker')."',
'".__('Un-claim', 'processmaker')."');
} else {
// task can't be unclaim because it isn't SELF_SERVICE
alert('".__('Can\\\'t un-assign Task!', 'processmaker')."', '".__('Un-claim task', 'processmaker')."');
}
} else {
showCommentDlg('".__('Re-assign task', 'processmaker')."',
'".__('Please input reason to re-assign:', 'processmaker')."',
'".__('Re-assign', 'processmaker')."');
}
return false;
});
})
");
if (Session::getLoginUserID() != $_REQUEST['users_id']) {
echo "&nbsp;&nbsp;";
echo "<input type='submit' name='reminder' value='".__('Send reminder', 'processmaker')."' class='submit'>";
}
Html::closeForm(true);
<?php
// ----------------------------------------------------------------------
// Original Author of file: Olivier Moron
// Purpose of file:
// ----------------------------------------------------------------------
// Direct access to file
if (strpos($_SERVER['PHP_SELF'], "task_users.php")) {
include ("../../../inc/includes.php");
header("Content-Type: text/html; charset=UTF-8");
Html::header_nocache();
}
if (!defined('GLPI_ROOT')) {
die("Can not access directly to this file");
}
Session::checkLoginUser();
$commoninputs = "<input type='hidden' name='items_id' value='".$_REQUEST['items_id']."'>".
"<input type='hidden' name='itemtype' value='".$_REQUEST['itemtype']."'>".
"<input type='hidden' name='cases_id' value='".$_REQUEST['cases_id']."'>".
"<input type='hidden' name='delIndex' value='".$_REQUEST['delIndex']."'>".
"<input type='hidden' name='users_id' value='".$_REQUEST['users_id']."'>".
"<input type='hidden' name='taskGuid' value='".$_REQUEST['taskGuid']."'>".
"<input type='hidden' name='delThread' value='".$_REQUEST['delThread']."'>".
"<input type='hidden' name='tasktype' value='".$_REQUEST['tasktype']."'>".
"<input type='hidden' name='tasks_id' value='".$_REQUEST['tasks_id']."'>";
$PM_SOAP = new PluginProcessmakerProcessmaker;
$PM_DB = new PluginProcessmakerDB;
$rand = rand();
echo "<form style='margin-bottom: 0px' name='processmaker_form_task$rand-".$_REQUEST['delIndex']."' id='processmaker_form_task$rand-".$_REQUEST['delIndex']."' method='post' action='".Toolbox::getItemTypeFormURL("PluginProcessmakerProcessmaker")."'>";
echo __('Re-assign task to', 'processmaker')."&nbsp;";
echo "<input type='hidden' name='action' value='reassign_reminder'>";
echo "<input type='hidden' name='comment' value=''>";
echo $commoninputs;
$can_unclaim = false; // by default
$grp = false;
$query = "SELECT TAS_GROUP_VARIABLE FROM TASK WHERE TAS_UID='".$_REQUEST['taskGuid']."' AND TAS_ASSIGN_TYPE='SELF_SERVICE';";
$res = $PM_DB->query($query);
if ($PM_DB->numrows($res) > 0 && $row = $PM_DB->fetch_assoc($res)) {
$can_unclaim = true;
if ($row['TAS_GROUP_VARIABLE'] != '') {
//self-service value based assignment
$PM_SOAP->login(true); // needs to be logged in to be able to call SOAP
$grp = $PM_SOAP->getGLPIGroupIdForSelfServiceTask($_REQUEST['caseGuid'], $_REQUEST['taskGuid']);
}
}
PluginProcessmakerUser::dropdown( ['name' => 'users_id_recipient',
'value' => $_REQUEST['users_id'],
'used' => $_REQUEST['used'],
'entity' => 0, //$item->fields["entities_id"], // not used, as any user can be assigned to any tasks
'entity_sons' => false, // not used, as any user can be assigned to any tasks
'right' => 'all',
'all' => ($can_unclaim ? 0 : -1),
'rand' => $rand,
'width' => '',
'specific_tags' => ['taskGuid' => $_REQUEST['taskGuid'], 'grpGuid' => ($grp !== false ? $grp['uid'] : 0)]
]);
echo "&nbsp;&nbsp;";
echo "<input type='submit' name='reassign$rand' value='".__s('Re-assign', 'processmaker')."' class='submit'>";
echo "<input type='submit' name='reassign' value='".__s('Re-assign', 'processmaker')."' class='submit' style='display:none'>";
echo HTML::scriptBlock("
$(function () {
// 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() {
$('#processmaker_form_task$rand-".$_REQUEST['delIndex']." input[name=comment]').val($('#comment$rand').val());
//$('#processmaker_form_task$rand-".$_REQUEST['delIndex']."').submit();
$('input[name=reassign').click();
$('#submit$rand').button('disable');
}
}],
show: true,
hide: true
}
$('<div id=reassign$rand></div>').appendTo($('#processmaker_form_task$rand-".$_REQUEST['delIndex']."'));
var locDlg = $('#reassign$rand').html(content + '<p><textarea id=comment$rand rows=6 cols=60></textarea></p><font color=red>".addslashes(__('Input at least 10 words in English to justify.','processmaker'))."</font>').dialog(dlgContents);
$('#comment$rand').focus();
$('#comment$rand').on('keydown keyup', function(e) {
if ($('#comment$rand').val().split(/\W+/).length > 10) {
$('#submit$rand').button('enable');
} else {
$('#submit$rand').button('disable');
}
});
return locDlg;
};
$('input[name=reassign$rand]').click(function (e) {
e.preventDefault();
if ($('input[name=users_id]').val() == $('input[name=users_id_recipient]').val()) {
// task is already assigned to this user
if ($('input[name=users_id]').val() == 0) {
alert('".addslashes(__('Task is already un-assigned!', 'processmaker'))."', '".addslashes(__('Re-assign task', 'processmaker'))."');
} else {
alert('".addslashes(__('Task is already assigned to this user!', 'processmaker'))."', '".addslashes(__('Re-assign task', 'processmaker'))."');
}
} else if ($('input[name=users_id_recipient]').val() == 0) {
// un-claim
if (".($can_unclaim ? 1 : 0)." && $('input[name=users_id]').val() != 0) {
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'))."');
} else {
// task can't be unclaim because it isn't SELF_SERVICE
alert('".addslashes(__("Can't un-assign task!", 'processmaker'))."', '".addslashes(__('Un-claim task', 'processmaker'))."');
}
} else {
showCommentDlg('".addslashes(__('Re-assign task', 'processmaker'))."',
'".addslashes(__('Please input reason to re-assign:', 'processmaker'))."',
'".addslashes(__('Re-assign', 'processmaker'))."');
}
return false;
});
})
");
if (Session::getLoginUserID() != $_REQUEST['users_id']) {
echo "&nbsp;&nbsp;";
echo "<input type='submit' name='reminder' value='".__s('Send reminder', 'processmaker')."' class='submit'>";
}
Html::closeForm(true);

View File

@@ -1,19 +1,19 @@
<?php
include_once ("../../../inc/includes.php");
Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "helpdesk", "PluginProcessmakerCase", "cases");
if (!$PM_SOAP->config->fields['maintenance']) {
if (Session::haveRightsOr("plugin_processmaker_case", [READ, UPDATE])) {
Search::show('PluginProcessmakerCase');
} else {
Html::displayRightError();
}
} else {
PluginProcessmakerProcessmaker::showUnderMaintenance();
}
Html::footer();
<?php
include_once ("../../../inc/includes.php");
Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "helpdesk", "PluginProcessmakerCase", "cases");
if (!$PM_SOAP->config->fields['maintenance']) {
if (Session::haveRightsOr("plugin_processmaker_case", [READ, DELETE, CANCEL, ADHOC_REASSIGN])) {
Search::show('PluginProcessmakerCase');
} else {
Html::displayRightError();
}
} else {
PluginProcessmakerProcessmaker::showUnderMaintenance();
}
Html::footer();

View File

@@ -1,273 +1,271 @@
<?php
include_once ("../../../inc/includes.php");
/**
* Summary of processMakerShowProcessList
* @param mixed $ID
* @param mixed $from_helpdesk
* @return boolean
*/
function processMakerShowProcessList ($ID, $from_helpdesk) {
global $DB, $CFG_GLPI, $_SESSION;
if (!Session::haveRight("ticket", CREATE)) {
return false;
}
$rand = rand();
echo "<form name= 'processmaker_form$rand' id='processmaker_form$rand' method='post' action='".Toolbox::getItemTypeFormURL("PluginProcessmakerProcessmaker")."'>";
echo "<div class='center'><table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='2'>".__('Process - Case', 'processmaker')."</th></tr>";
echo "<tr class='tab_bg_2'><td class='right' colspan='1'>";
echo __('Select the process you want to add', 'processmaker');
echo "<input type='hidden' name='action' value='newcase'>";
echo "<input type='hidden' name='id' value='-1'>";
echo "<input type='hidden' name='itemtype' value='Ticket'>";
echo "<input type='hidden' name='itilcategories_id' value='".$_REQUEST['itilcategories_id']."'>";
echo "<input type='hidden' name='type' value='".$_REQUEST['type']."'>";
PluginProcessmakerProcess::dropdown( [ 'value' => 0, 'entity' => $_SESSION['glpiactive_entity'], 'name' => 'plugin_processmaker_processes_id' ]);
echo "</td><td class='center'>";
echo "<input type='submit' name='additem' value='Start' class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
return true;
}
/**
* Summary of processMakerShowCase
* @param mixed $ID
* @param mixed $from_helpdesk
*/
function processMakerShowCase($ID, $from_helpdesk) {
global $CFG_GLPI, $PM_SOAP;
$caseInfo = $PM_SOAP->getCaseInfo( $_REQUEST['case_guid'] );
if ($caseInfo->status_code == 0) {
// case is created
// Must show it...
$rand = rand();
$PM_SOAP->echoDomain();
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.helpdesk.js?rand=$rand'></script>";
$tkt = new Ticket;
// as showFormHelpdesk uses $_POST, we must set it
$_POST = $_REQUEST;
// must be using bare text
$save_rich_text = $CFG_GLPI["use_rich_text"];
$CFG_GLPI["use_rich_text"] = false;
// to get the HTML code for the helpdesk form
$saved_ob_level = ob_get_level();
ob_start();
$tkt->showFormHelpdesk($ID);
$buffer = ob_get_clean();
$CFG_GLPI["use_rich_text"] = $save_rich_text;
// 9.1 only: hack to fix an issue with the initEditorSystem which calls scriptStart without calling scriptEnd
if (ob_get_level() > $saved_ob_level) {
$buffer = ob_get_clean().$buffer;
}
//echo $buffer;
//return;
// 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();
$buffer = str_replace(['&lt;', '&gt;', '</b>'], ['<', '>', $endOfBold], $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);
// 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;');
}
// add an input for processguid in the form
$res = $xpath->query('//form[@name="helpdeskform"]');
$input = $res->item(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->setAttribute('name', 'processmaker_processes_id');
$input->setAttribute('type', 'hidden');
$input->setAttribute('value', $_REQUEST['processes_id']);
// 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]');
//$res = $xpath->query('//*[@name="add"]/ancestor::tr[@class="tab_bg_1"]/preceding-sibling::tr[1]');
$table = $xpath->query('//*[@name="add"]/ancestor::table[1]');
$tr = $table->item(0)->insertBefore(new DOMElement('tr'), $res->item(0));
//$tr = $table->item(0)->appendChild(new DOMElement('tr'));
$td = $tr->appendChild(new DOMElement('td'));
$td->setAttribute('colspan', '2');
$iframe = $td->appendChild(new DOMElement('iframe'));
$pmCaseUser = $caseInfo->currentUsers[0]; // by default
$paramsURL = "DEL_INDEX={$pmCaseUser->delIndex}&action={$caseInfo->caseStatus}";
$iframe->setAttribute('id', 'caseiframe' );
$iframe->setAttribute('onload', "onLoadFrame( event, '{$caseInfo->caseId}', {$pmCaseUser->delIndex}, {$caseInfo->caseNumber}, '{$caseInfo->processName}') ;" );
$iframe->setAttribute('width', '100%' );
$iframe->setAttribute('style', 'border:none;' );
$iframe->setAttribute('src', "{$PM_SOAP->serverURL}/cases/cases_Open?sid={$PM_SOAP->getPMSessionID()}&APP_UID={$caseInfo->caseId}&{$paramsURL}&rand=$rand&glpi_domain={$PM_SOAP->config->fields['domain']}" );
// 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>
$buffer = str_replace($endOfBold, '</b>', $buffer);
// will revert back any char converted above
$buffer = mb_convert_encoding($buffer, 'UTF-8', 'HTML-ENTITIES');
echo $buffer;
}
}
function in_array_recursive($needle, $haystack) {
$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($haystack));
foreach ($it AS $element) {
if ($element == $needle) {
return true;
}
}
return false;
}
// Change profile system
if (isset($_POST['newprofile'])) {
if (isset($_SESSION["glpiprofiles"][$_POST['newprofile']])) {
Session::changeProfile($_POST['newprofile']);
if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
Html::redirect($CFG_GLPI['root_doc']."/front/central.php");
} else {
Html::redirect($_SERVER['PHP_SELF']);
}
} else {
Html::redirect(preg_replace("/entities_id=.*/", "", $_SERVER['HTTP_REFERER']));
}
}
// Manage entity change
if (isset($_GET["active_entity"])) {
if (!isset($_GET["is_recursive"])) {
$_GET["is_recursive"] = 0;
}
if (Session::changeActiveEntities($_GET["active_entity"], $_GET["is_recursive"])) {
if ($_GET["active_entity"] == $_SESSION["glpiactive_entity"]) {
Html::redirect(preg_replace("/entities_id.*/", "", $_SERVER['HTTP_REFERER']));
}
}
}
// Redirect management
if (isset($_GET["redirect"])) {
Toolbox::manageRedirect($_GET["redirect"]);
}
// redirect if no create ticket right
if (!Session::haveRight('ticket', CREATE)
&& !Session::haveRight('reminder_public', READ)
&& !Session::haveRight("rssfeed_public", READ)) {
if (Session::haveRight('followup', ITILFollowup::SEEPUBLIC) //TicketFollowup::SEEPUBLIC
|| Session::haveRight('task', TicketTask::SEEPUBLIC)
|| Session::haveRightsOr('ticketvalidation', [TicketValidation::VALIDATEREQUEST,
TicketValidation::VALIDATEINCIDENT])) {
Html::redirect($CFG_GLPI['root_doc']."/front/ticket.php");
} else if (Session::haveRight('reservation', ReservationItem::RESERVEANITEM)) {
Html::redirect($CFG_GLPI['root_doc']."/front/reservationitem.php");
} else if (Session::haveRight('knowbase', KnowbaseItem::READFAQ)) {
Html::redirect($CFG_GLPI['root_doc']."/front/helpdesk.faq.php");
}
}
Session::checkHelpdeskAccess();
Html::helpHeader(__('New ticket'), $_SERVER['PHP_SELF'], $_SESSION["glpiname"]);
if (isset($_REQUEST['case_guid'])) {
$res = $DB->request(
'glpi_plugin_processmaker_cases', [
'case_guid'=>$_REQUEST['case_guid']
]);
$query = "SELECT * FROM glpi_plugin_processmaker_cases WHERE case_guid='".$_REQUEST['case_guid']."'";
//$res = $DB->query( $query );
//if ($DB->numrows( $res )) { // a ticket already exists for this case, then show new cases
if ($res->numrows()) { // a ticket already exists for this case, then show new cases
processMakerShowProcessList(Session::getLoginUserID(), 1);
} else {
// before showing the case, we must check the rights for this user to view it, if entity has been changed in the meanwhile
// and must check if entity of the ticket is in the tree of authorized entities for current profile
$processList = PluginProcessmakerProcessmaker::getProcessesWithCategoryAndProfile( $_REQUEST["itilcategories_id"], $_REQUEST["type"], $_SESSION['glpiactiveprofile']['id'], $_REQUEST['entities_id'] );
if (in_array( $_REQUEST['entities_id'], $_SESSION['glpiactiveentities']) && in_array_recursive( $_REQUEST['processes_id'], $processList )) {
processMakerShowCase(Session::getLoginUserID(), 1);
} else {
Html::redirect($CFG_GLPI["root_doc"]."/front/helpdesk.public.php?create_ticket=1");
}
}
} else {
processMakerShowProcessList(Session::getLoginUserID(), 1);
}
Html::helpFooter();
<?php
include_once ("../../../inc/includes.php");
/**
* Summary of processMakerShowProcessList
* @param mixed $ID
* @param mixed $from_helpdesk
* @return boolean
*/
function processMakerShowProcessList ($ID, $from_helpdesk) {
global $DB, $CFG_GLPI, $_SESSION;
if (!Session::haveRight("ticket", CREATE)) {
return false;
}
$rand = rand();
echo "<form name= 'processmaker_form$rand' id='processmaker_form$rand' method='post' action='".Toolbox::getItemTypeFormURL("PluginProcessmakerProcessmaker")."'>";
echo "<div class='center'><table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='2'>".__('Process - Case', 'processmaker')."</th></tr>";
echo "<tr class='tab_bg_2'><td class='right' colspan='1'>";
echo __('Select the process you want to add', 'processmaker');
echo "<input type='hidden' name='action' value='newcase'>";
echo "<input type='hidden' name='id' value='-1'>";
echo "<input type='hidden' name='itemtype' value='Ticket'>";
echo "<input type='hidden' name='itilcategories_id' value='".$_REQUEST['itilcategories_id']."'>";
echo "<input type='hidden' name='type' value='".$_REQUEST['type']."'>";
PluginProcessmakerProcess::dropdown( [ 'value' => 0, 'entity' => $_SESSION['glpiactive_entity'], 'name' => 'plugin_processmaker_processes_id' ]);
echo "</td><td class='center'>";
echo "<input type='submit' name='additem' value='Start' class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
return true;
}
/**
* Summary of processMakerShowCase
* @param mixed $users_id
* @param mixed $from_helpdesk
*/
function processMakerShowCase($users_id, $from_helpdesk) {
global $CFG_GLPI, $PM_SOAP;
$caseInfo = $PM_SOAP->getCaseInfo( $_REQUEST['case_guid'] );
if ($caseInfo->status_code == 0) {
// case is created
// Must show it...
$rand = rand();
$PM_SOAP->echoDomain();
echo "<script type='text/javascript' src='".$CFG_GLPI["root_doc"]."/plugins/processmaker/js/cases.helpdesk.js?rand=$rand'></script>";
$tkt = new Ticket;
// as showFormHelpdesk uses $_POST, we must set it
$_POST = $_REQUEST;
//// must be using bare text
//$save_rich_text = $CFG_GLPI["use_rich_text"];
//$CFG_GLPI["use_rich_text"] = false;
// to get the HTML code for the helpdesk form
$saved_ob_level = ob_get_level();
ob_start();
$tkt->showFormHelpdesk($users_id);
$buffer = ob_get_clean();
//$CFG_GLPI["use_rich_text"] = $save_rich_text;
// 9.1 only: hack to fix an issue with the initEditorSystem which calls scriptStart without calling scriptEnd
if (ob_get_level() > $saved_ob_level) {
$buffer = ob_get_clean().$buffer;
}
//echo $buffer;
//return;
// 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);
// 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;');
}
// add an input for processguid in the form
$res = $xpath->query('//form[@name="helpdeskform"]');
$input = $res->item(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->setAttribute('name', 'processmaker_processes_id');
$input->setAttribute('type', 'hidden');
$input->setAttribute('value', $_REQUEST['processes_id']);
// 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]');
//$res = $xpath->query('//*[@name="add"]/ancestor::tr[@class="tab_bg_1"]/preceding-sibling::tr[1]');
$table = $xpath->query('//*[@name="add"]/ancestor::table[1]');
$tr = $table->item(0)->insertBefore(new DOMElement('tr'), $res->item(0));
//$tr = $table->item(0)->appendChild(new DOMElement('tr'));
$td = $tr->appendChild(new DOMElement('td'));
$td->setAttribute('colspan', '2');
$iframe = $td->appendChild(new DOMElement('iframe'));
$pmCaseUser = $caseInfo->currentUsers[0]; // by default
$paramsURL = "DEL_INDEX={$pmCaseUser->delIndex}&action={$caseInfo->caseStatus}";
$iframe->setAttribute('id', 'caseiframe' );
$iframe->setAttribute('onload', "onLoadFrame( event, '{$caseInfo->caseId}', {$pmCaseUser->delIndex}, {$caseInfo->caseNumber}, '{$caseInfo->processName}') ;" );
$iframe->setAttribute('width', '100%' );
$iframe->setAttribute('style', 'border:none;' );
$iframe->setAttribute('src', "{$PM_SOAP->serverURL}/cases/cases_Open?sid={$PM_SOAP->getPMSessionID()}&APP_UID={$caseInfo->caseId}&{$paramsURL}&rand=$rand&glpi_domain={$PM_SOAP->config->fields['domain']}" );
// 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;
}
}
function in_array_recursive($needle, $haystack) {
$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($haystack));
foreach ($it AS $element) {
if ($element == $needle) {
return true;
}
}
return false;
}
// Change profile system
if (isset($_POST['newprofile'])) {
if (isset($_SESSION["glpiprofiles"][$_POST['newprofile']])) {
Session::changeProfile($_POST['newprofile']);
if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
Html::redirect($CFG_GLPI['root_doc']."/front/central.php");
} else {
Html::redirect($_SERVER['PHP_SELF']);
}
} else {
Html::redirect(preg_replace("/entities_id=.*/", "", $_SERVER['HTTP_REFERER']));
}
}
// Manage entity change
if (isset($_GET["active_entity"])) {
if (!isset($_GET["is_recursive"])) {
$_GET["is_recursive"] = 0;
}
if (Session::changeActiveEntities($_GET["active_entity"], $_GET["is_recursive"])) {
if ($_GET["active_entity"] == $_SESSION["glpiactive_entity"]) {
Html::redirect(preg_replace("/entities_id.*/", "", $_SERVER['HTTP_REFERER']));
}
}
}
// Redirect management
if (isset($_GET["redirect"])) {
Toolbox::manageRedirect($_GET["redirect"]);
}
// redirect if no create ticket right
if (!Session::haveRight('ticket', CREATE)
&& !Session::haveRight('reminder_public', READ)
&& !Session::haveRight("rssfeed_public", READ)) {
if (Session::haveRight('followup', ITILFollowup::SEEPUBLIC) //TicketFollowup::SEEPUBLIC
|| Session::haveRight('task', TicketTask::SEEPUBLIC)
|| Session::haveRightsOr('ticketvalidation', [TicketValidation::VALIDATEREQUEST,
TicketValidation::VALIDATEINCIDENT])) {
Html::redirect($CFG_GLPI['root_doc']."/front/ticket.php");
} else if (Session::haveRight('reservation', ReservationItem::RESERVEANITEM)) {
Html::redirect($CFG_GLPI['root_doc']."/front/reservationitem.php");
} else if (Session::haveRight('knowbase', KnowbaseItem::READFAQ)) {
Html::redirect($CFG_GLPI['root_doc']."/front/helpdesk.faq.php");
}
}
Session::checkHelpdeskAccess();
Html::helpHeader(__('New ticket'), $_SERVER['PHP_SELF'], $_SESSION["glpiname"]);
if (isset($_REQUEST['case_guid'])) {
$res = $DB->request('glpi_plugin_processmaker_cases', ['case_guid' => $_REQUEST['case_guid']]);
//$query = "SELECT * FROM glpi_plugin_processmaker_cases WHERE case_guid='".$_REQUEST['case_guid']."'";
//$res = $DB->query( $query );
//if ($DB->numrows( $res )) { // a ticket already exists for this case, then show new cases
if ($res->numrows()) { // a ticket already exists for this case, then show new cases
processMakerShowProcessList(Session::getLoginUserID(), 1);
} else {
// before showing the case, we must check the rights for this user to view it, if entity has been changed in the meanwhile
// and must check if entity of the ticket is in the tree of authorized entities for current profile
$processList = PluginProcessmakerProcessmaker::getProcessesWithCategoryAndProfile( $_REQUEST["itilcategories_id"], $_REQUEST["type"], $_SESSION['glpiactiveprofile']['id'], $_REQUEST['entities_id'] );
if (in_array( $_REQUEST['entities_id'], $_SESSION['glpiactiveentities']) && in_array_recursive( $_REQUEST['processes_id'], $processList )) {
processMakerShowCase(Session::getLoginUserID(), 1);
} else {
Html::redirect($CFG_GLPI["root_doc"]."/front/helpdesk.public.php?create_ticket=1");
}
}
} else {
processMakerShowProcessList(Session::getLoginUserID(), 1);
}
Html::helpFooter();

960
hook.php
View File

@@ -1,474 +1,486 @@
<?php
include_once 'inc/processmaker.class.php';
function plugin_processmaker_MassiveActions($type) {
switch ($type) {
case 'PluginProcessmakerProcess' :
if (plugin_processmaker_haveRight('config', UPDATE)) {
return ['plugin_processmaker_taskrefresh' => __('Synchronize Task List', 'processmaker')];
}
break;
case 'PluginProcessmakerProcess_Profile' :
if (plugin_processmaker_haveRight('config', UPDATE)) {
return ['purge' => __('Delete permanently')];
}
break;
//case 'PluginProcessmakerCase' :
// if (plugin_processmaker_haveRight("case", DELETE)) {
// return array('purge' => __('Delete permanently'));
// }
//break;
}
return [];
}
/**
* Summary of plugin_processmaker_install
* Creates tables and initializes tasks, "GLPI Requesters" group
* and so on
* @return true or die!
*/
function plugin_processmaker_install() {
global $DB;
if (!$DB->tableExists("glpi_plugin_processmaker_cases")) {
// new installation
include_once(GLPI_ROOT."/plugins/processmaker/install/install.php");
processmaker_install();
} else {
// upgrade installation
include_once(GLPI_ROOT."/plugins/processmaker/install/update.php");
processmaker_update();
}
// To be called for each task managed by the plugin
// task in class
CronTask::Register('PluginProcessmakerProcessmaker', 'pmusers', DAY_TIMESTAMP, [ 'state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL]);
CronTask::Register('PluginProcessmakerProcessmaker', 'pmorphancases', DAY_TIMESTAMP, ['param' => 10, 'state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL]);
CronTask::Register('PluginProcessmakerProcessmaker', 'pmtaskactions', MINUTE_TIMESTAMP, ['state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL]);
// required because autoload doesn't work for unactive plugin'
include_once(GLPI_ROOT."/plugins/processmaker/inc/profile.class.php");
PluginProcessmakerProfile::createAdminAccess($_SESSION['glpiactiveprofile']['id']);
return true;
}
function plugin_processmaker_uninstall() {
CronTask::Unregister('PluginProcessmakerProcessmaker');
return true;
}
function plugin_processmaker_getAddSearchOptions($itemtype) {
$sopt = [];
// TODO add Change and Problem + other fields to the search
if ($itemtype == 'Ticket') {
$sopt[10001]['table'] = 'glpi_plugin_processmaker_cases';
$sopt[10001]['field'] = 'case_status';
//$sopt[1001]['linkfield'] = 'id';
$sopt[10001]['massiveaction'] = false;
$sopt[10001]['name'] = __('Case', 'processmaker').' - '.__('Status', 'processmaker');
$sopt[10001]['datatype'] = 'text';
$sopt[10001]['forcegroupby'] = true;
//$sopt[10001]['searchtype'] = 'equals';
//$sopt[1001]['itemlink_type'] = 'PluginProcessmakerTicketcase';
//$sopt[1001]['table'] = 'glpi_plugin_processmaker_ticketcase';
//$sopt[1001]['field'] = 'case_status';
//$sopt[1001]['massiveaction'] = false;
//$sopt[1001]['name'] = 'Case - Status';
//$sopt[1001]['forcegroupby'] = true;
//$sopt[1001]['datatype'] = 'itemlink';
// $sopt[1001]['itemlink_type'] = 'PluginProcessmakerProcessmaker';
//$sopt[1001]['joinparams'] = array('beforejoin'
// => array('table' => 'glpi_plugin_processmaker_ticketcase',
// 'linkfield' => 'ticket_id'));
//$sopt[1001]['joinparams']['jointype'] = "itemtype_id";
//$sopt[1001]['pfields_type'] = ;
}
return $sopt;
}
function plugin_processmaker_addLeftJoin($type, $ref_table, $new_table, $linkfield, &$already_link_tables) {
switch ($type) {
case 'Ticket':
switch ($new_table) {
case "glpi_plugin_processmaker_cases" :
$out= " LEFT JOIN `glpi_plugin_processmaker_cases`
ON (`$ref_table`.`id` = `glpi_plugin_processmaker_cases`.`items_id` AND `glpi_plugin_processmaker_cases`.`itemtype` like 'Ticket') ";
return $out;
}
return "";
}
return "";
}
/**
* Summary of plugin_pre_item_update_processmaker
* @param CommonITILObject $parm is an object
* @return void
*/
function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
global $DB;//, $PM_SOAP;
if (isset($_SESSION['glpiname'])) { // && $parm->getType() == 'Ticket') {
$locVar = [ ];
foreach ($parm->input as $key => $val) {
switch ($key) {
case 'global_validation' :
$locVar[ 'GLPI_TICKET_GLOBAL_VALIDATION' ] = $val;
$locVar[ 'GLPI_ITEM_GLOBAL_VALIDATION' ] = $val;
break;
case 'itilcategories_id' :
$locVar[ 'GLPI_ITEM_ITIL_CATEGORY_ID' ] = $val;
break;
case 'date' :
$locVar[ 'GLPI_ITEM_OPENING_DATE' ] = $val;
break;
case 'time_to_resolve' :
$locVar[ 'GLPI_TICKET_DUE_DATE' ] = $val;
$locVar[ 'GLPI_ITEM_DUE_DATE' ] = $val;
break;
case 'urgency' :
$locVar[ 'GLPI_TICKET_URGENCY' ] = $val;
$locVar[ 'GLPI_ITEM_URGENCY' ] = $val;
break;
case 'impact' :
$locVar[ 'GLPI_ITEM_IMPACT' ] = $val;
break;
case 'priority' :
$locVar[ 'GLPI_ITEM_PRIORITY' ] = $val;
break;
}
}
$itemId = $parm->getID();
$itemType = $parm->getType();
$locCase = new PluginProcessmakerCase;
foreach (PluginProcessmakerCase::getIDsFromItem($itemType, $itemId ) as $cases_id) {
$locCase->getFromDB($cases_id);
$locCase->sendVariables($locVar);
// if entities_id of item has been changed, then must update case
if (isset($parm->input['entities_id']) && $parm->input['entities_id'] != $parm->fields['entities_id']) {
$locCase->update(['id' => $cases_id, 'entities_id' => $parm->input['entities_id']]);
}
}
}
}
/**
* Summary of plugin_item_update_processmaker_satisfaction
* inject satisfaction survey into case
* @param mixed $parm is the object
*/
function plugin_item_update_processmaker_satisfaction($parm) {
global $PM_SOAP;
if (Session::isCron()) { // Task cron log with user admin
$PM_SOAP->login(true);
}
$cases = PluginProcessmakerCase::getIDsFromItem('Ticket', $parm->fields['tickets_id']);
foreach ($cases as $cases_id) {
$locCase = new PluginProcessmakerCase;
if ($locCase->getFromDB($cases_id)) {
// case is existing for this item
$locCase->sendVariables( ['GLPI_SATISFACTION_QUALITY' => $parm->fields['satisfaction']] );
}
}
}
/**
* Summary of plugin_item_update_processmaker_user
* When a user login is changed, then must change it in the PM tables
* @param User $param is the user being changed
*/
function plugin_item_update_processmaker_user(User $param) {
// Must test if user login has been changed
// if yes, must change the login in the PM tables:
// USERS and RBAC_USERS, othewise the link in the processmaker_users table will be invalid
if (in_array('name', $param->updates)) {
// check if user is in the processmaker_user table
$pm_user = PluginProcessmakerUser::getPMUserId($param->getID());
if ($pm_user) {
// must update the user in PM tables
global $PM_SOAP;
if ($param->fields['is_active'] == 0 || $param->fields['is_deleted'] == 1) {
$status = "INACTIVE";
} else {
$status = "ACTIVE";
}
$PM_SOAP->login(true);
$pmResult = $PM_SOAP->updateUser( $pm_user, $param->fields['name'], $param->fields['firstname'], $param->fields['realname'], $status );
}
}
}
function plugin_processmaker_post_init() {
global $PM_DB, $PM_SOAP;
if (!isset($PM_DB)) {
$PM_DB = new PluginProcessmakerDB;
}
if (!isset($PM_SOAP)) {
$PM_SOAP = new PluginProcessmakerProcessmaker;
// and default login is current running user if any
if (Session::getLoginUserID()) {
$PM_SOAP->login();
}
}
}
function plugin_processmaker_giveItem($itemtype, $ID, $data, $num) {
return;
}
function plugin_processmaker_change_profile() {
if ($_SESSION['glpiactiveprofile']['interface'] == "helpdesk") {
// must add the rights for simplified interface
$_SESSION['glpiactiveprofile']['plugin_processmaker_case'] = READ;
}
}
/**
* Summary of plugin_item_add_update_processmaker_tasks
* @param mixed $parm
*/
function plugin_item_update_processmaker_tasks($parm) {
global $DB, $CFG_GLPI, $PM_SOAP;
$pmTaskCat = new PluginProcessmakerTaskCategory;
if ($pmTaskCat->getFromDBbyCategory( $parm->fields['taskcategories_id'] )
&& in_array( 'state', $parm->updates )
&& $parm->input['state'] == Planning::DONE
&& $parm->oldvalues['state'] == Planning::TODO) { // the task has just been set to DONE state
//$itemtype = str_replace( 'Task', '', $parm->getType() );
$pmTask = new PluginProcessmakerTask($parm->getType());
$pmTask->getFromDB($parm->fields['id']);
$locCase = new PluginProcessmakerCase;
$locCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']);
$srccase_guid = $locCase->fields['case_guid'];
//$msg = Toolbox::backtrace(false);
//$msg .= ' $locCase: '.str_replace("\n", "\n ", print_r($locCase, true))."\n";
//$msg .= ' $task: '.str_replace("\n", "\n ", print_r($parm, true))."\n";
//$msg .= ' $pmTask: '.str_replace("\n", "\n ", print_r($pmTask, true))."\n";
//$msg .= "\n";
foreach ($DB->request( 'glpi_plugin_processmaker_caselinks', "is_active = 1 AND sourcetask_guid='".$pmTaskCat->fields['pm_task_guid']."'") as $targetTask) {
// Must check the condition
$casevariables = [];
$matches = [];
if (preg_match_all( "/@@(\w+)/u", $targetTask['sourcecondition'], $matches )) {
$casevariables = $matches[1];
}
$targetTask['targetactions'] = []; // empty array by default
foreach ($DB->request( 'glpi_plugin_processmaker_caselinkactions', 'plugin_processmaker_caselinks_id = '.$targetTask['id']) as $actionvalue) {
$targetTask['targetactions'][$actionvalue['name']] = $actionvalue['value'];
if (preg_match_all( "/@@(\w+)/u", $actionvalue['value'], $matches )) {
$casevariables = array_merge( $casevariables, $matches[1] );
}
}
$externalapplication = false; // by default
if ($targetTask['is_externaldata'] && isset($targetTask['externalapplication'])) {
// must read some values
$externalapplication = json_decode( $targetTask['externalapplication'], true );
// must be of the form
// {"method":"POST","url":"urloftheservice","params":json_object}
// Where method is the POST, GET, ... method
// url is the URL to be called
// params is a list of parameters to get from running case
foreach ($externalapplication['params'] as $paramname => $variable) {
if (preg_match_all( "/@@(\w+)/u", $variable, $matches )) {
$casevariables = array_merge( $casevariables, $matches[1] );
}
}
}
// ask for those case variables
//$PM_SOAP = new PluginProcessmakerProcessmaker();
//$PM_SOAP->login( );
// now tries to get the variables to check condition
$infoForTasks = $locCase->getVariables($casevariables);
foreach ($infoForTasks as $casevar => $varval) {
$infoForTasks[ "@@$casevar" ] = "'$varval'";
unset( $infoForTasks[ $casevar ] );
}
//$msg .= " ***********\n";
//$msg .= ' $targetTask: '.str_replace("\n", "\n ", print_r($targetTask, true))."\n";
$targetTask['sourcecondition'] = str_replace( array_keys($infoForTasks), $infoForTasks, $targetTask['sourcecondition'] );
$eval = eval( "return (".$targetTask['sourcecondition']." ? 1 : 0);" );
//$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 .= ' $result: '."$eval\n";
//$msg .= "\n";
if ($eval) {
// look at each linked ticket if a case is attached and then if a task like $val is TO_DO
// then will try to routeCase for each tasks in $val
$postdata = [];
foreach ($targetTask['targetactions'] as $action => $actionvalue) {
$postdata['form'][$action] = eval( "return ".str_replace( array_keys($infoForTasks), $infoForTasks, $actionvalue)." ;" );
}
$postdata['UID'] = $targetTask['targetdynaform_guid'];
$postdata['__DynaformName__'] = $targetTask['targetprocess_guid']."_".$targetTask['targetdynaform_guid'];
$postdata['__notValidateThisFields__'] = '[]';
$postdata['DynaformRequiredFields'] = '[]';
$postdata['form']['btnGLPISendRequest'] = 'submit';
$externalapplicationparams = [];
if ($externalapplication) {
// must call curl
foreach ($externalapplication['params'] as $paramname => $variable) {
$externalapplicationparams[$paramname] = eval( "return ".str_replace( array_keys($infoForTasks), $infoForTasks, $variable)." ;" );
}
$externalapplicationparams['callback'] = $CFG_GLPI["url_base"]."/plugins/processmaker/ajax/asynchronousdatas.php";
$ch = curl_init();
$externalapplication['url'] = eval( "return '".str_replace( array_keys($infoForTasks), $infoForTasks, $externalapplication['url'])."' ;" ); // '???
curl_setopt($ch, CURLOPT_URL, $externalapplication['url'] );
if (isset($externalapplication['method']) && $externalapplication['method'] == 'POST') {
curl_setopt($ch, CURLOPT_POST, 1);
}
}
if ($targetTask['is_self']) {
$PM_SOAP->login(true);
$taskCase = $PM_SOAP->taskCase( $srccase_guid );
foreach ($taskCase as $task) {
// search for target task guid
if ($task->guid == $targetTask['targettask_guid']) {
break;
}
}
$PM_SOAP->login();
$postdata['APP_UID'] = $srccase_guid;
$postdata['DEL_INDEX'] = $task->delegate;
//need to get the 'ProcessMaker' user
$pmconfig = $PM_SOAP->config; //PluginProcessmakerConfig::getInstance();
$cronaction = new PluginProcessmakerCrontaskaction;
$cronaction->add( [ 'plugin_processmaker_caselinks_id' => $targetTask['id'],
'plugin_processmaker_cases_id' => $locCase->getID(),
//'itemtype' => $itemtype,
//'items_id' => $parm->fields['tickets_id'],
'users_id' => $pmconfig->fields['users_id'],
'is_targettoclaim' => $targetTask['is_targettoclaim'],
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
],
null,
false);
if ($externalapplication) {
// must call external application in order to get the needed data asynchroneously
// must be of the form
// {"url":"urloftheservice","params":{"user":"@@USER_ID","system":"GPP","list":"@@ROLE_LIST"}}
// url is the URL to be called
$externalapplicationparams['id'] = $cronaction->getID();
$externalapplicationparams = json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT);
curl_setopt($ch, CURLOPT_POSTFIELDS, $externalapplicationparams);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Content-Length: ' . strlen($externalapplicationparams), 'Expect:']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_VERBOSE, 1);
if (isset($externalapplication['ssl_verify'])) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $externalapplication['ssl_verify']);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $externalapplication['ssl_verify']);
}
if (isset($externalapplication['proxy'])) {
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1 ) ;
curl_setopt($ch, CURLOPT_PROXY, $externalapplication['proxy']);
}
$response = curl_exec ($ch);
if ($response === false) {
//throw new Exception(curl_error($ch), curl_errno($ch));
Toolbox::logDebug( curl_error($ch).":".curl_errno($ch) );
}
curl_close ($ch);
}
// }
} else {
// TODO to review this part of code as it is no longer usable like this !!!
foreach (Ticket_Ticket::getLinkedTicketsTo( $parm->fields['tickets_id'] ) as $tlink) {
if ($tlink['link'] == Ticket_Ticket::LINK_TO) {
$query = "SELECT glpi_plugin_processmaker_cases.id, MAX(glpi_plugin_processmaker_tasks.del_index) AS del_index FROM glpi_tickettasks
JOIN glpi_plugin_processmaker_taskcategories ON glpi_plugin_processmaker_taskcategories.taskcategories_id=glpi_tickettasks.taskcategories_id
JOIN glpi_plugin_processmaker_cases ON glpi_plugin_processmaker_cases.processes_id=glpi_plugin_processmaker_taskcategories.processes_id
RIGHT JOIN glpi_plugin_processmaker_tasks ON glpi_plugin_processmaker_tasks.items_id=glpi_tickettasks.id AND glpi_plugin_processmaker_tasks.case_id=glpi_plugin_processmaker_cases.id
WHERE glpi_plugin_processmaker_taskcategories.pm_task_guid = '".$targetTask['targettask_guid']."' AND glpi_tickettasks.state = 1 AND glpi_tickettasks.tickets_id=".$tlink['tickets_id'];
foreach ($DB->request($query) as $case) {
// must be only one row
$postdata['APP_UID'] = $case['id'];
$postdata['DEL_INDEX'] = $case['del_index'];
$cronaction = new PluginProcessmakerCrontaskaction;
$cronaction->add( [ 'plugin_processmaker_caselinks_id' => $targetTask['id'],
'plugin_processmaker_cases_id' => $locCase->getID(),
//'itemtype' => $itemtype,
//'items_id' => $parm->fields['tickets_id'],
'users_id' => Session::getLoginUserID(),
'is_targettoclaim' => $targetTask['is_targettoclaim'],
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
],
null,
false);
}
}
}
}
if ($targetTask['is_synchronous']) {
// must call PluginProcessmakerProcessmaker::cronPMTaskActions()
PluginProcessmakerProcessmaker::cronPMTaskActions();
}
}
}
//$msg .= "================\n";
//Toolbox::logInFile("processmaker", $msg);
}
}
<?php
include_once 'inc/processmaker.class.php';
function plugin_processmaker_MassiveActions($type) {
switch ($type) {
case 'PluginProcessmakerProcess' :
if (plugin_processmaker_haveRight('config', UPDATE)) {
return ['plugin_processmaker_taskrefresh' => __('Synchronize Task List', 'processmaker')];
}
break;
case 'PluginProcessmakerProcess_Profile' :
if (plugin_processmaker_haveRight('config', UPDATE)) {
return ['purge' => __('Delete permanently')];
}
break;
//case 'PluginProcessmakerCase' :
// if (plugin_processmaker_haveRight("case", DELETE)) {
// return array('purge' => __('Delete permanently'));
// }
//break;
}
return [];
}
/**
* Summary of plugin_processmaker_install
* Creates tables and initializes tasks, "GLPI Requesters" group
* and so on
* @return true or die!
*/
function plugin_processmaker_install() {
global $DB;
if (!$DB->tableExists("glpi_plugin_processmaker_cases")) {
// new installation
include_once(GLPI_ROOT."/plugins/processmaker/install/install.php");
processmaker_install();
} else {
// upgrade installation
include_once(GLPI_ROOT."/plugins/processmaker/install/update.php");
processmaker_update();
}
// To be called for each task managed by the plugin
// task in class
CronTask::Register('PluginProcessmakerProcessmaker', 'pmusers', DAY_TIMESTAMP, [ 'state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL]);
CronTask::Register('PluginProcessmakerProcessmaker', 'pmorphancases', DAY_TIMESTAMP, ['param' => 10, 'state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL]);
CronTask::Register('PluginProcessmakerProcessmaker', 'pmtaskactions', MINUTE_TIMESTAMP, ['state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL]);
// required because autoload doesn't work for unactive plugin'
include_once(GLPI_ROOT."/plugins/processmaker/inc/profile.class.php");
PluginProcessmakerProfile::createAdminAccess($_SESSION['glpiactiveprofile']['id']);
return true;
}
function plugin_processmaker_uninstall() {
CronTask::Unregister('PluginProcessmakerProcessmaker');
return true;
}
function plugin_processmaker_getAddSearchOptions($itemtype) {
$sopt = [];
// TODO add Change and Problem + other fields to the search
if ($itemtype == 'Ticket') {
$sopt[10001]['table'] = 'glpi_plugin_processmaker_cases';
$sopt[10001]['field'] = 'case_status';
//$sopt[1001]['linkfield'] = 'id';
$sopt[10001]['massiveaction'] = false;
$sopt[10001]['name'] = __('Case', 'processmaker').' - '.__('Status', 'processmaker');
$sopt[10001]['datatype'] = 'text';
$sopt[10001]['forcegroupby'] = true;
//$sopt[10001]['searchtype'] = 'equals';
//$sopt[1001]['itemlink_type'] = 'PluginProcessmakerTicketcase';
//$sopt[1001]['table'] = 'glpi_plugin_processmaker_ticketcase';
//$sopt[1001]['field'] = 'case_status';
//$sopt[1001]['massiveaction'] = false;
//$sopt[1001]['name'] = 'Case - Status';
//$sopt[1001]['forcegroupby'] = true;
//$sopt[1001]['datatype'] = 'itemlink';
// $sopt[1001]['itemlink_type'] = 'PluginProcessmakerProcessmaker';
//$sopt[1001]['joinparams'] = array('beforejoin'
// => array('table' => 'glpi_plugin_processmaker_ticketcase',
// 'linkfield' => 'ticket_id'));
//$sopt[1001]['joinparams']['jointype'] = "itemtype_id";
//$sopt[1001]['pfields_type'] = ;
}
return $sopt;
}
function plugin_processmaker_addLeftJoin($type, $ref_table, $new_table, $linkfield, &$already_link_tables) {
switch ($type) {
case 'Ticket':
switch ($new_table) {
case "glpi_plugin_processmaker_cases" :
$out= " LEFT JOIN `glpi_plugin_processmaker_cases`
ON (`$ref_table`.`id` = `glpi_plugin_processmaker_cases`.`items_id` AND `glpi_plugin_processmaker_cases`.`itemtype` like 'Ticket') ";
return $out;
}
return "";
}
return "";
}
/**
* Summary of plugin_pre_item_update_processmaker
* @param CommonITILObject $parm is an object
* @return void
*/
function plugin_pre_item_update_processmaker(CommonITILObject $parm) {
//global $DB;//, $PM_SOAP;
// look at previous status
if (isset($parm->input['status'])
&& $parm->input['status'] == CommonITILObject::SOLVED
&& !in_array($parm->fields['status'], [CommonITILObject::SOLVED, CommonITILObject::CLOSED])
&& !PluginProcessmakerCase::canSolve(['item' => $parm])) {
$parm->input = []; // empty array... to prevent item update
Session::addMessageAfterRedirect(__('At least one \'Process case\' is running!<br/>Solving is currently disabled!', 'processmaker'), false, ERROR);
return;
}
if (isset($_SESSION['glpiname'])) {
$locVar = [ ];
foreach ($parm->input as $key => $val) {
switch ($key) {
case 'global_validation' :
$locVar[ 'GLPI_TICKET_GLOBAL_VALIDATION' ] = $val;
$locVar[ 'GLPI_ITEM_GLOBAL_VALIDATION' ] = $val;
break;
case 'itilcategories_id' :
$locVar[ 'GLPI_ITEM_ITIL_CATEGORY_ID' ] = $val;
break;
case 'date' :
$locVar[ 'GLPI_ITEM_OPENING_DATE' ] = $val;
break;
case 'time_to_resolve' :
$locVar[ 'GLPI_TICKET_DUE_DATE' ] = $val;
$locVar[ 'GLPI_ITEM_DUE_DATE' ] = $val;
break;
case 'urgency' :
$locVar[ 'GLPI_TICKET_URGENCY' ] = $val;
$locVar[ 'GLPI_ITEM_URGENCY' ] = $val;
break;
case 'impact' :
$locVar[ 'GLPI_ITEM_IMPACT' ] = $val;
break;
case 'priority' :
$locVar[ 'GLPI_ITEM_PRIORITY' ] = $val;
break;
}
}
$itemId = $parm->getID();
$itemType = $parm->getType();
$locCase = new PluginProcessmakerCase;
foreach (PluginProcessmakerCase::getIDsFromItem($itemType, $itemId) as $cases_id) {
$locCase->getFromDB($cases_id);
$locCase->sendVariables($locVar);
// if entities_id of item has been changed, then must update case
if (isset($parm->input['entities_id']) && $parm->input['entities_id'] != $parm->fields['entities_id']) {
$locCase->update(['id' => $cases_id, 'entities_id' => $parm->input['entities_id']]);
}
}
}
}
/**
* Summary of plugin_item_update_processmaker_satisfaction
* inject satisfaction survey into case
* @param mixed $parm is the object
*/
function plugin_item_update_processmaker_satisfaction($parm) {
global $PM_SOAP;
if (Session::isCron()) { // Task cron log with user admin
$PM_SOAP->login(true);
}
$cases = PluginProcessmakerCase::getIDsFromItem('Ticket', $parm->fields['tickets_id']);
foreach ($cases as $cases_id) {
$locCase = new PluginProcessmakerCase;
if ($locCase->getFromDB($cases_id)) {
// case is existing for this item
$locCase->sendVariables( ['GLPI_SATISFACTION_QUALITY' => $parm->fields['satisfaction']] );
}
}
}
/**
* Summary of plugin_item_update_processmaker_user
* When a user login is changed, then must change it in the PM tables
* @param User $param is the user being changed
*/
function plugin_item_update_processmaker_user(User $param) {
// Must test if user login has been changed
// if yes, must change the login in the PM tables:
// USERS and RBAC_USERS, othewise the link in the processmaker_users table will be invalid
if (in_array('name', $param->updates)) {
// check if user is in the processmaker_user table
$pm_user = PluginProcessmakerUser::getPMUserId($param->getID());
if ($pm_user) {
// must update the user in PM tables
global $PM_SOAP;
if ($param->fields['is_active'] == 0 || $param->fields['is_deleted'] == 1) {
$status = "INACTIVE";
} else {
$status = "ACTIVE";
}
$PM_SOAP->login(true);
$pmResult = $PM_SOAP->updateUser( $pm_user, $param->fields['name'], $param->fields['firstname'], $param->fields['realname'], $status );
}
}
}
function plugin_processmaker_post_init() {
global $PM_DB, $PM_SOAP;
if (!isset($PM_DB)) {
$PM_DB = new PluginProcessmakerDB;
}
if (!isset($PM_SOAP)) {
$PM_SOAP = new PluginProcessmakerProcessmaker;
// and default login is current running user if any
if (Session::getLoginUserID()) {
$PM_SOAP->login();
}
}
}
function plugin_processmaker_giveItem($itemtype, $ID, $data, $num) {
return;
}
function plugin_processmaker_change_profile() {
if ($_SESSION['glpiactiveprofile']['interface'] == "helpdesk") {
// must add the rights for simplified interface
$_SESSION['glpiactiveprofile']['plugin_processmaker_case'] = READ;
}
}
/**
* Summary of plugin_item_add_update_processmaker_tasks
* @param mixed $parm
*/
function plugin_item_update_processmaker_tasks($parm) {
global $DB, $CFG_GLPI, $PM_SOAP;
$pmTaskCat = new PluginProcessmakerTaskCategory;
if ($pmTaskCat->getFromDBbyCategory( $parm->fields['taskcategories_id'] )
&& in_array( 'state', $parm->updates )
&& $parm->input['state'] == Planning::DONE
&& $parm->oldvalues['state'] == Planning::TODO) { // the task has just been set to DONE state
//$itemtype = str_replace( 'Task', '', $parm->getType() );
$pmTask = new PluginProcessmakerTask($parm->getType());
$pmTask->getFromDB($parm->fields['id']);
$locCase = new PluginProcessmakerCase;
$locCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']);
$srccase_guid = $locCase->fields['case_guid'];
//$msg = Toolbox::backtrace(false);
//$msg .= ' $locCase: '.str_replace("\n", "\n ", print_r($locCase, true))."\n";
//$msg .= ' $task: '.str_replace("\n", "\n ", print_r($parm, true))."\n";
//$msg .= ' $pmTask: '.str_replace("\n", "\n ", print_r($pmTask, true))."\n";
//$msg .= "\n";
foreach ($DB->request( 'glpi_plugin_processmaker_caselinks', "is_active = 1 AND sourcetask_guid='".$pmTaskCat->fields['pm_task_guid']."'") as $targetTask) {
// Must check the condition
$casevariables = [];
$matches = [];
if (preg_match_all( "/@@(\w+)/u", $targetTask['sourcecondition'], $matches )) {
$casevariables = $matches[1];
}
$targetTask['targetactions'] = []; // empty array by default
foreach ($DB->request( 'glpi_plugin_processmaker_caselinkactions', 'plugin_processmaker_caselinks_id = '.$targetTask['id']) as $actionvalue) {
$targetTask['targetactions'][$actionvalue['name']] = $actionvalue['value'];
if (preg_match_all( "/@@(\w+)/u", $actionvalue['value'], $matches )) {
$casevariables = array_merge( $casevariables, $matches[1] );
}
}
$externalapplication = false; // by default
if ($targetTask['is_externaldata'] && isset($targetTask['externalapplication'])) {
// must read some values
$externalapplication = json_decode( $targetTask['externalapplication'], true );
// must be of the form
// {"method":"POST","url":"urloftheservice","params":json_object}
// Where method is the POST, GET, ... method
// url is the URL to be called
// params is a list of parameters to get from running case
foreach ($externalapplication['params'] as $paramname => $variable) {
if (preg_match_all( "/@@(\w+)/u", $variable, $matches )) {
$casevariables = array_merge( $casevariables, $matches[1] );
}
}
}
// ask for those case variables
//$PM_SOAP = new PluginProcessmakerProcessmaker();
//$PM_SOAP->login( );
// now tries to get the variables to check condition
$infoForTasks = $locCase->getVariables($casevariables);
foreach ($infoForTasks as $casevar => $varval) {
$infoForTasks[ "@@$casevar" ] = "'$varval'";
unset( $infoForTasks[ $casevar ] );
}
//$msg .= " ***********\n";
//$msg .= ' $targetTask: '.str_replace("\n", "\n ", print_r($targetTask, true))."\n";
$targetTask['sourcecondition'] = str_replace( array_keys($infoForTasks), $infoForTasks, $targetTask['sourcecondition'] );
$eval = eval( "return (".$targetTask['sourcecondition']." ? 1 : 0);" );
//$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 .= ' $result: '."$eval\n";
//$msg .= "\n";
if ($eval) {
// look at each linked ticket if a case is attached and then if a task like $val is TO_DO
// then will try to routeCase for each tasks in $val
$postdata = [];
foreach ($targetTask['targetactions'] as $action => $actionvalue) {
$postdata['form'][$action] = eval( "return ".str_replace( array_keys($infoForTasks), $infoForTasks, $actionvalue)." ;" );
}
$postdata['UID'] = $targetTask['targetdynaform_guid'];
$postdata['__DynaformName__'] = $targetTask['targetprocess_guid']."_".$targetTask['targetdynaform_guid'];
$postdata['__notValidateThisFields__'] = '[]';
$postdata['DynaformRequiredFields'] = '[]';
$postdata['form']['btnGLPISendRequest'] = 'submit';
$externalapplicationparams = [];
if ($externalapplication) {
// must call curl
foreach ($externalapplication['params'] as $paramname => $variable) {
$externalapplicationparams[$paramname] = eval( "return ".str_replace( array_keys($infoForTasks), $infoForTasks, $variable)." ;" );
}
$externalapplicationparams['callback'] = $CFG_GLPI["url_base"]."/plugins/processmaker/ajax/asynchronousdatas.php";
$ch = curl_init();
$externalapplication['url'] = eval( "return '".str_replace( array_keys($infoForTasks), $infoForTasks, $externalapplication['url'])."' ;" ); // '???
curl_setopt($ch, CURLOPT_URL, $externalapplication['url'] );
if (isset($externalapplication['method']) && $externalapplication['method'] == 'POST') {
curl_setopt($ch, CURLOPT_POST, 1);
}
}
if ($targetTask['is_self']) {
$PM_SOAP->login(true);
$taskCase = $PM_SOAP->taskCase( $srccase_guid );
foreach ($taskCase as $task) {
// search for target task guid
if ($task->guid == $targetTask['targettask_guid']) {
break;
}
}
$PM_SOAP->login();
$postdata['APP_UID'] = $srccase_guid;
$postdata['DEL_INDEX'] = $task->delegate;
//need to get the 'ProcessMaker' user
$pmconfig = $PM_SOAP->config; //PluginProcessmakerConfig::getInstance();
$cronaction = new PluginProcessmakerCrontaskaction;
$cronaction->add( [ 'plugin_processmaker_caselinks_id' => $targetTask['id'],
'plugin_processmaker_cases_id' => $locCase->getID(),
//'itemtype' => $itemtype,
//'items_id' => $parm->fields['tickets_id'],
'users_id' => $pmconfig->fields['users_id'],
'is_targettoclaim' => $targetTask['is_targettoclaim'],
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
],
null,
false);
if ($externalapplication) {
// must call external application in order to get the needed data asynchroneously
// must be of the form
// {"url":"urloftheservice","params":{"user":"@@USER_ID","system":"GPP","list":"@@ROLE_LIST"}}
// url is the URL to be called
$externalapplicationparams['id'] = $cronaction->getID();
$externalapplicationparams = json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT);
curl_setopt($ch, CURLOPT_POSTFIELDS, $externalapplicationparams);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Content-Length: ' . strlen($externalapplicationparams), 'Expect:']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 );
curl_setopt($ch, CURLOPT_VERBOSE, 1);
if (isset($externalapplication['ssl_verify'])) {
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $externalapplication['ssl_verify']);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $externalapplication['ssl_verify']);
}
if (isset($externalapplication['proxy'])) {
curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1 ) ;
curl_setopt($ch, CURLOPT_PROXY, $externalapplication['proxy']);
}
$response = curl_exec ($ch);
if ($response === false) {
//throw new Exception(curl_error($ch), curl_errno($ch));
Toolbox::logDebug( curl_error($ch).":".curl_errno($ch) );
}
curl_close ($ch);
}
// }
} else {
// TODO to review this part of code as it is no longer usable like this !!!
foreach (Ticket_Ticket::getLinkedTicketsTo( $parm->fields['tickets_id'] ) as $tlink) {
if ($tlink['link'] == Ticket_Ticket::LINK_TO) {
$query = "SELECT glpi_plugin_processmaker_cases.id, MAX(glpi_plugin_processmaker_tasks.del_index) AS del_index FROM glpi_tickettasks
JOIN glpi_plugin_processmaker_taskcategories ON glpi_plugin_processmaker_taskcategories.taskcategories_id=glpi_tickettasks.taskcategories_id
JOIN glpi_plugin_processmaker_cases ON glpi_plugin_processmaker_cases.processes_id=glpi_plugin_processmaker_taskcategories.processes_id
RIGHT JOIN glpi_plugin_processmaker_tasks ON glpi_plugin_processmaker_tasks.items_id=glpi_tickettasks.id AND glpi_plugin_processmaker_tasks.case_id=glpi_plugin_processmaker_cases.id
WHERE glpi_plugin_processmaker_taskcategories.pm_task_guid = '".$targetTask['targettask_guid']."' AND glpi_tickettasks.state = 1 AND glpi_tickettasks.tickets_id=".$tlink['tickets_id'];
foreach ($DB->request($query) as $case) {
// must be only one row
$postdata['APP_UID'] = $case['id'];
$postdata['DEL_INDEX'] = $case['del_index'];
$cronaction = new PluginProcessmakerCrontaskaction;
$cronaction->add( [ 'plugin_processmaker_caselinks_id' => $targetTask['id'],
'plugin_processmaker_cases_id' => $locCase->getID(),
//'itemtype' => $itemtype,
//'items_id' => $parm->fields['tickets_id'],
'users_id' => Session::getLoginUserID(),
'is_targettoclaim' => $targetTask['is_targettoclaim'],
'state' => ($targetTask['is_externaldata'] ? PluginProcessmakerCrontaskaction::WAITING_DATA : PluginProcessmakerCrontaskaction::DATA_READY),
'postdata' => json_encode( $postdata, JSON_HEX_APOS | JSON_HEX_QUOT),
'logs_out' => json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT)
],
null,
false);
}
}
}
}
if ($targetTask['is_synchronous']) {
// must call PluginProcessmakerProcessmaker::cronPMTaskActions()
PluginProcessmakerProcessmaker::cronPMTaskActions();
}
}
}
//$msg .= "================\n";
//Toolbox::logInFile("processmaker", $msg);
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,392 +1,383 @@
<?php
/**
*/
class PluginProcessmakerConfig extends CommonDBTM {
static $rightname = '';
static private $_instance = null;
/**
* Summary of canCreate
* @return boolean
*/
static function canCreate() {
return Session::haveRight('config', UPDATE);
}
/**
* Summary of canView
* @return boolean
*/
static function canView() {
return Session::haveRight('config', READ);
}
/**
* Summary of canUpdate
* @return boolean
*/
static function canUpdate() {
return Session::haveRight('config', UPDATE);
}
/**
* Summary of getTypeName
* @param mixed $nb plural
* @return mixed
*/
static function getTypeName($nb = 0) {
return __('ProcessMaker setup', 'processmaker');
}
/**
* Summary of getName
* @param mixed $with_comment with comment
* @return mixed
*/
function getName($with_comment = 0) {
return __('ProcessMaker', 'processmaker');
}
/**
* Summary of getInstance
* @return PluginProcessmakerConfig
*/
static function getInstance() {
if (!isset(self::$_instance)) {
self::$_instance = new self();
if (!self::$_instance->getFromDB(1)) {
self::$_instance->getEmpty();
}
}
return self::$_instance;
}
/**
* Prepare input datas for updating the item
* @param array $input used to update the item
* @return array the modified $input array
**/
function prepareInputForUpdate($input) {
global $CFG_GLPI;
if (!isset($input["maintenance"])) {
$input["maintenance"] = 0;
}
if (isset($input["pm_dbserver_passwd"])) {
if (empty($input["pm_dbserver_passwd"])) {
unset($input["pm_dbserver_passwd"]);
} else {
$input["pm_dbserver_passwd"] = Toolbox::encrypt(stripslashes($input["pm_dbserver_passwd"]), GLPIKEY);
}
}
if (isset($input["_blank_pm_dbserver_passwd"]) && $input["_blank_pm_dbserver_passwd"]) {
$input['pm_dbserver_passwd'] = '';
}
if (isset($input["pm_admin_passwd"])) {
if (empty($input["pm_admin_passwd"])) {
unset($input["pm_admin_passwd"]);
} else {
$input["pm_admin_passwd"] = Toolbox::encrypt(stripslashes($input["pm_admin_passwd"]), GLPIKEY);
}
}
if (isset($input["_blank_pm_admin_passwd"]) && $input["_blank_pm_admin_passwd"]) {
$input['pm_admin_passwd'] = '';
}
if (isset($input['pm_server_URL'])) {
$input['domain'] = self::getCommonDomain( $CFG_GLPI['url_base'], $input['pm_server_URL'] );
}
return $input;
}
/**
* Summary of getCommonDomain
* @param mixed $url1 first url
* @param mixed $url2 second url
* @return string the common domain part of the given urls
*/
static function getCommonDomain($url1, $url2) {
$domain = '';
try {
$glpi = explode(".", parse_url($url1, PHP_URL_HOST));
$pm = explode( ".", parse_url($url2, PHP_URL_HOST));
$cglpi = array_pop( $glpi );
$cpm = array_pop( $pm );
while ($cglpi && $cpm && $cglpi == $cpm) {
$domain = $cglpi.($domain==''?'':'.'.$domain);
$cglpi = array_pop( $glpi );
$cpm = array_pop( $pm );
}
if ($domain != '') {
return $domain;
}
} catch (Exception $e) {
$domain = '';
}
return $domain;
}
/**
* Summary of showConfigForm
* @param mixed $item is the config
* @return boolean
*/
static function showConfigForm($item) {
global $PM_DB, $CFG_GLPI, $PM_SOAP;
$setup_ok = false;
$ui_theme = [
'glpi_classic' => 'glpi_classic',
'glpi_neoclassic' => 'glpi_neoclassic'
];
$config = $PM_SOAP->config;
$config->showFormHeader(['colspan' => 4]);
if (!$config->fields['maintenance']) {
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Server URL (must be in same domain than GLPI, if GLPI is using HTTPS, PM server must also use HTTPS)', 'processmaker')."</td><td >";
echo "<input size='50' type='text' name='pm_server_URL' value='".$config->fields['pm_server_URL']."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>".__('Common domain with GLPI', 'processmaker')."</td>";
echo "<td><font color='red'><div name='domain'>".$config->fields['domain']."</div></font>";
echo Html::scriptBlock("
function setCommonDomain() {
function parseUrl( url ) {
var a = document.createElement('a');
a.href = url;
// debugger;
return { host: a.hostname, port: a.port, scheme: a.protocol.slice(0, -1), path: a.pathname, query: a.search.slice(1), fragment: a.hash.slice(1) } ;
}
var domain = '';
try {
var glpi = parseUrl( '".$CFG_GLPI['url_base']."' ).host.split('.') ;
var pm = parseUrl( $('input[name=pm_server_URL]').val()).host.split('.');
var cglpi = glpi.pop() ;
var cpm = pm.pop() ;
while( cglpi && cpm && cglpi == cpm ) {
domain = cglpi + (domain==''?'':'.' + domain) ;
cglpi = glpi.pop() ;
cpm = pm.pop() ;
}
if (domain != '' && domain.split('.').length > 1) { // common domain must be at least 'domain.com' and not 'com', otherwise some browser will not accept the CORS javascript
$('div[name=domain]').text(domain) ;
$('div[name=domain]').parent().attr('color', 'green');
return;
}
} catch(ex) {}
$('div[name=domain]').text('".__('None!', 'processmaker')."') ;
$('div[name=domain]').parent().attr('color', 'red');
};
$('input[name=pm_server_URL]').on('keyup', setCommonDomain ) ;
setCommonDomain() ;
");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Verify SSL certificate', 'processmaker')."</td><td >";
Dropdown::showYesNo("ssl_verify", $config->fields['ssl_verify']);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Workspace Name', 'processmaker')."</td><td >";
echo "<input type='text' name='pm_workspace' value='".$config->fields['pm_workspace']."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Server administrator name', 'processmaker')."</td>";
echo "<td ><input type='text' name='pm_admin_user' value='".$config->fields["pm_admin_user"]."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Server administrator password', 'processmaker')."</td>";
echo "<td ><input type='password' name='pm_admin_passwd' value='' autocomplete='off'>";
echo "&nbsp;<input type='checkbox' name='_blank_pm_admin_passwd'>&nbsp;".__('Clear');
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Connection status', 'processmaker')."</td><td >";
//$pm = new PluginProcessmakerProcessmaker;
if ($config->fields['pm_server_URL'] != ''
&& $config->fields['pm_workspace'] != ''
&& $config->fields["pm_admin_user"] != ''
// && ($pm->login(true))) {
&& ($PM_SOAP->login(true))) {
echo "<font color='green'>".__('Test successful');
$setup_ok = true;
} else {
// echo "<font color='red'>".__('Test failed')."<br>".print_r($pm->lasterror, true);
echo "<font color='red'>".__('Test failed')."<br>".print_r($PM_SOAP->lasterror, true);
}
echo "</font></span></td></tr>\n";
echo "<tr><td colspan='4' class='center b'>".__('SQL server setup', 'processmaker')."</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('SQL server (MariaDB or MySQL)', 'processmaker') . "</td>";
echo "<td ><input type='text' size=50 name='pm_dbserver_name' value='".$config->fields["pm_dbserver_name"]."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('Database name', 'processmaker') . "</td>";
echo "<td ><input type='text' size=50 name='pm_dbname' value='".$config->fields['pm_dbname']."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('SQL user', 'processmaker') . "</td>";
echo "<td ><input type='text' name='pm_dbserver_user' value='".$config->fields["pm_dbserver_user"]."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('SQL password', 'processmaker') . "</td>";
echo "<td ><input type='password' name='pm_dbserver_passwd' value='' autocomplete='off'>";
echo "&nbsp;<input type='checkbox' name='_blank_pm_dbserver_passwd'>&nbsp;".__('Clear');
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Connection status', 'processmaker')."</td><td >";
if ($PM_DB->connected && isset($PM_DB->dbdefault) && $PM_DB->dbdefault != '') {
echo "<font color='green'>".__('Test successful');
} else {
echo "<font color='red'>".__('Test failed');
}
echo "</font></span></td></tr>\n";
echo "<tr><td colspan='4' class='center b'>".__('Settings')."</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Theme Name', 'processmaker')."</td><td >";
Dropdown::showFromArray('pm_theme', $ui_theme,
['value' => $config->fields['pm_theme']]);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Main Task Category (edit to change name)', 'processmaker')."</td><td >";
TaskCategory::dropdown(['name' => 'taskcategories_id',
'display_emptychoice' => true,
'value' => $config->fields['taskcategories_id']]);
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Task Writer (edit to change name)', 'processmaker')."</td><td >";
$rand = mt_rand();
User::dropdown(['name' => 'users_id',
'display_emptychoice' => true,
'right' => 'all',
'rand' => $rand,
'value' => $config->fields['users_id']]);
// this code adds the + sign to the form
echo "<img alt='' title=\"".__s('Add')."\" src='".$CFG_GLPI["root_doc"].
"/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;'
onClick=\"".Html::jsGetElementbyID('add_dropdown'.$rand).".dialog('open');\">";
echo Ajax::createIframeModalWindow('add_dropdown'.$rand,
User::getFormURL(),
['display' => false]);
// end of + sign
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Group in ProcessMaker which will contain all GLPI users', 'processmaker')."</td><td >";
$pmGroups = [ 0 => Dropdown::EMPTY_VALUE ];
//$res = $PM_DB->request([
// 'SELECT DISTINCT' => 'CON_ID',
// 'FIELDS' => 'CON_VALUE',
// 'FROM' => 'CONTENT',
// 'WHERE' => ['CON_CATEGORY' => 'GRP_TITLE'],
// 'ORDER' => 'CON_VALUE'
// ]);
//$query = "SELECT DISTINCT CON_ID, CON_VALUE FROM CONTENT WHERE CON_CATEGORY='GRP_TITLE' ORDER BY CON_VALUE;";
if ($PM_DB->connected) {
$res = $PM_DB->request([
'SELECT DISTINCT' => 'CON_ID',
'FIELDS' => 'CON_VALUE',
'FROM' => 'CONTENT',
'WHERE' => ['CON_CATEGORY' => 'GRP_TITLE'],
'ORDER' => 'CON_VALUE'
]);
foreach ($res as $row) {
$pmGroups[ $row['CON_ID'] ] = $row['CON_VALUE'];
}
Dropdown::showFromArray( 'pm_group_guid', $pmGroups, ['value' => $config->fields['pm_group_guid']] );
} else {
echo "<font color='red'>".__('Not connected');
}
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('Max cases per item (0=unlimited)', 'processmaker') . "</td>";
echo "<td ><input type='text' name='max_cases_per_item' value='".$config->fields["max_cases_per_item"]."'>";
echo "</td></tr>\n";
} else {
echo "<tr><td colspan='4' class='center b'>";
PluginProcessmakerProcessmaker::showUnderMaintenance();
echo "</td></tr>";
}
echo "<tr><td colspan='4' class='center b'>".__('Maintenance')."</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Maintenance mode')."</td><td >";
Dropdown::showYesNo("maintenance", $config->fields['maintenance']);
echo "</td></tr>";
echo "<tr><td colspan='4'></td></tr>";
echo "<tr><th colspan='4'>".__('Processmaker system information', 'processmaker')."</th></tr>";
if ($setup_ok) {
$info = $PM_SOAP->systemInformation( );
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.$info->version.'</td></tr>';
echo '<tr><td>'.__('Web server', 'processmaker').'</td><td>'.$info->webServer.'</td></tr>';
echo '<tr><td>'.__('Server name', 'processmaker').'</td><td>'.$info->serverName.'</td></tr>';
echo '<tr><td>'.__('PHP version', 'processmaker').'</td><td>'.$info->phpVersion.'</td></tr>';
echo '<tr><td>'.__('DB version', 'processmaker').'</td><td>'.$info->databaseVersion.'</td></tr>';
echo '<tr><td>'.__('DB server IP', 'processmaker').'</td><td>'.$info->databaseServerIp.'</td></tr>';
echo '<tr><td>'.__('DB name', 'processmaker').'</td><td>'.$info->databaseName.'</td></tr>';
echo '<tr><td>'.__('User browser', 'processmaker').'</td><td>'.$info->userBrowser.'</td></tr>';
echo '<tr><td>'.__('User IP', 'processmaker').'</td><td>'.$info->userIp.'</td></tr>';
} else {
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.__('Not yet!', 'processmaker').'</td></tr>';
}
$config->showFormButtons(['candel' => false]);
return false;
}
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
if ($item->getType()=='Config') {
return __('ProcessMaker', 'processmaker');
}
return '';
}
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
if ($item->getType()=='Config') {
self::showConfigForm($item);
}
return true;
}
}
<?php
/**
*/
class PluginProcessmakerConfig extends CommonDBTM {
static $rightname = '';
static private $_instance = null;
/**
* Summary of canCreate
* @return boolean
*/
static function canCreate() {
return Session::haveRight('config', UPDATE);
}
/**
* Summary of canView
* @return boolean
*/
static function canView() {
return Session::haveRight('config', READ);
}
/**
* Summary of canUpdate
* @return boolean
*/
static function canUpdate() {
return Session::haveRight('config', UPDATE);
}
/**
* Summary of getTypeName
* @param mixed $nb plural
* @return mixed
*/
static function getTypeName($nb = 0) {
return __('ProcessMaker setup', 'processmaker');
}
/**
* Summary of getName
* @param mixed $with_comment with comment
* @return mixed
*/
function getName($with_comment = 0) {
return __('ProcessMaker', 'processmaker');
}
/**
* Summary of getInstance
* @return PluginProcessmakerConfig
*/
static function getInstance() {
if (!isset(self::$_instance)) {
self::$_instance = new self();
if (!self::$_instance->getFromDB(1)) {
self::$_instance->getEmpty();
}
}
return self::$_instance;
}
/**
* Prepare input datas for updating the item
* @param array $input used to update the item
* @return array the modified $input array
**/
function prepareInputForUpdate($input) {
global $CFG_GLPI;
if (!isset($input["maintenance"])) {
$input["maintenance"] = 0;
}
if (isset($input["pm_dbserver_passwd"])) {
if (empty($input["pm_dbserver_passwd"])) {
unset($input["pm_dbserver_passwd"]);
} else {
$input["pm_dbserver_passwd"] = Toolbox::sodiumEncrypt(stripslashes($input["pm_dbserver_passwd"]));
}
}
if (isset($input["_blank_pm_dbserver_passwd"]) && $input["_blank_pm_dbserver_passwd"]) {
$input['pm_dbserver_passwd'] = '';
}
if (isset($input["pm_admin_passwd"])) {
if (empty($input["pm_admin_passwd"])) {
unset($input["pm_admin_passwd"]);
} else {
$input["pm_admin_passwd"] = Toolbox::sodiumEncrypt(stripslashes($input["pm_admin_passwd"]));
}
}
if (isset($input["_blank_pm_admin_passwd"]) && $input["_blank_pm_admin_passwd"]) {
$input['pm_admin_passwd'] = '';
}
if (isset($input['pm_server_URL'])) {
$input['domain'] = self::getCommonDomain( $CFG_GLPI['url_base'], $input['pm_server_URL'] );
}
return $input;
}
/**
* Summary of getCommonDomain
* @param mixed $url1 first url
* @param mixed $url2 second url
* @return string the common domain part of the given urls
*/
static function getCommonDomain($url1, $url2) {
$domain = '';
try {
$glpi = explode(".", parse_url($url1, PHP_URL_HOST));
$pm = explode( ".", parse_url($url2, PHP_URL_HOST));
$cglpi = array_pop( $glpi );
$cpm = array_pop( $pm );
while ($cglpi && $cpm && $cglpi == $cpm) {
$domain = $cglpi.($domain==''?'':'.'.$domain);
$cglpi = array_pop( $glpi );
$cpm = array_pop( $pm );
}
if ($domain != '') {
return $domain;
}
} catch (Exception $e) {
$domain = '';
}
return $domain;
}
/**
* Summary of showConfigForm
* @param mixed $item is the config
* @return boolean
*/
static function showConfigForm($item) {
global $PM_DB, $CFG_GLPI, $PM_SOAP;
$setup_ok = false;
$ui_theme = [
'glpi_classic' => 'glpi_classic',
'glpi_neoclassic' => 'glpi_neoclassic'
];
$config = $PM_SOAP->config;
$config->showFormHeader(['colspan' => 2]);
if (!$config->fields['maintenance']) {
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Server URL (must be in same domain than GLPI, if GLPI is using HTTPS, PM server must also use HTTPS)', 'processmaker')."</td><td >";
echo "<input size='50' type='text' name='pm_server_URL' value='".$config->fields['pm_server_URL']."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>".__('Common domain with GLPI', 'processmaker')."</td>";
echo "<td><font color='red'><div name='domain'>".$config->fields['domain']."</div></font>";
echo Html::scriptBlock("
function setCommonDomain() {
function parseUrl( url ) {
var a = document.createElement('a');
a.href = url;
//debugger;
return { host: a.hostname, port: a.port, scheme: a.protocol.slice(0, -1), path: a.pathname, query: a.search.slice(1), fragment: a.hash.slice(1) } ;
}
var domain = '';
try {
var glpi = parseUrl( '".$CFG_GLPI['url_base']."' ).host.split('.') ;
var pm = parseUrl( $('input[name=pm_server_URL]').val()).host.split('.');
var cglpi = glpi.pop() ;
var cpm = pm.pop() ;
while( cglpi && cpm && cglpi == cpm ) {
domain = cglpi + (domain==''?'':'.' + domain) ;
cglpi = glpi.pop() ;
cpm = pm.pop() ;
}
if (domain != '' && domain.split('.').length > 1) { // common domain must be at least 'domain.com' and not 'com', otherwise some browser will not accept the CORS javascript
$('div[name=domain]').text(domain) ;
$('div[name=domain]').parent().attr('color', 'green');
return;
}
} catch(ex) {}
$('div[name=domain]').text('".__('None!', 'processmaker')."') ;
$('div[name=domain]').parent().attr('color', 'red');
};
$('input[name=pm_server_URL]').on('keyup', setCommonDomain ) ;
setCommonDomain() ;
");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Verify SSL certificate', 'processmaker')."</td><td >";
Dropdown::showYesNo("ssl_verify", $config->fields['ssl_verify']);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Workspace Name', 'processmaker')."</td><td >";
echo "<input type='text' name='pm_workspace' value='".$config->fields['pm_workspace']."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Server administrator name', 'processmaker')."</td>";
echo "<td ><input type='text' name='pm_admin_user' value='".$config->fields["pm_admin_user"]."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Server administrator password', 'processmaker')."</td>";
echo "<td ><input type='password' name='pm_admin_passwd' value='' autocomplete='off'>";
echo "&nbsp;<input type='checkbox' name='_blank_pm_admin_passwd'>&nbsp;".__('Clear');
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Connection status', 'processmaker')."</td><td >";
//$pm = new PluginProcessmakerProcessmaker;
if ($config->fields['pm_server_URL'] != ''
&& $config->fields['pm_workspace'] != ''
&& $config->fields["pm_admin_user"] != ''
&& ($PM_SOAP->login(true))) {
echo "<font color='green'>".__('Test successful');
$setup_ok = true;
} else {
// echo "<font color='red'>".__('Test failed')."<br>".print_r($pm->lasterror, true);
echo "<font color='red'>".__('Test failed')."<br>".print_r($PM_SOAP->lasterror, true);
}
echo "</font></span></td></tr>\n";
echo "<tr><th colspan='2'>".__('SQL server setup', 'processmaker')."</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('SQL server (MariaDB or MySQL)', 'processmaker') . "</td>";
echo "<td ><input type='text' size=50 name='pm_dbserver_name' value='".$config->fields["pm_dbserver_name"]."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('Database name', 'processmaker') . "</td>";
echo "<td ><input type='text' size=50 name='pm_dbname' value='".$config->fields['pm_dbname']."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('SQL user', 'processmaker') . "</td>";
echo "<td ><input type='text' name='pm_dbserver_user' value='".$config->fields["pm_dbserver_user"]."'>";
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('SQL password', 'processmaker') . "</td>";
echo "<td ><input type='password' name='pm_dbserver_passwd' value='' autocomplete='off'>";
echo "&nbsp;<input type='checkbox' name='_blank_pm_dbserver_passwd'>&nbsp;".__('Clear');
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Connection status', 'processmaker')."</td><td >";
if ($PM_DB->connected && isset($PM_DB->dbdefault) && $PM_DB->dbdefault != '') {
echo "<font color='green'>".__('Test successful');
} else {
echo "<font color='red'>".__('Test failed');
}
echo "</font></span></td></tr>\n";
echo "<tr><th colspan='2' >".__('Settings')."</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Theme Name', 'processmaker')."</td><td >";
Dropdown::showFromArray('pm_theme', $ui_theme,
['value' => $config->fields['pm_theme']]);
echo "</td></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Main Task Category (edit to change name)', 'processmaker')."</td><td >";
TaskCategory::dropdown(['name' => 'taskcategories_id',
'display_emptychoice' => true,
'value' => $config->fields['taskcategories_id']]);
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Task writer (edit to change name)', 'processmaker')."</td><td >";
$rand = mt_rand();
User::dropdown(['name' => 'users_id',
'display_emptychoice' => true,
'right' => 'all',
'rand' => $rand,
'value' => $config->fields['users_id']]);
// this code adds the + sign to the form
echo "<img alt='' title=\"".__s('Add')."\" src='".$CFG_GLPI["root_doc"].
"/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;'
onClick=\"".Html::jsGetElementbyID('add_dropdown'.$rand).".dialog('open');\">";
echo Ajax::createIframeModalWindow('add_dropdown'.$rand,
User::getFormURL(),
['display' => false]);
// end of + sign
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Group in ProcessMaker which will contain all GLPI users', 'processmaker')."</td><td >";
$pmGroups = [ 0 => Dropdown::EMPTY_VALUE ];
if ($PM_DB->connected) {
$res = $PM_DB->request([
'DISTINCT' => 'CON_ID',
'FIELDS' => ['CON_ID', 'CON_VALUE'],
'FROM' => 'CONTENT',
'WHERE' => ['CON_CATEGORY' => 'GRP_TITLE'],
'ORDER' => 'CON_VALUE'
]);
foreach ($res as $row) {
$pmGroups[ $row['CON_ID'] ] = $row['CON_VALUE'];
}
Dropdown::showFromArray('pm_group_guid', $pmGroups, ['value' => $config->fields['pm_group_guid']]);
} else {
echo "<font color='red'>".__('Not connected');
}
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >" . __('Max cases per item (0=unlimited)', 'processmaker') . "</td>";
echo "<td ><input type='text' name='max_cases_per_item' value='".$config->fields["max_cases_per_item"]."'>";
echo "</td></tr>\n";
} else {
echo "<tr><td colspan='2' class='center b'>";
PluginProcessmakerProcessmaker::showUnderMaintenance();
echo "</td></tr>";
}
echo "<tr><th colspan='2'>".__('Maintenance')."</th></tr>";
echo "<tr class='tab_bg_1'>";
echo "<td >".__('Maintenance mode')."</td><td >";
Dropdown::showYesNo("maintenance", $config->fields['maintenance']);
echo "</td></tr>";
echo "<tr><td colspan='2'></td></tr>";
echo "<tr><th colspan='2'>".__('ProcessMaker system information', 'processmaker')."</th></tr>";
if ($setup_ok) {
$info = $PM_SOAP->systemInformation( );
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.$info->version.'</td></tr>';
echo '<tr><td>'.__('Web server', 'processmaker').'</td><td>'.$info->webServer.'</td></tr>';
echo '<tr><td>'.__('Server name', 'processmaker').'</td><td>'.$info->serverName.'</td></tr>';
echo '<tr><td>'.__('PHP version', 'processmaker').'</td><td>'.$info->phpVersion.'</td></tr>';
echo '<tr><td>'.__('DB version', 'processmaker').'</td><td>'.$info->databaseVersion.'</td></tr>';
echo '<tr><td>'.__('DB server IP', 'processmaker').'</td><td>'.$info->databaseServerIp.'</td></tr>';
echo '<tr><td>'.__('DB name', 'processmaker').'</td><td>'.$info->databaseName.'</td></tr>';
echo '<tr><td>'.__('User browser', 'processmaker').'</td><td>'.$info->userBrowser.'</td></tr>';
echo '<tr><td>'.__('User IP', 'processmaker').'</td><td>'.$info->userIp.'</td></tr>';
} else {
echo '<tr><td>'.__('Version', 'processmaker').'</td><td>'.__('Not yet!', 'processmaker').'</td></tr>';
}
$config->showFormButtons(['candel' => false, 'colspan' => 1]);
return false;
}
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
if ($item->getType()=='Config') {
return __('ProcessMaker', 'processmaker');
}
return '';
}
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
if ($item->getType()=='Config') {
self::showConfigForm($item);
}
return true;
}
}

View File

@@ -1,26 +1,26 @@
<?php
class PluginProcessmakerDB extends DBmysql {
var $dbhost;
var $dbuser;
var $dbpassword;
var $dbdefault;
function __construct() {
$config = PluginProcessmakerConfig::getInstance();
if ($config->fields['pm_dbserver_name'] != ''
&& $config->fields['pm_dbserver_user'] != ''
&& $config->fields['pm_workspace'] != '' ) {
$this->dbhost = $config->fields['pm_dbserver_name'];
$this->dbuser = $config->fields['pm_dbserver_user'];
$this->dbpassword = Toolbox::decrypt($config->fields['pm_dbserver_passwd'], GLPIKEY);
$this->dbdefault = isset($config->fields['pm_dbname']) ? $config->fields['pm_dbname'] : '';
parent::__construct();
}
}
}
<?php
class PluginProcessmakerDB extends DBmysql {
var $dbhost;
var $dbuser;
var $dbpassword;
var $dbdefault;
function __construct() {
$config = PluginProcessmakerConfig::getInstance();
if ($config->fields['pm_dbserver_name'] != ''
&& $config->fields['pm_dbserver_user'] != ''
&& $config->fields['pm_workspace'] != '' ) {
$this->dbhost = $config->fields['pm_dbserver_name'];
$this->dbuser = $config->fields['pm_dbserver_user'];
$this->dbpassword = Toolbox::sodiumDecrypt($config->fields['pm_dbserver_passwd']);
$this->dbdefault = isset($config->fields['pm_dbname']) ? $config->fields['pm_dbname'] : '';
parent::__construct();
}
}
}

48
inc/glpikey.class.php Normal file
View File

@@ -0,0 +1,48 @@
<?php
/**
* PluginProcessmakerGlpikey short summary.
*
* PluginProcessmakerGlpikey description.
*
* @version 1.0
* @author MoronO
*/
class PluginProcessmakerGlpikey extends GLPIKey {
protected $fields = [
'glpi_plugin_processmaker_configs.pm_admin_passwd',
'glpi_plugin_processmaker_configs.pm_dbserver_passwd',
];
/**
* Get fields
*
* @return array
*/
public function getFields() :array {
return $this->fields;
}
/**
* Generate GLPI security key used for decryptable passwords
* and update values in DB if necessary.
* @return boolean
*/
public function migratePasswords() {
global $DB;
// Fetch old key and migrate
$sodium_key = null;
$old_key = $this->getLegacyKey();
if ($DB instanceof DBmysql) {
return $this->migrateFieldsInDb($sodium_key, $old_key);
}
return false;
}
}

View File

@@ -1,58 +1,59 @@
<?php
class PluginProcessmakerMenu extends CommonGLPI {
static $rightname = 'plugin_processmaker_config';
static function getMenuName() {
return 'ProcessMaker';
}
static function getMenuContent() {
if (!Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE])) {
return;
}
$front_page = "/plugins/processmaker/front";
$menu = [];
$menu['title'] = self::getMenuName();
$menu['page'] = "$front_page/process.php";
$menu['links']['search'] = PluginProcessmakerProcess::getSearchURL(false);
if (Session::haveRightsOr("config", [READ, UPDATE])) {
$menu['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
}
$itemtypes = ['PluginProcessmakerProcess' => 'processes',
'PluginProcessmakerCaselink' => 'caselinks'
];
foreach ($itemtypes as $itemtype => $option) {
$menu['options'][$option]['title'] = $itemtype::getTypeName(Session::getPluralNumber());
$menu['options'][$option]['page'] = $itemtype::getSearchURL(false);
$menu['options'][$option]['links']['search'] = $itemtype::getSearchURL(false);
if (Session::haveRightsOr("config", [READ, UPDATE])) {
$menu['options'][$option]['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
}
switch ($itemtype) {
case 'PluginProcessmakerProcess':
//if ($itemtype::canCreate()) {
// $menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
//}
break;
case 'PluginProcessmakerCaselink':
if (Session::haveRight("plugin_processmaker_config", UPDATE)) {
$menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
}
break;
default :
$menu['options'][$option]['page'] = PluginProcessmakerProcess::getSearchURL(false);
break;
}
}
return $menu;
}
}
<?php
class PluginProcessmakerMenu extends CommonGLPI {
static $rightname = 'plugin_processmaker_config';
static function getMenuName() {
return 'ProcessMaker';
}
static function getMenuContent() {
if (!Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE])) {
return [];
}
$front_page = "/plugins/processmaker/front";
$menu = [];
$menu['title'] = self::getMenuName();
$menu['page'] = "$front_page/process.php";
$menu['links']['search'] = PluginProcessmakerProcess::getSearchURL(false);
if (Session::haveRightsOr("config", [READ, UPDATE])) {
$menu['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
}
$menu['icon'] = "'></i><img src=\"/plugins/processmaker/pics/processmaker-xxs.png\" style=\"vertical-align: middle;\"/><i class='";
$itemtypes = ['PluginProcessmakerProcess' => 'processes',
'PluginProcessmakerCaselink' => 'caselinks'
];
foreach ($itemtypes as $itemtype => $option) {
$menu['options'][$option]['title'] = $itemtype::getTypeName(Session::getPluralNumber());
$menu['options'][$option]['page'] = $itemtype::getSearchURL(false);
$menu['options'][$option]['links']['search'] = $itemtype::getSearchURL(false);
if (Session::haveRightsOr("config", [READ, UPDATE])) {
$menu['options'][$option]['links']['config'] = PluginProcessmakerConfig::getFormURL(false);
}
switch ($itemtype) {
case 'PluginProcessmakerProcess':
//if ($itemtype::canCreate()) {
// $menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
//}
break;
case 'PluginProcessmakerCaselink':
if (Session::haveRight("plugin_processmaker_config", UPDATE)) {
$menu['options'][$option]['links']['add'] = $itemtype::getFormURL(false);
}
break;
default :
$menu['options'][$option]['page'] = PluginProcessmakerProcess::getSearchURL(false);
break;
}
}
return $menu;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,219 +1,204 @@
<?php
/**
* process_profile short summary.
*
* process_profile description.
*
* @version 1.0
* @author MoronO
*/
class PluginProcessmakerProcess_Profile extends CommonDBTM
{
static $rightname = '';
function can($ID, $right, array &$input = null) {
switch ($right) {
case DELETE :
case PURGE :
return (Session::haveRight('plugin_processmaker_config', UPDATE));
}
return Session::haveRight('plugin_processmaker_config', $right);
}
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
return __('Authorizations', 'processmaker');
}
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
global $DB;
$ID = $item->getField('id');
$canshowentity = Session::haveRight("entity", READ);
$canedit = Session::haveRight('plugin_processmaker_config', UPDATE);
$rand=mt_rand();
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='entityprocess_form$rand' id='entityprocess_form$rand' method='post' action='";
echo Toolbox::getItemTypeFormURL(__CLASS__)."'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='6'>".__('Authorizations', 'processmaker')."</tr>";
echo "<tr class='tab_bg_2'><td class='center'>";
echo "<input type='hidden' name='plugin_processmaker_processes_id' value='$ID'>";
Entity::Dropdown( ['entity' => $_SESSION['glpiactiveentities']]);
echo "</td><td class='center'>".Profile::getTypeName(1)."</td><td>";
Profile::dropdownUnder(['value' => Profile::getDefault()]);
echo "</td><td class='center'>".__('Recursive')."</td><td>";
Dropdown::showYesNo("is_recursive", 0);
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\""._sx('button', 'Add')."\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
$res = $DB->request([
'SELECT DISTINCT' => 'gpp.id AS linkID',
'FIELDS' => [
'gpp.id AS linkID',
'glpi_profiles.id',
'glpi_profiles.name',
'gpp.is_recursive',
'glpi_entities.completename',
'gpp.entities_id'
],
'FROM' => self::getTable() .' AS gpp',
'LEFT JOIN' => [
'glpi_profiles' => [
'FKEY' => [
'glpi_profiles' => 'id',
'gpp' => 'profiles_id'
]
],
'glpi_entities' => [
'FKEY' => [
'glpi_entities' => 'id',
'gpp' => 'entities_id'
]
]
],
'WHERE' => [ 'gpp.plugin_processmaker_processes_id' => $ID ],
'ORDER' => [ 'glpi_profiles.name', 'glpi_entities.completename' ]
]);
//$query = "SELECT DISTINCT gpp.`id` AS linkID,
// `glpi_profiles`.`id`,
// `glpi_profiles`.`name`,
// `gpp`.`is_recursive`,
// `glpi_entities`.`completename`,
// `gpp`.`entities_id`
// FROM `". self::getTable() ."` as gpp
// LEFT JOIN `glpi_profiles`
// ON (`gpp`.`profiles_id` = `glpi_profiles`.`id`)
// LEFT JOIN `glpi_entities`
// ON (`gpp`.`entities_id` = `glpi_entities`.`id`)
// WHERE `gpp`.`plugin_processmaker_processes_id` = '$ID'
// ORDER BY `glpi_profiles`.`name`, `glpi_entities`.`completename`";
//$result = $DB->query($query);
//$num = $DB->numrows($result);
$num = $res->numrows();
echo "<div class='spaced'>";
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
if ($canedit && $num) {
$massiveactionparams = ['num_displayed' => $num,
'container' => 'mass'.__CLASS__.$rand];
Html::showMassiveActions($massiveactionparams);
}
if ($num > 0) {
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit) {
$header_begin .= "<th>";
$header_top .= Html::getCheckAllAsCheckbox('mass'.__CLASS__.$rand);
$header_bottom .= Html::getCheckAllAsCheckbox('mass'.__CLASS__.$rand);
$header_end .= "</th>";
}
$header_end .= "<th>"._n('Entity', 'Entities', Session::getPluralNumber())."</th>";
$header_end .= "<th>".sprintf('%1$s (%2$s)', Profile::getTypeName(Session::getPluralNumber()),
__('D=Dynamic, R=Recursive'));
$header_end .= "</th></tr>";
echo $header_begin.$header_top.$header_end;
//while ($data = $DB->fetch_assoc($result)) {
foreach ($res as $data) {
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td width='10'>";
if (in_array($data["entities_id"], $_SESSION['glpiactiveentities'])) {
Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]);
} else {
echo "&nbsp;";
}
echo "</td>";
}
echo "<td>";
$link = $data["completename"];
if ($_SESSION["glpiis_ids_visible"]) {
$link = sprintf('%1$s (%2$s)', $link, $data["entities_id"]);
}
if ($canshowentity) {
echo "<a href='".Toolbox::getItemTypeFormURL('Entity')."?id=".
$data["entities_id"]."'>";
}
echo $link.($canshowentity ? "</a>" : '');
echo "</td>";
if (Profile::canView()) {
$entname = "<a href='".Toolbox::getItemTypeFormURL('Profile')."?id=".$data["id"]."'>".
$data["name"]."</a>";
} else {
$entname = $data["name"];
}
if ($data["is_recursive"]) {
$entname = sprintf('%1$s %2$s', $entname, "<span class='b'>(");
if ($data["is_recursive"]) {
//TRANS: letter 'R' for Recursive
$entname = sprintf('%1$s%2$s', $entname, __('R'));
}
$entname = sprintf('%1$s%2$s', $entname, ")</span>");
}
echo "<td>".$entname."</td>";
echo "</tr>";
}
echo $header_begin.$header_bottom.$header_end;
echo "</table>";
} else {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>".__('No item found')."</th></tr>";
echo "</table>\n";
}
if ($canedit && $num) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
}
Html::closeForm();
echo "</div>";
}
/**
* Summary of prepareInputForAdd
* @param mixed $input
* @return mixed
*/
function prepareInputForAdd($input) {
$tmp = new self;
$restrict=[
'WHERE' => [
'plugin_processmaker_processes_id' => $input['plugin_processmaker_processes_id'],
'entities_id' => $input['entities_id'],
'profiles_id' => $input['profiles_id']
],
];
if ($tmp->getFromDBByRequest($restrict)) {
//// then update existing
//$tmp->update(['id' => $tmp->getID(),
// 'is_recursive' => $input['is_recursive']]);
Session::addMessageAfterRedirect(__('Authorization not added: already existing!', 'processmaker'), true, WARNING);
return []; // to cancel add
}
return $input;
}
}
<?php
/**
* process_profile short summary.
*
* process_profile description.
*
* @version 1.0
* @author MoronO
*/
class PluginProcessmakerProcess_Profile extends CommonDBTM
{
static $rightname = '';
function can($ID, $right, array &$input = null) {
switch ($right) {
case DELETE :
case PURGE :
return (Session::haveRight('plugin_processmaker_config', UPDATE));
}
return Session::haveRight('plugin_processmaker_config', $right);
}
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
return __('Authorizations', 'processmaker');
}
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
global $DB;
$ID = $item->getField('id');
$canshowentity = Session::haveRight("entity", READ);
$canedit = Session::haveRight('plugin_processmaker_config', UPDATE);
$rand=mt_rand();
if ($canedit) {
echo "<div class='firstbloc'>";
echo "<form name='entityprocess_form$rand' id='entityprocess_form$rand' method='post' action='";
echo Toolbox::getItemTypeFormURL(__CLASS__)."'>";
echo "<table class='tab_cadre_fixe'>";
echo "<tr class='tab_bg_1'><th colspan='6'>".__('Authorizations', 'processmaker')."</tr>";
echo "<tr class='tab_bg_2'><td class='center'>";
echo "<input type='hidden' name='plugin_processmaker_processes_id' value='$ID'>";
Entity::Dropdown( ['entity' => $_SESSION['glpiactiveentities']]);
echo "</td><td class='center'>".Profile::getTypeName(1)."</td><td>";
Profile::dropdownUnder(['value' => Profile::getDefault()]);
echo "</td><td class='center'>".__('Recursive')."</td><td>";
Dropdown::showYesNo("is_recursive", 0);
echo "</td><td class='center'>";
echo "<input type='submit' name='add' value=\""._sx('button', 'Add')."\" class='submit'>";
echo "</td></tr>";
echo "</table>";
Html::closeForm();
echo "</div>";
}
$res = $DB->request([
'SELECT' => [
'gpp.id AS linkID',
'glpi_profiles.id',
'glpi_profiles.name',
'gpp.is_recursive',
'glpi_entities.completename',
'gpp.entities_id'
],
'DISTINCT' => true,
'FROM' => self::getTable() .' AS gpp',
'LEFT JOIN' => [
'glpi_profiles' => [
'FKEY' => [
'glpi_profiles' => 'id',
'gpp' => 'profiles_id'
]
],
'glpi_entities' => [
'FKEY' => [
'glpi_entities' => 'id',
'gpp' => 'entities_id'
]
]
],
'WHERE' => [ 'gpp.plugin_processmaker_processes_id' => $ID ],
'ORDER' => [ 'glpi_profiles.name', 'glpi_entities.completename' ]
]);
$num = $res->numrows();
echo "<div class='spaced'>";
Html::openMassiveActionsForm('mass'.__CLASS__.$rand);
if ($canedit && $num) {
$massiveactionparams = ['num_displayed' => $num,
'container' => 'mass'.__CLASS__.$rand];
Html::showMassiveActions($massiveactionparams);
}
if ($num > 0) {
echo "<table class='tab_cadre_fixehov'>";
$header_begin = "<tr>";
$header_top = '';
$header_bottom = '';
$header_end = '';
if ($canedit) {
$header_begin .= "<th>";
$header_top .= Html::getCheckAllAsCheckbox('mass'.__CLASS__.$rand);
$header_bottom .= Html::getCheckAllAsCheckbox('mass'.__CLASS__.$rand);
$header_end .= "</th>";
}
$header_end .= "<th>"._n('Entity', 'Entities', Session::getPluralNumber())."</th>";
$header_end .= "<th>".sprintf('%1$s (%2$s)', Profile::getTypeName(Session::getPluralNumber()),
__('D=Dynamic, R=Recursive'));
$header_end .= "</th></tr>";
echo $header_begin.$header_top.$header_end;
//while ($data = $DB->fetch_assoc($result)) {
foreach ($res as $data) {
echo "<tr class='tab_bg_1'>";
if ($canedit) {
echo "<td width='10'>";
if (in_array($data["entities_id"], $_SESSION['glpiactiveentities'])) {
Html::showMassiveActionCheckBox(__CLASS__, $data["linkID"]);
} else {
echo "&nbsp;";
}
echo "</td>";
}
echo "<td>";
$link = $data["completename"];
if ($_SESSION["glpiis_ids_visible"]) {
$link = sprintf('%1$s (%2$s)', $link, $data["entities_id"]);
}
if ($canshowentity) {
echo "<a href='".Toolbox::getItemTypeFormURL('Entity')."?id=".
$data["entities_id"]."'>";
}
echo $link.($canshowentity ? "</a>" : '');
echo "</td>";
if (Profile::canView()) {
$entname = "<a href='".Toolbox::getItemTypeFormURL('Profile')."?id=".$data["id"]."'>".
$data["name"]."</a>";
} else {
$entname = $data["name"];
}
if ($data["is_recursive"]) {
$entname = sprintf('%1$s %2$s', $entname, "<span class='b'>(");
if ($data["is_recursive"]) {
//TRANS: letter 'R' for Recursive
$entname = sprintf('%1$s%2$s', $entname, __('R'));
}
$entname = sprintf('%1$s%2$s', $entname, ")</span>");
}
echo "<td>".$entname."</td>";
echo "</tr>";
}
echo $header_begin.$header_bottom.$header_end;
echo "</table>";
} else {
echo "<table class='tab_cadre_fixe'>";
echo "<tr><th>".__('No item found')."</th></tr>";
echo "</table>\n";
}
if ($canedit && $num) {
$massiveactionparams['ontop'] = false;
Html::showMassiveActions($massiveactionparams);
}
Html::closeForm();
echo "</div>";
}
/**
* Summary of prepareInputForAdd
* @param mixed $input
* @return mixed
*/
function prepareInputForAdd($input) {
$tmp = new self;
$restrict=[
'WHERE' => [
'plugin_processmaker_processes_id' => $input['plugin_processmaker_processes_id'],
'entities_id' => $input['entities_id'],
'profiles_id' => $input['profiles_id']
],
];
if ($tmp->getFromDBByRequest($restrict)) {
//// then update existing
//$tmp->update(['id' => $tmp->getID(),
// 'is_recursive' => $input['is_recursive']]);
Session::addMessageAfterRedirect(__('Authorization not added: already existing!', 'processmaker'), true, WARNING);
return []; // to cancel add
}
return $input;
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -1,385 +1,385 @@
<?php
/**
* PluginProcessmakerTaskCategory short summary.
*
* PluginProcessmakerTaskCategory description.
*
* @version 1.0
* @author MoronO
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access directly to this file");
}
class PluginProcessmakerTaskCategory extends CommonDBTM
{
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
if ($item->getType() == 'TaskCategory') {
$pmtaskcat = new PluginProcessmakerTaskCategory;
if ($pmtaskcat->getFromDBbyCategory($item->fields['id'])) {
return __('Process task', 'processmaker');
} else {
return ''; // means no tab
}
}
return __('Task list', 'processmaker');
}
static function displayTabContentForProcess(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
global $DB, $CFG_GLPI;
self::title($item);
echo "<div class='center'><br><table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='7'>".__('Task List', 'processmaker')."</th></tr>";
echo "<tr><th>".__('Task name', 'processmaker')."</th>".
"<th>".__('Complete name')."</th>" .
"<th>".__('Start', 'processmaker')."</th>" .
"<th>".__('Task GUID', 'processmaker')."</th>" .
"<th>".__('Comments')."</th>" .
"<th>".__('Active')."</th>" .
"<th>".__('Sub-process', 'processmaker')."</th>" .
"</tr>";
$res = $DB->request([
'SELECT' => [
'pm.pm_task_guid',
'pm.taskcategories_id',
'pm.is_start',
'gl.name',
'gl.completename',
'gl.comment',
'pm.is_active',
'pm.is_subprocess'
],
'FROM' => 'glpi_plugin_processmaker_taskcategories AS pm',
'LEFT JOIN' => [
'glpi_taskcategories AS gl' => [
'FKEY' => [
'gl' => 'id',
'pm' => 'taskcategories_id'
]
]
],
'WHERE' => [
'pm.plugin_processmaker_processes_id' => $item->getId()
]
]);
//$query = "SELECT pm.pm_task_guid, pm.taskcategories_id, pm.`is_start`, gl.name, gl.completename, gl.`comment`, pm.is_active, pm.is_subprocess FROM glpi_plugin_processmaker_taskcategories AS pm
// LEFT JOIN glpi_taskcategories AS gl ON pm.taskcategories_id=gl.id
// WHERE pm.plugin_processmaker_processes_id=".$item->getID().";";
//foreach ($DB->request($query) as $taskCat) {
foreach ($res as $taskCat) {
echo "<tr class='tab_bg_1'>";
echo "<td class='b'><a href='".
Toolbox::getItemTypeFormURL('TaskCategory') . "?id=" . $taskCat['taskcategories_id'] . "'>" . $taskCat['name'];
if ($_SESSION["glpiis_ids_visible"]) {
echo " (" . $taskCat['taskcategories_id'] . ")";
}
echo "</a></td>";
echo "<td>" . $taskCat['completename'] . "</td>";
echo "<td class='center'>";
if ($taskCat['is_start']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Start', 'processmaker')."\">";
}
echo "</td>";
echo "<td >".$taskCat['pm_task_guid']."</td>";
echo "<td>".$taskCat['comment']."</td>";
echo "<td class='center'>";
if ($taskCat['is_active']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Active')."\">";
}
echo "</td>";
echo "<td class='center'>";
if ($taskCat['is_subprocess']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Sub-process', 'processmaker')."\">";
}
echo "</td>";
echo "</tr>";
}
echo "</table></div>";
return true;
}
/**
* Summary of displayTabContentForTaskCategory
* @param CommonGLPI $item
* @param mixed $tabnum
* @param mixed $withtemplate
* @return boolean
*/
static function displayTabContentForTaskCategory(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
global $DB, $CFG_GLPI;
$is_taskcat = false;
$processes_id = 0;
$pmtaskcat = new PluginProcessmakerTaskCategory;
$is_taskcat = $pmtaskcat->getFromDBbyCategory($item->fields['id']);
$processes_id = $pmtaskcat->fields['plugin_processmaker_processes_id'];
echo "<div class='center'><br><table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='8'>".__('Process task', 'processmaker')."</th></tr>";
echo "<tr><th>".__('Process name', 'processmaker')."</th>";
echo "<th>".__('Task name', 'processmaker')."</th>";
echo "<th>".__('Complete name')."</th>" .
"<th>".__('Start', 'processmaker')."</th>" .
"<th>".__('Task GUID', 'processmaker')."</th>" .
"<th>".__('Comments')."</th>" .
"<th>".__('Active')."</th>" .
"<th>".__('Sub-process', 'processmaker')."</th>" .
"</tr>";
$query = "SELECT pm.pm_task_guid, pm.taskcategories_id, pm.`is_start`, glp.name as 'pname', gl.name, gl.completename, gl.`comment`, pm.is_active, pm.is_subprocess FROM glpi_plugin_processmaker_taskcategories AS pm
LEFT JOIN glpi_taskcategories AS gl ON pm.taskcategories_id=gl.id
LEFT JOIN glpi_taskcategories AS glp ON glp.id=gl.taskcategories_id
WHERE pm.taskcategories_id=".$item->getID().";";
foreach ($DB->request($query) as $taskCat) {
echo "<tr class='tab_bg_1'>";
echo "<td class='b'><a href='";
echo Toolbox::getItemTypeFormURL('PluginProcessmakerProcess') . "?id=" . $processes_id . "'>" . $taskCat['pname'];
if ($_SESSION["glpiis_ids_visible"]) {
echo " (" . $processes_id . ")";
}
echo "</a></td>";
echo "<td class='b'>";
echo $taskCat['name'];
if ($_SESSION["glpiis_ids_visible"]) {
echo " (" . $taskCat['taskcategories_id'] . ")";
}
echo "</td>";
echo "<td>" . $taskCat['completename'] . "</td>";
echo "<td class='center'>";
if ($taskCat['is_start']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Start', 'processmaker')."\">";
}
echo "</td>";
echo "<td >".$taskCat['pm_task_guid']."</td>";
echo "<td>".$taskCat['comment']."</td>";
echo "<td class='center'>";
if ($taskCat['is_active']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Active')."\">";
}
echo "</td>";
echo "<td class='center'>";
if ($taskCat['is_subprocess']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Sub-process', 'processmaker')."\">";
}
echo "</td>";
echo "</tr>";
}
echo "</table></div>";
return true;
}
/**
* Summary of displayTabContentForItem
* @param CommonGLPI $item
* @param mixed $tabnum
* @param mixed $withtemplate
* @return boolean
*/
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
$ret = false;
switch ($item->getType()) {
case 'PluginProcessmakerProcess':
$ret = self::displayTabContentForProcess($item, $tabnum, $withtemplate);
break;
case 'TaskCategory':
$ret = self::displayTabContentForTaskCategory($item, $tabnum, $withtemplate);
break;
}
return $ret;
}
/**
* Print a good title for task categories tab
* add button for re-synchro of taskcategory list (only if rigths are w)
* @return nothing (display)
**/
static function title(CommonGLPI $item) {
global $CFG_GLPI;
if (Session::haveRight('plugin_processmaker_config', UPDATE)) {
$title = __('Synchronize Task List', 'processmaker');
$buttons = ["process.form.php?refreshtask=1&id=".$item->getID() => $title];
$pic = $CFG_GLPI["root_doc"] . "/plugins/processmaker/pics/gears.png";
if ($item->fields['maintenance']) {
$pic = $CFG_GLPI["root_doc"] . "/plugins/processmaker/pics/verysmall-under_maintenance.png";
}
Html::displayTitle($pic, $title, "", $buttons);
}
}
/**
* Retrieve a TaskCat from the database using its external id (unique index): pm_task_guid
*
* @param $task_guid string externalid
*
* @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;
}
/**
* Retrieve a TaskCat from the database using its category id (unique index): taskcategories_id
*
* @param $catid string task category id
*
* @return true if succeed else false
**/
function getFromDBbyCategory($catid) {
global $DB;
$res = $DB->request(
$this->getTable(),
[
'taskcategories_id' => $catid
]
);
//$query = "SELECT *
// FROM `".$this->getTable()."`
// WHERE `taskcategories_id` = $catid";
if ($res) {
if ($res->numrows() != 1) {
return false;
}
$this->fields = $res->next();
if (is_array($this->fields) && count($this->fields)) {
return true;
}
}
//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;
}
///**
// * Summary of dropdown
// * @param mixed $options
// * @return mixed
// */
//static function dropdown($options=array()) {
// global $CFG_GLPI;
// if (isset($options['value'])) {
// $that = new self;
// $that->getFromDB($options['value']);
// $options['value'] = $that->fields['taskcategories_id'];
// }
// $options['url'] = $CFG_GLPI["root_doc"].'/plugins/processmaker/ajax/dropdownTaskcategories.php';
// return Dropdown::show( 'TaskCategory', $options );
//}
///**
// * Execute the query to select ProcesssmakerTaskcategories
// *
// * @param $count true if execute an count(*),
// * @param $search pattern
// *
// * @return mysql result set.
// **/
//static function getSqlSearchResult ($count=true, $search='') {
// global $DB, $CFG_GLPI;
// $orderby = '';
// $where = ' WHERE glpi_plugin_processmaker_taskcategories.is_active=1 ';
// $join = ' LEFT JOIN glpi_taskcategories ON glpi_taskcategories.id = glpi_plugin_processmaker_taskcategories.taskcategories_id';
// if ($count) {
// $fields = " COUNT(DISTINCT glpi_plugin_processmaker_taskcategories.id) AS cpt ";
// } else {
// $fields = " DISTINCT glpi_taskcategories.id, glpi_taskcategories.completename AS name ";
// $orderby = " ORDER BY glpi_taskcategories.completename ASC";
// }
// if (strlen($search)>0 && $search!=$CFG_GLPI["ajax_wildcard"]) {
// $where .= " AND (glpi_taskcategories.completename $search
// OR glpi_taskcategories.comment $search) ";
// }
// $query = "SELECT $fields FROM glpi_plugin_processmaker_taskcategories $join ".$where." ".$orderby.";";
// return $DB->query($query);
//}
}
<?php
/**
* PluginProcessmakerTaskCategory short summary.
*
* PluginProcessmakerTaskCategory description.
*
* @version 1.0
* @author MoronO
*/
if (!defined('GLPI_ROOT')) {
die("Sorry. You can't access directly to this file");
}
class PluginProcessmakerTaskCategory extends CommonDBTM
{
function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) {
if ($item->getType() == 'TaskCategory') {
$pmtaskcat = new PluginProcessmakerTaskCategory;
if ($pmtaskcat->getFromDBbyCategory($item->fields['id'])) {
return __('Process task', 'processmaker');
} else {
return ''; // means no tab
}
}
return __('Task list', 'processmaker');
}
static function displayTabContentForProcess(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
global $DB, $CFG_GLPI;
self::title($item);
echo "<div class='center'><br><table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='7'>".__('Task list', 'processmaker')."</th></tr>";
echo "<tr><th>".__('Task name', 'processmaker')."</th>".
"<th>".__('Complete name')."</th>" .
"<th>".__('Start', 'processmaker')."</th>" .
"<th>".__('Task guid', 'processmaker')."</th>" .
"<th>".__('Comments')."</th>" .
"<th>".__('Active')."</th>" .
"<th>".__('Sub-process', 'processmaker')."</th>" .
"</tr>";
$res = $DB->request([
'SELECT' => [
'pm.pm_task_guid',
'pm.taskcategories_id',
'pm.is_start',
'gl.name',
'gl.completename',
'gl.comment',
'pm.is_active',
'pm.is_subprocess'
],
'FROM' => 'glpi_plugin_processmaker_taskcategories AS pm',
'LEFT JOIN' => [
'glpi_taskcategories AS gl' => [
'FKEY' => [
'gl' => 'id',
'pm' => 'taskcategories_id'
]
]
],
'WHERE' => [
'pm.plugin_processmaker_processes_id' => $item->getId()
]
]);
//$query = "SELECT pm.pm_task_guid, pm.taskcategories_id, pm.`is_start`, gl.name, gl.completename, gl.`comment`, pm.is_active, pm.is_subprocess FROM glpi_plugin_processmaker_taskcategories AS pm
// LEFT JOIN glpi_taskcategories AS gl ON pm.taskcategories_id=gl.id
// WHERE pm.plugin_processmaker_processes_id=".$item->getID().";";
//foreach ($DB->request($query) as $taskCat) {
foreach ($res as $taskCat) {
echo "<tr class='tab_bg_1'>";
echo "<td class='b'><a href='".
Toolbox::getItemTypeFormURL('TaskCategory') . "?id=" . $taskCat['taskcategories_id'] . "'>" . $taskCat['name'];
if ($_SESSION["glpiis_ids_visible"]) {
echo " (" . $taskCat['taskcategories_id'] . ")";
}
echo "</a></td>";
echo "<td>" . $taskCat['completename'] . "</td>";
echo "<td class='center'>";
if ($taskCat['is_start']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Start', 'processmaker')."\">";
}
echo "</td>";
echo "<td >".$taskCat['pm_task_guid']."</td>";
echo "<td>".$taskCat['comment']."</td>";
echo "<td class='center'>";
if ($taskCat['is_active']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Active')."\">";
}
echo "</td>";
echo "<td class='center'>";
if ($taskCat['is_subprocess']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Sub-process', 'processmaker')."\">";
}
echo "</td>";
echo "</tr>";
}
echo "</table></div>";
return true;
}
/**
* Summary of displayTabContentForTaskCategory
* @param CommonGLPI $item
* @param mixed $tabnum
* @param mixed $withtemplate
* @return boolean
*/
static function displayTabContentForTaskCategory(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
global $DB, $CFG_GLPI;
$is_taskcat = false;
$processes_id = 0;
$pmtaskcat = new PluginProcessmakerTaskCategory;
$is_taskcat = $pmtaskcat->getFromDBbyCategory($item->fields['id']);
$processes_id = $pmtaskcat->fields['plugin_processmaker_processes_id'];
echo "<div class='center'><br><table class='tab_cadre_fixehov'>";
echo "<tr><th colspan='8'>".__('Process task', 'processmaker')."</th></tr>";
echo "<tr><th>".__('Process name', 'processmaker')."</th>";
echo "<th>".__('Task name', 'processmaker')."</th>";
echo "<th>".__('Complete name')."</th>" .
"<th>".__('Start', 'processmaker')."</th>" .
"<th>".__('Task guid', 'processmaker')."</th>" .
"<th>".__('Comments')."</th>" .
"<th>".__('Active')."</th>" .
"<th>".__('Sub-process', 'processmaker')."</th>" .
"</tr>";
$query = "SELECT pm.pm_task_guid, pm.taskcategories_id, pm.`is_start`, glp.name as 'pname', gl.name, gl.completename, gl.`comment`, pm.is_active, pm.is_subprocess FROM glpi_plugin_processmaker_taskcategories AS pm
LEFT JOIN glpi_taskcategories AS gl ON pm.taskcategories_id=gl.id
LEFT JOIN glpi_taskcategories AS glp ON glp.id=gl.taskcategories_id
WHERE pm.taskcategories_id=".$item->getID().";";
foreach ($DB->request($query) as $taskCat) {
echo "<tr class='tab_bg_1'>";
echo "<td class='b'><a href='";
echo Toolbox::getItemTypeFormURL('PluginProcessmakerProcess') . "?id=" . $processes_id . "'>" . $taskCat['pname'];
if ($_SESSION["glpiis_ids_visible"]) {
echo " (" . $processes_id . ")";
}
echo "</a></td>";
echo "<td class='b'>";
echo $taskCat['name'];
if ($_SESSION["glpiis_ids_visible"]) {
echo " (" . $taskCat['taskcategories_id'] . ")";
}
echo "</td>";
echo "<td>" . $taskCat['completename'] . "</td>";
echo "<td class='center'>";
if ($taskCat['is_start']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Start', 'processmaker')."\">";
}
echo "</td>";
echo "<td >".$taskCat['pm_task_guid']."</td>";
echo "<td>".$taskCat['comment']."</td>";
echo "<td class='center'>";
if ($taskCat['is_active']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Active')."\">";
}
echo "</td>";
echo "<td class='center'>";
if ($taskCat['is_subprocess']) {
echo "<img src='".$CFG_GLPI["root_doc"]."/pics/ok.png' width='14' height='14' alt=\"".
__('Sub-process', 'processmaker')."\">";
}
echo "</td>";
echo "</tr>";
}
echo "</table></div>";
return true;
}
/**
* Summary of displayTabContentForItem
* @param CommonGLPI $item
* @param mixed $tabnum
* @param mixed $withtemplate
* @return boolean
*/
static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) {
$ret = false;
switch ($item->getType()) {
case 'PluginProcessmakerProcess':
$ret = self::displayTabContentForProcess($item, $tabnum, $withtemplate);
break;
case 'TaskCategory':
$ret = self::displayTabContentForTaskCategory($item, $tabnum, $withtemplate);
break;
}
return $ret;
}
/**
* Print a good title for task categories tab
* add button for re-synchro of taskcategory list (only if rigths are w)
* @return nothing (display)
**/
static function title(CommonGLPI $item) {
global $CFG_GLPI;
if (Session::haveRight('plugin_processmaker_config', UPDATE)) {
$title = __('Synchronize Task List', 'processmaker');
$buttons = ["process.form.php?refreshtask=1&id=".$item->getID() => $title];
$pic = $CFG_GLPI["root_doc"] . "/plugins/processmaker/pics/gears.png";
if ($item->fields['maintenance']) {
$pic = $CFG_GLPI["root_doc"] . "/plugins/processmaker/pics/verysmall-under_maintenance.png";
}
Html::displayTitle($pic, $title, "", $buttons);
}
}
/**
* Retrieve a TaskCat from the database using its external id (unique index): pm_task_guid
*
* @param $task_guid string externalid
*
* @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;
}
/**
* Retrieve a TaskCat from the database using its category id (unique index): taskcategories_id
*
* @param $catid string task category id
*
* @return true if succeed else false
**/
function getFromDBbyCategory($catid) {
global $DB;
$res = $DB->request(
$this->getTable(),
[
'taskcategories_id' => $catid
]
);
//$query = "SELECT *
// FROM `".$this->getTable()."`
// WHERE `taskcategories_id` = $catid";
if ($res) {
if ($res->numrows() != 1) {
return false;
}
$this->fields = $res->next();
if (is_array($this->fields) && count($this->fields)) {
return true;
}
}
//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;
}
///**
// * Summary of dropdown
// * @param mixed $options
// * @return mixed
// */
//static function dropdown($options=array()) {
// global $CFG_GLPI;
// if (isset($options['value'])) {
// $that = new self;
// $that->getFromDB($options['value']);
// $options['value'] = $that->fields['taskcategories_id'];
// }
// $options['url'] = $CFG_GLPI["root_doc"].'/plugins/processmaker/ajax/dropdownTaskcategories.php';
// return Dropdown::show( 'TaskCategory', $options );
//}
///**
// * Execute the query to select ProcesssmakerTaskcategories
// *
// * @param $count true if execute an count(*),
// * @param $search pattern
// *
// * @return mysql result set.
// **/
//static function getSqlSearchResult ($count=true, $search='') {
// global $DB, $CFG_GLPI;
// $orderby = '';
// $where = ' WHERE glpi_plugin_processmaker_taskcategories.is_active=1 ';
// $join = ' LEFT JOIN glpi_taskcategories ON glpi_taskcategories.id = glpi_plugin_processmaker_taskcategories.taskcategories_id';
// if ($count) {
// $fields = " COUNT(DISTINCT glpi_plugin_processmaker_taskcategories.id) AS cpt ";
// } else {
// $fields = " DISTINCT glpi_taskcategories.id, glpi_taskcategories.completename AS name ";
// $orderby = " ORDER BY glpi_taskcategories.completename ASC";
// }
// if (strlen($search)>0 && $search!=$CFG_GLPI["ajax_wildcard"]) {
// $where .= " AND (glpi_taskcategories.completename $search
// OR glpi_taskcategories.comment $search) ";
// }
// $query = "SELECT $fields FROM glpi_plugin_processmaker_taskcategories $join ".$where." ".$orderby.";";
// return $DB->query($query);
//}
}

View File

@@ -1,354 +1,333 @@
<?php
<?php
/**
* user short summary.
*
* user description.
*
* @version 2.0
* @author MoronO
*/
class PluginProcessmakerUser extends CommonDBTM {
/**
* Execute the query to select box with all glpi users where select key = name
*
* Internaly used by showGroup_Users, dropdownUsers and ajax/dropdownUsers.php
*
* @param array $tags contains taskGuid and grpGuid (task UID and Group UID)
* @param boolean $count true if execute an count(*),
* @param string|string[] $right limit user who have specific right
* @param integer $entity_restrict Restrict to a defined entity
* @param integer $value default value
* @param integer[] $used array: Already used items ID: not to display in dropdown
* @param string $search pattern
* @param integer $start start LIMIT value (default 0)
* @param integer $limit limit LIMIT value (default -1 no limit)
* @param boolean $inactive_deleted true to retreive also inactive or deleted users
* @return DBmysqlIterator
**/
static function getSqlSearchResult (array $tags, $count = true, $right = "all", $entity_restrict = -1, $value = 0,
array $used = [], $search = '',$start = 0, $limit = -1,
$inactive_deleted = 0) {
global $DB, $PM_DB, $CFG_GLPI;
// first need to get all users from $taskId
// TU_TYPE in (1, 2) means 1 is normal user, 2 is for adhoc users
$tu_type = [];
$tu_type[] = Session::haveRight('plugin_processmaker_case', ADHOC_REASSIGN) ? 2 : -1; // by default get (or not if no rights) the ad-hoc users
if ($tags['grpGuid'] == 0) {
$tu_type[] = 1; // if no group for selfservice value based assignment then get also the users
}
$res1 = new QuerySubQuery([
'SELECT' => 'GROUP_USER.USR_UID AS pm_user_id',
'FROM' => 'TASK_USER',
'INNER JOIN' => [
'GROUP_USER' => [
'FKEY' => [
'GROUP_USER' => 'GRP_UID',
'TASK_USER' => 'USR_UID',
['AND' => [
'TASK_USER.TU_RELATION' => 2,
'TASK_USER.TU_TYPE' => $tu_type
]
]
]
]
],
'WHERE' => [
'TAS_UID' => $tags['taskGuid'],
]
]);
$res2 = new QuerySubQuery([
'SELECT' => 'TASK_USER.USR_UID AS pm_user_id',
'FROM' => 'TASK_USER',
'WHERE' => [
'AND' => [
'TAS_UID' => $tags['taskGuid'],
'TASK_USER.TU_RELATION' => 1,
'TASK_USER.TU_TYPE' => $tu_type
]
]
]);
$subqueries = [$res1, $res2];
if ($tags['grpGuid'] != 0) {
// then add the user for the selfservice value based assignement
$res3 = new QuerySubQuery([
'SELECT' => 'GROUP_USER.USR_UID AS pm_user_id',
'FROM' => 'GROUP_USER',
'WHERE' => ['GROUP_USER.GRP_UID' => $tags['grpGuid']]
]);
$subqueries[] = $res3;
}
$union = new QueryUnion($subqueries);
$res = $PM_DB->request([
'FROM' => $union
]);
$pmUsers = [ ];
foreach ($res as $pmUser) {
$pmUsers[ ] = $pmUser[ 'pm_user_id' ];
}
$joinprofile = false;
switch ($right) {
case "id" :
$used[] = Session::getLoginUserID();
$query['WHERE']['AND']['glpi_users.id'] = Session::getLoginUserID();
break;
case "all" :
$query['WHERE']['AND']['glpi_users.id'] = ['>', 0];
break;
}
$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_active'] = 1;
if ((is_numeric($value) && $value)
|| count($used)) {
if (is_numeric($value)) {
$used[] = $value;
}
}
if ($count) {
$query['FIELDS'] = 'glpi_users.id';
$query['COUNT'] = 'cpt';
$query['DISTINCT'] = true;
} else {
$query['FIELDS'] = ['glpi_users.id', 'glpi_users.realname', 'glpi_users.firstname', 'glpi_users.name', 'glpi_useremails.email'];
$query['DISTINCT'] = true;
}
$query['FROM'] = 'glpi_plugin_processmaker_users';
$query['FROM'] = 'glpi_plugin_processmaker_users';
$query['INNER JOIN'] = [
'glpi_users' => [
'FKEY' => [
'glpi_users' => 'id',
'glpi_plugin_processmaker_users' => 'id'
]
]
];
$query['LEFT JOIN'] = [
'glpi_useremails' => [
'FKEY' => [
'glpi_users' => 'id',
'glpi_useremails' => 'users_id', [
'AND' => [
'glpi_useremails.is_default' => 1
]
]
]
],
'glpi_profiles_users' => [
'FKEY' => [
'glpi_users' => 'id',
'glpi_profiles_users' => 'users_id'
]
]
];
if ($joinprofile) {
$query['LEFT JOIN'] = [
'glpi_profiles' => [
'FKEY' => [
'glpi_profiles' => 'id',
'glpi_profiles_user' => 'profiles_id'
]
]
];
}
if ($count) {
$query['WHERE']['AND']['NOT']['glpi_users.id'] = $used;
} else {
if (strlen($search)>0 && $search!=$CFG_GLPI["ajax_wildcard"]) {
$txt_search = Search::makeTextSearchValue($search);
/**
* user short summary.
*
* user description.
*
* @version 2.0
* @author MoronO
*/
class PluginProcessmakerUser extends CommonDBTM {
/**
* Execute the query to select box with all glpi users where select key = name
*
* Internaly used by showGroup_Users, dropdownUsers and ajax/dropdownUsers.php
*
* @param $count true if execute an count(*),
* @param $right limit user who have specific right
* @param $entity_restrict Restrict to a defined entity
* @param $value default value
* @param $used array: Already used items ID: not to display in dropdown
* @param $search pattern
*
* @return DBmysqlIterator
**/
static function getSqlSearchResult ($taskId, $count = true, $right = "all", $entity_restrict = -1, $value = 0,
$used = [], $search = '', $limit = '') {
global $DB, $PM_DB, $CFG_GLPI;
// first need to get all users from $taskId
$adhoc_users = Session::haveRight('plugin_processmaker_case', ADHOC_REASSIGN) ? 2 : -1;
// TU_TYPE in (1, 2) means 1 is normal, 2 is for adhoc
// TU_RELATION is 1 for user, and 2 for group
$res1 = new QuerySubQuery([
'SELECT' => 'GROUP_USER.USR_UID AS pm_user_id',
'FROM' => 'TASK_USER',
'INNER JOIN' => [
'GROUP_USER' => [
'FKEY' => [
'GROUP_USER' => 'GRP_UID',
'TASK_USER' => 'USR_UID',
['AND' => [
'TASK_USER.TU_RELATION' => 2,
'TASK_USER.TU_TYPE' => [1, $adhoc_users]
]
]
]
]
],
'WHERE' => [
'TAS_UID' => $taskId,
]
]);
$res2 = new QuerySubQuery([
'SELECT' => 'TASK_USER.USR_UID AS pm_user_id',
'FROM' => 'TASK_USER',
'WHERE' => [
'AND' => [
'TAS_UID' => $taskId,
'TASK_USER.TU_RELATION' => 1,
'TASK_USER.TU_TYPE' => [1, $adhoc_users]
]
]
]);
$union = new QueryUnion([$res1, $res2]);
$res = $PM_DB->request([
'FROM' => $union
]);
//$db_pm = PluginProcessmakerConfig::getInstance()->getProcessMakerDB();
//$pmQuery = "SELECT GROUP_USER.USR_UID AS pm_user_id FROM TASK_USER
// JOIN GROUP_USER ON GROUP_USER.GRP_UID=TASK_USER.USR_UID AND TASK_USER.TU_RELATION = 2 AND TASK_USER.TU_TYPE=1
// WHERE TAS_UID = '$taskId'
// UNION
// SELECT TASK_USER.USR_UID AS pm_user_id FROM TASK_USER
// WHERE TAS_UID = '$taskId' AND TASK_USER.TU_RELATION = 1 AND TASK_USER.TU_TYPE=1 ; ";
$pmUsers = [ ];
//foreach ($PM_DB->request( $pmQuery ) as $pmUser) {
foreach ($res as $pmUser) {
$pmUsers[ ] = $pmUser[ 'pm_user_id' ];
}
//$where = '';
$joinprofile = false;
switch ($right) {
case "id" :
$used[] = Session::getLoginUserID();
//$where = " `glpi_users`.`id` = '".Session::getLoginUserID()."' ";
$query2['WHERE']['AND']['glpi_users.id'] = Session::getLoginUserID();
break;
case "all" :
//$where = " `glpi_users`.`id` > '0' ";
$query2['WHERE']['AND']['glpi_users.id'] = ['>', 0];
break;
}
//$where .= " AND glpi_plugin_processmaker_users.pm_users_id IN ('".join("', '", $pmUsers)."') ";
//$where .= " AND `glpi_users`.`is_deleted` = '0'
// AND `glpi_users`.`is_active` = '1' ";
$query2['WHERE']['AND']['glpi_plugin_processmaker_users.pm_users_id'] = $pmUsers;
$query2['WHERE']['AND']['glpi_users.is_deleted'] = 0;
$query2['WHERE']['AND']['glpi_users.is_active'] = 1;
if ((is_numeric($value) && $value)
|| count($used)) {
//$where .= " AND `glpi_users`.`id` NOT IN (";
if (is_numeric($value)) {
//$first = false;
//$where .= $value;
$used[] = $value;
//$query2['WHERE']['AND']['NOT']['glpi_users.id'] = $value;
} else {
//$first = true;
}
//$query2['WHERE']['AND']['NOT']['glpi_users.id'] = $used;
//foreach ($used as $val) {
// if ($first) {
// $first = false;
// } else {
// $where .= ",";
// }
// $where .= $val;
//}
//$where .= ")";
}
if ($count) {
//$query = "SELECT COUNT(DISTINCT glpi_users.id ) AS cpt ";
$query2['SELECT'] = ['COUNT DISTINCT' => 'glpi_users.id AS cpt'];
} else {
//$query = "SELECT DISTINCT glpi_users.id , `glpi_users`.`realname`, `glpi_users`.`firstname`, `glpi_users`.`name`, `glpi_useremails`.`email` ";
$query2['SELECT DISTINCT'] = 'glpi_users.id';
$query2['FIELDS'] = ['glpi_users.realname', 'glpi_users.firstname', 'glpi_users.name', 'glpi_useremails.email'];
}
$query2['FROM'] = 'glpi_plugin_processmaker_users';
//$query .= "FROM glpi_plugin_processmaker_users
// JOIN glpi_users ON glpi_users.id=glpi_plugin_processmaker_users.id ";
$query2['FROM'] = 'glpi_plugin_processmaker_users';
$query2['INNER JOIN'] = [
'glpi_users' => [
'FKEY' => [
'glpi_users' => 'id',
'glpi_plugin_processmaker_users' => 'id'
]
]
];
//$query .= " LEFT JOIN `glpi_useremails`
// ON (`glpi_users`.`id` = `glpi_useremails`.`users_id` AND `glpi_useremails`.is_default = 1)";
$query2['LEFT JOIN'] = [
'glpi_useremails' => [
'FKEY' => [
'glpi_users' => 'id',
'glpi_useremails' => 'users_id', [
'AND' => [
'glpi_useremails.is_default' => 1
]
]
]
],
'glpi_profiles_users' => [
'FKEY' => [
'glpi_users' => 'id',
'glpi_profiles_users' => 'users_id'
]
]
];
//$query .= " LEFT JOIN `glpi_profiles_users`
// ON (`glpi_users`.`id` = `glpi_profiles_users`.`users_id`)";
if ($joinprofile) {
$query2['LEFT JOIN'] = [
'glpi_profiles' => [
'FKEY' => [
'glpi_profiles' => 'id',
'glpi_profiles_user' => 'profiles_id'
]
]
];
//$query .= " LEFT JOIN `glpi_profiles`
// ON (`glpi_profiles`.`id` = `glpi_profiles_users`.`profiles_id`) ";
}
if ($count) {
$query2['WHERE']['AND']['NOT']['glpi_users.id'] = $used;
//$query .= " WHERE $where ";
} else {
if (strlen($search)>0 && $search!=$CFG_GLPI["ajax_wildcard"]) {
$query2['WHERE']['AND'] = [
'glpi_users.name' => ['LIKE',Search::makeTextSearchValue($search)],
'OR' => [
'glpi_users.realname' => ['LIKE',Search::makeTextSearchValue($search)],
'glpi_users.firstname' => ['LIKE',Search::makeTextSearchValue($search)],
'glpi_users.phone' => ['LIKE',Search::makeTextSearchValue($search)],
'glpi_useremails.email' => ['LIKE',Search::makeTextSearchValue($search)],
'RAW' => [
"CONCAT(`glpi_users`.`realname`,' ',`glpi_users`.`firstname`)".Search::makeTextSearch($search)
]
]
];
//$where .= " AND (`glpi_users`.`name` ".Search::makeTextSearch($search)."
// OR `glpi_users`.`realname` ".Search::makeTextSearch($search)."
// OR `glpi_users`.`firstname` ".Search::makeTextSearch($search)."
// OR `glpi_users`.`phone` ".Search::makeTextSearch($search)."
// OR `glpi_useremails`.`email` ".Search::makeTextSearch($search)."
// OR CONCAT(`glpi_users`.`realname`,' ',`glpi_users`.`firstname`) ".
// Search::makeTextSearch($search).")";
}
$query2['WHERE']['AND']['NOT']['glpi_users.id'] = $used;
//$query .= " WHERE $where ";
if ($_SESSION["glpinames_format"] == User::FIRSTNAME_BEFORE) {
//$query.=" ORDER BY `glpi_users`.`firstname`,
// `glpi_users`.`realname`,
// `glpi_users`.`name` ";
$query2['ORDER'] = ['glpi_users.firstname', 'glpi_users.realname', 'glpi_users.name'];
} else {
//$query.=" ORDER BY `glpi_users`.`realname`,
// `glpi_users`.`firstname`,
// `glpi_users`.`name` ";
$query2['ORDER'] = ['glpi_users.realname', 'glpi_users.firstname', 'glpi_users.name'];
}
if ($search != $CFG_GLPI["ajax_wildcard"]) {
//$query .= " $limit";
$query2['LIMIT'] = 200;
}
}
return $DB->request($query2);
//return $DB->query($query);
}
/**
* Make a select box with all glpi users where select key = name
*
* Parameters which could be used in options array :
* - name : string / name of the select (default is users_id)
* - right : string / limit user who have specific right :
* id -> only current user (default case);
* interface -> central ;
* all -> all users ;
* specific right like show_all_ticket, create_ticket....
* - comments : boolean / is the comments displayed near the dropdown (default true)
* - entity : integer or array / restrict to a defined entity or array of entities
* (default -1 : no restriction)
* - entity_sons : boolean / if entity restrict specified auto select its sons
* only available if entity is a single value not an array(default false)
* - all : Nobody or All display for none selected
* all=0 (default) -> Nobody
* all=1 -> All
* all=-1-> nothing
* - rand : integer / already computed rand value
* - toupdate : array / Update a specific item on select change on dropdown
* (need value_fieldname, to_update, url (see Ajax::updateItemOnSelectEvent for informations)
* and may have moreparams)
* - used : array / Already used items ID: not to display in dropdown (default empty)
* - on_change : string / value to transmit to "onChange"
*
* @param $options array of possible options
*
* @return int (print out an HTML select box)
**/
static function dropdown($options = []) {
global $CFG_GLPI;
$options['url'] = $CFG_GLPI["root_doc"].'/plugins/processmaker/ajax/dropdownUsers.php';
return User::dropdown( $options );
}
/**
* Summary of getGLPIUserId
* returns GLPI user ID from a Processmaker user ID
* @param string $pmUserId
* @return int GLPI user id, or 0 if not found
*/
public static function getGLPIUserId($pmUserId) {
$obj = new self;
if ($obj->getFromDBByRequest([
'WHERE' => [
'pm_users_id' => $pmUserId
],
])) {
return $obj->fields['id'];
}
return 0;
}
/**
* Summary of getPMUserId
* returns processmaker user id for given GLPI user id
* @param int $glpi_userId id of user from GLPI database
* @return string which is the uid of user in Processmaker database, or false if not found
*/
public static function getPMUserId($glpiUserId) {
if (is_numeric($glpiUserId)) {
$obj = new self;
if ($obj->getFromDB($glpiUserId)) {
return $obj->fields['pm_users_id'];
}
}
return false;
}
/**
* Summary of getGlpiIdFromAny
* Returns the GLPI id of the user or false if not found
* Accept either PM GUID, GLPI logon, or GLPI ID
* @param $any
* @return mixed GLPI ID of the user or false if not found
*/
public static function getGlpiIdFromAny($any) {
$ret = self::getGLPIUserId($any);
if ($ret) {
return $ret;
}
$ret = self::getPMUserId($any);
if ($ret) {
return $any;
}
$usr = new User;
if ($usr->getFromDBbyName($any)) {
return $usr->getId();
}
return false;
}
///**
// * Summary of getNewPassword
// * @param mixed $username
// * @return string a new password computed
// * from uppercasing first letter of $username
// * and encoding
// * and adding a ramdon number (4 digits)
// * and truncating it to a length of 20 chars
// */
//public static function getNewPassword( $username ) {
// $newPass = Toolbox::encrypt( ucfirst( stripslashes( $username ) ), GLPIKEY) ;
// return substr( rand(1000,9999).$newPass, 0, 19) ;
//}
}
$firstname_field = $DB->quoteName(User::getTableField('firstname'));
$realname_field = $DB->quoteName(User::getTableField('realname'));
$fields = $_SESSION["glpinames_format"] == User::FIRSTNAME_BEFORE
? [$firstname_field, $realname_field]
: [$realname_field, $firstname_field];
$concat = new \QueryExpression(
'CONCAT(' . implode(',' . $DB->quoteValue(' ') . ',', $fields) . ')'
. ' LIKE ' . $DB->quoteValue($txt_search)
);
$query['WHERE']['AND'] = [
'glpi_users.name' => ['LIKE', $txt_search],
'OR' => [
'glpi_users.realname' => ['LIKE', $txt_search],
'glpi_users.firstname' => ['LIKE', $txt_search],
'glpi_users.phone' => ['LIKE', $txt_search],
'glpi_useremails.email' => ['LIKE', $txt_search],
$concat
]
];
}
$query['WHERE']['AND']['NOT']['glpi_users.id'] = $used;
if ($_SESSION["glpinames_format"] == User::FIRSTNAME_BEFORE) {
$query['ORDER'] = ['glpi_users.firstname', 'glpi_users.realname', 'glpi_users.name'];
} else {
$query['ORDER'] = ['glpi_users.realname', 'glpi_users.firstname', 'glpi_users.name'];
}
if ($search != $CFG_GLPI["ajax_wildcard"]) {
$query['LIMIT'] = $limit;
$query['START'] = $start;
}
}
return $DB->request($query);
}
/**
* Make a select box with all glpi users where select key = name
*
* Parameters which could be used in options array :
* - name : string / name of the select (default is users_id)
* - right : string / limit user who have specific right :
* id -> only current user (default case);
* interface -> central ;
* all -> all users ;
* specific right like show_all_ticket, create_ticket....
* - comments : boolean / is the comments displayed near the dropdown (default true)
* - entity : integer or array / restrict to a defined entity or array of entities
* (default -1 : no restriction)
* - entity_sons : boolean / if entity restrict specified auto select its sons
* only available if entity is a single value not an array(default false)
* - all : Nobody or All display for none selected
* all=0 (default) -> Nobody
* all=1 -> All
* all=-1-> nothing
* - rand : integer / already computed rand value
* - toupdate : array / Update a specific item on select change on dropdown
* (need value_fieldname, to_update, url (see Ajax::updateItemOnSelectEvent for informations)
* and may have moreparams)
* - used : array / Already used items ID: not to display in dropdown (default empty)
* - on_change : string / value to transmit to "onChange"
*
* @param $options array of possible options
*
* @return int (print out an HTML select box)
**/
static function dropdown($options = []) {
global $CFG_GLPI;
$options['url'] = $CFG_GLPI["root_doc"].'/plugins/processmaker/ajax/dropdownUsers.php';
return User::dropdown( $options );
}
/**
* Summary of getGLPIUserId
* returns GLPI user ID from a Processmaker user ID
* @param string $pmUserId
* @return int GLPI user id, or 0 if not found
*/
public static function getGLPIUserId($pmUserId) {
$obj = new self;
if ($obj->getFromDBByRequest([
'WHERE' => [
'pm_users_id' => $pmUserId
],
])) {
return $obj->fields['id'];
}
return 0;
}
/**
* Summary of getPMUserId
* returns processmaker user id for given GLPI user id
* @param int $glpi_userId id of user from GLPI database
* @return string which is the uid of user in Processmaker database, or false if not found
*/
public static function getPMUserId($glpiUserId) {
if (is_numeric($glpiUserId)) {
$obj = new self;
if ($obj->getFromDB($glpiUserId)) {
return $obj->fields['pm_users_id'];
}
}
return false;
}
/**
* Summary of getGlpiIdFromAny
* Returns the GLPI id of the user or false if not found
* Accept either PM GUID, GLPI logon, or GLPI ID
* @param $any
* @return mixed GLPI ID of the user or false if not found
*/
public static function getGlpiIdFromAny($any) {
$ret = self::getGLPIUserId($any);
if ($ret) {
return $ret;
}
$ret = self::getPMUserId($any);
if ($ret) {
return $any;
}
$usr = new User;
if ($usr->getFromDBbyName($any)) {
return $usr->getId();
}
return false;
}
///**
// * Summary of getNewPassword
// * @param mixed $username
// * @return string a new password computed
// * from uppercasing first letter of $username
// * and encoding
// * and adding a ramdon number (4 digits)
// * and truncating it to a length of 20 chars
// */
//public static function getNewPassword( $username ) {
// $newPass = Toolbox::encrypt( ucfirst( stripslashes( $username ) ), GLPIKEY) ;
// return substr( rand(1000,9999).$newPass, 0, 19) ;
//}
}

View File

@@ -1,190 +1,190 @@
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinkactions
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinkactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
`name` varchar(255) NOT NULL,
`value` text,
PRIMARY KEY (`id`),
UNIQUE KEY `caselinks_id_name` (`plugin_processmaker_caselinks_id`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinks
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`is_active` tinyint(1) NOT NULL DEFAULT '0',
`is_externaldata` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas',
`is_self` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self',
`sourcetask_guid` varchar(32) DEFAULT NULL,
`targettask_guid` varchar(32) DEFAULT NULL,
`targetprocess_guid` varchar(32) DEFAULT NULL,
`targetdynaform_guid` varchar(32) DEFAULT NULL,
`sourcecondition` text,
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
`is_targettoreassign` TINYINT(1) NOT NULL DEFAULT '0',
`is_targettoimpersonate` TINYINT(1) NOT NULL DEFAULT '0',
`externalapplication` TEXT NULL,
`is_synchronous` TINYINT(1) NOT NULL DEFAULT '0',
`date_mod` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `is_active` (`is_active`),
KEY `is_externaldata` (`is_externaldata`),
KEY `is_self` (`is_self`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_cases
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` (
`id` INT(11) NOT NULL,
`itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket',
`items_id` INT(11) NOT NULL,
`entities_id` INT(11) NOT NULL DEFAULT '0',
`name` MEDIUMTEXT NOT NULL DEFAULT '',
`case_guid` VARCHAR(32) NOT NULL,
`case_status` VARCHAR(20) NOT NULL DEFAULT 'DRAFT',
`plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL,
`plugin_processmaker_cases_id` INT(11) NULL DEFAULT NULL,
INDEX `items` (`itemtype`, `items_id`),
INDEX `case_status` (`case_status`),
PRIMARY KEY (`id`),
UNIQUE INDEX `case_guid` (`case_guid`),
INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`),
INDEX `plugin_processmaker_cases_id` (`plugin_processmaker_cases_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_configs
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT 'ProcessMaker',
`pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://itsm-pm.acme.com/',
`pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow',
`pm_admin_user` varchar(255) DEFAULT NULL,
`pm_admin_passwd` varchar(255) DEFAULT NULL,
`pm_theme` varchar(50) NOT NULL DEFAULT 'glpi_classic',
`date_mod` timestamp NULL DEFAULT NULL,
`taskcategories_id` int(11) DEFAULT NULL,
`users_id` int(11) DEFAULT NULL,
`pm_group_guid` varchar(32) DEFAULT NULL,
`comment` text,
`pm_dbserver_name` varchar(255) DEFAULT 'localhost',
`pm_dbname` varchar(50) DEFAULT 'wf_workflow',
`pm_dbserver_user` varchar(255) DEFAULT NULL,
`pm_dbserver_passwd` varchar(255) DEFAULT NULL,
`domain` varchar(50) DEFAULT '',
`maintenance` tinyint(1) NOT NULL DEFAULT '0',
`ssl_verify` tinyint(1) NOT NULL DEFAULT '0',
`db_version` varchar(10) NOT NULL DEFAULT '3.4.10',
`max_cases_per_item` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
`plugin_processmaker_cases_id` int(11) DEFAULT '0',
`users_id` int(11) NOT NULL DEFAULT '0',
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
`postdata` mediumtext,
`logs_out` mediumtext,
`state` int(11) NOT NULL,
`date_mod` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`process_guid` varchar(32) NOT NULL,
`name` varchar(255) NOT NULL,
`is_active` tinyint(1) NOT NULL DEFAULT '0',
`hide_case_num_title` tinyint(1) NOT NULL DEFAULT '0',
`insert_task_comment` tinyint(1) NOT NULL DEFAULT '0',
`comment` text,
`taskcategories_id` int(11) DEFAULT NULL,
`itilcategories_id` int(11) NOT NULL DEFAULT '0',
`type` int(11) NOT NULL DEFAULT '1' COMMENT 'Only used for self-service Tickets',
`date_mod` timestamp NULL DEFAULT NULL,
`project_type` varchar(50) NOT NULL DEFAULT 'classic',
`is_change` tinyint(1) NOT NULL DEFAULT '0',
`is_problem` tinyint(1) NOT NULL DEFAULT '0',
`is_incident` tinyint(1) NOT NULL DEFAULT '0',
`is_request` tinyint(1) NOT NULL DEFAULT '0',
`maintenance` TINYINT(1) NOT NULL DEFAULT '0',
`max_cases_per_item` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `process_guid` (`process_guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles
CREATE TABLE `glpi_plugin_processmaker_processes_profiles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`plugin_processmaker_processes_id` int(11) NOT NULL,
`profiles_id` int(11) NOT NULL,
`entities_id` int(11) NOT NULL,
`is_recursive` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `plugin_processmaker_processes_id_profiles_id_entities_id` (`plugin_processmaker_processes_id`, `profiles_id`, `entities_id`),
KEY `entities_id` (`entities_id`),
KEY `profiles_id` (`profiles_id`),
KEY `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`),
KEY `is_recursive` (`is_recursive`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
-- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories
CREATE TABLE `glpi_plugin_processmaker_taskcategories` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`plugin_processmaker_processes_id` INT(11) NOT NULL,
`pm_task_guid` VARCHAR(32) NOT NULL,
`taskcategories_id` INT(11) NOT NULL,
`is_start` TINYINT(1) NOT NULL DEFAULT '0',
`is_active` TINYINT(1) NOT NULL DEFAULT '1',
`is_subprocess` TINYINT(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE INDEX `pm_task_guid` (`pm_task_guid`),
UNIQUE INDEX `items` (`taskcategories_id`),
INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_tasks
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`items_id` int(11) NOT NULL,
`itemtype` varchar(32) NOT NULL,
`plugin_processmaker_cases_id` int(11) NOT NULL,
`plugin_processmaker_taskcategories_id` int(11) NOT NULL,
`del_index` int(11) NOT NULL,
`del_thread` INT(11) NOT NULL,
`del_thread_status` varchar(32) NOT NULL DEFAULT 'OPEN',
PRIMARY KEY (`id`),
UNIQUE KEY `tasks` (`plugin_processmaker_cases_id`,`del_index`),
UNIQUE KEY `items` (`itemtype`,`items_id`),
KEY `del_thread_status` (`del_thread_status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_users
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pm_users_id` varchar(32) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `pm_users_id` (`pm_users_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET NAMES utf8 */;
/*!50503 SET NAMES utf8mb4 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinkactions
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinkactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
`name` varchar(255) NOT NULL,
`value` text,
PRIMARY KEY (`id`),
UNIQUE KEY `caselinks_id_name` (`plugin_processmaker_caselinks_id`,`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_caselinks
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`is_active` tinyint(1) NOT NULL DEFAULT '0',
`is_externaldata` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas',
`is_self` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self',
`sourcetask_guid` varchar(32) DEFAULT NULL,
`targettask_guid` varchar(32) DEFAULT NULL,
`targetprocess_guid` varchar(32) DEFAULT NULL,
`targetdynaform_guid` varchar(32) DEFAULT NULL,
`sourcecondition` text,
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
`is_targettoreassign` TINYINT(1) NOT NULL DEFAULT '0',
`is_targettoimpersonate` TINYINT(1) NOT NULL DEFAULT '0',
`externalapplication` TEXT NULL,
`is_synchronous` TINYINT(1) NOT NULL DEFAULT '0',
`date_mod` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `is_active` (`is_active`),
KEY `is_externaldata` (`is_externaldata`),
KEY `is_self` (`is_self`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_cases
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` (
`id` INT(11) NOT NULL,
`itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket',
`items_id` INT(11) NOT NULL,
`entities_id` INT(11) NOT NULL DEFAULT '0',
`name` MEDIUMTEXT NOT NULL DEFAULT '',
`case_guid` VARCHAR(32) NOT NULL,
`case_status` VARCHAR(20) NOT NULL DEFAULT 'DRAFT',
`plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL,
`plugin_processmaker_cases_id` INT(11) NULL DEFAULT NULL,
INDEX `items` (`itemtype`, `items_id`),
INDEX `case_status` (`case_status`),
PRIMARY KEY (`id`),
UNIQUE INDEX `case_guid` (`case_guid`),
INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`),
INDEX `plugin_processmaker_cases_id` (`plugin_processmaker_cases_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_configs
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL DEFAULT 'ProcessMaker',
`pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://itsm-pm.acme.com/',
`pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow',
`pm_admin_user` varchar(255) DEFAULT NULL,
`pm_admin_passwd` varchar(255) DEFAULT NULL,
`pm_theme` varchar(50) NOT NULL DEFAULT 'glpi_classic',
`date_mod` timestamp NULL DEFAULT NULL,
`taskcategories_id` int(11) DEFAULT NULL,
`users_id` int(11) DEFAULT NULL,
`pm_group_guid` varchar(32) DEFAULT NULL,
`comment` text,
`pm_dbserver_name` varchar(255) DEFAULT 'localhost',
`pm_dbname` varchar(50) DEFAULT 'wf_workflow',
`pm_dbserver_user` varchar(255) DEFAULT NULL,
`pm_dbserver_passwd` varchar(255) DEFAULT NULL,
`domain` varchar(50) DEFAULT '',
`maintenance` tinyint(1) NOT NULL DEFAULT '0',
`ssl_verify` tinyint(1) NOT NULL DEFAULT '0',
`db_version` varchar(10) NOT NULL DEFAULT '4.0.0',
`max_cases_per_item` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`plugin_processmaker_caselinks_id` int(11) DEFAULT NULL,
`plugin_processmaker_cases_id` int(11) DEFAULT '0',
`users_id` int(11) NOT NULL DEFAULT '0',
`is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0',
`postdata` mediumtext,
`logs_out` mediumtext,
`state` int(11) NOT NULL,
`date_mod` timestamp NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`process_guid` varchar(32) NOT NULL,
`name` varchar(255) NOT NULL,
`is_active` tinyint(1) NOT NULL DEFAULT '0',
`hide_case_num_title` tinyint(1) NOT NULL DEFAULT '0',
`insert_task_comment` tinyint(1) NOT NULL DEFAULT '0',
`comment` text,
`taskcategories_id` int(11) DEFAULT NULL,
`itilcategories_id` int(11) NOT NULL DEFAULT '0',
`type` int(11) NOT NULL DEFAULT '1' COMMENT 'Only used for self-service Tickets',
`date_mod` timestamp NULL DEFAULT NULL,
`project_type` varchar(50) NOT NULL DEFAULT 'classic',
`is_change` tinyint(1) NOT NULL DEFAULT '0',
`is_problem` tinyint(1) NOT NULL DEFAULT '0',
`is_incident` tinyint(1) NOT NULL DEFAULT '0',
`is_request` tinyint(1) NOT NULL DEFAULT '0',
`maintenance` TINYINT(1) NOT NULL DEFAULT '0',
`max_cases_per_item` int(11) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE KEY `process_guid` (`process_guid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles
CREATE TABLE `glpi_plugin_processmaker_processes_profiles` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`plugin_processmaker_processes_id` int(11) NOT NULL,
`profiles_id` int(11) NOT NULL,
`entities_id` int(11) NOT NULL,
`is_recursive` tinyint(1) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `plugin_processmaker_processes_id_profiles_id_entities_id` (`plugin_processmaker_processes_id`, `profiles_id`, `entities_id`),
KEY `entities_id` (`entities_id`),
KEY `profiles_id` (`profiles_id`),
KEY `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`),
KEY `is_recursive` (`is_recursive`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;
-- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories
CREATE TABLE `glpi_plugin_processmaker_taskcategories` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`plugin_processmaker_processes_id` INT(11) NOT NULL,
`pm_task_guid` VARCHAR(32) NOT NULL,
`taskcategories_id` INT(11) NOT NULL,
`is_start` TINYINT(1) NOT NULL DEFAULT '0',
`is_active` TINYINT(1) NOT NULL DEFAULT '1',
`is_subprocess` TINYINT(1) NOT NULL DEFAULT '0',
PRIMARY KEY (`id`),
UNIQUE INDEX `pm_task_guid` (`pm_task_guid`),
UNIQUE INDEX `items` (`taskcategories_id`),
INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_tasks
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`items_id` int(11) NOT NULL,
`itemtype` varchar(32) NOT NULL,
`plugin_processmaker_cases_id` int(11) NOT NULL,
`plugin_processmaker_taskcategories_id` int(11) NOT NULL,
`del_index` int(11) NOT NULL,
`del_thread` INT(11) NOT NULL,
`del_thread_status` varchar(32) NOT NULL DEFAULT 'OPEN',
PRIMARY KEY (`id`),
UNIQUE KEY `tasks` (`plugin_processmaker_cases_id`,`del_index`),
UNIQUE KEY `items` (`itemtype`,`items_id`),
KEY `del_thread_status` (`del_thread_status`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- Dumping structure for table glpi.glpi_plugin_processmaker_users
CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`pm_users_id` varchar(32) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `pm_users_id` (`pm_users_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */;
/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;

View File

@@ -1,60 +1,64 @@
<?php
function processmaker_update() {
global $DB;
// update from older versions
// load config to get current version
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "db_version" )) {
$current_version = '2.4.1';
} else {
include_once(GLPI_ROOT."/plugins/processmaker/inc/config.class.php");
$config = PluginProcessmakerConfig::getInstance();
$current_version = $config->fields['db_version'];
if (empty($current_version)) {
$current_version = '2.4.1';
}
}
switch ($current_version) {
case '2.4.1' :
// will upgrade any old versions (< 3.2.8) to 3.2.8
include_once(GLPI_ROOT."/plugins/processmaker/install/update_to_3_2_8.php");
$new_version = update_to_3_2_8();
case '3.2.8' :
// will upgrade 3.2.8 to 3.2.9
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_2_8_to_3_2_9.php");
$new_version = update_3_2_8_to_3_2_9();
case '3.2.9' :
// will upgrade 3.2.9 to 3.3.0
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_2_9_to_3_3_0.php");
$new_version = update_3_2_9_to_3_3_0();
case '3.3.0' :
// will upgrade 3.3.0 to 3.3.1
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_0_to_3_3_1.php");
$new_version = update_3_3_0_to_3_3_1();
case '3.3.1' :
// will upgrade 3.3.1 to 3.3.8
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_1_to_3_3_8.php");
$new_version = update_3_3_1_to_3_3_8();
case '3.3.8' :
// will upgrade 3.3.8 to 3.4.9
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_8_to_3_4_9.php");
$new_version = update_3_3_8_to_3_4_9();
case '3.4.9' :
// will upgrade 3.4.9 to 3.4.10
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_4_9_to_3_4_10.php");
$new_version = update_3_4_9_to_3_4_10();
}
if (isset($new_version)) {
// end update by updating the db version number
$query = "UPDATE `glpi_plugin_processmaker_configs` SET `db_version` = '$new_version' WHERE `id` = 1;";
$DB->query($query) or die("error when updating db_version field in glpi_plugin_processmaker_configs" . $DB->error());
}
}
<?php
function processmaker_update() {
global $DB;
// update from older versions
// load config to get current version
if (!$DB->fieldExists("glpi_plugin_processmaker_configs", "db_version" )) {
$current_version = '2.4.1';
} else {
include_once(GLPI_ROOT."/plugins/processmaker/inc/config.class.php");
$config = PluginProcessmakerConfig::getInstance();
$current_version = $config->fields['db_version'];
if (empty($current_version)) {
$current_version = '2.4.1';
}
}
switch ($current_version) {
case '2.4.1' :
// will upgrade any old versions (< 3.2.8) to 3.2.8
include_once(GLPI_ROOT."/plugins/processmaker/install/update_to_3_2_8.php");
$new_version = update_to_3_2_8();
case '3.2.8' :
// will upgrade 3.2.8 to 3.2.9
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_2_8_to_3_2_9.php");
$new_version = update_3_2_8_to_3_2_9();
case '3.2.9' :
// will upgrade 3.2.9 to 3.3.0
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_2_9_to_3_3_0.php");
$new_version = update_3_2_9_to_3_3_0();
case '3.3.0' :
// will upgrade 3.3.0 to 3.3.1
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_0_to_3_3_1.php");
$new_version = update_3_3_0_to_3_3_1();
case '3.3.1' :
// will upgrade 3.3.1 to 3.3.8
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_1_to_3_3_8.php");
$new_version = update_3_3_1_to_3_3_8();
case '3.3.8' :
// will upgrade 3.3.8 to 3.4.9
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_8_to_3_4_9.php");
$new_version = update_3_3_8_to_3_4_9();
case '3.4.9' :
// will upgrade 3.4.9 to 3.4.10
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_4_9_to_3_4_10.php");
$new_version = update_3_4_9_to_3_4_10();
case '3.4.10' :
// will upgrade 3.4.10 to 4.0.0
include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_4_10_to_4_0_0.php");
$new_version = update_3_4_10_to_4_0_0();
}
if (isset($new_version) && $new_version !== false) {
// end update by updating the db version number
$query = "UPDATE `glpi_plugin_processmaker_configs` SET `db_version` = '$new_version' WHERE `id` = 1;";
$DB->query($query) or die("error when updating db_version field in glpi_plugin_processmaker_configs" . $DB->error());
}
}

View File

@@ -0,0 +1,14 @@
<?php
function update_3_4_10_to_4_0_0() {
global $DB;
// needs to change password encryption
$pmglpikey = new PluginProcessmakerGlpikey;
if ($pmglpikey->migratePasswords()) {
return '4.0.0';
}
return false;
}

Binary file not shown.

View File

@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: processmaker-plugin\n"
"POT-Creation-Date: 2018-08-06 14:32+0200\n"
"PO-Revision-Date: 2018-08-06 14:43+0200\n"
"PO-Revision-Date: 2021-02-15 14:25\n"
"Last-Translator: tomolimo\n"
"Language-Team: Czech\n"
"Language: cs_CZ\n"
@@ -12,11 +12,7 @@ msgstr ""
"X-Generator: Poedit 2.1.1\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=4; plural=(n==1) ? 0 : (n>=2 && n<=4) ? 1 : 3;\n"
"X-Poedit-KeywordsList: ;__:1,2t;_e:1,2t;_x:1c,2,3t;_n:1,2,4t;__s:1,2t;"
"_ex:1c,2,3t;_sx:1c,2,3t;_nx:1c,2,3,5t\n"
"X-Crowdin-Project: processmaker-plugin\n"
"X-Crowdin-Language: cs\n"
"X-Crowdin-File: /3.3.0/source.po\n"
"X-Poedit-KeywordsList: ;__:1,2t;_e:1,2t;_x:1c,2,3t;_n:1,2,4t;__s:1,2t;_ex:1c,2,3t;_sx:1c,2,3t;_nx:1c,2,3,5t\n"
"X-Poedit-SearchPath-0: ajax\n"
"X-Poedit-SearchPath-1: front\n"
"X-Poedit-SearchPath-2: inc\n"
@@ -24,75 +20,80 @@ msgstr ""
"X-Poedit-SearchPath-4: js\n"
"X-Poedit-SearchPath-5: hook.php\n"
"X-Poedit-SearchPath-6: setup.php\n"
"X-Crowdin-Project: processmaker-plugin\n"
"X-Crowdin-Project-ID: 310131\n"
"X-Crowdin-Language: cs\n"
"X-Crowdin-File: /3.3.0/source.po\n"
"X-Crowdin-File-ID: 15\n"
#: ajax/task_users.php:25
#: ajax/task_users.php:25
msgid "Re-assign task to"
msgstr "Úkol předat"
#: ajax/task_users.php:45
#: ajax/task_users.php:45
msgid "Re-assign"
msgstr "Předat"
#: front/case.form.php:35
#: front/case.form.php:35
msgid "Case has been deleted!"
msgstr "Případ byl smazán!"
#: front/case.form.php:37
#: front/case.form.php:37
msgid "Unable to delete case!"
msgstr "Případ se nedaří smazat!"
#: front/case.form.php:50
#: front/case.form.php:50
msgid "Case has been cancelled!"
msgstr "Případ byl zrušen!"
#: front/case.form.php:52 front/case.form.php:55
#: front/case.form.php:52 front/case.form.php:55
msgid "Unable to cancel case!"
msgstr "Případ se nedaří zrušit!"
#: front/case.form.php:76 front/case.form.php:78 inc/case.class.php:1018
#: front/case.form.php:76 front/case.form.php:78 inc/case.class.php:1018
msgid "Process cases"
msgstr "Případy procesu"
#: front/case.php:5 front/caselink.form.php:27 front/caselink.php:5
#: front/process.form.php:25 front/process.php:5 inc/caselink.class.php:143
#: inc/config.class.php:50 inc/config.class.php:354 inc/process.class.php:393
#: inc/profile.class.php:52 inc/profile.class.php:83
#: front/case.php:5 front/caselink.form.php:27 front/caselink.php:5
#: front/process.form.php:25 front/process.php:5 inc/caselink.class.php:143
#: inc/config.class.php:50 inc/config.class.php:354 inc/process.class.php:393
#: inc/profile.class.php:52 inc/profile.class.php:83
msgid "ProcessMaker"
msgstr "ProcessMaker"
#: front/processmaker.form.php:85
#: front/processmaker.form.php:85
msgid "Task re-assigned!"
msgstr "Úkol předán!"
#: front/processmaker.form.php:87
#: front/processmaker.form.php:87
msgid "Error re-assigning task: "
msgstr "Chyba při předávání úkolu: "
#: front/processmaker.form.php:90
#: front/processmaker.form.php:90
msgid "Task already assigned to this person!"
msgstr "Úkol už je této osobě přiřazen!"
#: front/processmaker.helpdesk.form.php:21
#: front/processmaker.helpdesk.form.php:21
msgid "Process - Case"
msgstr "Proces případ"
#: front/processmaker.helpdesk.form.php:24 inc/case.class.php:605
#: front/processmaker.helpdesk.form.php:24 inc/case.class.php:605
msgid "Select the process you want to add"
msgstr "Vyberte proces který chcete přidat"
#: hook.php:31 inc/taskcategory.class.php:98
#: hook.php:31 inc/taskcategory.class.php:98
msgid "Synchronize Task List"
msgstr "Synchronizovat seznam úkolů"
#: hook.php:158 inc/case.class.php:77
#: hook.php:158 inc/case.class.php:77
msgid "Case"
msgstr "Případ"
#: hook.php:158 inc/case.class.php:586 inc/case.class.php:1062
#: hook.php:158 inc/case.class.php:586 inc/case.class.php:1062
msgid "Status"
msgstr "Stav"
#: inc/case.class.php:23 inc/case.class.php:90 inc/case.class.php:92
#: inc/case.class.php:23 inc/case.class.php:90 inc/case.class.php:92
msgid "Process case"
msgid_plural "Process cases"
msgstr[0] "Případ procesu"
@@ -100,465 +101,462 @@ msgstr[1] "Případy procesu"
msgstr[2] "Případy procesu"
msgstr[3] "Případy procesu"
#: inc/case.class.php:80
#: inc/case.class.php:80
msgid "Sub-case"
msgstr ""
msgstr "Dílčí případ"
#: inc/case.class.php:312
#: inc/case.class.php:312
msgid "Current task(s) properties"
msgstr "Vlastnosti stávajícího úkolu"
#: inc/case.class.php:316 inc/task.class.php:263
#: inc/case.class.php:316 inc/task.class.php:263
msgid "Task"
msgstr "Úkol"
#: inc/case.class.php:317 inc/task.class.php:264
#: inc/case.class.php:317 inc/task.class.php:264
msgid "Task guid"
msgstr "Nikde se neopakující identif. úkolu"
#: inc/case.class.php:318 inc/task.class.php:265
#: inc/case.class.php:318 inc/task.class.php:265
msgid "Current user"
msgstr "Stávající uživatel"
#: inc/case.class.php:319 inc/task.class.php:266
#: inc/case.class.php:319 inc/task.class.php:266
msgid "Task delegation date"
msgstr "Datum delegování úkolu"
#: inc/case.class.php:341 inc/task.class.php:275
#: inc/case.class.php:341 inc/task.class.php:275
msgid "To be claimed"
msgstr "Chcete-li uplatnit"
#: inc/case.class.php:377
#: inc/case.class.php:377
msgid "Sub-case properties"
msgstr ""
msgstr "Vlastnosti dílčího případu"
#: inc/case.class.php:380
#: inc/case.class.php:380
msgid "Parent case properties"
msgstr ""
msgstr "Vlastnosti nadřazeného případu"
#: inc/case.class.php:382
#: inc/case.class.php:382
msgid "Case properties"
msgstr "Vlastnosti případu"
#: inc/case.class.php:387 inc/case.class.php:584 inc/case.class.php:1036
#: inc/process.class.php:548
#: inc/case.class.php:387 inc/case.class.php:584 inc/case.class.php:1036
#: inc/process.class.php:548
msgid "Process"
msgstr "Proces"
#: inc/case.class.php:388
#: inc/case.class.php:388
msgid "Case title"
msgstr "Název případu"
#: inc/case.class.php:389
#: inc/case.class.php:389
msgid "Case number"
msgstr "Číslo případu"
#: inc/case.class.php:390
#: inc/case.class.php:390
msgid "Case status"
msgstr "Stav případu"
#: inc/case.class.php:391
#: inc/case.class.php:391
msgid "Case guid"
msgstr "Nikde se neopakující identif. případu"
#: inc/case.class.php:392
#: inc/case.class.php:392
msgid "Creator"
msgstr "Vytvořil"
#: inc/case.class.php:393
#: inc/case.class.php:393
msgid "Creation date"
msgstr "Datum vytvoření"
#: inc/case.class.php:394
#: inc/case.class.php:394
msgid "Last update"
msgstr "Poslední úprava"
#: inc/case.class.php:479
#, php-format
#: inc/case.class.php:479
#, php-format
msgid "Case is linked to a %1s"
msgstr ""
msgstr "Případ je propojen s %1s"
#: inc/case.class.php:481
#, php-format
#: inc/case.class.php:481
#, php-format
msgid "Sub-case is linked to a %1s"
msgstr ""
msgstr "Dílčí případ je propojen s %1s"
#: inc/case.class.php:506
#: inc/case.class.php:506
msgid "Case cancellation"
msgstr "Zrušení případu"
#: inc/case.class.php:507
#: inc/case.class.php:507
msgid "Cancel case"
msgstr "Zrušit případ"
#: inc/case.class.php:511
#: inc/case.class.php:511
msgid "Confirm cancellation?"
msgstr "Potvrdit zrušení?"
#: inc/case.class.php:511 inc/profile.class.php:23
#: inc/case.class.php:511 inc/profile.class.php:23
msgid "Cancel"
msgstr "Storno"
#: inc/case.class.php:532
#: inc/case.class.php:532
msgid "Case deletion"
msgstr "Mazání případu"
#: inc/case.class.php:533
#: inc/case.class.php:533
msgid "Delete case"
msgstr "Smazat případ"
#: inc/case.class.php:585 inc/case.class.php:1029
#: inc/case.class.php:585 inc/case.class.php:1029
msgid "Title"
msgstr "Titulek"
#: inc/case.class.php:587 inc/case.class.php:1070
#: inc/case.class.php:587 inc/case.class.php:1070
msgid "Sub-case of"
msgstr ""
msgstr "Dílčí případ z"
#: inc/case.class.php:602
#: inc/case.class.php:602
msgid "Add a new case"
msgstr "Přidat nový případ"
#: inc/case.class.php:995
#: inc/case.class.php:995
msgctxt "case_status"
msgid "Draft"
msgstr "Koncept"
#: inc/case.class.php:996
#: inc/case.class.php:996
msgctxt "case_status"
msgid "To do"
msgstr "Dodělat"
#: inc/case.class.php:997
#: inc/case.class.php:997
msgctxt "case_status"
msgid "Completed"
msgstr "Dokončeno"
#: inc/case.class.php:998
#: inc/case.class.php:998
msgctxt "case_status"
msgid "Cancelled"
msgstr "Zrušeno"
#: inc/case.class.php:1022
#: inc/case.class.php:1022
msgid "ID"
msgstr "Identif."
#: inc/case.class.php:1049
#: inc/case.class.php:1049
msgid "Item"
msgstr "Položka"
#: inc/case.class.php:1056
#: inc/case.class.php:1056
msgid "Item entity"
msgstr "Entita položky"
#: inc/casechangelog.class.php:35
#: inc/casechangelog.class.php:35
msgid "Change log"
msgstr "Seznam změn"
#: inc/casedynaform.class.php:80
#: inc/casedynaform.class.php:80
msgid "Dynaforms"
msgstr "Dynamické formuláře"
#: inc/casehistory.class.php:35
#: inc/casehistory.class.php:35
msgid "History"
msgstr "Historie"
#: inc/caselink.class.php:51
#: inc/caselink.class.php:51
msgid "Case-links"
msgstr "Propojení případů"
#: inc/caselink.class.php:53
#: inc/caselink.class.php:53
msgid "Case-link"
msgstr "Propojení případu"
#: inc/caselink.class.php:75 inc/caselink.class.php:165
#: inc/caselink.class.php:75 inc/caselink.class.php:165
msgid "External data"
msgstr "Externí data"
#: inc/caselink.class.php:80 inc/caselink.class.php:171
#: inc/caselink.class.php:80 inc/caselink.class.php:171
msgid "Self"
msgstr "Samo"
#: inc/caselink.class.php:85 inc/caselink.class.php:189
#: inc/caselink.class.php:85 inc/caselink.class.php:189
msgid "Source task GUID"
msgstr "Nikde se neopakující identif. zdrojového úkolu"
#: inc/caselink.class.php:93 inc/caselink.class.php:195
#: inc/caselink.class.php:93 inc/caselink.class.php:195
msgid "Target task GUID"
msgstr "Nikde se neopakující identif. cílového úkolu"
#: inc/caselink.class.php:101 inc/caselink.class.php:207
#: inc/caselink.class.php:101 inc/caselink.class.php:207
msgid "Target process GUID"
msgstr "Nikde se neopakující identif. cílového procesu"
#: inc/caselink.class.php:110 inc/caselink.class.php:201
#: inc/caselink.class.php:110 inc/caselink.class.php:201
msgid "Target dynaform GUID"
msgstr "Nikde se neopakující identif. cílového dynamického formuláře"
#: inc/caselink.class.php:115 inc/caselink.class.php:213
#: inc/caselink.class.php:115 inc/caselink.class.php:213
msgid "Source condition"
msgstr "Stav zdroje"
#: inc/caselink.class.php:121 inc/caselink.class.php:177
#: inc/caselink.class.php:121 inc/caselink.class.php:177
msgid "Claim target task"
msgstr "Převzít cílový úkol"
#: inc/caselink.class.php:126 inc/caselink.class.php:183
#: inc/caselink.class.php:126 inc/caselink.class.php:183
msgid "External application JSON config"
msgstr "JSON nastavení externí aplikace"
#: inc/casemap.class.php:43
#: inc/casemap.class.php:43
msgid "Map"
msgstr "Mapa"
#: inc/config.class.php:41
#: inc/config.class.php:41
msgid "ProcessMaker setup"
msgstr "Nastavení ProcessMaker"
#: inc/config.class.php:159
#: inc/config.class.php:159
msgid "Server URL (must be in same domain than GLPI)"
msgstr "URL adresa serveru (je třeba, aby byla ze stejné domény jako GLPI)"
#: inc/config.class.php:164
#: inc/config.class.php:164
msgid "Common domain with GLPI"
msgstr "Společná doména s GLPI"
#: inc/config.class.php:193
#: inc/config.class.php:193
msgid "None!"
msgstr "Žádná!"
#: inc/config.class.php:202
#: inc/config.class.php:202
msgid "Workspace Name"
msgstr "Název pracovního prostoru"
#: inc/config.class.php:207
#: inc/config.class.php:207
msgid "Server administrator name"
msgstr "Uživatelské jméno správce serveru"
#: inc/config.class.php:212
#: inc/config.class.php:212
msgid "Server administrator password"
msgstr "Heslo správce serveru"
#: inc/config.class.php:218 inc/config.class.php:258
#: inc/config.class.php:218 inc/config.class.php:258
msgid "Connection status"
msgstr "Stav spojení"
#: inc/config.class.php:234
#: inc/config.class.php:234
msgid "SQL server setup"
msgstr "Nastavení SQL serveru"
#: inc/config.class.php:237
#: inc/config.class.php:237
msgid "SQL server (MariaDB or MySQL)"
msgstr "SQL server (MariaDB nebo MySQL)"
#: inc/config.class.php:242
#: inc/config.class.php:242
msgid "Database name"
msgstr "Název databáze"
#: inc/config.class.php:247
#: inc/config.class.php:247
msgid "SQL user"
msgstr "SQL uživatel"
#: inc/config.class.php:252
#: inc/config.class.php:252
msgid "SQL password"
msgstr "SQL heslo"
#: inc/config.class.php:269
#: inc/config.class.php:269
msgid "Theme Name"
msgstr "Název motivu vzhledu"
#: inc/config.class.php:275
#: inc/config.class.php:275
msgid "Main Task Category (edit to change name)"
msgstr "Hlavní kategorie úkolu (pro změnu názvu upravte)"
#: inc/config.class.php:282
#: inc/config.class.php:282
msgid "Task Writer (edit to change name)"
msgstr "Úkol zapsal (pro změnu jména upravte)"
#: inc/config.class.php:302
#: inc/config.class.php:302
msgid "Group in ProcessMaker which will contain all GLPI users"
msgstr "Skupina v ProcessMaker která bude obsahovat všechny uživatele z GLPI"
#: inc/config.class.php:331
#: inc/config.class.php:331
msgid "Processmaker system information"
msgstr "Systémové informace o Processmaker"
#: inc/config.class.php:334 inc/config.class.php:344
#: inc/config.class.php:334 inc/config.class.php:344
msgid "Version"
msgstr "Verze"
#: inc/config.class.php:335
#: inc/config.class.php:335
msgid "Web server"
msgstr "Webový server"
#: inc/config.class.php:336
#: inc/config.class.php:336
msgid "Server name"
msgstr "Název serveru"
#: inc/config.class.php:337
#: inc/config.class.php:337
msgid "PHP version"
msgstr "Verze PHP"
#: inc/config.class.php:338
#: inc/config.class.php:338
msgid "DB version"
msgstr "Verze databáze"
#: inc/config.class.php:339
#: inc/config.class.php:339
msgid "DB server IP"
msgstr "IP adresa webového serveru"
#: inc/config.class.php:340
#: inc/config.class.php:340
msgid "DB name"
msgstr "Název databáze"
#: inc/config.class.php:341
#: inc/config.class.php:341
msgid "User browser"
msgstr "Prohlížeč uživatele"
#: inc/config.class.php:342
#: inc/config.class.php:342
msgid "User IP"
msgstr "IP adresa uživatele"
#: inc/config.class.php:344
#: inc/config.class.php:344
msgid "Not yet!"
msgstr "Ještě ne!"
#: inc/process.class.php:350
#: inc/process.class.php:350
msgid "Synchronize Process List"
msgstr "Synchronizovat seznam procesů"
#: inc/process.class.php:427 inc/process.class.php:589
#: inc/process.class.php:427 inc/process.class.php:589
msgid "Process GUID"
msgstr "Nikde se neopakující identif. procesu"
#: inc/process.class.php:433
#: inc/process.class.php:433
msgid "Process type"
msgstr ""
msgstr "Typ procesu"
#: inc/process.class.php:439
#: inc/process.class.php:439
msgid "Hide case num. & title"
msgstr ""
msgstr "Skrýt číslo případu a nadpis"
#: inc/process.class.php:445
#: inc/process.class.php:445
msgid "Insert Task Category"
msgstr "Vložit kategorii úkolu"
#: inc/process.class.php:457
#: inc/process.class.php:457
msgid "Ticket type (self-service)"
msgstr "Typ požadavku (samoobslužné)"
#: inc/process.class.php:464 inc/process.class.php:609
#: inc/process.class.php:464 inc/process.class.php:609
msgid "Visible in Incident for Central interface"
msgstr ""
msgstr "Viditelné v incidentu pro ústřední rozhraní"
#: inc/process.class.php:470 inc/process.class.php:614
#: inc/process.class.php:470 inc/process.class.php:614
msgid "Visible in Request for Central interface"
msgstr ""
msgstr "Viditelné v požadavku pro ústřední rozhraní"
#: inc/process.class.php:476 inc/process.class.php:666
#: inc/process.class.php:476 inc/process.class.php:666
msgid "Visible in Change"
msgstr ""
msgstr "Viditelné ve změně"
#: inc/process.class.php:482 inc/process.class.php:671
#: inc/process.class.php:482 inc/process.class.php:671
msgid "Visible in Problem"
msgstr ""
msgstr "Viditelné v problému"
#: inc/process.class.php:519
#: inc/process.class.php:519
msgctxt "process_type"
msgid "Classic"
msgstr "Klasický"
#: inc/process.class.php:520
#: inc/process.class.php:520
msgctxt "process_type"
msgid "BPMN"
msgstr "BPMN"
#: inc/process.class.php:546
#: inc/process.class.php:546
msgid "Processes"
msgstr "Procesy"
#: inc/process.class.php:599
#: inc/process.class.php:599
msgid "Hide case number and title in task descriptions"
msgstr "V popisech úkolů skrýt číslo a titulek případu"
#: inc/process.class.php:604
#: inc/process.class.php:604
msgid "Insert Task Category comments in Task Description"
msgstr "Vložit komentáře kategorie úkolu do jeho popisu"
#: inc/process.class.php:619
#: inc/process.class.php:619
msgid "ITIL Category for Self-service interface (left empty to disable)"
msgstr ""
msgstr "ITIL kategorie pro samoobslužné rozhraní (ponecháním nevyplněného bude vypnuto)"
#: inc/process.class.php:646
#: inc/process.class.php:646
msgid "Type for Self-service interface"
msgstr ""
msgstr "Typ samoobslužného rozhraní"
#: inc/process.class.php:676
#: inc/process.class.php:676
msgid "Process type (to be changed only if not up-to-date)"
msgstr ""
msgstr "Typ procesu (který má být změněno pouze pokud není aktuální)"
#: inc/process_profile.class.php:26 inc/process_profile.class.php:45
#: inc/process_profile.class.php:26 inc/process_profile.class.php:45
msgid "Authorizations"
msgstr "Oprávnění"
#: inc/process_profile.class.php:179
#: inc/process_profile.class.php:179
msgid "Authorization not added: already existing!"
msgstr "Oprávnění nepřidáno: už existuje!"
#: inc/processmaker.class.php:116 inc/processmaker.class.php:118
#: inc/processmaker.class.php:116 inc/processmaker.class.php:118
msgctxt "errors"
msgid "Error creating case!"
msgstr "Chyba při vytváření případu!"
#: inc/processmaker.class.php:117
#: inc/processmaker.class.php:117
msgctxt "errors"
msgid "Can't create case: no rights for it!"
msgstr "Případ se nedaří vytvořit: nedostatečná oprávnění!"
#: inc/processmaker.class.php:984
#: inc/processmaker.class.php:984
msgid "Syncs GLPI users and groups into ProcessMaker."
msgstr "Synchronizuje uživatele a skupiny z GLPI do ProcessMaker."
#: inc/processmaker.class.php:986
#: inc/processmaker.class.php:986
msgid "Cleaning of orphan cases."
msgstr "Čištění osiřelých případů."
#: inc/processmaker.class.php:986
#: inc/processmaker.class.php:986
msgid "Number of days to keep orphan cases"
msgstr "Po kolik dnů ponechávat osiřelé případy"
#: inc/processmaker.class.php:988
#: inc/processmaker.class.php:988
msgid "To apply task actions between cases."
msgstr "Pro uplatnění akcí úkolu mezi případy."
#: inc/processmaker.class.php:1696
#: inc/processmaker.class.php:1696
msgid "Case title: "
msgstr "Titulek případu: "
#: inc/processmaker.class.php:2178
#: inc/processmaker.class.php:2178
msgid "A 'Case' is running!"
msgstr "„Případ“ je v běhu!"
#: inc/processmaker.class.php:2179
#: inc/processmaker.class.php:2179
msgid "You must manage it first (see 'Process - Case' tab)!"
msgstr "Nejprve je třeba toto spravovat (viz panel „Proces případ“)!"
#: inc/processmaker.class.php:3038
msgid ""
"ProcessMaker plugin is under maintenance, please retry later, thank you."
msgstr ""
"Na zásuvném modulu ProcessMaker probíhá údržba, zkuste to prosím později "
"děkujeme."
#: inc/processmaker.class.php:3038
msgid "ProcessMaker plugin is under maintenance, please retry later, thank you."
msgstr "Na zásuvném modulu ProcessMaker probíhá údržba, zkuste to prosím později děkujeme."
#: inc/profile.class.php:17
#: inc/profile.class.php:17
msgid "Process configuration"
msgstr "Nastavení procesu"
#: inc/profile.class.php:21
#: inc/profile.class.php:21
msgid "Cases"
msgstr "Případy"
#: inc/task.class.php:29
#: inc/task.class.php:29
msgid "Process case task"
msgid_plural "Process case tasks"
msgstr[0] "Zpracovat úkoly případu"
@@ -566,47 +564,48 @@ msgstr[1] "Process case tasks"
msgstr[2] "Process case tasks"
msgstr[3] "Process case tasks"
#: inc/task.class.php:258
#: inc/task.class.php:258
msgid "Sub-case task(s)"
msgstr ""
msgstr "Úkoly dílčího případu"
#: inc/taskcategory.class.php:21 inc/taskcategory.class.php:31
#: inc/taskcategory.class.php:21 inc/taskcategory.class.php:31
msgid "Task List"
msgstr "Seznam úkolů"
#: inc/taskcategory.class.php:32
#: inc/taskcategory.class.php:32
msgid "Task name"
msgstr "Název úkolu"
#: inc/taskcategory.class.php:34 inc/taskcategory.class.php:60
#: inc/taskcategory.class.php:34 inc/taskcategory.class.php:60
msgid "Start"
msgstr "Spustit"
#: inc/taskcategory.class.php:35
#: inc/taskcategory.class.php:35
msgid "Task GUID"
msgstr "Nikde se neopakující identif. úkolu"
#: inc/taskcategory.class.php:38 inc/taskcategory.class.php:78
#: inc/taskcategory.class.php:38 inc/taskcategory.class.php:78
msgid "Sub-process"
msgstr "Dílčí proces"
#~ msgid "Case item"
#~ msgstr "Case item"
#~ msgid "Case item"
#~ msgstr "Case item"
#~ msgid "Subcase of"
#~ msgstr "Subcase of"
#~ msgid "Subcase of"
#~ msgstr "Subcase of"
#~ msgid "Project type"
#~ msgstr "Project type"
#~ msgid "Project type"
#~ msgstr "Project type"
#~ msgid "Hide case number and title"
#~ msgstr "Hide case number and title"
#~ msgid "Hide case number and title"
#~ msgstr "Hide case number and title"
#~ msgid "ITIL Category (self-service)"
#~ msgstr "ITIL Category (self-service)"
#~ msgid "ITIL Category (self-service)"
#~ msgstr "ITIL Category (self-service)"
#~ msgid "Project type (to be changed if not up-to-date)"
#~ msgstr "Project type (to be changed if not up-to-date)"
#~ msgid "Project type (to be changed if not up-to-date)"
#~ msgstr "Project type (to be changed if not up-to-date)"
#~ msgid "Plugin is under maintenance, please retry later, thank you."
#~ msgstr "Plugin is under maintenance, please retry later, thank you."
#~ msgid "Plugin is under maintenance, please retry later, thank you."
#~ msgstr "Plugin is under maintenance, please retry later, thank you."

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -1,18 +1,19 @@
msgid ""
msgstr ""
"Project-Id-Version: processmaker-plugin\n"
"POT-Creation-Date: 2020-07-13 09:41+0200\n"
"PO-Revision-Date: 2020-07-13 11:02+0200\n"
"POT-Creation-Date: 2021-02-15 17:32+0100\n"
"PO-Revision-Date: 2021-02-15 17:34+0100\n"
"Last-Translator: tomolimo\n"
"Language-Team: French\n"
"Language: fr_FR\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 2.3.1\n"
"X-Generator: Poedit 2.4.2\n"
"X-Poedit-Basepath: ..\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
"X-Poedit-KeywordsList: ;__:1,2t;_e:1,2t;_x:1c,2,3t;_n:1,2,4t;__s:1,2t;_ex:1c,2,3t;_sx:1c,2,3t;_nx:1c,2,3,5t\n"
"X-Poedit-KeywordsList: ;__:1,2t;_e:1,2t;_x:1c,2,3t;_n:1,2,4t;__s:1,2t;"
"_ex:1c,2,3t;_sx:1c,2,3t;_nx:1c,2,3,5t\n"
"X-Crowdin-Project: processmaker-plugin\n"
"X-Crowdin-Project-ID: 310131\n"
"X-Crowdin-Language: fr\n"
@@ -28,54 +29,63 @@ msgstr ""
#: ajax/task_users.php:36
msgid "Re-assign task to"
msgstr "Ré-affecter tâche à"
msgstr "Réattribuer la tâche à"
#: ajax/task_users.php:60 ajax/task_users.php:61 ajax/task_users.php:124
#: ajax/task_users.php:67 ajax/task_users.php:68 ajax/task_users.php:135
msgid "Re-assign"
msgstr "Ré-affecter"
msgstr "Réattribuer"
#: ajax/task_users.php:110
#| msgid "Task already assigned to this person!"
msgid "Task is already assigned to this user or group!"
msgstr "La tâche est déjà affectée à cet utilisateur (ou ce groupe) !"
#: ajax/task_users.php:100
msgid "Input at least 10 words in English to justify."
msgstr "Entrez au moins 10 mots en anglais pour justifier."
#: ajax/task_users.php:110 ajax/task_users.php:122
#| msgid "Re-assign task to"
#: ajax/task_users.php:118
msgid "Task is already un-assigned!"
msgstr "L'attribution de cette tâche est déjà supprimée !"
#: ajax/task_users.php:118 ajax/task_users.php:120 ajax/task_users.php:133
msgid "Re-assign task"
msgstr "Ré-affecter tâche"
msgstr "Réattribuer la tâche"
#: ajax/task_users.php:114 ajax/task_users.php:119
#| msgid "Claim target task"
#: ajax/task_users.php:120
msgid "Task is already assigned to this user!"
msgstr "La tâche est déjà attribuée à cet utilisateur !"
#: ajax/task_users.php:125 ajax/task_users.php:130
msgid "Un-claim task"
msgstr "Annuler affectation de la tâche"
msgstr "Supprimer l'attribution de la tâche"
#: ajax/task_users.php:115
msgid "Please input reason to un-claim<br/>(task will be re-assigned to former group):"
msgstr "Saisir la raison pour l'annulation de l'affectation<br/>(la tâche sera ré-affectée au groupe précédent) :"
#: ajax/task_users.php:126
msgid ""
"Please input reason to un-claim<br/>(task will be re-assigned to former "
"group):"
msgstr ""
"Saisir la raison pour l'annulation de l'attribution<br/>(la tâche sera "
"réattribuée au groupe précédent) :"
#: ajax/task_users.php:116
#: ajax/task_users.php:127
msgid "Un-claim"
msgstr "Annulation de l'affectation"
msgstr "Suppression de l'attribution"
#: ajax/task_users.php:119
msgid "Can\\'t un-assign Task!"
msgstr "Annulation de l'affectation impossible !"
#: ajax/task_users.php:123
msgid "Please input reason to re-assign:"
msgstr "Saisir la raison pour la ré-affectation :"
#: ajax/task_users.php:130
msgid "Can't un-assign task!"
msgstr "Suppression de l'attribution impossible !"
#: ajax/task_users.php:134
msgid "Please input reason to re-assign:"
msgstr "Saisir la raison pour la réattribution :"
#: ajax/task_users.php:145
msgid "Send reminder"
msgstr "Envoyer un rappel"
#: front/case.form.php:32
msgid "Case has been deleted!"
msgstr "Le cas a été effacé !"
msgstr "Le cas a été supprimé !"
#: front/case.form.php:34
msgid "Unable to delete case!"
msgstr "Impossible d'effacer le cas !"
msgstr "Impossible de supprimer le cas !"
#: front/case.form.php:46
msgid "Case has been cancelled!"
@@ -85,12 +95,12 @@ msgstr "Le cas a été annulé !"
msgid "Unable to cancel case!"
msgstr "Impossible d'annuler le cas !"
#: front/case.form.php:70 front/case.form.php:72 inc/case.class.php:1310
#: front/case.form.php:70 front/case.form.php:72 inc/case.class.php:1272
msgid "Process cases"
msgstr "Cas des processus"
#: front/case.php:5 front/caselink.form.php:29 front/caselink.php:5
#: front/process.form.php:27 front/process.php:5 inc/caselink.class.php:157
#: front/process.form.php:27 front/process.php:5 inc/caselink.class.php:158
#: inc/config.class.php:50 inc/config.class.php:363 inc/process.class.php:409
#: inc/profile.class.php:52 inc/profile.class.php:83
msgid "ProcessMaker"
@@ -98,222 +108,235 @@ msgstr "ProcessMaker"
#: front/processmaker.form.php:80
msgid "Task re-assigned!"
msgstr "Tâche ré-affectée !"
msgstr "Tâche réattribuée !"
#: front/processmaker.form.php:82
msgid "Error re-assigning task: "
msgstr "Impossible de ré-affecter cette tâche :"
msgstr "Impossible de réattribuer cette tâche :"
#: front/processmaker.form.php:93
#| msgid "Task name"
msgid "Task un-claimed!"
msgstr "Annulation de l'affectation de la tâche effectuée !"
msgstr "Annulation de l'attribution de la tâche effectuée !"
#: front/processmaker.form.php:95
msgid "Can't un-claim task! Verify 'Assignement Rules' in the process definition."
msgstr "Annulation de l'affectation impossible ! Vérifiez les règles d'assignation dans la définition du Processus."
msgid ""
"Can't un-claim task! Verify 'Assignement Rules' in the process definition."
msgstr ""
"Annulation de l'attribution impossible ! Vérifiez les règles d'attribution "
"dans la définition du Processus."
#: front/processmaker.helpdesk.form.php:21
msgid "Process - Case"
msgstr "Processus - Cas"
#: front/processmaker.helpdesk.form.php:24 inc/case.class.php:799
#: front/processmaker.helpdesk.form.php:24 inc/case.class.php:761
msgid "Select the process you want to add"
msgstr "Choisir le processus à démarrer"
msgstr "Choisir le processus à ajouter"
#: hook.php:9 inc/taskcategory.class.php:214
msgid "Synchronize Task List"
msgstr "Synchroniser la liste des Tâches"
msgstr "Synchroniser la liste des tâches"
#: hook.php:76 inc/case.class.php:89
msgid "Case"
msgstr "Cas"
#: hook.php:76 inc/case.class.php:778 inc/case.class.php:1355
#: hook.php:76 inc/case.class.php:740 inc/case.class.php:1317
msgid "Status"
msgstr "Statut"
#: inc/case.class.php:25 inc/case.class.php:102 inc/case.class.php:104
#: inc/case.class.php:25
msgid "Process case"
msgid_plural "Process cases"
msgstr[0] "Cas du processus"
msgstr[1] "Cas des processus"
msgstr[1] "Cas du processus"
#: inc/case.class.php:92
msgid "Sub-case"
msgstr "Sous-cas"
#: inc/case.class.php:303
#: inc/case.class.php:265
#, php-format
msgid "<b>Task un-claimed!</b><br/><b>Case: </b>%s<br/><b>Task: </b>\"%s\" has been un-assigned from \"%s\" and assigned to \"%s\" group.<br/><b>Reason: </b>%s"
msgstr "<b>Annulation de l'affection de la tâche effectuée !</b><br/><b>Cas : </b>%s<br/><b>Tâche : </b>\"%s\" a été libérée de \"%s\" et assignée au groupe \"%s\".<br/><b>Motif : </b>%s"
msgid ""
"<b>Task un-claimed!</b><br/><b>Case: </b>%s<br/><b>Task: </b>\"%s\" has been "
"un-assigned from \"%s\" and assigned to \"%s\" group.<br/><b>Reason: </b>%s"
msgstr ""
"<b>Suppression de l'attribution de la tâche effectuée !</b><br/><b>Cas : </b>"
"%s<br/><b>Tâche : </b>\"%s\" a été libérée de \"%s\" et attribuée au groupe "
"\"%s\".<br/><b>Motif : </b>%s"
#: inc/case.class.php:420
#: inc/case.class.php:382
#, php-format
msgid "<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"
msgstr "<b>Tâche ré-assignée !</b><br/><b>Cas : </b>%s<br/><b>Tâche : </b>\"%s\" a été ré-assignée de \"%s\" à \"%s\".<br/><b>Motif : </b>%s"
msgid ""
"<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"
msgstr ""
"<b>Tâche réattribuée !</b><br/><b>Cas : </b>%s<br/><b>Tâche : </b>\"%s\" a "
"été réattribuée de \"%s\" à \"%s\".<br/><b>Motif : </b>%s"
#: inc/case.class.php:429
#: inc/case.class.php:391
#, php-format
msgid "<b>Task assigned!</b><br/><b>Case: </b>%s<br/><b>Task: </b>\"%s\" has been assigned to \"%s\".<br/><b>Reason: </b>%s"
msgstr "<b>Tâche assignée !</b><br/><b>Cas : </b>%s<br/><b>Tâche : </b>\"%s\" a été asignée à \"%s\".<br/><b>Motif : </b>%s"
msgid ""
"<b>Task assigned!</b><br/><b>Case: </b>%s<br/><b>Task: </b>\"%s\" has been "
"assigned to \"%s\".<br/><b>Reason: </b>%s"
msgstr ""
"<b>Tâche attribuée !</b><br/><b>Cas : </b>%s<br/><b>Tâche : </b>\"%s\" a été "
"attribuée à \"%s\".<br/><b>Motif : </b>%s"
#: inc/case.class.php:510
#: inc/case.class.php:472
msgid "Current task(s) properties"
msgstr "Propriétés des tâches en cours"
#: inc/case.class.php:514 inc/task.class.php:283
#: inc/case.class.php:476 inc/task.class.php:283
msgid "Task"
msgstr "Tâche"
#: inc/case.class.php:515 inc/task.class.php:284
#: inc/case.class.php:477 inc/task.class.php:284 inc/taskcategory.class.php:43
#: inc/taskcategory.class.php:122
msgid "Task guid"
msgstr "Guid de la tâche"
#: inc/case.class.php:516 inc/task.class.php:285
#: inc/case.class.php:478 inc/task.class.php:285
msgid "Current user"
msgstr "Utilisateur actuel"
#: inc/case.class.php:517 inc/task.class.php:286
#: inc/case.class.php:479 inc/task.class.php:286
msgid "Task delegation date"
msgstr "Date de délégation de tâche"
msgstr "Date d'attribution de tâche"
#: inc/case.class.php:539 inc/task.class.php:295
#: inc/case.class.php:501 inc/task.class.php:295
msgid "To be claimed"
msgstr "A réclamer"
#: inc/case.class.php:575
#: inc/case.class.php:537
msgid "Sub-case properties"
msgstr "Propriétés du sous-cas"
#: inc/case.class.php:578
#: inc/case.class.php:540
msgid "Parent case properties"
msgstr "Propriétés du cas parent"
#: inc/case.class.php:580
#: inc/case.class.php:542
msgid "Case properties"
msgstr "Propriétés du cas"
#: inc/case.class.php:585 inc/case.class.php:776 inc/case.class.php:1328
#: inc/case.class.php:547 inc/case.class.php:738 inc/case.class.php:1290
#: inc/process.class.php:576
msgid "Process"
msgstr "Processus"
#: inc/case.class.php:586 inc/notificationtargetprocessmaker.class.php:64
#: inc/case.class.php:548 inc/notificationtargetprocessmaker.class.php:64
msgid "Case title"
msgstr "Titre du cas"
#: inc/case.class.php:587
#: inc/case.class.php:549
msgid "Case number"
msgstr "Numéro du cas"
#: inc/case.class.php:588
#: inc/case.class.php:550
msgid "Case status"
msgstr "Statut du cas"
#: inc/case.class.php:589
#: inc/case.class.php:551
msgid "Case guid"
msgstr "Guid du cas"
#: inc/case.class.php:590
#: inc/case.class.php:552
msgid "Creator"
msgstr "Créateur"
#: inc/case.class.php:591 inc/case.class.php:1370
#: inc/case.class.php:553 inc/case.class.php:1332
msgid "Creation date"
msgstr "Date de création"
#: inc/case.class.php:592
#: inc/case.class.php:554
msgid "Last update"
msgstr "Dernière mise à jour"
#: inc/case.class.php:675
#: inc/case.class.php:637
#, php-format
msgid "Case is linked to a %1s"
msgstr "Le cas est lié à un %1s"
#: inc/case.class.php:677
#: inc/case.class.php:639
#, php-format
msgid "Sub-case is linked to a %1s"
msgstr "Le sous-cas est lié à un %1s"
#: inc/case.class.php:698
#: inc/case.class.php:660
msgid "Case cancellation"
msgstr "Annulation du cas"
#: inc/case.class.php:699
#: inc/case.class.php:661
msgid "Cancel case"
msgstr "Annuler cas"
#: inc/case.class.php:703
#: inc/case.class.php:665
msgid "Confirm cancellation?"
msgstr "Confirmer lannulation ?"
#: inc/case.class.php:703 inc/profile.class.php:23
#: inc/case.class.php:665 inc/profile.class.php:23
msgid "Cancel"
msgstr "Annuler"
#: inc/case.class.php:717
#: inc/case.class.php:679
msgid "Case deletion"
msgstr "Suppression du cas"
#: inc/case.class.php:777 inc/case.class.php:1321
#: inc/case.class.php:739 inc/case.class.php:1283
msgid "Title"
msgstr "Titre"
#: inc/case.class.php:779 inc/case.class.php:1362
#: inc/case.class.php:741 inc/case.class.php:1324
msgid "Sub-case of"
msgstr "Sous-cas de"
#: inc/case.class.php:796
#: inc/case.class.php:758
msgid "Add a new case"
msgstr "Ajouter un nouveau cas"
#: inc/case.class.php:1227
#: inc/case.class.php:1189
msgctxt "case_status"
msgid "Draft"
msgstr "Brouillon"
#: inc/case.class.php:1228
#: inc/case.class.php:1190
msgctxt "case_status"
msgid "To do"
msgstr "A faire"
#: inc/case.class.php:1229
#: inc/case.class.php:1191
msgctxt "case_status"
msgid "Completed"
msgstr "Terminé"
#: inc/case.class.php:1230
#: inc/case.class.php:1192
msgctxt "case_status"
msgid "Cancelled"
msgstr "Annulé"
#: inc/case.class.php:1314
#: inc/case.class.php:1276
msgid "ID"
msgstr "ID"
#: inc/case.class.php:1335 inc/notificationtargetprocessmaker.class.php:72
#| msgid "Item entity"
#: inc/case.class.php:1297 inc/notificationtargetprocessmaker.class.php:72
msgid "Item type"
msgstr "Type de l'item"
#: inc/case.class.php:1342
#: inc/case.class.php:1304
msgid "Item"
msgstr "Item"
#: inc/case.class.php:1349
#: inc/case.class.php:1311
msgid "Item entity"
msgstr "Entité de l'item"
#: inc/case.class.php:1379
#| msgid "Last update"
#: inc/case.class.php:1341
msgid "Last update date"
msgstr "Date de dernière mise à jour"
#: inc/case.class.php:1392
#: inc/case.class.php:1354
#, php-format
#| msgid "Case status"
msgid "Case status is '%s'"
msgstr "L'état du cas est '%s'"
@@ -341,43 +364,43 @@ msgstr "Lien-cas"
msgid "Synchronous"
msgstr "Synchrone"
#: inc/caselink.class.php:80 inc/caselink.class.php:179
#: inc/caselink.class.php:80 inc/caselink.class.php:180
msgid "External data"
msgstr "Données externes"
#: inc/caselink.class.php:85 inc/caselink.class.php:185
#: inc/caselink.class.php:85 inc/caselink.class.php:186
msgid "Self"
msgstr "Self"
#: inc/caselink.class.php:90 inc/caselink.class.php:203
#: inc/caselink.class.php:90 inc/caselink.class.php:204
msgid "Source task GUID"
msgstr "GUID de la tâche source"
#: inc/caselink.class.php:98 inc/caselink.class.php:209
#: inc/caselink.class.php:99 inc/caselink.class.php:210
msgid "Target task GUID"
msgstr "GUID de la tâche cible"
#: inc/caselink.class.php:106 inc/caselink.class.php:221
#: inc/caselink.class.php:107 inc/caselink.class.php:222
msgid "Target process GUID"
msgstr "GUID du Processus cible"
#: inc/caselink.class.php:115 inc/caselink.class.php:215
#: inc/caselink.class.php:116 inc/caselink.class.php:216
msgid "Target dynaform GUID"
msgstr "GUID du dynaform cible"
#: inc/caselink.class.php:120 inc/caselink.class.php:227
#: inc/caselink.class.php:121 inc/caselink.class.php:228
msgid "Source condition"
msgstr "Condition d'activation du lien"
#: inc/caselink.class.php:126 inc/caselink.class.php:191
#: inc/caselink.class.php:127 inc/caselink.class.php:192
msgid "Claim target task"
msgstr "Tâche cible 'à réclamer'"
#: inc/caselink.class.php:136
#: inc/caselink.class.php:137
msgid "Impersonate target task user"
msgstr "Personnifier l'utilisateur de la tâche cible"
#: inc/caselink.class.php:141 inc/caselink.class.php:197
#: inc/caselink.class.php:142 inc/caselink.class.php:198
msgid "External application JSON config"
msgstr "Configuration JSON de l'application externe"
@@ -390,9 +413,12 @@ msgid "ProcessMaker setup"
msgstr "Configuration du serveur ProcessMaker"
#: inc/config.class.php:159
#| msgid "Server URL (must be in same domain than GLPI)"
msgid "Server URL (must be in same domain than GLPI, if GLPI is using HTTPS, PM server must also use HTTPS)"
msgstr "URL du serveur (doit être dans le même domaine que GLPI, si GLPI utilise HTTPS, alors PM doit aussi utiliser HTTPS)"
msgid ""
"Server URL (must be in same domain than GLPI, if GLPI is using HTTPS, PM "
"server must also use HTTPS)"
msgstr ""
"URL du serveur (doit être dans le même domaine que GLPI, si GLPI utilise "
"HTTPS, alors PM doit aussi utiliser HTTPS)"
#: inc/config.class.php:163
msgid "Common domain with GLPI"
@@ -412,7 +438,7 @@ msgstr "Nom du Workspace"
#: inc/config.class.php:211
msgid "Server administrator name"
msgstr "Non de l'administreur du server ProcessMaker"
msgstr "Nom de l'administrateur du server ProcessMaker"
#: inc/config.class.php:216
msgid "Server administrator password"
@@ -451,7 +477,7 @@ msgid "Main Task Category (edit to change name)"
msgstr "Catégorie principale des tâches (éditer pour changer le nom)"
#: inc/config.class.php:286
msgid "Task Writer (edit to change name)"
msgid "Task writer (edit to change name)"
msgstr "Auteur des tâches (éditer pour changer le nom)"
#: inc/config.class.php:306
@@ -484,7 +510,7 @@ msgstr "Version de PHP"
#: inc/config.class.php:347
msgid "DB version"
msgstr "Version de la Db"
msgstr "Version de la DB"
#: inc/config.class.php:348
msgid "DB server IP"
@@ -515,30 +541,22 @@ msgid "eMail recipients"
msgstr "Destinataires des emails"
#: inc/notificationtargetprocessmaker.class.php:60
#| msgid "Process case"
#| msgid_plural "Process cases"
msgid "Process category"
msgstr "Catégorie du processus"
#: inc/notificationtargetprocessmaker.class.php:61
#| msgid "Process case"
#| msgid_plural "Process cases"
msgid "Process category id"
msgstr "ID de la catégorie du processus"
#: inc/notificationtargetprocessmaker.class.php:62
#| msgid "Process case task"
#| msgid_plural "Process case tasks"
msgid "Process category comment"
msgstr "Commentaire de la catégorie du processus"
#: inc/notificationtargetprocessmaker.class.php:63
#| msgid "Case guid"
msgid "Case id"
msgstr "ID du cas"
#: inc/notificationtargetprocessmaker.class.php:65
#| msgid "Case deletion"
msgid "Case description"
msgstr "Description du cas"
@@ -563,17 +581,14 @@ msgid "Value for key in 'ZZZ' assoc array (1-dimension array)"
msgstr "Valeur pour la clé 'key' du tableau associatif à une dimension 'ZZZ'"
#: inc/notificationtargetprocessmaker.class.php:73
#| msgid "Item"
msgid "Item id"
msgstr "ID de l'item"
#: inc/notificationtargetprocessmaker.class.php:74
#| msgid "Item"
msgid "Item URL"
msgstr "URL de l'item"
#: inc/notificationtargetprocessmaker.class.php:75
#| msgid "Item entity"
msgid "Item title"
msgstr "Titre de l'item"
@@ -586,11 +601,14 @@ msgid "YYY is to be replaced by any array variables"
msgstr "YYY doit être remplacé par n'importe quel nom de tableau"
#: inc/notificationtargetprocessmaker.class.php:90
msgid "ZZZ is to be replaced by any assoc array variables (1-dimension array with key/value pairs)"
msgstr "ZZZ doit être replacé par n'importe quel nom de tableau associatif à une dimension (paire clé/valeur)"
msgid ""
"ZZZ is to be replaced by any assoc array variables (1-dimension array with "
"key/value pairs)"
msgstr ""
"ZZZ doit être replacé par n'importe quel nom de tableau associatif à une "
"dimension (paire clé/valeur)"
#: inc/notificationtargettask.class.php:195
#| msgid "Task delegation date"
msgid "Task action"
msgstr "Action de la tâche"
@@ -608,7 +626,7 @@ msgstr "Type de processus"
#: inc/process.class.php:455
msgid "Hide case num. & title"
msgstr "Cacher num. et titre du cas"
msgstr "Cacher le numéro et le titre du cas"
#: inc/process.class.php:461
msgid "Insert Task Category"
@@ -654,15 +672,18 @@ msgstr "Processus"
#: inc/process.class.php:627
msgid "Hide case number and title in task descriptions"
msgstr "Masquer numéro et titre des cas dans les descriptions des tâches"
msgstr "Masquer le numéro et le titre des cas dans les descriptions des tâches"
#: inc/process.class.php:632
msgid "Insert Task Category comments in Task Description"
msgstr "Insérer les commentaires des Catégories de Tâches dans les descriptions des Tâches"
msgstr ""
"Insérer les commentaires des catégories de tâches dans les descriptions des "
"tâches"
#: inc/process.class.php:652
msgid "ITIL Category for Self-service interface (left empty to disable)"
msgstr "Catégorie ITIL pour l'interface libre-service (laissez vide pour désactiver)"
msgstr ""
"Catégorie ITIL pour l'interface libre-service (laissez vide pour désactiver)"
#: inc/process.class.php:679
msgid "Type for Self-service interface"
@@ -674,7 +695,6 @@ msgstr "Type de processus (à modifier uniquement si pas à jour)"
#: inc/process.class.php:862
#, php-format
#| msgid "ProcessMaker plugin is under maintenance, please retry later, thank you."
msgid "Process '%s' is under maintenance, please retry later, thank you."
msgstr "Le processus '%s' est en maintenance, ré-essayez plus tard, merci."
@@ -698,7 +718,8 @@ msgstr "Impossible de créer le cas : pas de droits pour cela !"
#: inc/processmaker.class.php:1012
msgid "Syncs GLPI users and groups into ProcessMaker."
msgstr "Synchronisation des utilisateurs GLPI et des groups avec ProcessMaker."
msgstr ""
"Synchronisation des utilisateurs GLPI et des groupes avec ProcessMaker."
#: inc/processmaker.class.php:1014
msgid "Cleaning of orphan cases."
@@ -712,26 +733,33 @@ msgstr "Nombre de jours avant nettoyage des cas orphelins"
msgid "To apply task actions between cases."
msgstr "Pour appliquer des actions de tâches entre cas."
#: inc/processmaker.class.php:1720
#: inc/processmaker.class.php:1707
msgid "Case title: "
msgstr "Titre du cas : "
#: inc/processmaker.class.php:2275
#: inc/processmaker.class.php:2262
msgid "A 'Case' is running!"
msgstr "Un 'Cas' est en cours !"
#: inc/processmaker.class.php:2276
#: inc/processmaker.class.php:2263
msgid "You must manage it first (see 'Process - Case' tab)!"
msgstr "Vous devez d'abord le terminer (voir onglet 'Processus - Cas') !"
#: inc/processmaker.class.php:2774
#: inc/processmaker.class.php:2779
#, php-format
msgid "Unable to derivate case! Retry in a moment, or ask your administrator.<hr>Error code: %u<br/>Error message: %s<br/>"
msgstr "Impossible de dériver le cas ! Ré-essayez dans un moment, ou demandez à votre administrateur.<hr>Code d'erreur : %u<br/>Message d'erreur : %s<br/>"
msgid ""
"Unable to derivate case! Retry in a moment, or ask your administrator."
"<hr>Error code: %u<br/>Error message: %s<br/>"
msgstr ""
"Impossible de dériver le cas ! Ré-essayez dans un moment, ou demandez à "
"votre administrateur.<hr>Code d'erreur : %u<br/>Message d'erreur : %s<br/>"
#: inc/processmaker.class.php:3281
msgid "ProcessMaker plugin is under maintenance, please retry later, thank you."
msgstr "Le plugin ProcessMaker est en maintenance, veuillez ré-essayer plus tard, merci."
#: inc/processmaker.class.php:3283
msgid ""
"ProcessMaker plugin is under maintenance, please retry later, thank you."
msgstr ""
"Le plugin ProcessMaker est en maintenance, veuillez ré-essayer plus tard, "
"merci."
#: inc/profile.class.php:17
msgid "Process configuration"
@@ -743,7 +771,7 @@ msgstr "Cas"
#: inc/profile.class.php:23
msgid "Ad Hoc user re-assign"
msgstr "Ré-assignation d'un utilisateur Ad Hoc"
msgstr "Réattribution d'un utilisateur Ad Hoc"
#: inc/task.class.php:29
msgid "Process case task"
@@ -756,47 +784,161 @@ msgid "Sub-case task(s)"
msgstr "Tache(s) du sous-cas"
#: inc/taskcategory.class.php:24 inc/taskcategory.class.php:116
#| msgid "Process case"
#| msgid_plural "Process cases"
msgid "Process task"
msgstr "Tâche du processus"
#: inc/taskcategory.class.php:29
#| msgid "Task List"
#: inc/taskcategory.class.php:29 inc/taskcategory.class.php:39
msgid "Task list"
msgstr "List des tâches"
#: inc/taskcategory.class.php:39
msgid "Task List"
msgstr "Liste des tâches"
#: inc/taskcategory.class.php:40 inc/taskcategory.class.php:118
msgid "Task name"
msgstr "Nom de la Tâche"
msgstr "Nom de la tâche"
#: inc/taskcategory.class.php:42 inc/taskcategory.class.php:68
#: inc/taskcategory.class.php:121 inc/taskcategory.class.php:155
msgid "Start"
msgstr "Démarrer"
#: inc/taskcategory.class.php:43 inc/taskcategory.class.php:122
msgid "Task GUID"
msgstr "GUID de la Tâche"
#: inc/taskcategory.class.php:46 inc/taskcategory.class.php:86
#: inc/taskcategory.class.php:125 inc/taskcategory.class.php:173
msgid "Sub-process"
msgstr "Sous-processus"
#: inc/taskcategory.class.php:117
#| msgid "Process case"
#| msgid_plural "Process cases"
msgid "Process name"
msgstr "Nom du procesus"
msgstr "Nom du processus"
#~ msgid "Delete case"
#, fuzzy
#~| msgid "Delete case"
#~ msgid "Delete permanently"
#~ msgstr "Delete case"
#, fuzzy
#~| msgid "None!"
#~ msgid "None"
#~ msgstr "Aucun !"
#, fuzzy
#~| msgid "Maintenance"
#~ msgid "Maintenance mode"
#~ msgstr "Maintenance"
#, fuzzy
#~| msgid "Case id"
#~ msgid "Case URL"
#~ msgstr "ID du cas"
#, fuzzy
#~| msgid "Task guid"
#~ msgid "Task add"
#~ msgstr "Guid de la tâche"
#, fuzzy
#~| msgid "Task re-assigned!"
#~ msgid "Task re-assign"
#~ msgstr "Tâche réattribuée !"
#, fuzzy
#~| msgid "Task un-claimed!"
#~ msgid "Task un-claim"
#~ msgstr "Annulation de l'attribution de la tâche effectuée !"
#, fuzzy
#~| msgid "Task name"
#~ msgid "Task done"
#~ msgstr "Nom de la tâche"
#, fuzzy
#~| msgid "Send reminder"
#~ msgid "Task reminder"
#~ msgstr "Envoyer un rappel"
#, fuzzy
#~| msgid "Creation date"
#~ msgid "Opening date"
#~ msgstr "Date de création"
#, fuzzy
#~| msgid "Case description"
#~ msgid "Description"
#~ msgstr "Description du cas"
#, fuzzy
#~| msgid "Process category id"
#~ msgid "Category id"
#~ msgstr "ID de la catégorie du processus"
#, fuzzy
#~| msgid "Process category comment"
#~ msgid "Category comment"
#~ msgstr "Commentaire de la catégorie du processus"
#, fuzzy
#~| msgid "Task action"
#~ msgid "Total duration"
#~ msgstr "Action de la tâche"
#, fuzzy
#~| msgid "Re-assign task"
#~ msgid "User assigned to task"
#~ msgstr "Réattribuer la tâche"
#, fuzzy
#~| msgid "Case is linked to a %1s"
#~ msgid "User login assigned to task"
#~ msgstr "Le cas est lié à un %1s"
#, fuzzy
#~| msgid "Re-assign task"
#~ msgid "Group assigned to task"
#~ msgstr "Réattribuer la tâche"
#, fuzzy
#~| msgid "Start"
#~ msgid "Start date"
#~ msgstr "Démarrer"
#, fuzzy
#~| msgid "Last update"
#~ msgid "Last updater"
#~ msgstr "Dernière mise à jour"
#, fuzzy
#~| msgid "Task delegation date"
#~ msgid "Delegation index"
#~ msgstr "Date d'attribution de tâche"
#, fuzzy
#~| msgid "Delete case"
#~ msgid "Delete"
#~ msgstr "Delete case"
#, fuzzy
#~| msgctxt "case_status"
#~| msgid "Completed"
#~ msgid "Complete name"
#~ msgstr "Terminé"
#, fuzzy
#~| msgid "Re-assign"
#~ msgctxt "processmaker"
#~ msgid "Re-assign"
#~ msgstr "Réattribuer"
#, fuzzy
#~| msgid "Process case"
#~| msgid_plural "Process cases"
#~ msgctxt "processmaker"
#~ msgid "Process case"
#~ msgstr "Cas du processus"
#~ msgid "Task GUID"
#~ msgstr "Task GUID"
#~ msgid "Task List"
#~ msgstr "Task List"
#~ msgid "Case item"
#~ msgstr "Case item"

File diff suppressed because it is too large Load Diff

BIN
pics/processmaker-mid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
pics/processmaker-tiny.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

BIN
pics/processmaker-xxs.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 783 B

BIN
pics/processmaker.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

View File

@@ -1,66 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<root>
<name>Processmaker</name>
<key>processmaker</key>
<state>stable</state>
<logo>https://raw.githubusercontent.com/tomolimo/processmaker/master/processmaker.png</logo>
<description>
<short>
<fr>Ce plugin fournit la possibilité d'intégrer un processus (workflow) aux objets ITIL (Tickets, Changements et Problèmes).</fr>
<en>This plugin provides a process (workflow) management linked to ITIL objects (Tickets, Changes and Problems).</en>
<cs>Tento zásuvný modul poskytuje správu procesů (pracovní postup) napojený na požadavky.</cs>
</short>
<long>
<en>This plugin is dedicated to provide process (workflows) management linked to ITIL objects (Tickets, Changes and Problems). This goal is achieved using a customized ProcessMaker server (URL: https://github.com/tomolimo/processmaker-server). ProcessMaker provides BPMN Process design and execution. This plugin is the glue between GLPI and ProcessMaker.</en>
<fr>Ce plugin est dédié à la gestion de processus (workflows) liés aux objets ITIL (Tickets, Changements et Problèmes). Ce but est atteint par l'utilisation d'un serveur ProcessMaker customisé (URL: https://github.com/tomolimo/processmaker-server). ProcessMaker fournit un outil graphique de création de processus BPMN et permet l'exécution de ceux-ci. Ce plugin sert de glue entre GLPI et ProcessMaker.</fr>
<cs>Tento zásuvný modul je věnován poskytnutí správy procesu (pracovní postup), napojeného na požadavky. Tohoto cíle je dosaženo použitím ProcessMaker (URL: https://github.com/tomolimo/processmaker-server). ProcessMaker poskytne návrh procesu a vykonání pracovního postupu. Tento zásuvný modul je můstkem mezi GLPI a ProcessMaker.</cs>
</long>
</description>
<homepage>https://github.com/tomolimo/processmaker</homepage>
<download>https://github.com/tomolimo/processmaker/releases</download>
<issues>https://github.com/tomolimo/processmaker/issues</issues>
<readme>https://github.com/tomolimo/processmaker/wiki</readme>
<authors>
<author>Olivier Moron</author>
</authors>
<versions>
<version>
<num>3.3.8</num>
<compatibility>9.1</compatibility>
</version>
<version>
<num>3.4.26</num>
<compatibility>9.2</compatibility>
</version>
<version>
<num>3.5.11</num>
<compatibility>9.3</compatibility>
</version>
<version>
<num>3.6.17</num>
<compatibility>9.4</compatibility>
</version>
</versions>
<langs>
<lang>en_gb</lang>
<lang>fr_fr</lang>
<lang>cs_cz</lang>
</langs>
<license>GPL v2+</license>
<tags>
<fr>
<tag>Processus</tag>
<tag>BPMN 2.0</tag>
<tag>Workflow</tag>
<tag>Helpdesk</tag>
<tag>Ticket</tag>
</fr>
<en>
<tag>Processes</tag>
<tag>BPMN 2.0</tag>
<tag>Helpdesk</tag>
<tag>Workflows</tag>
<tag>Ticket</tag>
</en>
</tags>
<?xml version="1.0" encoding="UTF-8"?>
<root>
<name>Processmaker</name>
<key>processmaker</key>
<state>stable</state>
<logo>https://raw.githubusercontent.com/tomolimo/processmaker/master/processmaker.png</logo>
<description>
<short>
<fr>Ce plugin fournit la possibilité d'intégrer un processus (workflow) aux objets ITIL (Tickets, Changements et Problèmes).</fr>
<en>This plugin provides a process (workflow) management linked to ITIL objects (Tickets, Changes and Problems).</en>
<cs>Tento zásuvný modul poskytuje správu procesů (pracovní postup) napojený na požadavky.</cs>
</short>
<long>
<en>This plugin is dedicated to provide process (workflows) management linked to ITIL objects (Tickets, Changes and Problems). This goal is achieved using a customized ProcessMaker server (URL: https://github.com/tomolimo/processmaker-server). ProcessMaker provides BPMN Process design and execution. This plugin is the glue between GLPI and ProcessMaker.</en>
<fr>Ce plugin est dédié à la gestion de processus (workflows) liés aux objets ITIL (Tickets, Changements et Problèmes). Ce but est atteint par l'utilisation d'un serveur ProcessMaker customisé (URL: https://github.com/tomolimo/processmaker-server). ProcessMaker fournit un outil graphique de création de processus BPMN et permet l'exécution de ceux-ci. Ce plugin sert de glue entre GLPI et ProcessMaker.</fr>
<cs>Tento zásuvný modul je věnován poskytnutí správy procesu (pracovní postup), napojeného na požadavky. Tohoto cíle je dosaženo použitím ProcessMaker (URL: https://github.com/tomolimo/processmaker-server). ProcessMaker poskytne návrh procesu a vykonání pracovního postupu. Tento zásuvný modul je můstkem mezi GLPI a ProcessMaker.</cs>
</long>
</description>
<homepage>https://github.com/tomolimo/processmaker</homepage>
<download>https://github.com/tomolimo/processmaker/releases</download>
<issues>https://github.com/tomolimo/processmaker/issues</issues>
<readme>https://github.com/tomolimo/processmaker/wiki</readme>
<authors>
<author>Olivier Moron</author>
</authors>
<versions>
<version>
<num>3.3.8</num>
<compatibility>9.1</compatibility>
</version>
<version>
<num>3.4.30</num>
<compatibility>9.2</compatibility>
</version>
<version>
<num>3.5.15</num>
<compatibility>9.3</compatibility>
</version>
<version>
<num>3.6.21</num>
<compatibility>9.4</compatibility>
</version>
<version>
<num>4.0.0</num>
<compatibility>9.5</compatibility>
</version>
</versions>
<langs>
<lang>en_gb</lang>
<lang>fr_fr</lang>
<lang>cs_cz</lang>
</langs>
<license>GPL v2+</license>
<tags>
<fr>
<tag>Processus</tag>
<tag>BPMN 2.0</tag>
<tag>Workflow</tag>
<tag>Helpdesk</tag>
<tag>Ticket</tag>
</fr>
<en>
<tag>Processes</tag>
<tag>BPMN 2.0</tag>
<tag>Helpdesk</tag>
<tag>Workflows</tag>
<tag>Ticket</tag>
</en>
</tags>
</root>

343
setup.php
View File

@@ -1,165 +1,178 @@
<?php
define('PROCESSMAKER_VERSION', '3.6.17');
// used for case cancellation
define("CANCEL", 256);
// used for ad-hoc user re-assign
define("ADHOC_REASSIGN", 512);
// Init the hooks of the plugins -Needed
function plugin_init_processmaker() {
global $PLUGIN_HOOKS, $CFG_GLPI;
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
$objects = ['Ticket', 'Change', 'Problem'];
Plugin::registerClass('PluginProcessmakerProcessmaker');
Plugin::registerClass('PluginProcessmakerCase', ['addtabon' => $objects, 'notificationtemplates_types' => true]);
Plugin::registerClass('PluginProcessmakerTask', ['notificationtemplates_types' => true]);
Plugin::registerClass('PluginProcessmakerTaskCategory', ['addtabon' => 'TaskCategory']);
if (Session::haveRightsOr("config", [READ, UPDATE])) {
Plugin::registerClass('PluginProcessmakerConfig', ['addtabon' => 'Config']);
$PLUGIN_HOOKS['config_page']['processmaker'] = 'front/config.form.php';
}
Plugin::registerClass('PluginProcessmakerProfile', ['addtabon' => 'Profile']);
Plugin::registerClass('PluginProcessmakerProcess_Profile');
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
$PLUGIN_HOOKS['pre_show_item']['processmaker']
= ['PluginProcessmakerProcessmaker', 'pre_show_item_processmaker'];
$PLUGIN_HOOKS['pre_show_tab']['processmaker']
= ['PluginProcessmakerProcessmaker', 'pre_show_tab_processmaker'];
$PLUGIN_HOOKS['post_show_tab']['processmaker']
= ['PluginProcessmakerProcessmaker', 'post_show_tab_processmaker'];
// Display a menu entry ?
if (Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE])) {
// tools
$PLUGIN_HOOKS['menu_toadd']['processmaker']['tools'] = 'PluginProcessmakerMenu';
}
if (Session::haveRightsOr('plugin_processmaker_case', [READ, UPDATE])) {
// helpdesk
$PLUGIN_HOOKS['menu_toadd']['processmaker']['helpdesk'] = 'PluginProcessmakerCase';
}
Plugin::registerClass('PluginProcessmakerProcess', [ 'massiveaction_nodelete_types' => true] );
$hooks = [];
foreach ($objects as $obj) {
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_pre_item_add_processmaker'];
}
$PLUGIN_HOOKS['pre_item_add']['processmaker'] = $hooks;
$hooks = [];
foreach ($objects as $obj) {
$hooks[$obj] = 'plugin_pre_item_update_processmaker';
}
$PLUGIN_HOOKS['pre_item_update']['processmaker'] = $hooks;
$hooks = ['TicketSatisfaction' => 'plugin_item_update_processmaker_satisfaction',
'User' => 'plugin_item_update_processmaker_user'];
foreach ($objects as $obj) {
$hooks[$obj.'Task'] = 'plugin_item_update_processmaker_tasks';
}
$PLUGIN_HOOKS['item_update']['processmaker'] = $hooks;
$hooks = [];
foreach ($objects as $obj) {
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_add_processmaker'];
}
$PLUGIN_HOOKS['item_add']['processmaker'] = $hooks;
$hooks = [];
foreach ($objects as $obj) {
$hooks['NotificationTarget'.$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_data_processmaker'];
}
$PLUGIN_HOOKS['item_get_datas']['processmaker'] = $hooks;
$hooks = [];
foreach ($objects as $obj) {
$hooks["PluginPdf".$obj."Task"] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_pdfdata_processmaker'];
}
$PLUGIN_HOOKS['item_get_pdfdatas']['processmaker'] = $hooks;
// Javascript
$plugin = new Plugin();
if ($plugin->isActivated('processmaker')
&& Session::getLoginUserID() ) {
$url = explode("/", $_SERVER['PHP_SELF']);
$pageName = explode("?", array_pop($url));
switch ($pageName[0]) {
case "tracking.injector.php":
case "helpdesk.public.php":
$PLUGIN_HOOKS['add_javascript']['processmaker'] = ["js/helpdesk.public.js.php"];
break;
case "planning.php":
$PLUGIN_HOOKS['add_javascript']['processmaker'] = ["js/planning.js"];
break;
case "central.php":
$PLUGIN_HOOKS['add_javascript']['processmaker'] = ["js/central.js"];
break;
}
}
$PLUGIN_HOOKS['use_massive_action']['processmaker'] = 1;
$CFG_GLPI['planning_types'][] = 'PluginProcessmakerTask';
$PLUGIN_HOOKS['post_init']['processmaker'] = 'plugin_processmaker_post_init';
// in order to set rights when in helpdesk interface
// otherwise post-only users can't see cases and then can't act on a case task.
$PLUGIN_HOOKS['change_profile']['processmaker'] = 'plugin_processmaker_change_profile';
}
// Get the name and the version of the plugin - Needed
function plugin_version_processmaker() {
return [
'name' => 'Process Maker',
'version' => PROCESSMAKER_VERSION,
'author' => 'Olivier Moron',
'license' => 'GPLv3+',
'homepage' => 'https://github.com/tomolimo/processmaker',
'requirements' => [
'glpi' => [
'min' => '9.4',
'max' => '9.5'
],
]
];
}
// 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.4', 'lt') || version_compare(GLPI_VERSION, '9.5', 'ge')) {
echo "This plugin requires GLPI >= 9.4 and < 9.5";
return false;
}
return true;
}
function plugin_processmaker_check_config($verbose = false) {
return true;
}
function plugin_processmaker_haveRight($module, $right) {
return Session::haveRight("plugin_processmaker_".$module, $right);
}
<?php
define('PROCESSMAKER_VERSION', '4.0.0');
// used for case cancellation
define("CANCEL", 256);
// used for ad-hoc user re-assign
define("ADHOC_REASSIGN", 512);
// Init the hooks of the plugins -Needed
function plugin_init_processmaker() {
global $PLUGIN_HOOKS, $CFG_GLPI;
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
$plugin = new Plugin();
if ($plugin->isActivated('processmaker')) {
$objects = ['Ticket', 'Change', 'Problem'];
Plugin::registerClass('PluginProcessmakerProcessmaker');
Plugin::registerClass('PluginProcessmakerCase', ['addtabon' => $objects, 'notificationtemplates_types' => true]);
Plugin::registerClass('PluginProcessmakerTask', ['notificationtemplates_types' => true]);
Plugin::registerClass('PluginProcessmakerTaskCategory', ['addtabon' => 'TaskCategory']);
if (Session::haveRightsOr("config", [READ, UPDATE])) {
Plugin::registerClass('PluginProcessmakerConfig', ['addtabon' => 'Config']);
$PLUGIN_HOOKS['config_page']['processmaker'] = 'front/config.form.php';
}
Plugin::registerClass('PluginProcessmakerProfile', ['addtabon' => 'Profile']);
Plugin::registerClass('PluginProcessmakerProcess_Profile');
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
$PLUGIN_HOOKS['pre_show_item']['processmaker']
= ['PluginProcessmakerProcessmaker', 'pre_show_item_processmaker'];
$PLUGIN_HOOKS['pre_show_tab']['processmaker']
= ['PluginProcessmakerProcessmaker', 'pre_show_tab_processmaker'];
//$PLUGIN_HOOKS['post_show_tab']['processmaker']
// = ['PluginProcessmakerProcessmaker', 'post_show_tab_processmaker'];
// Display a menu entry ?
if (Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE])) {
// tools
$PLUGIN_HOOKS['menu_toadd']['processmaker']['tools'] = 'PluginProcessmakerMenu';
}
if (Session::haveRightsOr('plugin_processmaker_case', [READ, UPDATE])) {
// helpdesk
$PLUGIN_HOOKS['menu_toadd']['processmaker']['helpdesk'] = 'PluginProcessmakerCase';
}
Plugin::registerClass('PluginProcessmakerProcess', [ 'massiveaction_nodelete_types' => true] );
$hooks = [];
foreach ($objects as $obj) {
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_pre_item_add_processmaker'];
}
$PLUGIN_HOOKS['pre_item_add']['processmaker'] = $hooks;
$hooks = [];
foreach ($objects as $obj) {
$hooks[$obj] = 'plugin_pre_item_update_processmaker';
}
$PLUGIN_HOOKS['pre_item_update']['processmaker'] = $hooks;
$hooks = ['TicketSatisfaction' => 'plugin_item_update_processmaker_satisfaction',
'User' => 'plugin_item_update_processmaker_user'];
foreach ($objects as $obj) {
$hooks[$obj.'Task'] = 'plugin_item_update_processmaker_tasks';
}
$PLUGIN_HOOKS['item_update']['processmaker'] = $hooks;
$hooks = [];
foreach ($objects as $obj) {
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_add_processmaker'];
}
$PLUGIN_HOOKS['item_add']['processmaker'] = $hooks;
$hooks = [];
foreach ($objects as $obj) {
$hooks['NotificationTarget'.$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_data_processmaker'];
}
$PLUGIN_HOOKS['item_get_datas']['processmaker'] = $hooks;
$hooks = [];
foreach ($objects as $obj) {
$hooks["PluginPdf".$obj."Task"] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_pdfdata_processmaker'];
}
$PLUGIN_HOOKS['item_get_pdfdatas']['processmaker'] = $hooks;
// Javascript
$plugin = new Plugin();
if ($plugin->isActivated('processmaker')
&& Session::getLoginUserID() ) {
$url = explode("/", $_SERVER['PHP_SELF']);
$pageName = explode("?", array_pop($url));
switch ($pageName[0]) {
case "tracking.injector.php":
case "helpdesk.public.php":
$PLUGIN_HOOKS['add_javascript']['processmaker'] = ["js/helpdesk.public.js.php"];
break;
case "planning.php":
$PLUGIN_HOOKS['add_javascript']['processmaker'] = ["js/planning.js"];
break;
case "central.php":
$PLUGIN_HOOKS['add_javascript']['processmaker'] = ["js/central.js"];
break;
}
}
$PLUGIN_HOOKS['use_massive_action']['processmaker'] = 1;
$CFG_GLPI['planning_types'][] = 'PluginProcessmakerTask';
$PLUGIN_HOOKS['post_init']['processmaker'] = 'plugin_processmaker_post_init';
// in order to set rights when in helpdesk interface
// otherwise post-only users can't see cases and then can't act on a case task.
$PLUGIN_HOOKS['change_profile']['processmaker'] = 'plugin_processmaker_change_profile';
//if ($plugin->isActivated('processmaker')) {
// in order to manage the password encryption
$pmglpikey = new PluginProcessmakerGlpikey;
foreach ($pmglpikey->getFields() as $fld) {
$PLUGIN_HOOKS['secured_fields'][] = $fld;
}
//}
}
}
// Get the name and the version of the plugin - Needed
function plugin_version_processmaker() {
return [
'name' => 'Process Maker',
'version' => PROCESSMAKER_VERSION,
'author' => 'Olivier Moron',
'license' => 'GPLv3+',
'homepage' => 'https://github.com/tomolimo/processmaker',
'requirements' => [
'glpi' => [
'min' => '9.5',
'max' => '9.6'
],
]
];
}
// 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";
return false;
}
return true;
}
function plugin_processmaker_check_config($verbose = false) {
return true;
}
function plugin_processmaker_haveRight($module, $right) {
return Session::haveRight("plugin_processmaker_".$module, $right);
}