Version 3.4.5
Compatibility with GLPI 9.2
This commit is contained in:
96
setup.php
96
setup.php
@@ -1,7 +1,8 @@
|
||||
<?php
|
||||
|
||||
// used for case cancellation
|
||||
define("CANCEL", 256);
|
||||
define("CANCEL", 256);
|
||||
define('PROCESSMAKER_VERSION', '3.4.5');
|
||||
|
||||
// Init the hooks of the plugins -Needed
|
||||
function plugin_init_processmaker() {
|
||||
@@ -10,29 +11,27 @@ function plugin_init_processmaker() {
|
||||
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
|
||||
|
||||
$objects = ['Ticket', 'Change', 'Problem'];
|
||||
// $objects = ['Ticket'];
|
||||
// $objects = ['Ticket'];
|
||||
|
||||
Plugin::registerClass('PluginProcessmakerProcessmaker');
|
||||
|
||||
Plugin::registerClass('PluginProcessmakerCase', array('addtabon' => $objects));
|
||||
Plugin::registerClass('PluginProcessmakerCase', ['addtabon' => $objects]);
|
||||
|
||||
Plugin::registerClass('PluginProcessmakerTaskCategory');
|
||||
|
||||
if (Session::haveRightsOr("config", [READ, UPDATE])) {
|
||||
Plugin::registerClass('PluginProcessmakerConfig', array('addtabon' => 'Config'));
|
||||
Plugin::registerClass('PluginProcessmakerConfig', ['addtabon' => 'Config']);
|
||||
$PLUGIN_HOOKS['config_page']['processmaker'] = 'front/config.form.php';
|
||||
}
|
||||
|
||||
Plugin::registerClass('PluginProcessmakerProfile', array('addtabon' => 'Profile'));
|
||||
|
||||
$PLUGIN_HOOKS['change_profile']['processmaker'] = array('PluginProcessmakerProfile','select');
|
||||
Plugin::registerClass('PluginProcessmakerProfile', ['addtabon' => 'Profile']);
|
||||
|
||||
Plugin::registerClass('PluginProcessmakerProcess_Profile');
|
||||
|
||||
$PLUGIN_HOOKS['csrf_compliant']['processmaker'] = true;
|
||||
|
||||
$PLUGIN_HOOKS['pre_show_item']['processmaker']
|
||||
= array('PluginProcessmakerProcessmaker', 'pre_show_item_processmaker');
|
||||
= ['PluginProcessmakerProcessmaker', 'pre_show_item_processmaker'];
|
||||
|
||||
//$PLUGIN_HOOKS['pre_item_form']['processmaker']
|
||||
// = array('PluginProcessmakerProcessmaker', 'pre_item_form_processmakerticket');
|
||||
@@ -40,9 +39,9 @@ function plugin_init_processmaker() {
|
||||
// = array('PluginProcessmakerProcessmaker', 'post_item_form_processmakerticket');
|
||||
|
||||
$PLUGIN_HOOKS['pre_show_tab']['processmaker']
|
||||
= array('PluginProcessmakerProcessmaker', 'pre_show_tab_processmaker');
|
||||
= ['PluginProcessmakerProcessmaker', 'pre_show_tab_processmaker'];
|
||||
$PLUGIN_HOOKS['post_show_tab']['processmaker']
|
||||
= array('PluginProcessmakerProcessmaker', 'post_show_tab_processmaker');
|
||||
= ['PluginProcessmakerProcessmaker', 'post_show_tab_processmaker'];
|
||||
|
||||
// Display a menu entry ?
|
||||
if (Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE])) {
|
||||
@@ -50,55 +49,60 @@ function plugin_init_processmaker() {
|
||||
$PLUGIN_HOOKS['menu_toadd']['processmaker'] = ['tools' => 'PluginProcessmakerMenu', 'helpdesk' => 'PluginProcessmakerCase'];
|
||||
}
|
||||
|
||||
Plugin::registerClass('PluginProcessmakerProcess', array( 'massiveaction_nodelete_types' => true) );
|
||||
Plugin::registerClass('PluginProcessmakerProcess', [ 'massiveaction_nodelete_types' => true] );
|
||||
|
||||
$hooks = [];
|
||||
foreach($objects as $obj){
|
||||
foreach ($objects as $obj) {
|
||||
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_pre_item_add_processmaker'];
|
||||
}
|
||||
$PLUGIN_HOOKS['pre_item_add']['processmaker'] = $hooks;
|
||||
|
||||
$hooks = [];
|
||||
foreach($objects as $obj){
|
||||
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'];
|
||||
foreach($objects as $obj){
|
||||
foreach ($objects as $obj) {
|
||||
$hooks[$obj.'Task'] = 'plugin_item_update_processmaker_tasks';
|
||||
}
|
||||
$PLUGIN_HOOKS['item_update']['processmaker'] = $hooks;
|
||||
|
||||
$hooks = [];
|
||||
foreach($objects as $obj){
|
||||
foreach ($objects as $obj) {
|
||||
$hooks[$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_add_processmaker'];
|
||||
}
|
||||
$PLUGIN_HOOKS['item_add']['processmaker'] = $hooks;
|
||||
$PLUGIN_HOOKS['item_get_datas']['processmaker'] = array(
|
||||
'NotificationTargetTicket' => array('PluginProcessmakerProcessmaker', 'plugin_item_get_datas_processmaker')
|
||||
);
|
||||
|
||||
$PLUGIN_HOOKS['item_get_pdfdatas']['processmaker'] = array(
|
||||
'PluginPdfTicketTask' => array('PluginProcessmakerProcessmaker', 'plugin_item_get_pdfdatas_processmaker')
|
||||
);
|
||||
|
||||
$hooks = [];
|
||||
foreach($objects as $obj){
|
||||
$hooks[$obj.'_User'] = 'plugin_pre_item_purge_processmaker';
|
||||
foreach ($objects as $obj) {
|
||||
$hooks['NotificationTarget'.$obj] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_data_processmaker'];
|
||||
}
|
||||
$PLUGIN_HOOKS['pre_item_purge']['processmaker'] = $hooks;
|
||||
$PLUGIN_HOOKS['item_get_datas']['processmaker'] = $hooks;
|
||||
|
||||
$hooks = [];
|
||||
foreach($objects as $obj){
|
||||
$hooks[$obj.'_User'] = 'plugin_item_purge_processmaker';
|
||||
foreach ($objects as $obj) {
|
||||
$hooks["PluginPdf'.$obj.'Task"] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_pdfdata_processmaker'];
|
||||
}
|
||||
$PLUGIN_HOOKS['item_purge']['processmaker'] = $hooks;
|
||||
$PLUGIN_HOOKS['item_get_pdfdatas']['processmaker'] = $hooks;
|
||||
|
||||
//$hooks = [];
|
||||
//foreach($objects as $obj){
|
||||
// $hooks[$obj.'_User'] = 'plugin_pre_item_purge_processmaker';
|
||||
//}
|
||||
//$PLUGIN_HOOKS['pre_item_purge']['processmaker'] = $hooks;
|
||||
|
||||
//$hooks = [];
|
||||
//foreach($objects as $obj){
|
||||
// $hooks[$obj.'_User'] = 'plugin_item_purge_processmaker';
|
||||
//}
|
||||
//$PLUGIN_HOOKS['item_purge']['processmaker'] = $hooks;
|
||||
|
||||
$plugin = new Plugin();
|
||||
if ($plugin->isActivated('processmaker')
|
||||
&& Session::getLoginUserID() ) {
|
||||
$PLUGIN_HOOKS['add_javascript']['processmaker'] = array("js/domain.js.php");
|
||||
|
||||
$url = explode("/", $_SERVER['PHP_SELF']);
|
||||
$pageName = explode("?", array_pop($url));
|
||||
switch ($pageName[0]) {
|
||||
@@ -106,6 +110,16 @@ function plugin_init_processmaker() {
|
||||
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;
|
||||
case "case.form.php":
|
||||
case "processmaker.helpdesk.form.php" :
|
||||
$PLUGIN_HOOKS['add_javascript']['processmaker'] = ["js/domain.js.php"];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,22 +132,30 @@ function plugin_init_processmaker() {
|
||||
// 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 array ('name' => 'Process Maker',
|
||||
'version' => '3.3.1',
|
||||
'author' => 'Olivier Moron',
|
||||
'homepage' => 'https://github.com/tomolimo/processmaker',
|
||||
'minGlpiVersion' => '9.1');
|
||||
return [
|
||||
'name' => 'Process Maker',
|
||||
'version' => PROCESSMAKER_VERSION,
|
||||
'author' => 'Olivier Moron',
|
||||
'license' => 'GPLv3+',
|
||||
'homepage' => 'https://github.com/tomolimo/processmaker',
|
||||
'requirements' => [
|
||||
'glpi' => [
|
||||
'min' => '9.2',
|
||||
'max' => '9.2.99'
|
||||
],
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
// 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.1', 'lt') || version_compare(GLPI_VERSION, '9.3', 'ge')) {
|
||||
echo "This plugin requires GLPI >= 9.1 and < 9.3";
|
||||
if (version_compare(GLPI_VERSION, '9.2', 'lt') || version_compare(GLPI_VERSION, '9.3', 'ge')) {
|
||||
echo "This plugin requires GLPI >= 9.2 and < 9.3";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user