diff --git a/README.md b/README.md index b7d1bad..d554ca2 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ GLPI plugin that provides an interface with a customized ProcessMaker server (https://github.com/tomolimo/processmaker-server). -version 3.4.5 is compatible with GLPI 9.2 and needs ProcessMaker either 3.0.1.8-RE-1.12 (https://github.com/tomolimo/processmaker-server/releases/tag/3.0.1.8-RE-1.12) or 3.3.0-RE-1.0 (https://github.com/tomolimo/processmaker-server/releases/tag/3.3.0-RE-1.0) +version 3.4.x is compatible with GLPI 9.2 and needs ProcessMaker either 3.0.1.8-RE-1.12 (https://github.com/tomolimo/processmaker-server/releases/tag/3.0.1.8-RE-1.12) or 3.3.0-RE-1.x (https://github.com/tomolimo/processmaker-server/releases/tag/3.3.0-RE-1.0) This plugin can run classic and bpmn processes diff --git a/ajax/dropdownProcesses.php b/ajax/dropdownProcesses.php index af506a7..ba543e3 100644 --- a/ajax/dropdownProcesses.php +++ b/ajax/dropdownProcesses.php @@ -61,15 +61,22 @@ } $processall = (isset($_REQUEST['specific_tags']['process_restrict']) && !$_REQUEST['specific_tags']['process_restrict']); +$count_cases_per_item = isset($_REQUEST['specific_tags']['count_cases_per_item']) ? $_REQUEST['specific_tags']['count_cases_per_item'] : []; $result = PluginProcessmakerProcess::getSqlSearchResult(false, $search); if ($DB->numrows($result)) { while ($data = $DB->fetch_array($result)) { $process_entities = PluginProcessmakerProcess::getEntitiesForProfileByProcess($data["id"], $_SESSION['glpiactiveprofile']['id'], true); - if ($processall || in_array( $_REQUEST["entity_restrict"], $process_entities)) { - array_push( $processes, [ 'id' => $data["id"], - 'text' => $data["name"] ]); + $can_add = $data['max_cases_per_item'] == 0 || !isset($count_cases_per_item[$data["id"]]) || $count_cases_per_item[$data["id"]] < $data['max_cases_per_item']; + if ($processall + || ($data['maintenance'] != 1 + && in_array( $_REQUEST["entity_restrict"], $process_entities) + && $can_add) ) { + + array_push( $processes, ['id' => $data["id"], + 'text' => $data["name"] + ]); $count++; } } diff --git a/ajax/dropdownUsers.php b/ajax/dropdownUsers.php index 2ad0286..ccf9afa 100644 --- a/ajax/dropdownUsers.php +++ b/ajax/dropdownUsers.php @@ -77,11 +77,6 @@ } } -if (!function_exists('dpuser_cmp')) { - function dpuser_cmp($a, $b) { - return strcasecmp($a, $b); - } -} $datas = []; diff --git a/ajax/task_users.php b/ajax/task_users.php index e9e5351..e6b9393 100644 --- a/ajax/task_users.php +++ b/ajax/task_users.php @@ -18,31 +18,120 @@ Session::checkLoginUser(); +$commoninputs = "". + "". + "". + "". + "". + "". + "". + "". + ""; + $PM_SOAP = new PluginProcessmakerProcessmaker; // not used in this context, just here to define the type of $PM_SOAP $PM_DB = new PluginProcessmakerDB; $rand = rand(); echo "