3
0

Version to 3.5.1

Compatible with GLPI 9.3
This commit is contained in:
tomolimo
2019-05-21 10:47:15 +02:00
parent 8a711173cc
commit 96c6e9ba6f
43 changed files with 1027 additions and 1669 deletions

View File

@@ -3,12 +3,9 @@ include_once ("../../../inc/includes.php");
switch ($_POST["action"]) {
case 'newcase':
if (isset($_POST['items_id']) && $_POST['items_id'] > 0) { // then this case will be bound to an item
// TODO: we must check if a case is not already existing
// to manage the problem of F5 (Refresh)
if (isset($_POST['items_id']) && $_POST['items_id'] > 0) {
//$hasCase = PluginProcessmakerCase::getIDFromItem($_POST['itemtype'], $_POST['items_id']);
//if ($hasCase === false && $_POST['plugin_processmaker_processes_id'] > 0) {
// then this case will be bound to an item
if ($_POST['plugin_processmaker_processes_id'] > 0) {
$resultCase = $PM_SOAP->startNewCase($_POST['plugin_processmaker_processes_id'], $_POST['itemtype'], $_POST['items_id'], Session::getLoginUserID());
@@ -18,9 +15,18 @@ switch ($_POST["action"]) {
if ($case->getFromGUID($resultCase->caseId)) {
$link = $case->getLinkURL();
$task = new PluginProcessmakerTask();
$task->getFromDBByQuery(" WHERE `plugin_processmaker_cases_id`=".$case->getID()); // normally there is only one and only one first task
$task->getFromDBByRequest([
'WHERE' => [
'plugin_processmaker_cases_id' => $case->getID()
],
]);
//$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->getID());
Session::setActiveTab('PluginProcessmakerCase', 'PluginProcessmakerTask$'.$task->fields['id']);
$item = new $_POST['itemtype'];
$item->getFromDB($_POST['items_id']);
unset($_SERVER['REQUEST_URI']); // to prevent use of processmaker.form.php in NavigateList
@@ -39,11 +45,18 @@ switch ($_POST["action"]) {
Html::back();
}
} else { // the case is created before the ticket (used for post-only case creation before ticket creation)
$pm_user_guid = PluginProcessmakerUser::getPMUserId( Session::getLoginUserID() );
$resultCase = $PM_SOAP->newCase( $_POST['plugin_processmaker_processes_id'],
[ 'GLPI_ITEM_CAN_BE_SOLVED' => 0,
'GLPI_SELFSERVICE_CREATED' => '1',
'GLPI_ITEM_TYPE' => 'Ticket',
'GLPI_URL' => $CFG_GLPI['url_base']] );
['GLPI_ITEM_CAN_BE_SOLVED' => 0,
'GLPI_SELFSERVICE_CREATED' => '1',
'GLPI_ITEM_TYPE' => 'Ticket',
'GLPI_URL' => $CFG_GLPI['url_base'],
// Specific to Tickets
// GLPI_TICKET_TYPE will contains 1 (= incident) or 2 (= request)
'GLPI_TICKET_TYPE' => $_POST['type'],
'GLPI_ITEM_REQUESTER_GLPI_ID' => Session::getLoginUserID(),
'GLPI_ITEM_REQUESTER_PM_ID' => $pm_user_guid
] );
if ($resultCase->status_code == 0) {
// case is created
// Must show it...