Files
tomolino-processmaker/setup.php
tomolimo ca197c9f43 Cherry pick from 3.5.10 to 3.6.16
Added feature GLPI_TASK_PREVENT_REASSIGN to prevent assignment of a list of users (can be PM UID, GLPI id, GLPI logon) to a specific task (can be task list)

Cherry pick from 3.4.24 to 3.6.15

Cherry pick from 3.4.23
Added a proxy and SSL mangement to external application calls Added an escape DB for ticket name and ticket solution description Updated translation
Added swingcall.php file (to test swing api)
Set version to 3.6.14

Cherry pick from version 3.4.22
Added a new case variable to be able to create information tasks GLPI_ITEM_INFORMATION_TASK

Cherry pick from 3.4.21
Revert back $_REQUEST into $_POST

cherry pick from version 3.4.20
Added Send reminder Added unclaim task
Rewrite some code for clearer maintenance

commented line HTTPROXY setup

Bugfixe : remove the default setting of a followup

bugfixes:
- list the processes according to the type of ticket (request or incident).
- set variable 'content' according to the variable sent by processmaker in the addItemFollowup function
- logged error information of curl

Set content to tinymce content field

Bugfixes : Update the taskId (value and letter case)

Bugfixes requests. bad syntax with the new ORM

Changed folder properties

Changed text Deleted unused param

Added a hook to manage the change of user login
Cleaning of unused code Set version to 3.6.8

add condition to set user = admin when script is run in crontask fixes
2020-10-07 15:40:05 +02:00

166 lines
5.5 KiB
PHP

<?php
define('PROCESSMAKER_VERSION', '3.6.16');
// 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);
}