Added GLPI_TICKET_ID to case after ticket creation via simplified interface

Added GLPI_ITEM_TYPE to case at ticket creation via simplified interface
Fixed problem of ticket text in simplified interface
Fixed problem of viewing pm task when task is too high in simplified interface
Created scripts folder and moved importUsersGLPI2PM.php into it
Set version to 3.1.6
This commit is contained in:
tomolimo
2017-09-01 10:47:29 +02:00
parent 1a29ccc1c6
commit 8168c7a8ed
6 changed files with 36 additions and 26 deletions

View File

@@ -27,6 +27,7 @@ switch ($_POST["action"]) {
$resultCase = $myProcessMaker->newCase( $_POST['plugin_processmaker_process_id'],
array( 'GLPI_ITEM_CAN_BE_SOLVED' => 0,
'GLPI_SELFSERVICE_CREATED' => '1',
'GLPI_ITEM_TYPE' => 'Ticket',
'GLPI_URL' => $CFG_GLPI['url_base'].$CFG_GLPI['root_doc']) );
if ($resultCase->status_code == 0) {
// case is created

View File

@@ -1062,7 +1062,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
}
}
/**
* summary of cronPMUsers
@@ -1314,8 +1314,8 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
if (isset($parm->input['processmaker_caseid'])) {
// a case is already started for this ticket, then bind them together
$itemType = $parm->getType(); //$myCase->getField('itemtype');
$itemId = $parm->fields['id']; //$myCase->getField('items_id');
$itemType = $parm->getType();
$itemId = $parm->fields['id'];
$caseId = $parm->input['processmaker_caseid'];
$myCase = new PluginProcessmakerCase;
@@ -1336,6 +1336,11 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
// here we create a fake task that will be used to store the creator of the case
// this is due for traceability only
$myProcessMaker->add1stTask( $myCase->fields['itemtype'], $myCase->fields['items_id'], $caseInfo, array( 'notif' => false) ); // no notif
// before routing, send items_id and itemtype
// as this information was not available at case creation
$resultSave = $myProcessMaker->sendVariables( $myCase->getID(), array( "GLPI_TICKET_ID" => $itemId ) );
// route case
$pmRouteCaseResponse = $myProcessMaker->routeCase( $myCase->getID(), $parm->input['processmaker_delindex'] );
@@ -1440,12 +1445,12 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
// then we should check if this user has rights on the item, if not then we must add it to the watcher list!
$glpi_item = getItemForItemtype( $itemType );
$glpi_item->getFromDB( $itemId );
$user_entities = Profile_User::getUserEntities( $techId, true, true );
$user_can_view = in_array( $glpi_item->fields['entities_id'], $user_entities );
//$user_entities = Profile_User::getUserEntities( $techId, true, true );
//$user_can_view = in_array( $glpi_item->fields['entities_id'], $user_entities );
if (!$glpi_item->isUser( CommonITILActor::REQUESTER, $techId )
&& !$glpi_item->isUser( CommonITILActor::OBSERVER, $techId )
&& !$glpi_item->isUser( CommonITILActor::ASSIGN, $techId )
&& !$user_can_view ) {
&& !$glpi_item->isUser( CommonITILActor::ASSIGN, $techId ) ) {
//&& !$user_can_view ) {
// then we must add this tech user to watcher list
$glpi_item_user = getItemForItemtype( $glpi_item->getType() . "_User" );
$donotif = $CFG_GLPI["use_mailing"];
@@ -1667,8 +1672,8 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
/**
* Summary of computeTaskDuration
* @param mixed $task
* @param mixed $entity
* @param mixed $task
* @param mixed $entity
* @return mixed
*/
function computeTaskDuration( $task, $entity ) {

View File

@@ -5,14 +5,22 @@ var caseIFrame;
function onClickContinue(obj) {
//debugger;
// call old handler
contentDocument = caseIFrame.contentDocument;
var txtAreaUserRequestSumUp = contentDocument.getElementById('form[UserRequestSumUp]');
if (txtAreaUserRequestSumUp) {
$("textarea[name='content']").val($(txtAreaUserRequestSumUp).val());
} else {
$("textarea[name='content']").val('_');
}
// call old handler if any
if (obj != undefined && oldHandler) {
oldHandler(obj.target);
}
// hide the iFrame
caseIFrame.style.visibility = 'hidden';
// call new handler
// trigger a click on the 'add' button of the ticket
submitButton.click();
}
@@ -34,11 +42,10 @@ function bGLPIHideElement(eltList, attribute, value) {
function onLoadFrame( evt, caseId, delIndex, caseNumber, processName ) {
var caseTimerCounter = 0;
var redimIFrame = false;
//var bAreaUseRequestSumUp = false;
var bButtonContinue = false;
var caseTimer = window.setInterval(function () {
//debugger ;
// look for frmDerivation form
// look for caseiframe iFrame
caseIFrame = document.getElementById('caseiframe');
@@ -50,15 +57,8 @@ function onLoadFrame( evt, caseId, delIndex, caseNumber, processName ) {
}
if (caseIFrame != undefined && contentDocument) {
var buttonContinue = contentDocument.getElementById('form[btnGLPISendRequest]');
var txtAreaUseRequestSumUp = contentDocument.getElementById('form[UserRequestSumUp]');
var linkList = contentDocument.getElementsByTagName('a');
if (txtAreaUseRequestSumUp != undefined) {
//debugger;
$("textarea[name='content']")[0].value = txtAreaUseRequestSumUp.value;
} else {
$("textarea[name='content']")[0].value = '_';
}
if (!bButtonContinue && buttonContinue != undefined && linkList != undefined && linkList.length > 0) {
bButtonContinue = true; //window.clearInterval(caseTimer); // to be sure that it will be done only one time
// change action for the attached form and add some parameters
@@ -84,13 +84,17 @@ function onLoadFrame( evt, caseId, delIndex, caseNumber, processName ) {
}
// try to redim caseIFrame
// try to redim caseIFrame
if (!redimIFrame) {
redimIFrame = true; // to prevent several timer creation
// redim one time
redimTaskFrame(caseIFrame);
// redim each second
var redimFrameTimer = window.setInterval(function () {
redimTaskFrame(caseIFrame);
}, 1000);
redimIFrame = true;
}
}

View File

@@ -23,7 +23,7 @@
</authors>
<versions>
<version>
<num>3.1.5</num>
<num>3.1.6</num>
<compatibility>9.1</compatibility>
</version>
</versions>

View File

@@ -12,7 +12,7 @@
chdir(dirname($_SERVER["SCRIPT_FILENAME"]));
define('DO_NOT_CHECK_HTTP_REFERER', 1);
define('GLPI_ROOT', '../..');
define('GLPI_ROOT', '../../..');
include (GLPI_ROOT . "/inc/includes.php");
include_once 'inc/processmaker.class.php' ;

View File

@@ -100,7 +100,7 @@ function plugin_version_processmaker() {
global $LANG;
return array ('name' => 'Process Maker',
'version' => '3.1.5',
'version' => '3.1.6',
'author' => 'Olivier Moron',
'homepage' => '',
'minGlpiVersion' => '9.1');