Merge pull request #129 from tomolimo/4.0/bugfixes
Fixed issue with criteria in getProcessesWithCategoryAndProfile that prevents correct list of processes
This commit is contained in:
@@ -42,7 +42,7 @@ $can_unclaim = false; // by default
|
|||||||
$grp = false;
|
$grp = false;
|
||||||
$query = "SELECT TAS_GROUP_VARIABLE FROM TASK WHERE TAS_UID='".$_REQUEST['taskGuid']."' AND TAS_ASSIGN_TYPE='SELF_SERVICE';";
|
$query = "SELECT TAS_GROUP_VARIABLE FROM TASK WHERE TAS_UID='".$_REQUEST['taskGuid']."' AND TAS_ASSIGN_TYPE='SELF_SERVICE';";
|
||||||
$res = $PM_DB->query($query);
|
$res = $PM_DB->query($query);
|
||||||
if ($PM_DB->numrows($res) > 0 && $row = $PM_DB->fetch_assoc($res)) {
|
if ($PM_DB->numrows($res) > 0 && $row = $PM_DB->fetchAssoc($res)) {
|
||||||
$can_unclaim = true;
|
$can_unclaim = true;
|
||||||
if ($row['TAS_GROUP_VARIABLE'] != '') {
|
if ($row['TAS_GROUP_VARIABLE'] != '') {
|
||||||
//self-service value based assignment
|
//self-service value based assignment
|
||||||
|
|||||||
@@ -1,126 +1,126 @@
|
|||||||
<?php
|
<?php
|
||||||
include_once ("../../../inc/includes.php");
|
include_once ("../../../inc/includes.php");
|
||||||
|
|
||||||
switch ($_POST["action"]) {
|
switch ($_REQUEST["action"]) {
|
||||||
case 'newcase':
|
case 'newcase':
|
||||||
if (isset($_POST['items_id']) && $_POST['items_id'] > 0) {
|
if (isset($_REQUEST['items_id']) && $_REQUEST['items_id'] > 0) {
|
||||||
|
|
||||||
// then this case will be bound to an item
|
// then this case will be bound to an item
|
||||||
if ($_POST['plugin_processmaker_processes_id'] > 0) {
|
if ($_REQUEST['plugin_processmaker_processes_id'] > 0) {
|
||||||
|
|
||||||
$resultCase = $PM_SOAP->startNewCase($_POST['plugin_processmaker_processes_id'], $_POST['itemtype'], $_POST['items_id'], Session::getLoginUserID());
|
$resultCase = $PM_SOAP->startNewCase($_REQUEST['plugin_processmaker_processes_id'], $_REQUEST['itemtype'], $_REQUEST['items_id'], Session::getLoginUserID());
|
||||||
|
|
||||||
if ($resultCase->status_code == 0) {
|
if ($resultCase->status_code == 0) {
|
||||||
$case = new PluginProcessmakerCase;
|
$case = new PluginProcessmakerCase;
|
||||||
if ($case->getFromGUID($resultCase->caseId)) {
|
if ($case->getFromGUID($resultCase->caseId)) {
|
||||||
$link = $case->getLinkURL();
|
$link = $case->getLinkURL();
|
||||||
$task = new PluginProcessmakerTask($_POST['itemtype'].'Task');
|
$task = new PluginProcessmakerTask($_REQUEST['itemtype'].'Task');
|
||||||
|
|
||||||
$task->getFromDBByRequest([
|
$task->getFromDBByRequest([
|
||||||
'WHERE' => [
|
'WHERE' => [
|
||||||
'plugin_processmaker_cases_id' => $case->getID()
|
'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
|
//$task->getFromDBByQuery(" WHERE `plugin_processmaker_cases_id`=".$case->getID()); // normally there is only one and only one first task
|
||||||
//$link .= '&forcetab=PluginProcessmakerTask$'.$task->getID();
|
//$link .= '&forcetab=PluginProcessmakerTask$'.$task->getID();
|
||||||
|
|
||||||
Session::setActiveTab('PluginProcessmakerCase', 'PluginProcessmakerTask$'.$task->fields['id']);
|
Session::setActiveTab('PluginProcessmakerCase', 'PluginProcessmakerTask$'.$task->fields['id']);
|
||||||
$item = new $_POST['itemtype'];
|
$item = new $_REQUEST['itemtype'];
|
||||||
$item->getFromDB($_POST['items_id']);
|
$item->getFromDB($_REQUEST['items_id']);
|
||||||
unset($_SERVER['REQUEST_URI']); // to prevent use of processmaker.form.php in NavigateList
|
unset($_SERVER['REQUEST_URI']); // to prevent use of processmaker.form.php in NavigateList
|
||||||
Session::initNavigateListItems('PluginProcessmakerCase',
|
Session::initNavigateListItems('PluginProcessmakerCase',
|
||||||
//TRANS : %1$s is the itemtype name,
|
//TRANS : %1$s is the itemtype name,
|
||||||
// %2$s is the name of the item (used for headings of a list)
|
// %2$s is the name of the item (used for headings of a list)
|
||||||
sprintf('%1$s = %2$s',
|
sprintf('%1$s = %2$s',
|
||||||
$_POST['itemtype']::getTypeName(1), $item->fields["name"]));
|
$_REQUEST['itemtype']::getTypeName(1), $item->fields["name"]));
|
||||||
Html::redirect($link);
|
Html::redirect($link);
|
||||||
}
|
}
|
||||||
Html::back();
|
Html::back();
|
||||||
} else {
|
} else {
|
||||||
Session::addMessageAfterRedirect( PluginProcessmakerProcessmaker::getPMErrorMessage($resultCase->status_code)."<br>".$resultCase->message." (".$resultCase->status_code.")", true, ERROR);
|
Session::addMessageAfterRedirect( PluginProcessmakerProcessmaker::getPMErrorMessage($resultCase->status_code)."<br>".$resultCase->message." (".$resultCase->status_code.")", true, ERROR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Html::back();
|
Html::back();
|
||||||
}
|
}
|
||||||
} else { // the case is created before the ticket (used for post-only case creation before ticket creation)
|
} else { // the case is created before the ticket (used for post-only case creation before ticket creation)
|
||||||
$pm_user_guid = PluginProcessmakerUser::getPMUserId( Session::getLoginUserID() );
|
$pm_user_guid = PluginProcessmakerUser::getPMUserId( Session::getLoginUserID() );
|
||||||
$resultCase = $PM_SOAP->newCase( $_POST['plugin_processmaker_processes_id'],
|
$resultCase = $PM_SOAP->newCase( $_REQUEST['plugin_processmaker_processes_id'],
|
||||||
['GLPI_ITEM_CAN_BE_SOLVED' => 0,
|
['GLPI_ITEM_CAN_BE_SOLVED' => 0,
|
||||||
'GLPI_SELFSERVICE_CREATED' => '1',
|
'GLPI_SELFSERVICE_CREATED' => '1',
|
||||||
'GLPI_ITEM_TYPE' => 'Ticket',
|
'GLPI_ITEM_TYPE' => 'Ticket',
|
||||||
'GLPI_URL' => $CFG_GLPI['url_base'],
|
'GLPI_URL' => $CFG_GLPI['url_base'],
|
||||||
// Specific to Tickets
|
// Specific to Tickets
|
||||||
// GLPI_TICKET_TYPE will contains 1 (= incident) or 2 (= request)
|
// GLPI_TICKET_TYPE will contains 1 (= incident) or 2 (= request)
|
||||||
'GLPI_TICKET_TYPE' => $_POST['type'],
|
'GLPI_TICKET_TYPE' => $_REQUEST['type'],
|
||||||
'GLPI_ITEM_REQUESTER_GLPI_ID' => Session::getLoginUserID(),
|
'GLPI_ITEM_REQUESTER_GLPI_ID' => Session::getLoginUserID(),
|
||||||
'GLPI_ITEM_REQUESTER_PM_ID' => $pm_user_guid
|
'GLPI_ITEM_REQUESTER_PM_ID' => $pm_user_guid
|
||||||
] );
|
] );
|
||||||
if ($resultCase->status_code == 0) {
|
if ($resultCase->status_code == 0) {
|
||||||
// case is created
|
// case is created
|
||||||
// Must show it...
|
// Must show it...
|
||||||
//
|
//
|
||||||
$rand = rand( );
|
$rand = rand( );
|
||||||
Html::redirect($CFG_GLPI['root_doc']."/plugins/processmaker/front/processmaker.helpdesk.form.php?processes_id=".$_POST['plugin_processmaker_processes_id']."&case_guid=".$resultCase->caseId."&rand=$rand&itilcategories_id=".$_POST["itilcategories_id"]."&type=".$_POST["type"]."&entities_id=".$_POST['entities_id']);
|
Html::redirect($CFG_GLPI['root_doc']."/plugins/processmaker/front/processmaker.helpdesk.form.php?processes_id=".$_REQUEST['plugin_processmaker_processes_id']."&case_guid=".$resultCase->caseId."&rand=$rand&itilcategories_id=".$_REQUEST["itilcategories_id"]."&type=".$_REQUEST["type"]."&entities_id=".$_REQUEST['entities_id']);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
Session::addMessageAfterRedirect( PluginProcessmakerProcessmaker::getPMErrorMessage($resultCase->status_code)."<br>$resultCase->message ($resultCase->status_code)", true, ERROR);
|
Session::addMessageAfterRedirect( PluginProcessmakerProcessmaker::getPMErrorMessage($resultCase->status_code)."<br>$resultCase->message ($resultCase->status_code)", true, ERROR);
|
||||||
Html::redirect($CFG_GLPI["root_doc"]."/front/helpdesk.public.php?create_ticket=1");
|
Html::redirect($CFG_GLPI["root_doc"]."/front/helpdesk.public.php?create_ticket=1");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'reassign_reminder' :
|
case 'reassign_reminder' :
|
||||||
if (isset($_POST['reassign'])) {
|
if (isset($_REQUEST['reassign'])) {
|
||||||
// here we should re-assign the current task to $_POST['users_id_recipient']
|
// here we should re-assign the current task to $_REQUEST['users_id_recipient']
|
||||||
$locCase = new PluginProcessmakerCase;
|
$locCase = new PluginProcessmakerCase;
|
||||||
$locCase->getFromDB($_POST['cases_id']);
|
$locCase->getFromDB($_REQUEST['cases_id']);
|
||||||
if ($_POST['users_id_recipient'] != 0) {
|
if ($_REQUEST['users_id_recipient'] != 0) {
|
||||||
// we are assigning a new tech to a task
|
// we are assigning a new tech to a task
|
||||||
$pmResponse = $locCase->reassignCase($_POST['delIndex'],
|
$pmResponse = $locCase->reassignCase($_REQUEST['delIndex'],
|
||||||
$_POST['taskGuid'],
|
$_REQUEST['taskGuid'],
|
||||||
$_POST['delThread'],
|
$_REQUEST['delThread'],
|
||||||
$_POST['users_id'],
|
$_REQUEST['users_id'],
|
||||||
$_POST['users_id_recipient'],
|
$_REQUEST['users_id_recipient'],
|
||||||
['comment' => $_POST['comment']]);
|
['comment' => $_REQUEST['comment']]);
|
||||||
if ($pmResponse) {
|
if ($pmResponse) {
|
||||||
Session::addMessageAfterRedirect(__('Task re-assigned!', 'processmaker'), true, INFO);
|
Session::addMessageAfterRedirect(__('Task re-assigned!', 'processmaker'), true, INFO);
|
||||||
} else {
|
} else {
|
||||||
Session::addMessageAfterRedirect(__('Error re-assigning task: ', 'processmaker').$pmResponse->message, true, ERROR);
|
Session::addMessageAfterRedirect(__('Error re-assigning task: ', 'processmaker').$pmResponse->message, true, ERROR);
|
||||||
}
|
}
|
||||||
} elseif ($_POST['users_id_recipient'] == 0) {
|
} elseif ($_REQUEST['users_id_recipient'] == 0) {
|
||||||
// we are unassigning a task, i.e.: task un-claim
|
// we are unassigning a task, i.e.: task un-claim
|
||||||
$pmResponse = $locCase->unassignCase($_POST['delIndex'],
|
$pmResponse = $locCase->unassignCase($_REQUEST['delIndex'],
|
||||||
$_POST['taskGuid'],
|
$_REQUEST['taskGuid'],
|
||||||
$_POST['tasktype'],
|
$_REQUEST['tasktype'],
|
||||||
$_POST['tasks_id'],
|
$_REQUEST['tasks_id'],
|
||||||
$_POST['itemtype'],
|
$_REQUEST['itemtype'],
|
||||||
['comment' => $_POST['comment']]);
|
['comment' => $_REQUEST['comment']]);
|
||||||
if ($pmResponse) {
|
if ($pmResponse) {
|
||||||
Session::addMessageAfterRedirect(__('Task un-claimed!', 'processmaker'), true, INFO);
|
Session::addMessageAfterRedirect(__('Task un-claimed!', 'processmaker'), true, INFO);
|
||||||
} else {
|
} else {
|
||||||
Session::addMessageAfterRedirect(__("Can't un-claim task! Verify 'Assignement Rules' in the process definition.", 'processmaker'), true, ERROR);
|
Session::addMessageAfterRedirect(__("Can't un-claim task! Verify 'Assignement Rules' in the process definition.", 'processmaker'), true, ERROR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} elseif (isset($_POST['reminder'])) {
|
} elseif (isset($_REQUEST['reminder'])) {
|
||||||
// send notification remider as requested for this task
|
// send notification remider as requested for this task
|
||||||
|
|
||||||
$locCase = new PluginProcessmakerCase;
|
$locCase = new PluginProcessmakerCase;
|
||||||
$locCase->getFromDB($_POST['cases_id']);
|
$locCase->getFromDB($_REQUEST['cases_id']);
|
||||||
$glpi_item = new $_POST['itemtype'];
|
$glpi_item = new $_REQUEST['itemtype'];
|
||||||
$glpi_item->getFromDB($_POST['items_id']);
|
$glpi_item->getFromDB($_REQUEST['items_id']);
|
||||||
$pm_task = new PluginProcessmakerTask($_POST['tasktype']);
|
$pm_task = new PluginProcessmakerTask($_REQUEST['tasktype']);
|
||||||
$pm_task->getFromDB($_POST['tasks_id']);
|
$pm_task->getFromDB($_REQUEST['tasks_id']);
|
||||||
$glpi_task = new $_POST['tasktype'];
|
$glpi_task = new $_REQUEST['tasktype'];
|
||||||
$glpi_task->getFromDB($_POST['tasks_id']);
|
$glpi_task->getFromDB($_REQUEST['tasks_id']);
|
||||||
|
|
||||||
// send notification now!
|
// send notification now!
|
||||||
$pm_task->sendNotification('task_reminder', $glpi_task, $glpi_item, $locCase);
|
$pm_task->sendNotification('task_reminder', $glpi_task, $glpi_item, $locCase);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// to return to item
|
// to return to item
|
||||||
Html::back();
|
Html::back();
|
||||||
|
|
||||||
|
|||||||
@@ -59,8 +59,8 @@ function processMakerShowCase($users_id, $from_helpdesk) {
|
|||||||
|
|
||||||
$tkt = new Ticket;
|
$tkt = new Ticket;
|
||||||
|
|
||||||
// as showFormHelpdesk uses $_POST, we must set it
|
// as showFormHelpdesk uses $_REQUEST, we must set it
|
||||||
$_POST = $_REQUEST;
|
$_REQUEST = $_REQUEST;
|
||||||
|
|
||||||
//// must be using bare text
|
//// must be using bare text
|
||||||
//$save_rich_text = $CFG_GLPI["use_rich_text"];
|
//$save_rich_text = $CFG_GLPI["use_rich_text"];
|
||||||
@@ -189,9 +189,9 @@ function in_array_recursive($needle, $haystack) {
|
|||||||
|
|
||||||
|
|
||||||
// Change profile system
|
// Change profile system
|
||||||
if (isset($_POST['newprofile'])) {
|
if (isset($_REQUEST['newprofile'])) {
|
||||||
if (isset($_SESSION["glpiprofiles"][$_POST['newprofile']])) {
|
if (isset($_SESSION["glpiprofiles"][$_REQUEST['newprofile']])) {
|
||||||
Session::changeProfile($_POST['newprofile']);
|
Session::changeProfile($_REQUEST['newprofile']);
|
||||||
|
|
||||||
if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
|
if ($_SESSION["glpiactiveprofile"]["interface"] == "central") {
|
||||||
Html::redirect($CFG_GLPI['root_doc']."/front/central.php");
|
Html::redirect($CFG_GLPI['root_doc']."/front/central.php");
|
||||||
@@ -205,20 +205,20 @@ if (isset($_POST['newprofile'])) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Manage entity change
|
// Manage entity change
|
||||||
if (isset($_GET["active_entity"])) {
|
if (isset($_REQUEST["active_entity"])) {
|
||||||
if (!isset($_GET["is_recursive"])) {
|
if (!isset($_REQUEST["is_recursive"])) {
|
||||||
$_GET["is_recursive"] = 0;
|
$_REQUEST["is_recursive"] = 0;
|
||||||
}
|
}
|
||||||
if (Session::changeActiveEntities($_GET["active_entity"], $_GET["is_recursive"])) {
|
if (Session::changeActiveEntities($_REQUEST["active_entity"], $_REQUEST["is_recursive"])) {
|
||||||
if ($_GET["active_entity"] == $_SESSION["glpiactive_entity"]) {
|
if ($_REQUEST["active_entity"] == $_SESSION["glpiactive_entity"]) {
|
||||||
Html::redirect(preg_replace("/entities_id.*/", "", $_SERVER['HTTP_REFERER']));
|
Html::redirect(preg_replace("/entities_id.*/", "", $_SERVER['HTTP_REFERER']));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Redirect management
|
// Redirect management
|
||||||
if (isset($_GET["redirect"])) {
|
if (isset($_REQUEST["redirect"])) {
|
||||||
Toolbox::manageRedirect($_GET["redirect"]);
|
Toolbox::manageRedirect($_REQUEST["redirect"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// redirect if no create ticket right
|
// redirect if no create ticket right
|
||||||
|
|||||||
@@ -1,68 +1,68 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
// Original Author of file: MoronO
|
// Original Author of file: MoronO
|
||||||
// Purpose of file: mimic tracking.injector.php
|
// Purpose of file: mimic tracking.injector.php
|
||||||
// ----------------------------------------------------------------------
|
// ----------------------------------------------------------------------
|
||||||
if (isset( $_REQUEST['_glpi_csrf_token'] )) {
|
if (isset( $_REQUEST['_glpi_csrf_token'] )) {
|
||||||
define('GLPI_KEEP_CSRF_TOKEN', true);
|
define('GLPI_KEEP_CSRF_TOKEN', true);
|
||||||
}
|
}
|
||||||
$PM_POST = $_POST;
|
$PM_POST = $_POST;
|
||||||
$PM_REQUEST = $_REQUEST;
|
$PM_REQUEST = $_REQUEST;
|
||||||
$PM_GET = $_GET;
|
$PM_GET = $_GET;
|
||||||
include( "../../../inc/includes.php" );
|
include( "../../../inc/includes.php" );
|
||||||
|
|
||||||
if (empty($_POST["_type"])
|
if (empty($_REQUEST["_type"])
|
||||||
|| ($_POST["_type"] != "Helpdesk")
|
|| ($_REQUEST["_type"] != "Helpdesk")
|
||||||
|| !$CFG_GLPI["use_anonymous_helpdesk"]) {
|
|| !$CFG_GLPI["use_anonymous_helpdesk"]) {
|
||||||
Session::checkRight("ticket", CREATE);
|
Session::checkRight("ticket", CREATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Security check
|
// Security check
|
||||||
if (empty($_POST) || count($_POST) == 0) {
|
if (empty($_REQUEST) || count($_REQUEST) == 0) {
|
||||||
Html::redirect($CFG_GLPI["root_doc"]."/front/helpdesk.public.php");
|
Html::redirect($CFG_GLPI["root_doc"]."/front/helpdesk.public.php");
|
||||||
}
|
}
|
||||||
|
|
||||||
// here we are going to test if we must start a process
|
// here we are going to test if we must start a process
|
||||||
if (isset($_POST["_from_helpdesk"]) && $_POST["_from_helpdesk"] == 1
|
if (isset($_REQUEST["_from_helpdesk"]) && $_REQUEST["_from_helpdesk"] == 1
|
||||||
&& isset($_POST["type"]) //&& $_POST["type"] == Ticket::DEMAND_TYPE
|
&& isset($_REQUEST["type"]) //&& $_REQUEST["type"] == Ticket::DEMAND_TYPE
|
||||||
&& isset($_POST["itilcategories_id"])
|
&& isset($_REQUEST["itilcategories_id"])
|
||||||
&& isset($_POST["entities_id"])) {
|
&& isset($_REQUEST["entities_id"])) {
|
||||||
// here we have to check if there is an existing process in the entity and with the category
|
// here we have to check if there is an existing process in the entity and with the category
|
||||||
// if yes we will start it
|
// if yes we will start it
|
||||||
// if not we will continue
|
// if not we will continue
|
||||||
// special case if RUMT plugin is enabled and no process is available and category is 'User Management' then must start RUMT.
|
// special case if RUMT plugin is enabled and no process is available and category is 'User Management' then must start RUMT.
|
||||||
|
|
||||||
$processList = PluginProcessmakerProcessmaker::getProcessesWithCategoryAndProfile( $_POST["itilcategories_id"], $_POST["type"], $_SESSION['glpiactiveprofile']['id'], $_POST["entities_id"] );
|
$processList = PluginProcessmakerProcessmaker::getProcessesWithCategoryAndProfile( $_REQUEST["itilcategories_id"], $_REQUEST["type"], $_SESSION['glpiactiveprofile']['id'], $_REQUEST["entities_id"] );
|
||||||
|
|
||||||
// currently only one process should be assigned to this itilcategory so this array should contain only one row
|
// currently only one process should be assigned to this itilcategory so this array should contain only one row
|
||||||
$processQt = count( $processList );
|
$processQt = count( $processList );
|
||||||
if ($processQt == 1) {
|
if ($processQt == 1) {
|
||||||
$_POST['action']='newcase';
|
$_REQUEST['action']='newcase';
|
||||||
$_POST['plugin_processmaker_processes_id'] = $processList[0]['id'];
|
$_REQUEST['plugin_processmaker_processes_id'] = $processList[0]['id'];
|
||||||
include (GLPI_ROOT . "/plugins/processmaker/front/processmaker.form.php");
|
include (GLPI_ROOT . "/plugins/processmaker/front/processmaker.form.php");
|
||||||
die();
|
die();
|
||||||
} else if ($processQt > 1) {
|
} else if ($processQt > 1) {
|
||||||
// in this case we should show the process dropdown selection
|
// in this case we should show the process dropdown selection
|
||||||
include (GLPI_ROOT . "/plugins/processmaker/front/processmaker.helpdesk.form.php");
|
include (GLPI_ROOT . "/plugins/processmaker/front/processmaker.helpdesk.form.php");
|
||||||
die();
|
die();
|
||||||
} else {
|
} else {
|
||||||
// in this case should start RUMT
|
// in this case should start RUMT
|
||||||
// if and only if itilcategories_id matches one of the 'User Management' categories
|
// if and only if itilcategories_id matches one of the 'User Management' categories
|
||||||
// could be done via ARBehviours or RUMT itself
|
// could be done via ARBehviours or RUMT itself
|
||||||
$userManagementCat = [ 100556, 100557, 100558 ];
|
$userManagementCat = [ 100556, 100557, 100558 ];
|
||||||
$plug = new Plugin;
|
$plug = new Plugin;
|
||||||
if ($processQt == 0 && in_array( $_POST["itilcategories_id"], $userManagementCat) && $plug->isActivated('rayusermanagementticket' )) {
|
if ($processQt == 0 && in_array( $_REQUEST["itilcategories_id"], $userManagementCat) && $plug->isActivated('rayusermanagementticket' )) {
|
||||||
Html::redirect($CFG_GLPI['root_doc']."/plugins/rayusermanagementticket/front/rayusermanagementticket.helpdesk.public.php");
|
Html::redirect($CFG_GLPI['root_doc']."/plugins/rayusermanagementticket/front/rayusermanagementticket.helpdesk.public.php");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// prepare environment for std tracking.injector.php
|
// prepare environment for std tracking.injector.php
|
||||||
// switch to front dir
|
// switch to front dir
|
||||||
chdir(GLPI_ROOT."/front");
|
chdir(GLPI_ROOT."/front");
|
||||||
// revert back $_POST, $_GET and $_REQUEST
|
// revert back $_POST, $_GET and $_REQUEST
|
||||||
$_GET = $PM_GET;
|
$_GET = $PM_GET;
|
||||||
$_POST = $PM_POST;
|
$_POST = $PM_POST;
|
||||||
$_REQUEST = $PM_REQUEST;
|
$_REQUEST = $PM_REQUEST;
|
||||||
include (GLPI_ROOT . "/front/tracking.injector.php");
|
include (GLPI_ROOT . "/front/tracking.injector.php");
|
||||||
|
|||||||
@@ -2674,9 +2674,21 @@ debugger;
|
|||||||
global $DB;
|
global $DB;
|
||||||
$dbu = new DbUtils;
|
$dbu = new DbUtils;
|
||||||
$processList = [ ];
|
$processList = [ ];
|
||||||
//$entityAncestors = implode( ", ", $dbu->getAncestorsOf( $dbu->getTableForItemType( 'Entity' ), $entity ) );
|
|
||||||
$entityAncestors = $dbu->getAncestorsOf( $dbu->getTableForItemType( 'Entity' ), $entity );
|
$entityAncestors = $dbu->getAncestorsOf( $dbu->getTableForItemType( 'Entity' ), $entity );
|
||||||
//if (strlen( $entityAncestors ) > 0) {
|
|
||||||
|
$entities = ['entities_id' => $entity];
|
||||||
|
if (count( $entityAncestors ) > 0) {
|
||||||
|
$entities = [
|
||||||
|
'OR' => [
|
||||||
|
'entities_id' => $entity,
|
||||||
|
'AND' => [
|
||||||
|
'entities_id' => $entityAncestors,
|
||||||
|
'is_recursive' => 1
|
||||||
|
]
|
||||||
|
]
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
if ($category > 0) {
|
if ($category > 0) {
|
||||||
$query = [
|
$query = [
|
||||||
'FIELDS' => ['glpi_plugin_processmaker_processes.id', 'glpi_plugin_processmaker_processes.name'],
|
'FIELDS' => ['glpi_plugin_processmaker_processes.id', 'glpi_plugin_processmaker_processes.name'],
|
||||||
@@ -2696,30 +2708,21 @@ debugger;
|
|||||||
],
|
],
|
||||||
'WHERE' => [
|
'WHERE' => [
|
||||||
'AND' => [
|
'AND' => [
|
||||||
|
'is_active' => 1,
|
||||||
'itilcategories_id' => $category,
|
'itilcategories_id' => $category,
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'profiles_id' => $profile,
|
'profiles_id' => $profile,
|
||||||
'entities_id' => $entity
|
$entities
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
if (count( $entityAncestors ) > 0) {
|
|
||||||
//$entityAncestors = " OR (entities_id IN ($entityAncestors) AND is_recursive = 1) ";
|
|
||||||
$entityAncestors[] = $entity;
|
|
||||||
$query['WHERE']['AND']['entities_id'] = $entityAncestors;
|
|
||||||
$query['WHERE']['AND']['is_recursive'] = 1;
|
|
||||||
}
|
|
||||||
$res = $DB->request($query);
|
$res = $DB->request($query);
|
||||||
foreach ($res as $row) {
|
foreach ($res as $row) {
|
||||||
$processList[] = $row;
|
$processList[] = $row;
|
||||||
}
|
}
|
||||||
$processList = array_map("unserialize", array_unique(array_map("serialize", $processList)));
|
$processList = array_map("unserialize", array_unique(array_map("serialize", $processList)));
|
||||||
}
|
}
|
||||||
//$query ="SELECT DISTINCT glpi_plugin_processmaker_processes.id, glpi_plugin_processmaker_processes.name FROM glpi_plugin_processmaker_processes
|
|
||||||
// INNER JOIN glpi_plugin_processmaker_processes_profiles ON glpi_plugin_processmaker_processes_profiles.plugin_processmaker_processes_id=glpi_plugin_processmaker_processes.id
|
|
||||||
// WHERE is_active = 1 AND itilcategories_id = $category AND `type` = $type AND profiles_id = $profile AND (entities_id = $entity $entityAncestors)";
|
|
||||||
|
|
||||||
//foreach ($DB->request( $query ) as $row) {
|
|
||||||
|
|
||||||
return $processList;
|
return $processList;
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,7 @@
|
|||||||
<compatibility>9.4</compatibility>
|
<compatibility>9.4</compatibility>
|
||||||
</version>
|
</version>
|
||||||
<version>
|
<version>
|
||||||
<num>4.0.4</num>
|
<num>4.0.5</num>
|
||||||
<compatibility>9.5</compatibility>
|
<compatibility>9.5</compatibility>
|
||||||
</version>
|
</version>
|
||||||
</versions>
|
</versions>
|
||||||
|
|||||||
Reference in New Issue
Block a user