3
0

* Bugfix Reminders on task cancelled before delete reminders update was not deleted

* Bugfix Uncaught ReferenceError: $ is not defined on ITIL Object creation
* Delete error message after case cancellation successfully
* change minimum version of processmaker server
* delete TODO comment
* Add possibility to cancel case with multiple tasks
* bugfix delete reminder on case's cancel  or delete
* Add behavior on a claimed task or reasign to the current user for show task in timeline
* Fixed issue with default dates settings in reminders for tasks
* Added shortcut to select "Me as sender"
* Added a test to prevent post-only user to set reminder settings
* Updated XML
* Fix issue with screen view
* Adjusted wordings
* Reviewed $new_date computation in cron
* Bugfix creating a case in processcase tab doesn't redirect to the case
* Adjusted visualization for Reminder
* Added an <hr>
* Adjusted values in dropdowns when settings are NULL
* Added a test to prevent sending of remminders to "ProcessMaker" user
* Added view of default and actual reminder settings for a PM task
* cronPMReminder reflects changes and send reminders
* Re-engineered table fields and search options
* Fixed issue with FUP that were no longuer added to timeline.
* Added automatic reminders
* bugfix on filter
* Changed copyrights
* added .gitignore
* add process category search option + input in process form
* Added process categories
* bugfixes on helpdesk process
* bugfixes html_tags and actiontime
* Changed the way the userId of the first task was computed, to be able to have a tobeclaimed task
* Added get/set APP_DATA scripts to be able to read/write the APP_DATA in json files
* Added a followup when a reminder is sent to task user (or group)

Set version 5.2.3
This commit is contained in:
Moron, Olivier
2025-01-14 12:17:17 +01:00
parent 5851f0fa42
commit cc17bd5fe4
79 changed files with 1978 additions and 354 deletions

View File

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

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2024 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -53,11 +53,22 @@ if (isset( $_SERVER['REQUEST_METHOD'] ) && $_SERVER['REQUEST_METHOD']=='OPTIONS
$datas = json_decode($request_body, true);
$asyncdata = new PluginProcessmakerCrontaskaction;
if (isset($datas['id']) && $asyncdata->getFromDB( $datas['id'] ) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA) {
$ID = 0;
if (isset($_REQUEST['id'])) {
$ID = $_REQUEST['id'];
}
if (isset($datas['id'])) {
$ID = $datas['id'];
}
if ($ID && $asyncdata->getFromDB($ID) && $asyncdata->fields['state'] == PluginProcessmakerCrontaskaction::WAITING_DATA) {
$initialdatas = json_decode($asyncdata->fields['formdata'], true);
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas['form'] );
if (isset($datas['form'])) {
$datas = $datas['form'];
}
$initialdatas['form'] = array_merge( $initialdatas['form'], $datas );
$formdata = json_encode($initialdatas, JSON_HEX_APOS | JSON_HEX_QUOT | JSON_UNESCAPED_UNICODE);
$asyncdata->update( [ 'id' => $datas['id'], 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'formdata' => $formdata ] );
$asyncdata->update( [ 'id' => $ID, 'state' => PluginProcessmakerCrontaskaction::DATA_READY, 'formdata' => $formdata ] );
$ret = [ 'code' => '0', 'message' => 'Done' ];
} else {
$ret = [ 'code' => '2', 'message' => 'Case is not existing, or state is not WAITING_DATA' ];

52
ajax/case.php Normal file
View File

@@ -0,0 +1,52 @@
<?php
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2024 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
LICENSE
This file is part of ProcessMaker plugin for GLPI.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this plugin. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
use Glpi\Application\View\TemplateRenderer;
include ("../../../inc/includes.php");
$item = new $_REQUEST['itemtype'];
$item->getFromDB($_REQUEST['items_id']);
$countProcesses = [];
$cases = PluginProcessmakerCase::getAllCases($_REQUEST['itemtype'], $_REQUEST['items_id'], $countProcesses);
echo "<div class='row'>";
echo "<div class='col-auto order-last d-none d-md-block'>";
TemplateRenderer::getInstance()->display(
'components\user\picture.html.twig',
[
'users_id' => Session::getLoginUserID(),
]
);
echo "</div>";
echo "<div class='col'>";
echo "<div class='row timeline-content t-right card mt-4' style='border: 1px solid rgb(65, 133, 244);'>";
echo "<div class='card-body'>";
echo "<div class='clearfix'>";
echo "<button class='btn btn-sm btn-ghost-secondary float-end mb-1 close-new-case-form collapsed' data-bs-toggle='collapse' data-bs-target='#new-CaseForm-block' aria-expanded='false'>";
echo "<i class='fa-lg ti ti-x'></i></button></div>";
echo "<div class='newCaseContent'>";
PluginProcessmakerCase::showAddFormForItem($item, rand(), $countProcesses, true);
echo "</div></div></div></div></div>";

View File

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

View File

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

View File

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

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2024 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -58,8 +58,7 @@ if (!isset($_REQUEST['all'])) {
}
$used = [];
if (isset($_REQUEST['used'])) {
if (isset($_REQUEST['used']) && is_array($_REQUEST['used'])) {
$used = $_REQUEST['used'];
}
@@ -98,7 +97,7 @@ $users = [];
$count = 0;
foreach ($res as $data) {
$users[$data["id"]] = $dbu->formatUserName($data["id"], $data["name"], $data["realname"],
$data["firstname"], 0);
$data["firstname"], 0) . " (" . $data["name"] . ")";
$logins[$data["id"]] = $data["name"];
}

View File

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

34
ajax/task.php Normal file
View File

@@ -0,0 +1,34 @@
<?php
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2024 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
LICENSE
This file is part of ProcessMaker plugin for GLPI.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this plugin. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include ("../../../inc/includes.php");
if( isset($_REQUEST) && !empty($_REQUEST)) {
$Case = new PluginProcessmakerCase;
$Case->getFromDB($_REQUEST['cases_id']);
PluginProcessmakerTask::displayTabContentForItem($Case, $_REQUEST['tabnum']);
}

File diff suppressed because it is too large Load Diff

View File

@@ -1,7 +1,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2024 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -27,7 +27,7 @@ along with this plugin. If not, see <http://www.gnu.org/licenses/>.
span.pm_task, a.pm_task {
float: right;
color: #fff !important;
border-radius: 8px;
border-radius: 4px;
padding-left: 8px;
line-height: 1.5;
}
@@ -43,4 +43,10 @@ span.pm_task_case {
margin-left: 8px;
flex: none;
align-self: flex-start;
}
td.pm_reminder {
border-left-color: lightgrey;
border-left-width: 1px;
border-left-style: solid;
}

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,29 @@
<?php
/**
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2024 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
LICENSE
This file is part of ProcessMaker plugin for GLPI.
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This plugin is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this plugin. If not, see <http://www.gnu.org/licenses/>.
--------------------------------------------------------------------------
*/
include ( "../../../inc/includes.php");

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2024 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -51,17 +51,20 @@ switch ($_REQUEST["action"]) {
//$task->getFromDBByQuery(" WHERE `plugin_processmaker_cases_id`=".$case->getID()); // normally there is only one and only one first task
//$link .= '&forcetab=PluginProcessmakerTask$'.$task->getID();
Session::setActiveTab('PluginProcessmakerCase', 'PluginProcessmakerTask$'.$task->fields['id']);
$item = new $_REQUEST['itemtype'];
$item->getFromDB($_REQUEST['items_id']);
unset($_SERVER['REQUEST_URI']); // to prevent use of processmaker.form.php in NavigateList
Session::initNavigateListItems('PluginProcessmakerCase',
//TRANS : %1$s is the itemtype name,
if (!isset($_REQUEST['timeline'])) {
Session::setActiveTab('PluginProcessmakerCase', 'PluginProcessmakerTask$'.$task->fields['id']);
$item = new $_REQUEST['itemtype'];
$item->getFromDB($_REQUEST['items_id']);
unset($_SERVER['REQUEST_URI']); // to prevent use of processmaker.form.php in NavigateList
Session::initNavigateListItems('PluginProcessmakerCase',
//TRANS : %1$s is the itemtype name,
// %2$s is the name of the item (used for headings of a list)
sprintf('%1$s = %2$s',
$_REQUEST['itemtype']::getTypeName(1), $item->fields["name"]));
Html::redirect($link);
sprintf('%1$s = %2$s',
$_REQUEST['itemtype']::getTypeName(1), $item->fields["name"]));
Html::redirect($link);
} else if ($_REQUEST['timeline']) {
Html::back();
}
}
Html::back();
} else {
@@ -138,7 +141,7 @@ switch ($_REQUEST["action"]) {
}
}
} elseif (isset($_REQUEST['reminder'])) {
// send notification remider as requested for this task
// send notification reminder as requested for this task
$locCase = new PluginProcessmakerCase;
$locCase->getFromDB($_REQUEST['cases_id']);
@@ -151,6 +154,71 @@ switch ($_REQUEST["action"]) {
// send notification now!
$pm_task->sendNotification('task_reminder', $glpi_task, $glpi_item, $locCase);
// Add a follow-up in the hosting item to indicate the sending of the reminder
$fu = new ITILFollowup();
$input = $fu->fields;
$fucontent = sprintf(
__("Case: '%s',<br>Task: '%s',<br>A reminder has been sent to:<br>", 'processmaker'),
$locCase->fields['name'],
Dropdown::getDropdownName("glpi_taskcategories", $glpi_task->fields["taskcategories_id"])
);
if (isset($glpi_task->fields['users_id_tech']) && $glpi_task->fields['users_id_tech'] > 0) {
// get infos for user
$dbu = new DbUtils;
$userinfos = $dbu->getUserName($glpi_task->fields['users_id_tech'], 2);
$fucontent .= "-> " . $userinfos['name'] . "<br>";
}
if (isset($glpi_task->fields['groups_id_tech']) && $glpi_task->fields['groups_id_tech'] > 0) {
// get infos for group
$grp = new Group();
$grp->getFromDB($glpi_task->fields['groups_id_tech']);
$fucontent .= "-> " . $grp->fields['name'] . "<br>";
}
$input['content'] = $DB->escape($fucontent);
$input['is_private'] = 0;
//$input['requesttypes_id'] = ;
$input['items_id'] = $_REQUEST['items_id'];
$input['users_id'] = Session::getLoginUserID(true);
$input['itemtype'] = $_REQUEST['itemtype'];
$fu->add($input);
} elseif (isset($_REQUEST['reminder_settings'])) {
// here we must add/update the taskrecalls
$recall = new PluginProcessmakerTaskrecall();
// if the new_when is less than glpi_currenttime, then set it to glpi_currenttime
// to prevent send of many "after reminders" in case of late cron that missed several "after reminders"
// if the new_when is less than glpi_currenttime, then set it to glpi_currenttime
$new_when = -1; // by default will delete any records
if (isset($_REQUEST['actual_before_time']) && $_REQUEST['actual_before_time'] >= 0) {
$new_when = $_REQUEST['next_reminder_before'];
} elseif ($_REQUEST['actual_after_time'] >= 0) {
$new_when = $_REQUEST['next_reminder_after'];
}
if ($new_when !== -1 && $_REQUEST['plugin_processmaker_taskrecalls_id'] > 0) {
$recall->update([
'id' => $_REQUEST['plugin_processmaker_taskrecalls_id'],
'before_time' => $_REQUEST['actual_before_time'],
'after_time' => $_REQUEST['actual_after_time'],
'when' => $new_when,
'users_id' => $_REQUEST['actual_users_id']
]);
} elseif ($new_when !== -1) {
$recall->add([
'plugin_processmaker_tasks_id' => $_REQUEST['plugin_processmaker_tasks_id'],
'before_time' => $_REQUEST['actual_before_time'],
'after_time' => $_REQUEST['actual_after_time'],
'when' => $new_when,
'users_id' => $_REQUEST['actual_users_id']
]);
} elseif ($_REQUEST['plugin_processmaker_taskrecalls_id'] > 0) {
$recall->delete(['id' => $_REQUEST['plugin_processmaker_taskrecalls_id']]);
}
}
}

View File

@@ -3,7 +3,7 @@ use Symfony\Component\DomCrawler\Crawler;
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2024 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -108,8 +108,15 @@ function processMakerShowCase($users_id, $from_helpdesk) {
$tkt->showFormHelpdesk($users_id);
$buffer = ob_get_clean();
//if (ob_get_level() > 1) {
// echo $buffer;
// $buffer = ob_get_clean();
//}
//to change this HTML code
$rand = rand();
$buffer = preg_replace(['@</i>\s+</span>`@',"@'</span>',@", "@&nbsp;@", "@</i>\s+</button>`;@", "@</span>`@", "@</i>`@"], ["icon_span_$rand`","'post_span_$rand',", "nbsp_$rand", "icon_button_$rand`;", "span_$rand`", "icon_$rand`"], $buffer);
// to change this HTML code
$crawler = new Crawler();
$crawler->addHtmlContent($buffer);
@@ -122,7 +129,7 @@ function processMakerShowCase($users_id, $from_helpdesk) {
$crawler->filter('[name=add]')->getNode(0)->setAttribute('style', 'display:none;');
// add an input for processguid in the form
$formNode = $crawler->filter('#itil-form');
$formNode = $crawler->filter('div.card');
$input = $formNode->getNode(0)->appendChild(new DOMElement('input'));
$input->setAttribute('name', 'processmaker_process_guid');
$input->setAttribute('type', 'hidden');
@@ -191,10 +198,13 @@ function processMakerShowCase($users_id, $from_helpdesk) {
]));
$iframe->setAttribute(
'src',
"{$PM_SOAP->serverURL}/cases/cases_Open?sid={$PM_SOAP->getPMSessionID()}&APP_UID={$caseInfo->caseId}&{$paramsURL}&glpi_data={$glpi_data}"
);
"{$PM_SOAP->serverURL}/cases/cases_Open?sid={$PM_SOAP->getPMSessionID()}&APP_UID={$caseInfo->caseId}&{$paramsURL}&glpi_data={$glpi_data}"
);
echo $crawler->html();
$buffer = $crawler->html();
$buffer = str_replace(["icon_span_$rand`", "'post_span_$rand',", "nbsp_$rand", "icon_button_$rand`;", "span_$rand`", "icon_$rand`"], ['</i> </span>`', "'</span>',", "&nbsp;", "</i> </button>`;", "</span>`", "</i>`"], $buffer);
echo $buffer;
}
}

View File

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

View File

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

219
hook.php
View File

@@ -2,7 +2,7 @@
/*
-------------------------------------------------------------------------
ProcessMaker plugin for GLPI
Copyright (C) 2014-2023 by Raynet SAS a company of A.Raymond Network.
Copyright (C) 2014-2024 by Raynet SAS a company of A.Raymond Network.
https://www.araymond.com/
-------------------------------------------------------------------------
@@ -72,8 +72,9 @@ function plugin_processmaker_install() {
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]);
CronTask::Register('PluginProcessmakerTaskcategory', 'pmreminders', 5*MINUTE_TIMESTAMP, ['state' => CronTask::STATE_DISABLE, 'mode' => CronTask::MODE_EXTERNAL]);
// required because autoload doesn't work for unactive plugin'
// required because autoload doesn't work for inactive plugin'
include_once(PLUGIN_PROCESSMAKER_ROOT . "/inc/profile.class.php");
PluginProcessmakerProfile::createAdminAccess($_SESSION['glpiactiveprofile']['id']);
@@ -90,18 +91,14 @@ function plugin_processmaker_uninstall() {
function plugin_processmaker_getAddSearchOptionsNew($itemtype) {
$name = _n('Process Case', 'Process Cases', Session::getPluralNumber(), 'processmaker');
$tab = [];
$tab[] = [
'id' => 'processmaker',
'name' => $name
if (in_array($itemtype, ['Ticket', 'Change', 'Problem'])) {
$tab[] = [
'id' => 'processmaker',
'name' => _n('Process Case', 'Process Cases', Session::getPluralNumber(), 'processmaker')
];
// TODO add Change and Problem + other fields to the search
$objects = ['Ticket', 'Change', 'Problem'];
if (in_array($itemtype, $objects)) {
$tab[] = [
'id' => 10001,
'table' => PluginProcessmakerCase::getTable(),
@@ -191,20 +188,199 @@ function plugin_processmaker_getAddSearchOptionsNew($itemtype) {
];
}
return $tab;
if ($itemtype == 'TaskCategory') {
$tab[] = [
'id' => 'processmaker',
'name' => _n('Process task category', 'Process task categories', Session::getPluralNumber(), 'processmaker')
];
$tab[] = [
'id' => 20000,
'table' => PluginProcessmakerTaskCategory::getTable(),
'field' => 'taskcategories_id',
'massiveaction' => false,
'name' => __('Process task', 'processmaker'),
'datatype' => 'itemlink',
'joinparams' => [
'jointype' => 'child'
]
];
$tab[] = [
'id' => 20001,
'table' => PluginProcessmakerTaskCategory::getTable(),
'field' => 'is_start',
'massiveaction' => false,
'name' => __('Start', 'processmaker'),
'datatype' => 'bool',
'joinparams' => [
'jointype' => 'child'
]
];
$tab[] = [
'id' => 20002,
'table' => PluginProcessmakerTaskCategory::getTable(),
'field' => 'is_active',
'massiveaction' => false,
'name' => __('Active', 'processmaker'),
'datatype' => 'bool',
'joinparams' => [
'jointype' => 'child'
]
];
$tab[] = [
'id' => 20003,
'table' => PluginProcessmakerTaskCategory::getTable(),
'field' => 'is_subprocess',
'massiveaction' => false,
'name' => __('Sub-process', 'processmaker'),
'datatype' => 'bool',
'joinparams' => [
'jointype' => 'child'
]
];
$tab[] = [
'id' => 20004,
'table' => PluginProcessmakerTaskCategory::getTable(),
'field' => 'is_reassignreason_mandatory',
'massiveaction' => false,
'name' => __('Force re-assign reason', 'processmaker'),
'datatype' => 'specific',
'nosearch' => true,
'nodisplay' => true,
'joinparams' => [
'jointype' => 'child'
]
];
$tab[] = [
'id' => 20005,
'table' => PluginProcessmakerTaskCategory::getTable(),
'field' => 'before_time',
'massiveaction' => false,
'name' => __('Reminder (before task begin)', 'processmaker'),
'datatype' => 'specific',
'searchequalsonfield' => true,
'searchtype' => [
'equals',
'notequals',
'lessthan',
'morethan'
],
'joinparams' => [
'jointype' => 'child'
]
];
$tab[] = [
'id' => 20006,
'table' => User::getTable(),
'field' => 'name',
'massiveaction' => false,
'name' => __('Reminder sender', 'processmaker'),
'datatype' => 'dropdown',
'linkfield' => 'users_id',
'joinparams' => [
'beforejoin' => [
'table' => PluginProcessmakerTaskCategory::getTable(),
'joinparams' => [
'jointype' => 'child',
]
]
]
];
$tab[] = [
'id' => 20007,
'table' => PluginProcessmakerTaskCategory::getTable(),
'field' => 'after_time',
'massiveaction' => false,
'name' => __('Reminder (after task end)', 'processmaker'),
'datatype' => 'specific',
'searchequalsonfield' => true,
'searchtype' => [
'equals',
'notequals',
'lessthan',
'morethan'
],
'joinparams' => [
'jointype' => 'child'
]
];
// $tab[] = [
// 'id' => 20008,
// 'table' => PluginProcessmakerTaskCategory::getTable(),
// 'field' => 'reminder_overdue_frequency',
// 'massiveaction' => false,
// 'name' => __('Reminder frequency', 'processmaker'),
// 'datatype' => 'specific',
// 'searchequalsonfield' => true,
// 'searchtype' => [
// 'equals',
// 'notequals',
// ],
// 'joinparams' => [
// 'jointype' => 'child',
// ]
//];
}
return $tab;
}
//function plugin_processmaker_addWhere($link, $nott, $itemtype, $ID, $val, $searchtype) {
function plugin_processmaker_addWhere($link, $nott, $itemtype, $ID, $val, $searchtype) {
if ($itemtype == 'TaskCategory' && $ID == 20005) { // 20005 == before_time
switch ($searchtype) {
case 'lessthan':
if ($nott) {
return "$link (`glpi_plugin_processmaker_taskcategories`.`before_time` <= $val)";
} else {
return "$link (`glpi_plugin_processmaker_taskcategories`.`before_time` > $val)";
}
break;
case 'morethan':
if ($nott) {
return "$link (`glpi_plugin_processmaker_taskcategories`.`before_time` >= $val)";
} else {
return "$link (`glpi_plugin_processmaker_taskcategories`.`before_time` < $val)";
}
break;
}
}
if ($itemtype == 'TaskCategory' && $ID == 20007) { // 20007 == after_time
switch ($searchtype) {
case 'lessthan':
if ($nott) {
return "$link (`glpi_plugin_processmaker_taskcategories`.`after_time` >= $val)";
} else {
return "$link (`glpi_plugin_processmaker_taskcategories`.`after_time` < $val)";
}
break;
case 'morethan':
if ($nott) {
return "$link (`glpi_plugin_processmaker_taskcategories`.`after_time` <= $val)";
} else {
return "$link (`glpi_plugin_processmaker_taskcategories`.`after_time` > $val)";
}
break;
}
}
// return '';
return '';
}
//function plugin_processmaker_giveItem($itemtype, $ID, $data, $num) {
// echo '';
//}
function plugin_processmaker_giveItem($itemtype, $ID, $data, $num) {
echo '';
}
/**
* Summary of plugin_pre_item_update_processmaker
* @param CommonITILObject $parm is an object
@@ -491,6 +667,9 @@ function plugin_item_update_processmaker_tasks($parm) {
], [], false);
$externalapplicationparams['id'] = $cronactionid;
if ($externalapplication) {
$externalapplicationparams['callback'] .= "?id=$cronactionid";
}
$externalapplicationparams = json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT);
// add to the crontaskcation the id of the crontaskaction itself in the postdata
$cronaction->update([
@@ -545,7 +724,7 @@ function plugin_item_update_processmaker_tasks($parm) {
// add to the crontaskaction the response of the remote API
$cronaction->update([
'id' => $cronactionid,
'retcode' => ($response === false ? $error : $response)
'retcode' => ($response === false ? $error : $DB->escape($response))
], false);
curl_close ($ch);

File diff suppressed because it is too large Load Diff

View File

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

Some files were not shown because too many files have changed in this diff Show More