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 "
"; echo __('Re-assign task to', 'processmaker')." "; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; -echo ""; +echo ""; +echo ""; +echo $commoninputs; + +$can_unclaim = false; // by default +$query = "SELECT TAS_GROUP_VARIABLE FROM TASK WHERE TAS_UID='".$_REQUEST['taskGuid']."' AND TAS_ASSIGN_TYPE='SELF_SERVICE';"; +$res = $PM_DB->query($query); +if ($PM_DB->numrows($res) > 0) { + $can_unclaim = true; +} PluginProcessmakerUser::dropdown( ['name' => 'users_id_recipient', - 'value' => $_REQUEST['users_id'], - 'used' => [$_REQUEST['users_id']], - 'entity' => 0, //$item->fields["entities_id"], // not used, as any user can be assigned to any tasks - 'entity_sons' => false, // not used, as any user can be assigned to any tasks - 'right' => 'all', - 'rand' => $rand, - 'width' => '', - 'specific_tags' => ['taskGuid' => $_REQUEST['taskGuid']]]); + 'value' => $_REQUEST['users_id'], + 'used' => $_REQUEST['used'], + 'entity' => 0, //$item->fields["entities_id"], // not used, as any user can be assigned to any tasks + 'entity_sons' => false, // not used, as any user can be assigned to any tasks + 'right' => 'all', + 'rand' => $rand, + 'width' => '', + 'specific_tags' => ['taskGuid' => $_REQUEST['taskGuid']] + ]); + echo "  "; -echo ""; -Html::closeForm(true); +echo ""; +echo ""; + +echo HTML::scriptBlock(" + $(function () { + // Dialog helpers + // Create the dialog with \"Re-assign\" button + function showCommentDlg(title, content, alttext) { + + var dlgContents = { + title: title, + modal: true, + width: 'auto', + height: 'auto', + resizable: false, + close: function (event, ui) { + $(this).dialog('destroy').remove(); + }, + buttons: [{ + text: alttext, + id: 'submit$rand', + disabled: 'disabled', + click: function() { + $('#processmaker_form_task$rand-".$_REQUEST['delIndex']." input[name=comment]').val($('#comment$rand').val()); + //$('#processmaker_form_task$rand-".$_REQUEST['delIndex']."').submit(); + $('input[name=reassign').click(); + $('#submit$rand').button('disable'); + } + }], + show: true, + hide: true + } + $('
').appendTo($('#processmaker_form_task$rand-".$_REQUEST['delIndex']."')); + var locDlg = $('#reassign$rand').html(content + '

Input at least 10 words in English to justify.').dialog(dlgContents); + $('#comment$rand').focus(); + $('#comment$rand').on('keydown keyup', function(e) { + if ($('#comment$rand').val().split(/\W+/).length > 10) { + $('#submit$rand').button('enable'); + } else { + $('#submit$rand').button('disable'); + } + }); + return locDlg; + }; + + $('input[name=reassign$rand]').click(function (e) { + e.preventDefault(); + if ($('input[name=users_id]').val() == $('input[name=users_id_recipient]').val()) { + // task is already assigned to this user + alert('".__('Task is already assigned to this user or group!', 'processmaker')."', '".__('Re-assign task', 'processmaker')."'); + } else if ($('input[name=users_id_recipient]').val() == 0) { + // un-claim + if (".($can_unclaim ? 1 : 0)." && $('input[name=users_id]').val() != 0) { + showCommentDlg('".__('Un-claim task', 'processmaker')."', + '".__('Please input reason to un-claim
(task will be re-assigned to former group):', 'processmaker')."', + '".__('Un-claim', 'processmaker')."'); + } else { + // task can't be unclaim because it isn't SELF_SERVICE + alert('".__('Can\\\'t un-assign Task!', 'processmaker')."', '".__('Un-claim task', 'processmaker')."'); + } + } else { + showCommentDlg('".__('Re-assign task', 'processmaker')."', + '".__('Please input reason to re-assign:', 'processmaker')."', + '".__('Re-assign', 'processmaker')."'); + } + return false; + }); + }) + "); + + +if (Session::getLoginUserID() != $_REQUEST['users_id']) { + echo "  "; + echo ""; +} + +Html::closeForm(true); diff --git a/front/case.form.php b/front/case.form.php index 6ed607f..f3f63ac 100644 --- a/front/case.form.php +++ b/front/case.form.php @@ -22,16 +22,13 @@ function glpi_processmaker_case_reload_page() { if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'route' && isset( $_REQUEST['UID'] ) && isset( $_REQUEST['APP_UID'] ) && isset( $_REQUEST['__DynaformName__'] )) { // then get item id from DB if ($locCase->getFromGUID($_REQUEST['APP_UID'])) { - - if (isset( $_REQUEST['form'] )) { - $PM_SOAP->derivateCase($locCase, $_REQUEST); - } + $PM_SOAP->derivateCase($locCase, $_REQUEST); } glpi_processmaker_case_reload_page(); -} else if (isset($_REQUEST['action']) && $_REQUEST['action'] == 'delete') { +} else if (isset($_REQUEST['purge'])) { // delete case from case table, this will also delete the tasks - if ($locCase->getFromDB($_POST['cases_id']) && $locCase->deleteCase()) { + if ($locCase->getFromDB($_REQUEST['id']) && $locCase->deleteCase()) { Session::addMessageAfterRedirect(__('Case has been deleted!', 'processmaker'), true, INFO); } else { Session::addMessageAfterRedirect(__('Unable to delete case!', 'processmaker'), true, ERROR); diff --git a/front/case.php b/front/case.php index 8cb05e5..45bb2ac 100644 --- a/front/case.php +++ b/front/case.php @@ -5,19 +5,8 @@ Html::header(__('ProcessMaker', 'processmaker'), $_SERVER['PHP_SELF'], "helpdesk", "PluginProcessmakerCase", "cases"); if (!$PM_SOAP->config->fields['maintenance']) { - if (Session::haveRightsOr("plugin_processmaker_config", [READ, UPDATE])) { + if (Session::haveRightsOr("plugin_processmaker_case", [READ, UPDATE])) { - // force default sort to column id / DESC - if (empty($_SESSION['glpisearch']['PluginProcessmakerCase']) - || isset($_GET["reset"]) - || !isset($_GET["sort"]) - ) { - $_SESSION['glpisearch']['PluginProcessmakerCase']['order'] = 'DESC'; - $_SESSION['glpisearch']['PluginProcessmakerCase']['sort'] = '1'; - if (isset($_GET["reset"])) { - unset($_GET['reset']); - } - } Search::show('PluginProcessmakerCase'); } else { Html::displayRightError(); diff --git a/front/process_profile.form.php b/front/process_profile.form.php index c273793..1de5fda 100644 --- a/front/process_profile.form.php +++ b/front/process_profile.form.php @@ -12,6 +12,6 @@ if ($right->add($_POST)) { } Html::back(); -} +} Html::displayErrorAndDie("lost"); diff --git a/front/processmaker.form.php b/front/processmaker.form.php index a2a0b2f..a038065 100644 --- a/front/processmaker.form.php +++ b/front/processmaker.form.php @@ -3,12 +3,9 @@ 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()); @@ -17,7 +14,7 @@ $case = new PluginProcessmakerCase; if ($case->getFromGUID($resultCase->caseId)) { $link = $case->getLinkURL(); - $task = new PluginProcessmakerTask(); + $task = new PluginProcessmakerTask($_POST['itemtype'].'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(); Session::setActiveTab('PluginProcessmakerCase', 'PluginProcessmakerTask$'.$task->getID()); @@ -39,17 +36,24 @@ 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... // $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=".$_REQUEST["type"]."&entities_id=".$_REQUEST['entities_id']); + 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']); } else { Session::addMessageAfterRedirect( PluginProcessmakerProcessmaker::getPMErrorMessage($resultCase->status_code)."
$resultCase->message ($resultCase->status_code)", true, ERROR); @@ -57,88 +61,55 @@ } } - break; + break; - case 'unpausecase_or_reassign_or_delete' : - if (isset($_POST['unpause'])) { + case 'reassign_reminder' : + if (isset($_POST['reassign'])) { + // here we should re-assign the current task to $_POST['users_id_recipient'] $locCase = new PluginProcessmakerCase; $locCase->getFromDB($_POST['cases_id']); - $pmResultUnpause = $locCase->unpauseCase($_POST['delIndex'], $_POST['users_id']); - if ($pmResultUnpause->status_code == 0) { - Html::back(); - } else { - echo "Error unpausing case: ".$pmResultUnpause->message." \n"; - } - } else if (isset($_POST['reassign'])) { - // here we should re-assign the current task to $_POST['users_id_recipient'] - //$GLPINewPMUserId = PluginProcessmakerUser::getPMUserId( $_POST['users_id_recipient'] ); - if ($_POST['users_id'] != $_POST['users_id_recipient']) { // normally should be different as of the dropdown prevents already used - $locCase = new PluginProcessmakerCase; - $locCase->getFromDB($_POST['cases_id']); - + if ($_POST['users_id_recipient'] != 0) { + // we are assigning a new tech to a task $pmResponse = $locCase->reassignCase($_POST['delIndex'], $_POST['taskGuid'], $_POST['delThread'], $_POST['users_id'], - $_POST['users_id_recipient']); + $_POST['users_id_recipient'], + ['comment' => $_POST['comment']]); if ($pmResponse) { Session::addMessageAfterRedirect(__('Task re-assigned!', 'processmaker'), true, INFO); } else { Session::addMessageAfterRedirect(__('Error re-assigning task: ', 'processmaker').$pmResponse->message, true, ERROR); } - } else { - Session::addMessageAfterRedirect(__('Task already assigned to this person!', 'processmaker'), true, ERROR); + } elseif ($_POST['users_id_recipient'] == 0) { + // we are unassigning a task, i.e.: task un-claim + $pmResponse = $locCase->unassignCase($_POST['delIndex'], + $_POST['taskGuid'], + $_POST['tasktype'], + $_POST['tasks_id'], + $_POST['itemtype'], + ['comment' => $_POST['comment']]); + if ($pmResponse) { + Session::addMessageAfterRedirect(__('Task un-claimed!', 'processmaker'), true, INFO); + } else { + Session::addMessageAfterRedirect(__("Can't un-claim task! Verify 'Assignement Rules' in the process definition.", 'processmaker'), true, ERROR); + } } - //} else if (isset($_POST['delete'])) { - // // delete case from case table, this will also delete the tasks - // $locCase = new PluginProcessmakerCase; - // if ($locCase->getFromDB($_POST['cases_id']) && $locCase->deleteCase()) { - // // request delete from pm itself - // $PM_SOAP->login(true); - - // $resultPM = $PM_SOAP->deleteCase($locCase->fields['case_guid']); - - // if ($resultPM->status_code == 0) { - // Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO); - // } else { - // Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR); - // } - // } else { - // Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR); - // } - //} else if (isset($_POST['cancel'])) { - // // cancel case from PM - // $locCase = new PluginProcessmakerCase; - // $locCase->getFromDB($_POST['cases_id']); - // $resultPM = $PM_SOAP->cancelCase($locCase->fields['case_guid']); //, $_POST['plugin_processmaker_del_index'], $_POST['plugin_processmaker_users_id'] ) ; - // if ($resultPM->status_code === 0) { - // //$locCase = new PluginProcessmakerCase; - // //$locCase->getFromDB($_POST['cases_id']); - // if ($locCase->cancelCase()) { - // Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['cancelled'], true, INFO); - // } else { - // Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR); - // } - // } else { - // if ($resultPM->status_code == 100 && $locCase->deleteCase()) { // case is draft then delete it - // // request delete from pm itself - // $PM_SOAP->login(true); - - // $resultPM = $PM_SOAP->deleteCase($locCase->fields['case_guid']); + } elseif (isset($_POST['reminder'])) { + // send notification remider as requested for this task - // if ($resultPM->status_code == 0) { - // Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO); - // } else { - // Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR); - // } - // } else { - // Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled']. " " . $resultPM->message, true, ERROR); - // } - // } + $locCase = new PluginProcessmakerCase; + $locCase->getFromDB($_POST['cases_id']); + $glpi_item = new $_POST['itemtype']; + $glpi_item->getFromDB($_POST['items_id']); + $pm_task = new PluginProcessmakerTask($_POST['tasktype']); + $pm_task->getFromDB($_POST['tasks_id']); + $glpi_task = new $_POST['tasktype']; + $glpi_task->getFromDB($_POST['tasks_id']); + + // send notification now! + $pm_task->sendNotification('task_reminder', $glpi_task, $glpi_item, $locCase); } - - break; - } // to return to item diff --git a/front/processmaker.helpdesk.form.php b/front/processmaker.helpdesk.form.php index 212a910..5a7175a 100644 --- a/front/processmaker.helpdesk.form.php +++ b/front/processmaker.helpdesk.form.php @@ -54,6 +54,7 @@ function processMakerShowCase($ID, $from_helpdesk) { $rand = rand(); + $PM_SOAP->echoDomain(); echo ""; $tkt = new Ticket; diff --git a/hook.php b/hook.php index 130e12b..5ffb08b 100644 --- a/hook.php +++ b/hook.php @@ -24,66 +24,6 @@ function plugin_processmaker_MassiveActions($type) { } -//function plugin_processmaker_MassiveActionsDisplay($options) { - -// switch ($options['itemtype']) { -// case 'PluginProcessmakerProcess' : -// //case 'PluginProcessmakerCase' : -// switch ($options['action']) { -// case "plugin_processmaker_taskrefresh" : -// //case "plugin_processmaker_purgecase" : -// echo ""; -// break; - -// } -// break; -// } -// return ""; -//} - - -//function plugin_processmaker_MassiveActionsProcess($data) { - -// switch ($data['action']) { - -// case "plugin_processmaker_taskrefresh" : -// if ($data['itemtype'] == 'PluginProcessmakerProcess') { -// foreach ($data["item"] as $key => $val) { -// if ($val == 1) { -// $process = new PluginProcessmakerProcess; -// $process->refreshTasks( array( 'id' => $key ) ); - -// } -// } -// } -// break; -// //case "plugin_processmaker_purgecase": -// // if ($data['itemtype'] == 'PluginProcessmakerCase') { -// // foreach ($data["item"] as $key => $val) { -// // if ($val == 1) { -// // $locCase= new PluginProcessmakerCase; -// // //$locCase->( array( 'id' => $key ) ); - -// // } -// // } -// // } -// // break; -// //case 'plugin_processmaker_process_profile_delete' : -// // if ($data['itemtype'] == 'PluginProcessmakerProcess_Profile') { -// // foreach ($data["item"] as $key => $val) { -// // if ($val == 1) { -// // $process_profile = new PluginProcessmakerProcess_Profile; -// // $process_profile->delete( array( 'id' => $key ), true ); - -// // } -// // } -// // } -// // break; - -// } -//} - /** * Summary of plugin_processmaker_install * Creates tables and initializes tasks, "GLPI Requesters" group @@ -192,6 +132,7 @@ function plugin_pre_item_update_processmaker(CommonITILObject $parm) { switch ($key) { case 'global_validation' : $locVar[ 'GLPI_TICKET_GLOBAL_VALIDATION' ] = $val; + $locVar[ 'GLPI_ITEM_GLOBAL_VALIDATION' ] = $val; break; case 'itilcategories_id' : $locVar[ 'GLPI_ITEM_ITIL_CATEGORY_ID' ] = $val; @@ -239,7 +180,10 @@ function plugin_pre_item_update_processmaker(CommonITILObject $parm) { * @param mixed $parm is the object */ function plugin_item_update_processmaker_satisfaction($parm) { - + global $PM_SOAP; + if (Session::isCron()) { // Task cron log with user admin + $PM_SOAP->login(true); + } $cases = PluginProcessmakerCase::getIDsFromItem('Ticket', $parm->fields['tickets_id']); foreach ($cases as $cases_id) { $locCase = new PluginProcessmakerCase; @@ -250,73 +194,33 @@ function plugin_item_update_processmaker_satisfaction($parm) { } } -///** -// * Summary of plugin_pre_item_purge_processmaker -// * @param mixed $parm is the object -// */ -//function plugin_pre_item_purge_processmaker ( $parm ) { - -// if ($parm->getType() == 'Ticket_User' && is_array( $parm->fields ) && isset( $parm->fields['type'] ) && $parm->fields['type'] == 2) { -// $itemId = $parm->fields['tickets_id']; -// $itemType = 'Ticket'; -// $technicians = PluginProcessmakerProcessmaker::getItemUsers( $itemType, $itemId, 2 ); // 2 for technicians - -// if (PluginProcessmakerCase::getIDFromItem($itemType, $itemId) && count($technicians) == 1) { -// $parm->input = null; // to cancel deletion of the last tech in the ticket -// } -// } -//} - -///** -// * Summary of plugin_item_purge_processmaker -// * @param mixed $parm is the object -// */ -//function plugin_item_purge_processmaker($parm) { -// global $DB, $PM_SOAP; - -// //$objects = ['Ticket', 'Change', 'Problem']; -// $object_users = ['Ticket_User', 'Change_User', 'Problem_User']; - -// if (in_array($parm->getType(), $object_users) && is_array( $parm->fields ) && isset( $parm->fields['type'] ) && $parm->fields['type'] == 2) { - -// // We just deleted a tech from this ticket then we must if needed "de-assign" the tasks assigned to this tech -// // and re-assign them to the first tech in the list !!!! - -// $itemType = strtolower(explode('_', $parm->getType())[0]); // $parm->getType() returns 'Ticket_User'; -// $itemId = $parm->fields[$itemType.'s_id']; -// $cases = PluginProcessmakerCase::getIDsFromItem($itemType, $itemId); -// foreach ($cases as $cases_id) { -// // cases are existing for this item -// $locCase = new PluginProcessmakerCase; -// if ($locCase->getFromDB($cases_id)) { -// $technicians = PluginProcessmakerProcessmaker::getItemUsers($itemType, $itemId, CommonITILActor::ASSIGN); - -// $locVars = array( 'GLPI_TICKET_TECHNICIAN_GLPI_ID' => $technicians[0]['glpi_id'], -// 'GLPI_ITEM_TECHNICIAN_GLPI_ID' => $technicians[0]['glpi_id'], -// 'GLPI_TICKET_TECHNICIAN_PM_ID' => $technicians[0]['pm_id'], -// 'GLPI_ITEM_TECHNICIAN_PM_ID' => $technicians[0]['pm_id'] -// ); - -// // and we must find all tasks assigned to this former user and re-assigned them to new user (if any :))! -// $caseInfo = $locCase->getCaseInfo( ); -// if ($caseInfo !== false) { -// $locCase->sendVariables( $locVars); -// // need to get info on the thread of the GLPI current user -// // we must retreive currentGLPI user from this array -// $GLPICurrentPMUserId = PluginProcessmakerUser::getPMUserId( $parm->fields['users_id'] ); -// if (property_exists($caseInfo, 'currentUsers') && is_array( $caseInfo->currentUsers )) { -// foreach ($caseInfo->currentUsers as $caseUser) { -// if ($caseUser->userId == $GLPICurrentPMUserId && in_array( $caseUser->delThreadStatus, array('DRAFT', 'OPEN', 'PAUSE' ) )) { -// $locCase->reassignCase($caseUser->delIndex, $caseUser->taskId, $caseUser->delThread, $parm->fields['users_id'], $technicians[0]['pm_id'] ); -// } -// } -// } -// } - -// } -// } -// } -//} + +/** + * Summary of plugin_item_update_processmaker_user + * When a user login is changed, then must change it in the PM tables + * @param User $param is the user being changed + */ +function plugin_item_update_processmaker_user(User $param) { + // Must test if user login has been changed + // if yes, must change the login in the PM tables: + // USERS and RBAC_USERS, othewise the link in the processmaker_users table will be invalid + if (in_array('name', $param->updates)) { + // check if user is in the processmaker_user table + $pm_user = PluginProcessmakerUser::getPMUserId($param->getID()); + if ($pm_user) { + // must update the user in PM tables + global $PM_SOAP; + if ($param->fields['is_active'] == 0 || $param->fields['is_deleted'] == 1) { + $status = "INACTIVE"; + } else { + $status = "ACTIVE"; + } + $PM_SOAP->login(true); + $pmResult = $PM_SOAP->updateUser( $pm_user, $param->fields['name'], $param->fields['firstname'], $param->fields['realname'], $status ); + } + } +} + function plugin_processmaker_post_init() { global $PM_DB, $PM_SOAP; @@ -352,22 +256,27 @@ function plugin_processmaker_change_profile() { function plugin_item_update_processmaker_tasks($parm) { global $DB, $CFG_GLPI, $PM_SOAP; - // we need to test if a specific case is completed, and if so - // we should complete the linked cases (via linked tickets) $pmTaskCat = new PluginProcessmakerTaskCategory; if ($pmTaskCat->getFromDBbyCategory( $parm->fields['taskcategories_id'] ) && in_array( 'state', $parm->updates ) - && $parm->input['state'] == 2) { // the task has just been set to DONE state + && $parm->input['state'] == Planning::DONE + && $parm->oldvalues['state'] == Planning::TODO) { // the task has just been set to DONE state - $itemtype = str_replace( 'Task', '', $parm->getType() ); + //$itemtype = str_replace( 'Task', '', $parm->getType() ); $pmTask = new PluginProcessmakerTask($parm->getType()); $pmTask->getFromDB($parm->fields['id']); $locCase = new PluginProcessmakerCase; - $locCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']); //Item($itemtype, $parm->fields['tickets_id']); + $locCase->getFromDB($pmTask->fields['plugin_processmaker_cases_id']); $srccase_guid = $locCase->fields['case_guid']; + //$msg = Toolbox::backtrace(false); + //$msg .= ' $locCase: '.str_replace("\n", "\n ", print_r($locCase, true))."\n"; + //$msg .= ' $task: '.str_replace("\n", "\n ", print_r($parm, true))."\n"; + //$msg .= ' $pmTask: '.str_replace("\n", "\n ", print_r($pmTask, true))."\n"; + //$msg .= "\n"; + foreach ($DB->request( 'glpi_plugin_processmaker_caselinks', "is_active = 1 AND sourcetask_guid='".$pmTaskCat->fields['pm_task_guid']."'") as $targetTask) { // Must check the condition @@ -390,7 +299,7 @@ function plugin_item_update_processmaker_tasks($parm) { // must read some values $externalapplication = json_decode( $targetTask['externalapplication'], true ); // must be of the form - // {"method":"POST","url":"http://arsupd201.ar.ray.group:8000/search_by_userid/","params":{"user":"@@USER_ID","system":"GPP","list":"@@ROLE_LIST"}} + // {"method":"POST","url":"urloftheservice","params":json_object} // Where method is the POST, GET, ... method // url is the URL to be called // params is a list of parameters to get from running case @@ -410,9 +319,20 @@ function plugin_item_update_processmaker_tasks($parm) { $infoForTasks[ "@@$casevar" ] = "'$varval'"; unset( $infoForTasks[ $casevar ] ); } + + //$msg .= " ***********\n"; + //$msg .= ' $targetTask: '.str_replace("\n", "\n ", print_r($targetTask, true))."\n"; + $targetTask['sourcecondition'] = str_replace( array_keys($infoForTasks), $infoForTasks, $targetTask['sourcecondition'] ); - if (eval( "return ".$targetTask['sourcecondition'].";" )) { + $eval = eval( "return (".$targetTask['sourcecondition']." ? 1 : 0);" ); + + //$msg .= ' $infoForTasks: '.str_replace("\n", "\n ", print_r($infoForTasks, true))."\n"; + //$msg .= ' $targetTask[\'sourcecondition\']: '.str_replace("\n", "\n ", print_r($targetTask['sourcecondition'], true))."\n"; + //$msg .= ' $result: '."$eval\n"; + //$msg .= "\n"; + + if ($eval) { // look at each linked ticket if a case is attached and then if a task like $val is TO_DO // then will try to routeCase for each tasks in $val @@ -436,9 +356,13 @@ function plugin_item_update_processmaker_tasks($parm) { $ch = curl_init(); $externalapplication['url'] = eval( "return '".str_replace( array_keys($infoForTasks), $infoForTasks, $externalapplication['url'])."' ;" ); // '??? curl_setopt($ch, CURLOPT_URL, $externalapplication['url'] ); + if (isset($externalapplication['method']) && $externalapplication['method'] == 'POST') { + curl_setopt($ch, CURLOPT_POST, 1); + } } if ($targetTask['is_self']) { + $PM_SOAP->login(true); $taskCase = $PM_SOAP->taskCase( $srccase_guid ); foreach ($taskCase as $task) { // search for target task guid @@ -446,6 +370,7 @@ function plugin_item_update_processmaker_tasks($parm) { break; } } + $PM_SOAP->login(); $postdata['APP_UID'] = $srccase_guid; $postdata['DEL_INDEX'] = $task->delegate; @@ -470,29 +395,43 @@ function plugin_item_update_processmaker_tasks($parm) { if ($externalapplication) { // must call external application in order to get the needed data asynchroneously // must be of the form - // {"url":"http://arsupd201.ar.ray.group:8000/search_by_userid/","params":{"user":"@@USER_ID","system":"GPP","list":"@@ROLE_LIST"}} + // {"url":"urloftheservice","params":{"user":"@@USER_ID","system":"GPP","list":"@@ROLE_LIST"}} // url is the URL to be called $externalapplicationparams['id'] = $cronaction->getID(); $externalapplicationparams = json_encode( $externalapplicationparams, JSON_HEX_APOS | JSON_HEX_QUOT); - curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS, $externalapplicationparams); curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json', 'Content-Length: ' . strlen($externalapplicationparams), 'Expect:']); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1 ); + curl_setopt($ch, CURLOPT_VERBOSE, 1); - //curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1 ) ; - //curl_setopt($ch, CURLOPT_PROXY, "localhost:8889"); + //curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $pmconfig->fields['ssl_verify']); + //curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $pmconfig->fields['ssl_verify']); + if (isset($externalapplication['ssl_verify'])) { + curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, $externalapplication['ssl_verify']); + curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $externalapplication['ssl_verify']); + } + + //curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1 ) ; + //curl_setopt($ch, CURLOPT_PROXY, "localhost:8888"); + if (isset($externalapplication['proxy'])) { + curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1 ) ; + curl_setopt($ch, CURLOPT_PROXY, $externalapplication['proxy']); + } $response = curl_exec ($ch); - //Toolbox::logDebug( $response ) ; + if (!$response) { + Toolbox::logDebug($response); + } curl_close ($ch); } // } } else { + // TODO to review this part of code as it is no longer usable like this !!! foreach (Ticket_Ticket::getLinkedTicketsTo( $parm->fields['tickets_id'] ) as $tlink) { if ($tlink['link'] == Ticket_Ticket::LINK_TO) { $query = "SELECT glpi_plugin_processmaker_cases.id, MAX(glpi_plugin_processmaker_tasks.del_index) AS del_index FROM glpi_tickettasks @@ -531,5 +470,9 @@ function plugin_item_update_processmaker_tasks($parm) { } } + + //$msg .= "================\n"; + //Toolbox::logInFile("processmaker", $msg); + } } diff --git a/inc/case.class.php b/inc/case.class.php index 3dbfe2e..e35297c 100644 --- a/inc/case.class.php +++ b/inc/case.class.php @@ -14,6 +14,8 @@ class PluginProcessmakerCase extends CommonDBTM { //static public $items_id = 'items_id'; // Field name static $rightname = 'plugin_processmaker_case'; + private $process = null; + const DRAFT = 'DRAFT'; const TO_DO = 'TO_DO'; const COMPLETED = 'COMPLETED'; @@ -28,13 +30,13 @@ static function getTypeName($nb = 0) { //} - //static function canView() { - // return Session::haveRightsOr('plugin_processmaker_case', [READ, UPDATE]); - //} + static function canView() { + return Session::haveRightsOr('plugin_processmaker_case', [READ, UPDATE]); + } - //function canViewItem() { - // return Session::haveRightsOr('plugin_processmaker_case', READ); - //} + function canViewItem() { + return Session::haveRight('plugin_processmaker_case', READ); + } //static function canUpdate( ) { // return Session::haveRight('plugin_processmaker_config', UPDATE); @@ -44,25 +46,31 @@ static function getTypeName($nb = 0) { // return Session::haveRight('plugin_processmaker_config', UPDATE); //} + //function canEdit($ID) { + // return parent::canDelete(); + //} function maybeDeleted() { return false; } - static function canDelete() { - return parent::canDelete(); - } + //static function canDelete() { + // return parent::canDelete(); + //} - function canDeleteItem() { - return parent::canDeleteItem(); - } + //function canDeleteItem() { + // return parent::canDeleteItem(); + //} static function canPurge() { - return self::canDelete(); + return true; //self::canDelete(); } function canPurgeItem() { - return $this->canDeleteItem(); + return $_SESSION['glpiactiveprofile']['interface'] == 'central' + && $this->fields['plugin_processmaker_cases_id'] == 0 + && $this->canDeleteItem() + && (self::canDelete() || $this->fields['case_status'] == PluginProcessmakerCase::DRAFT); } static function canCancel() { @@ -83,7 +91,7 @@ function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { // case is a sub-case $tabname = __('Sub-case', 'processmaker'); } - return [ __CLASS__ => $tabname." ".self::getStatus($item->fields['case_status']).""]; + return [ 'main' => $tabname." ".self::getStatus($item->fields['case_status']).""]; } else { $items_id = $item->getID(); $itemtype = $item->getType(); @@ -205,6 +213,123 @@ function unpauseCase($delIndex, $userGuid) { } + /** + * Summary of unassignCase + * Will unassign the delIndex task, restoring the assigned group + * @param $delIndex int the delegation index + * @param $taskGuid string the GUID of the task + * @param $tasktype string the type of task (TicketTask, ChangeTask, ProblemTask) + * @param $tasks_id int the id of the task + * @param $itemtype string the type of the ITIL object (Ticket, Change, Problem) + * @return bool + */ + function unassignCase($delIndex, $taskGuid, $tasktype, $tasks_id, $itemtype, $options) { + global $PM_DB, $PM_SOAP, $DB; + + // un-claim task + // will unclaim the task + // to unclaim a task, we must un-assign the task in the APP_DELEGATION table + // and un-assign the task in glpi_itemtypeTask table + $groupname = ''; + + // should get the group that is assigned to the task in SELF_SERVICE assign type + $query = "SELECT TAS_GROUP_VARIABLE FROM TASK WHERE TAS_UID='".$taskGuid."' AND TAS_ASSIGN_TYPE='SELF_SERVICE' LIMIT 1;"; + foreach($PM_DB->request($query) as $pmGroup) { + // should have only one record + if ($pmGroup['TAS_GROUP_VARIABLE'] == '') { + // then we are in the self-service with a group in the TASK_USER table + // TU_RELATION=2 is groups and TU_TYPE=1 means normal (= not adhoc) + // then get the group name from the CONTENT table + $query = "SELECT CONTENT.CON_VALUE FROM TASK_USER + JOIN CONTENT ON CONTENT.CON_ID=TASK_USER.USR_UID AND CONTENT.CON_CATEGORY='GRP_TITLE' AND CONTENT.CON_LANG = 'en' + WHERE TASK_USER.TAS_UID='".$taskGuid."' AND TASK_USER.TU_RELATION=2 AND TASK_USER.TU_TYPE=1 LIMIT 1;"; + + foreach ($PM_DB->request($query) as $onlyrec) { + $groupname = $onlyrec['CON_VALUE']; + } + + + } else { + // then we are in the self-service with a case variable that contains either a group either an array of users + // array of users is not yet supported by PM plugin, as GLPI tasks have one and only one users_id_tech. + // group guid (in the case variable) must be retrieved from APP DATA + + // TODO + //////////////////////////////////////////////////////////////// + // Currently this case is not manageable by GLPI + // as GLPI needs at least a user or a group to be assigned to a task + // and when using the self-service value based assignment, there + // is a case variable that contains a list of users. This list of users cannot be mapped to a group in GLI + // OR may be we may create an artificial group in GLPI that would contains the list of users + //////////////////////////////////////////////////////////////// + + // and then we get the name of the group from the CONTENT table + //$query = "SELECT CON_VALUE FROM CONTENT + // WHERE CONTENT.CON_ID='$groupId' AND CONTENT.CON_CATEGORY='GRP_TITLE' AND CONTENT.CON_LANG='en' ;"; + + } + } + + $groups_id_tech = PluginProcessmakerProcessmaker::getGLPIGroupId($groupname); + + if ($groups_id_tech) { + // unclaim the case only when a GLPI group can be found + + $query = "UPDATE APP_DELEGATION SET USR_UID='', DEL_INIT_DATE=NULL, USR_ID=0 WHERE APP_NUMBER=".$this->getID()." AND DEL_INDEX=$delIndex;"; + $PM_DB->query($query); + + $glpi_task = new $tasktype; + $glpi_task->getFromDB($tasks_id); + $foreignkey = getForeignKeyFieldForItemType( $itemtype ); + + $donotif = PluginProcessmakerNotificationTargetProcessmaker::saveNotificationState(false); // do not send notification yet + $glpi_task->update( ['id' => $glpi_task->getID(), + $foreignkey => $glpi_task->fields[$foreignkey], + 'users_id_tech' => 0, + 'groups_id_tech' => $groups_id_tech, + 'update' => true] ); + PluginProcessmakerNotificationTargetProcessmaker::restoreNotificationState($donotif); + + // send notification now! + $pm_task = new PluginProcessmakerTask($tasktype); + $pm_task->getFromDB($tasks_id); + $glpi_item = new $itemtype; + $glpi_item->getFromDB($glpi_task->fields[$foreignkey]); + $pm_task->sendNotification('task_unclaim', $glpi_task, $glpi_item, $this); + + // create an information task and add comment + $pm_process = $this->getProcess(); + $dbu = new DbUtils; + $info = __('Task un-claimed!
Case: %s
Task: "%s" has been un-assigned from "%s" and assigned to "%s" group.
Reason: %s', 'processmaker'); + $info .= ""; + $taskCat = new TaskCategory; + $taskCat->getFromDB( $glpi_task->fields['taskcategories_id'] ); + $info = sprintf($info, + $this->getNameID(['forceid' => true]), + DropdownTranslation::getTranslatedValue($glpi_task->fields['taskcategories_id'], 'TaskCategory', 'name', $_SESSION['glpilanguage'], $taskCat->fields['name']), + Html::clean($dbu->getUserName(isset($glpi_task->oldvalues['users_id_tech']) ? $glpi_task->oldvalues['users_id_tech'] : 0)), + Html::clean($groupname), + $options['comment'] + ); + // unescape some chars and replace CRLF, CR or LF by
+ $info = str_replace(["\\'", '\\"', '\r\n', '\r', '\n'], ["'", '"', '
', '
', '
'], $info); + + $glpi_task->add([$foreignkey => $glpi_task->fields[$foreignkey], + 'is_private' => 0, // a post-only user can't create private task + 'taskcategories_id' => $pm_process->fields['taskcategories_id'], + 'content' => $DB->escape($info), + 'users_id' => $PM_SOAP->taskWriter, + 'state' => Planning::INFO, + 'users_id_tech' => Session::getLoginUserID(), + ]); + + return true; + } + + return false; + } + + /** * Summary of reassignCase * @param mixed $delIndex @@ -214,12 +339,15 @@ function unpauseCase($delIndex, $userGuid) { * @param mixed $users_id_target * @return mixed */ - function reassignCase($delIndex, $taskGuid, $delThread, $users_id_source, $users_id_target) { + function reassignCase($delIndex, $taskGuid, $delThread, $users_id_source, $users_id_target, $options) { global $PM_SOAP; - $users_guid_source = PluginProcessmakerUser::getPMUserId($users_id_source); + $users_guid_source = ''; // by default + if ($users_id_source !== 0) { // when task is not 'to be claimed' + $users_guid_source = PluginProcessmakerUser::getPMUserId($users_id_source); + } $users_guid_target = PluginProcessmakerUser::getPMUserId($users_id_target); $pmResponse = $PM_SOAP->reassignCase($this->fields['case_guid'], $delIndex, $users_guid_source, $users_guid_target); - // now should managed GLPI Tasks previously assigned to the $users_guid_source + // now should manage GLPI Tasks previously assigned to the $users_guid_source if ($pmResponse->status_code == 0) { // we need to change the delindex of the glpi task and the assigned tech to prevent creation of new tasks // we need the delindex of the current glpi task, and the delindex of the new one @@ -234,7 +362,7 @@ function reassignCase($delIndex, $taskGuid, $delThread, $users_id_source, $users break; } } - $this->reassignTask($delIndex, $newDelIndex, $delThread, $newDelThread, $users_id_target ); + $this->reassignTask($delIndex, $newDelIndex, $delThread, $newDelThread, $users_id_target, $options); return true; } return false; @@ -247,30 +375,95 @@ function reassignCase($delIndex, $taskGuid, $delThread, $users_id_source, $users * @param mixed $newDelIndex * @param mixed $newTech */ - public function reassignTask ($delIndex, $newDelIndex, $delThread, $newDelThread, $newTech) { - global $DB; + public function reassignTask ($delIndex, $newDelIndex, $delThread, $newDelThread, $newTech, $options) { + global $DB, $PM_SOAP; - $query = "SELECT * FROM glpi_plugin_processmaker_tasks WHERE plugin_processmaker_cases_id={$this->getID()} AND del_index=$delIndex AND del_thread=$delThread; "; - $res = $DB->query($query); - if ($DB->numrows($res) > 0) { - $row = $DB->fetch_array( $res ); - $glpi_task = new $row['itemtype']; - $glpi_task->getFromDB( $row['items_id'] ); + $dbu = new DbUtils; + $pm_task_row = $dbu->getAllDataFromTable(PluginProcessmakerTask::getTable(), ['plugin_processmaker_cases_id' => $this->getID(), 'del_index' => $delIndex, 'del_thread' => $delThread]); + if ($pm_task_row && count($pm_task_row) == 1) { + $pm_task_row = array_shift($pm_task_row); + $glpi_task = new $pm_task_row['itemtype']; + $glpi_task->getFromDB($pm_task_row['items_id']); - $itilobject_itemtype = $this->fields['itemtype']; //str_replace( 'Task', '', $row['itemtype'] ); + $itilobject_itemtype = $this->fields['itemtype']; $foreignkey = getForeignKeyFieldForItemType( $itilobject_itemtype ); PluginProcessmakerProcessmaker::addWatcher( $itilobject_itemtype, $glpi_task->fields[ $foreignkey ], $newTech ); - $glpi_task->update( [ 'id' => $row['items_id'], $foreignkey => $glpi_task->fields[ $foreignkey ], 'users_id_tech' => $newTech ]); + $donotif = PluginProcessmakerNotificationTargetProcessmaker::saveNotificationState(false); // do not send notification yet + $glpi_task->update( ['id' => $glpi_task->getID(), + $foreignkey => $glpi_task->fields[$foreignkey], + 'users_id_tech' => $newTech, + 'groups_id_tech' => 0, + 'update' => true] ); + PluginProcessmakerNotificationTargetProcessmaker::restoreNotificationState($donotif); // then update the delIndex and delThread - $query = "UPDATE glpi_plugin_processmaker_tasks SET del_index = $newDelIndex, del_thread = $newDelThread WHERE id={$row['id']}; "; - $res = $DB->query($query); + $query = "UPDATE glpi_plugin_processmaker_tasks SET del_index = $newDelIndex, del_thread = $newDelThread WHERE id={$pm_task_row['id']}; "; + $DB->query($query); + + // send notification now! + $pm_task = new PluginProcessmakerTask($pm_task_row['itemtype']); + $pm_task->getFromDB($pm_task_row['items_id']); + $glpi_item = new $itilobject_itemtype; + $glpi_item->getFromDB($glpi_task->fields[$foreignkey]); + $pm_task->sendNotification('task_reassign', $glpi_task, $glpi_item, $this); + + // create an information task and add comment + $pm_process = $this->getProcess(); + $old_users_tech_id = isset($glpi_task->oldvalues['users_id_tech']) ? $glpi_task->oldvalues['users_id_tech'] : 0; + $taskCat = new TaskCategory; + $taskCat->getFromDB( $glpi_task->fields['taskcategories_id'] ); + $task_name = DropdownTranslation::getTranslatedValue($glpi_task->fields['taskcategories_id'], 'TaskCategory', 'name', $_SESSION['glpilanguage'], $taskCat->fields['name']); + $new_tech_name = Html::clean($dbu->getUserName($newTech)); + if ($old_users_tech_id) { + $info = __('Task re-assigned!
Case: %s
Task: "%s" has been re-assigned from "%s" to "%s".
Reason: %s', 'processmaker'); + $info = sprintf($info, + $this->getNameID(['forceid' => true]), + $task_name, + Html::clean($dbu->getUserName(isset($glpi_task->oldvalues['users_id_tech']) ? $glpi_task->oldvalues['users_id_tech'] : 0)), + $new_tech_name, + $options['comment'] + ); + } else { + $info = __('Task assigned!
Case: %s
Task: "%s" has been assigned to "%s".
Reason: %s', 'processmaker'); + $info = sprintf($info, + $this->getNameID(['forceid' => true]), + $task_name, + $new_tech_name, + $options['comment'] + ); + } + $info .= ""; + + // unescape some chars and replace CRLF, CR or LF by
+ $info = str_replace(["\\'", '\\"', '\r\n', '\r', '\n'], ["'", '"', '
', '
', '
'], $info); + + $glpi_task->add([$foreignkey => $glpi_task->fields[$foreignkey], + 'is_private' => 0, // a post-only user can't create private task + 'taskcategories_id' => $pm_process->fields['taskcategories_id'], + 'content' => $DB->escape($info), + 'users_id' => $PM_SOAP->taskWriter, + 'state' => Planning::INFO, + 'users_id_tech' => Session::getLoginUserID(), + ]); } } + /** + * Summary of getProcess + * Returns process object + * @return bool|PluginProcessmakerProcess + */ + function getProcess() { + $pm_process = new PluginProcessmakerProcess; + if (!$this->process && $pm_process->getFromDB($this->fields['plugin_processmaker_processes_id'])) { + $this->process = $pm_process; + } + return $this->process; + } + /** * Summary of showCaseProperties */ @@ -477,9 +670,6 @@ public function sortTasks($tasks, $GLPICurrentPMUserId) { */ static function showCaseInfoTab(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) { // echo 'The idea is to show here the GLPI ITIL item to which it is linked, and to give a resume of the current case status, and to give possibility to delete or cancel the case.'; - - echo ""; - $itemtype = $case->fields['itemtype']; $maintitle = __('Case is linked to a %1s', 'processmaker'); @@ -487,7 +677,7 @@ static function showCaseInfoTab(CommonGLPI $case, $tabnum = 1, $withtemplate = 0 $maintitle = __('Sub-case is linked to a %1s', 'processmaker'); } - echo ""; + echo ""; Ticket::commonListHeader(Search::HTML_OUTPUT); @@ -502,12 +692,8 @@ static function showCaseInfoTab(CommonGLPI $case, $tabnum = 1, $withtemplate = 0 // it's a main case, not a sub-case // and we have the rights to cancel cases - // show a form to be able to cancel the case - $rand = rand(); echo "

"; - echo ""; - echo "
"; echo "
".sprintf($maintitle, $itemtype::getTypeName(1))."
".sprintf($maintitle, $itemtype::getTypeName(1))."
"; echo ""; echo ""; @@ -517,33 +703,27 @@ static function showCaseInfoTab(CommonGLPI $case, $tabnum = 1, $withtemplate = 0 echo ""; echo "
".__('Case cancellation', 'processmaker')."
".__('Cancel case', 'processmaker')."
"; - Html::closeForm(); - } // will not show delete button if case is a sub-process // and will show it only if it is a draft or if current glpi user has the right to delete cases and session is central - if ($case->fields['plugin_processmaker_cases_id'] == 0 - && ($case->fields['case_status'] == self::DRAFT - || (plugin_processmaker_haveRight("case", DELETE) - && $_SESSION['glpiactiveprofile']['interface'] == 'central'))) { + if ($case->canPurgeItem($case->getID())) { // then propose a button to delete case - $rand = rand(); + // the button will be effectively shown by the showFormButtons() echo "

"; - echo ""; - echo "
"; echo ""; - echo ""; - echo ""; - echo "
".__('Case deletion', 'processmaker')."
".__('Delete case', 'processmaker').""; - echo ""; - echo ""; - echo ""; - echo "
"; + echo "".__('Case deletion', 'processmaker').""; + // echo "".__('Delete case', 'processmaker').""; + // echo ""; + // echo ""; + // echo ""; + // echo ""; + // echo ""; + echo ""; + echo "

"; - Html::closeForm(); } return; @@ -556,7 +736,7 @@ static function showCaseInfoTab(CommonGLPI $case, $tabnum = 1, $withtemplate = 0 * @param CommonITILObject $item */ static function showForItem(CommonITILObject $item) { - global $DB, $CFG_GLPI; + global $DB, $CFG_GLPI, $PM_SOAP; $items_id = $item->getField('id'); $itemtype = $item->getType(); @@ -570,7 +750,7 @@ static function showForItem(CommonITILObject $item) { $rand = mt_rand(); - $query = "SELECT gppc.`id` AS assocID, gppc.`id` as id, gppp.name as pname, gppc.`case_status`, gppc.`plugin_processmaker_cases_id` + $query = "SELECT gppc.`id` AS assocID, gppc.`id` as id, gppp.id as pid, gppp.name as pname, gppc.`case_status`, gppc.`plugin_processmaker_cases_id` FROM `glpi_plugin_processmaker_cases` as gppc LEFT JOIN `glpi_plugin_processmaker_processes` AS gppp ON gppp.`id`=gppc.`plugin_processmaker_processes_id` WHERE gppc.`itemtype` = '$itemtype' @@ -579,25 +759,33 @@ static function showForItem(CommonITILObject $item) { $result = $DB->query($query); $cases = []; - $used = []; + $used = []; + $pid = []; if ($numrows = $DB->numrows($result)) { while ($data = $DB->fetch_assoc($result)) { $cases[$data['id']] = $data; - $used[$data['id']] = $data['id']; + $used[$data['id']] = $data['id']; + if (isset($pid[$data['pid']])) { + $pid[$data['pid']] += 1; + } else { + $pid[$data['pid']] = 1; + } } } $columns = ['pname' => __('Process', 'processmaker'), - 'name' => __('Title', 'processmaker'), - 'status' => __('Status', 'processmaker'), - 'sub' => __('Sub-case of', 'processmaker') + 'name' => __('Title', 'processmaker'), + 'status' => __('Status', 'processmaker'), + 'sub' => __('Sub-case of', 'processmaker') ]; // check if item is not solved nor closed if ($canupdate && $item->fields['status'] != CommonITILObject::SOLVED && $item->fields['status'] != CommonITILObject::CLOSED - && $_SESSION['glpiactiveprofile']['interface'] != 'helpdesk') { + && $_SESSION['glpiactiveprofile']['interface'] != 'helpdesk' + && ($numrows < $PM_SOAP->config->fields['max_cases_per_item'] + || $PM_SOAP->config->fields['max_cases_per_item'] == 0)) { echo "
"; echo ""; echo ""; @@ -621,7 +809,8 @@ static function showForItem(CommonITILObject $item) { PluginProcessmakerProcess::dropdown(['value' => 0, 'entity' => $item->fields['entities_id'], 'name' => 'plugin_processmaker_processes_id', - 'condition' => "is_active=1 $is_itemtype" + 'condition' => "is_active=1 $is_itemtype", + 'specific_tags' => ['count_cases_per_item' => $pid] ]); echo ""; echo ""; @@ -728,7 +917,7 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtem if ($item->getType() == __CLASS__) { // we are in a case viewing the main tab // the 'Case infos' tab - self::showCaseInfoTab($item, $tabnum, $withtemplate); + //self::showCaseInfoTab($item, $tabnum, $withtemplate); } else { @@ -752,12 +941,13 @@ private function deleteTasks() { $ret = false; $query = "DELETE FROM glpi_".strtolower($this->fields['itemtype'])."tasks WHERE id IN (SELECT items_id FROM glpi_plugin_processmaker_tasks WHERE plugin_processmaker_cases_id='".$this->fields['id']."')"; - if ($DB->query( $query )) { - $query = "DELETE FROM glpi_plugin_processmaker_tasks WHERE plugin_processmaker_cases_id='".$this->fields['id']."'"; - if ($DB->query( $query )) { - $ret = true; - } + // also delete all information tasks that are linked to this case + $query2 = "DELETE FROM glpi_".strtolower($this->fields['itemtype'])."tasks WHERE content REGEXP 'fields['id']."\'>'"; + $query3 = "DELETE FROM glpi_plugin_processmaker_tasks WHERE plugin_processmaker_cases_id='".$this->fields['id']."'"; + if ($DB->query($query) && $DB->query($query2) && $DB->query($query3)) { + $ret = true; } + return $ret; } @@ -783,7 +973,7 @@ private function cancelTasks() { $ret = false; if (isset($this->fields['case_status']) && $this->fields['case_status'] == "TO_DO") { - $query = "UPDATE glpi_".$this->fields['itemtype']."tasks SET state=0,users_id_tech=0,begin=NULL,end=NULL WHERE state=1 AND id in (select items_id from glpi_plugin_processmaker_tasks where plugin_processmaker_cases_id='".$this->fields['id']."')"; + $query = "UPDATE glpi_".$this->fields['itemtype']."tasks SET state=0,users_id_tech=0,groups_id_tech=0,begin=NULL,end=NULL WHERE state=1 AND id in (select items_id from glpi_plugin_processmaker_tasks where plugin_processmaker_cases_id='".$this->fields['id']."')"; if ($DB->query( $query )) { $ret = true; } @@ -1098,6 +1288,18 @@ static function getItemtype($value) { } + /** + * Get default values to search engine to override + **/ + static function getDefaultSearchRequest() { + + $search = ['sort' => 1, + 'order' => 'DESC']; + + return $search; + } + + /** * Summary of getSearchOptions * @return mixed @@ -1186,81 +1388,28 @@ function getSearchOptions() { function showForm ($ID, $options = ['candel'=>false]) { - //global $DB, $CFG_GLPI, $LANG; + $options['colspan'] = 6; + $options['formtitle'] = sprintf( __('Case status is \'%s\'', 'processmaker'), self::getStatus($this->fields['case_status'])); - $options['candel'] = true; - - $this->initForm($ID, $options); $this->showFormHeader($options); - //echo ""; - //echo "".__("Name").""; - //echo ""; - //echo ""; - - //echo ""; - //echo "".__("Active").""; - //Dropdown::showYesNo("is_active", $this->fields["is_active"]); - //echo ""; - - //echo ""; - //echo "".__("External data").""; - //Dropdown::showYesNo("is_externaldata", $this->fields["is_externaldata"]); - //echo ""; - - //echo ""; - //echo "".__("Self").""; - //Dropdown::showYesNo("is_self", $this->fields["is_self"]); - //echo ""; - - //echo ""; - //echo "".__("Source task GUID").""; - ////PluginProcessmakerTaskCategory::dropdown(array('name' => 'plugin_processmaker_taskcategories_id_source', - //// 'display_emptychoice' => false, - //// 'value' => $this->fields['plugin_processmaker_taskcategories_id_source'])); - //echo ""; - //echo ""; - - //echo ""; - //echo "".__("Target task GUID").""; - ////PluginProcessmakerTaskCategory::dropdown(array('name' => 'plugin_processmaker_taskcategories_id_target', - //// 'display_emptychoice' => false, - //// 'value' => $this->fields['plugin_processmaker_taskcategories_id_target'])); - //echo ""; - //echo ""; - - //echo ""; - //echo "".__("Target process GUID").""; - ////Dropdown::show( 'PluginProcessmakerProcess', array('name' => 'plugin_processmaker_processes_id', - //// 'display_emptychoice' => true, - //// 'value' => $this->fields['plugin_processmaker_processes_id'], - //// 'condition' => 'is_active = 1')); - //echo ""; - //echo ""; - - //echo ""; - //echo "".__("Target dynaform GUID").""; - //echo ""; - //echo ""; - - //echo ""; - //echo "".__("Source condition").""; - ////echo ""; - //echo ""; - //echo ""; - - //echo ""; - //echo "".__("Claim target task").""; - //Dropdown::showYesNo("is_targettoclaim", $this->fields["is_targettoclaim"]); - //echo ""; - - //echo ""; - //echo "".__("External application JSON config").""; - //echo ""; - //echo ""; - - $this->showFormButtons($options ); + $process = new PluginProcessmakerProcess; + $process->getFromDB($this->fields['plugin_processmaker_processes_id']); + + if ($process->fields['maintenance']) { + PluginProcessmakerProcess::showUnderMaintenance($process->fields['name'], 'small'); + } + self::showCaseInfoTab($this); + + //echo '
' ; + $options['candel'] = true; + $this->showFormButtons($options); + + echo Html::scriptBlock(" + $('#tabsbody th').css('text-align', 'center'); + $('#tabsbody td').css('text-align', 'center'); + "); } @@ -1271,21 +1420,31 @@ function showForm ($ID, $options = ['candel'=>false]) { */ function defineTabs($options = []) { - // $ong = array('empty' => $this->getTypeName(1)); + $process = new PluginProcessmakerProcess; + $process->getFromDB($this->fields['plugin_processmaker_processes_id']); + $ong = []; - //$this->addDefaultFormTab($ong); + if (self::isLayoutWithMain()) { + $this->addDefaultFormTab($ong); + } - $this->addStandardTab('PluginProcessmakerTask', $ong, $options); + if (!$process->fields['maintenance']) { + $this->addStandardTab('PluginProcessmakerTask', $ong, $options); + } - $this->addStandardTab(__CLASS__, $ong, $options); + if (!self::isLayoutWithMain()) { + $this->addStandardTab(__CLASS__, $ong, $options); + } - $this->addStandardTab('PluginProcessmakerCasemap', $ong, $options); + if (!$process->fields['maintenance']) { + $this->addStandardTab('PluginProcessmakerCasemap', $ong, $options); - $this->addStandardTab('PluginProcessmakerCasehistory', $ong, $options); + $this->addStandardTab('PluginProcessmakerCasehistory', $ong, $options); - $this->addStandardTab('PluginProcessmakerCasechangelog', $ong, $options); + $this->addStandardTab('PluginProcessmakerCasechangelog', $ong, $options); - $this->addStandardTab('PluginProcessmakerCasedynaform', $ong, $options); + $this->addStandardTab('PluginProcessmakerCasedynaform', $ong, $options); + } return $ong; } @@ -1332,4 +1491,5 @@ function deleteCronTaskActions() { return $DB->query($query); } + } diff --git a/inc/casechangelog.class.php b/inc/casechangelog.class.php index 9d10ce7..34c73e9 100644 --- a/inc/casechangelog.class.php +++ b/inc/casechangelog.class.php @@ -10,13 +10,14 @@ */ class PluginProcessmakerCasechangelog extends CommonDBTM { - static function displayTabContentForItem(CommonGLPI $case, $tabnum=1, $withtemplate=0) { + static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) { global $CFG_GLPI, $PM_SOAP; $rand = rand(); $caseHistoryURL = $PM_SOAP->serverURL."/cases/ajaxListener?action=changeLogHistory&rand=$rand"; + $PM_SOAP->echoDomain(); echo ""; //?rand=$rand' $iframe = ""; - $PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand) ; + $PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand); } - function getTabNameForItem(CommonGLPI $case, $withtemplate = 0){ + function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) { return __('Change log', 'processmaker'); } -} \ No newline at end of file +} diff --git a/inc/casedynaform.class.php b/inc/casedynaform.class.php index e6d85f7..29d5a24 100644 --- a/inc/casedynaform.class.php +++ b/inc/casedynaform.class.php @@ -19,6 +19,7 @@ static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtem $proj = new PluginProcessmakerProcess; $proj->getFromDB($case->fields['plugin_processmaker_processes_id']); + $PM_SOAP->echoDomain(); echo ""; //?rand=$rand' echo ""; $iframe = ""; - $PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand) ; + $PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand); } - function getTabNameForItem(CommonGLPI $case, $withtemplate = 0){ + function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) { return __('History', 'processmaker'); } -} \ No newline at end of file +} diff --git a/inc/caselink.class.php b/inc/caselink.class.php index 00b341c..57886b5 100644 --- a/inc/caselink.class.php +++ b/inc/caselink.class.php @@ -249,6 +249,16 @@ function getSearchOptions() { return $tab; } + + function prepareInputForUpdate($input) { + return Toolbox::unclean_cross_side_scripting_deep($input); + } + + + function prepareInputForAdd($input) { + return Toolbox::unclean_cross_side_scripting_deep($input); + } + //static function getMenuContent() { // if (!Session::haveRight('entity', READ)) { diff --git a/inc/caselinkaction.class.php b/inc/caselinkaction.class.php index bce380d..60f0eb8 100644 --- a/inc/caselinkaction.class.php +++ b/inc/caselinkaction.class.php @@ -9,4 +9,4 @@ * @author MoronO */ class PluginProcessmakerCaselinkaction extends CommonDBTM { -} \ No newline at end of file +} diff --git a/inc/casemap.class.php b/inc/casemap.class.php index 2b2c53a..4c268c0 100644 --- a/inc/casemap.class.php +++ b/inc/casemap.class.php @@ -10,7 +10,7 @@ */ class PluginProcessmakerCasemap extends CommonDBTM { - static function displayTabContentForItem(CommonGLPI $case, $tabnum=1, $withtemplate=0) { + static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtemplate = 0) { global $CFG_GLPI, $PM_SOAP; $rand = rand(); @@ -26,6 +26,7 @@ static function displayTabContentForItem(CommonGLPI $case, $tabnum=1, $withtempl "/cases/ajaxListener?action=processMap" )."&rand=$rand"; + $PM_SOAP->echoDomain(); echo ""; //?rand=$rand' $iframe = ""; - $PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand) ; + $PM_SOAP->initCaseAndShowTab(['APP_UID' => $case->fields['case_guid'], 'DEL_INDEX' => 1], $iframe, $rand); } - function getTabNameForItem(CommonGLPI $case, $withtemplate = 0){ + function getTabNameForItem(CommonGLPI $case, $withtemplate = 0) { return __('Map', 'processmaker'); } -} \ No newline at end of file +} diff --git a/inc/config.class.php b/inc/config.class.php index 9520523..ea5f898 100644 --- a/inc/config.class.php +++ b/inc/config.class.php @@ -156,7 +156,7 @@ static function showConfigForm($item) { if (!$config->fields['maintenance']) { echo ""; - echo "".__('Server URL (must be in same domain than GLPI)', 'processmaker').""; + echo "".__('Server URL (must be in same domain than GLPI, if GLPI is using HTTPS, PM server must also use HTTPS)', 'processmaker').""; echo ""; echo ""; @@ -315,24 +315,29 @@ function parseUrl( url ) { } else { echo "".__('Not connected'); } + echo "\n"; + echo ""; + echo "" . __('Max cases per item (0=unlimited)', 'processmaker') . ""; + echo ""; echo "\n"; + } else { echo ""; PluginProcessmakerProcessmaker::showUnderMaintenance(); echo ""; } - echo "".__('Maintenance').""; + echo "".__('Maintenance').""; - echo ""; - echo "".__('Maintenance mode').""; - Dropdown::showYesNo("maintenance", $config->fields['maintenance']); - echo ""; + echo ""; + echo "".__('Maintenance mode').""; + Dropdown::showYesNo("maintenance", $config->fields['maintenance']); + echo ""; - echo ""; + echo ""; - echo "".__('Processmaker system information', 'processmaker').""; + echo "".__('Processmaker system information', 'processmaker').""; if ($setup_ok) { $info = $PM_SOAP->systemInformation( ); echo ''.__('Version', 'processmaker').''.$info->version.''; @@ -347,7 +352,7 @@ function parseUrl( url ) { } else { echo ''.__('Version', 'processmaker').''.__('Not yet!', 'processmaker').''; } - $config->showFormButtons(['candel'=>false]); + $config->showFormButtons(['candel' => false]); return false; } diff --git a/inc/notificationtargetcase.class.php b/inc/notificationtargetcase.class.php new file mode 100644 index 0000000..7e74e32 --- /dev/null +++ b/inc/notificationtargetcase.class.php @@ -0,0 +1,120 @@ + __('Send email', 'processmaker')]; + } + + + /** + * Summary of addAdditionalTargets + * @param mixed $event + */ + function addAdditionalTargets($event = '') { + $this->notification_targets = []; + $this->notification_targets_labels = []; + $this->addTarget(self::RECIPIENTS, __('eMail recipients', 'processmaker'), self::EMAIL_RECIPIENTS); + } + + + /** + * Summary of addSpecificTargets + * @param mixed $data + * @param mixed $options + */ + function addSpecificTargets($data, $options) { + + // test if we are in the good notification + // then in this case add the targets from the ['recipients'] + if (isset($options['glpi_send_email'])) { + // normalize $options['glpi_send_email'] to an array of email parameters + $options['glpi_send_email'] = isset($options['glpi_send_email']['notifications_id']) ? [$options['glpi_send_email']] : $options['glpi_send_email']; + + foreach($options['glpi_send_email'] as $params) { + if (isset($params['notifications_id']) + && $params['notifications_id'] == $data['notifications_id']) { + //Look for all targets whose type is Notification::ITEM_USER + switch ($data['type']) { + case self::EMAIL_RECIPIENTS: + + switch ($data['items_id']) { + + case self::RECIPIENTS : + $this->addUsers($params); + break; + } + } + } + } + } + + // if no target is added to $this, then the notification will not be sent. + + } + + + /** + * Add users from $options['glpi_send_email']['to'] + * + * @param array $email_param should contain 'recipients' + * + * @return void + */ + function addUsers($email_param = []) { + global $DB, $CFG_GLPI; + + if (isset($email_param['recipients'])) { + $id_list = []; // for users with ids + $email_list = []; // for standalone emails + + // normalize into array the recipient list + $email_param['recipients'] = is_array($email_param['recipients']) ? $email_param['recipients'] : [$email_param['recipients']]; + foreach ($email_param['recipients'] as $user) { + if (is_numeric($user)) { + $id_list[] = intval($user); + } else { + $email_list[] = $user; + } + } + + $query = $this->getDistinctUserSql()." + FROM `glpi_users` ". + $this->getProfileJoinSql()." + WHERE `glpi_users`.`id` IN (".implode(',', $id_list).")"; + + foreach ($DB->request($query) as $data) { + $this->addToRecipientsList($data); + } + + foreach($email_list as $email){ + $this->addToRecipientsList([ + 'email' => $email, + 'language' => $CFG_GLPI["language"], + 'users_id' => -1 + ]); + } + } + } + +} diff --git a/inc/notificationtargetprocessmaker.class.php b/inc/notificationtargetprocessmaker.class.php new file mode 100644 index 0000000..6076fb9 --- /dev/null +++ b/inc/notificationtargetprocessmaker.class.php @@ -0,0 +1,226 @@ + __('Process category', 'processmaker'), + 'process.categoryid' => __('Process category id', 'processmaker'), + 'process.categorycomment' => __('Process category comment', 'processmaker'), + 'case.id' => __('Case id', 'processmaker'), + 'case.title' => __('Case title', 'processmaker'), + 'case.description' => __('Case description', 'processmaker'), + 'case.url' => __('Case URL'), + 'var.XXX' => __('Case variable \'XXX\'', 'processmaker'), + 'array.YYY' => __('List of values in \'YYY\' array', 'processmaker'), + 'array.numberofYYY' => __('Number of rows in \'YYY\' array', 'processmaker'), + 'array.YYY.colname' => __('Value for colname in \'YYY\' array', 'processmaker'), + '1darray.ZZZ.key' => __('Value for key in \'ZZZ\' assoc array (1-dimension array)', 'processmaker'), + 'item.type' => __('Item type', 'processmaker'), + 'item.id' => __('Item id', 'processmaker'), + 'item.url' => __('Item URL', 'processmaker'), + 'item.title' => __('Item title', 'processmaker') + ]; + + foreach ($tags as $tag => $label) { + $elt= ['tag' => $tag, + 'label' => $label, + 'value' => true]; + if ($tag == 'var.XXX') { + $elt['allowed_values'] = [__('XXX is to be replaced by any case variable names', 'processmaker')]; + } + if ($tag == 'array.YYY') { + $elt['allowed_values'] = [__('YYY is to be replaced by any array variables', 'processmaker')]; + $elt['foreach'] = true; + } + if ($tag == '1darray.ZZZ.key') { + $elt['allowed_values'] = [__('ZZZ is to be replaced by any assoc array variables (1-dimension array with key/value pairs)', 'processmaker')]; + } + $this->addTagToList($elt); + } + + asort($this->tag_descriptions); + } + + + /** + * Get all data needed for template processing + **/ + public function addDataForTemplate($event, $options = []) { + global $CFG_GLPI, $PM_DB; + + $excluded = ['_VAR_CHANGED_', + 'PIN', + 'APPLICATION', + 'PROCESS', + 'TASK', + 'INDEX', + 'USER_LOGGED', + 'USR_USERNAME', + 'APP_NUMBER', + 'GLPI_.*', + 'SYS_.*' + ]; + + $process = new PluginProcessmakerProcess; + + $process->getFromDB($options['case']->fields['plugin_processmaker_processes_id']); + $taskcat_id = $process->fields['taskcategories_id']; + + // get case variable values + $res = $PM_DB->query("SELECT APP_DATA, APP_TITLE, APP_DESCRIPTION FROM APPLICATION WHERE APP_NUMBER = ".$options['case']->fields['id']); + if ($res && $PM_DB->numrows($res) == 1) { + // get all the case variables from $PM_DB + $caserow = $PM_DB->fetch_assoc($res); + $case_variables = unserialize($caserow['APP_DATA']); + $excluded_re = '/^(' . implode('|', $excluded) . ')$/u'; + foreach ($case_variables as $key => $val) { + if (!preg_match($excluded_re, $key)) { + if (is_array($val)) { + // add numberof for count of rows + $this->data["##array.numberof$key##"] = count($val); + // get the keys/vals of the sub-array + foreach ($val as $attribute => $row) { + if (is_array($row)) { + $index = isset($this->data["array.$key"]) ? count($this->data["array.$key"]) : 0; + foreach ($row as $col_name => $col_val) { + $this->data["array.$key"][$index]["##array.$key.$col_name##"] = $col_val; + $this->data["##lang.array.$key.$col_name##"] = $col_name; + } + } else { + $this->data["1darray.$key"]["##array.$key.$attribute##"] = $row; + $this->data["##lang.1darray.$key.$attribute##"] = $attribute; + } + } + } else { + $this->data["##var.$key##"] = $val; + $this->data["##lang.var.$key##"] = $key; + } + } + } + $this->data['##case.title##'] = $caserow['APP_TITLE']; + $this->data['##case.description##'] = $caserow['APP_DESCRIPTION']; + } + + // case id + $this->data['##case.id##'] = $options['case']->fields['id']; + + // case URL + $this->data['##case.url##'] = $this->formatURL($options['additionnaloption']['usertype'], + urlencode(urlencode($CFG_GLPI["url_base"] . + PluginProcessmakerCase::getFormURLWithID($options['case']->fields['id'], false)))); + + // parent task information: meta data on process + // will get parent of task which is the process task category + $tmp_taskcatinfo['name'] = DropdownTranslation::getTranslatedValue($taskcat_id, 'TaskCategory', 'name'); + $tmp_taskcatinfo['comment'] = DropdownTranslation::getTranslatedValue($taskcat_id, 'TaskCategory', 'comment'); + // process title + $this->data['##process.categoryid##'] = $taskcat_id; + $this->data['##process.category##'] = $tmp_taskcatinfo['name']; + $this->data['##process.categorycomment##'] = $tmp_taskcatinfo['comment']; + + // add information about item that hosts the case + $item = new $options['case']->fields['itemtype']; + $item->getFromDB($options['case']->fields['items_id']); + $this->data['##item.type##'] = $item->getTypeName(1); + $this->data['##item.id##'] = sprintf("%07d", $options['case']->fields['items_id']); // to have items_id with 7 digits with leading 0 + $this->data['##item.url##'] = $this->formatURL($options['additionnaloption']['usertype'], + urlencode(urlencode($CFG_GLPI["url_base"] . + $item::getFormURLWithID($options['case']->fields['items_id'], false)))); + $this->data['##item.title##'] = HTML::entities_deep($item->fields['name']); + + // add labels to tags that are not set + $this->getTags(); + foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) { + if (!isset($this->data[$tag])) { + $this->data[$tag] = $values['label']; + } + } + } + + + /** + * Get header to add to content + **/ + function getContentHeader() { + + if ($this->getMode() == \Notification_NotificationTemplate::MODE_MAIL + && MailCollector::getNumberOfActiveMailCollectors() + ) { + return NotificationTargetTicket::HEADERTAG.' '.__('To answer by email, write above this line').' '. + NotificationTargetTicket::HEADERTAG; + } + + return ''; + } + + + /** + * Get footer to add to content + **/ + function getContentFooter() { + + if ($this->getMode() == \Notification_NotificationTemplate::MODE_MAIL + && MailCollector::getNumberOfActiveMailCollectors() + ) { + return NotificationTargetTicket::FOOTERTAG.' '.__('To answer by email, write under this line').' '. + NotificationTargetTicket::FOOTERTAG; + } + + return ''; + } + +} \ No newline at end of file diff --git a/inc/notificationtargettask.class.php b/inc/notificationtargettask.class.php new file mode 100644 index 0000000..1deff80 --- /dev/null +++ b/inc/notificationtargettask.class.php @@ -0,0 +1,327 @@ + ['event' => 'task_add_', 'label' => __('Task add'), 'glpi' => 'add_task'], + 'task_reassign' => ['event' => 'task_reassign_', 'label' => __('Task re-assign'), 'glpi' => 'update_task'], + 'task_unclaim' => ['event' => 'task_unclaim_', 'label' => __('Task un-claim'), 'glpi' => 'update_task'], + 'task_done' => ['event' => 'task_done_', 'label' => __('Task done'), 'glpi' => 'update_task'], + 'task_reminder' => ['event' => 'task_reminder_', 'label' => __('Task reminder'), 'glpi' => 'update_task'] + ]; + } + + + /** + * Summary of getDefaultGLPIEvents + * Will return the GLPI default task event matching a self type + * @param string $type + * @return string + */ + static function getDefaultGLPIEvents($type) { + $events = self::getDefaultEvents(); + return $events[$type]['glpi']; + } + + + /** + * Summary of getNotification + * @param mixed $evt + * @param mixed $taskcat + * @param mixed $entity + * @return array + */ + static function getNotifications($evt, $taskcat, $entity) { + // search if at least one active notification is existing for that pm task with that event 'task_update_'.$glpi_task->fields['taskcategories_id'] + $defaultEvents = self::getDefaultEvents(); + $event = $defaultEvents[$evt]['event'].$taskcat; + $dbu = new DbUtils; + $crit = $dbu->getEntitiesRestrictCriteria(Notification::getTable(), 'entities_id', $entity, true); + return ['event' => $event, 'notifications' => $dbu->getAllDataFromTable(Notification::getTable(), ['itemtype' => 'PluginProcessmakerTask', 'event' => $event, 'is_active' => 1, $crit])]; + } + + + /** + * Summary of getEvents + * @return string[] + */ + public function getEvents() { + global $DB; + $actions = []; + + $defaultEvents = self::getDefaultEvents(); + + $table = PluginProcessmakerTaskCategory::getTable(); + $ptable = PluginProcessmakerProcess::getTable(); + $query = "SELECT $table.taskcategories_id AS taskcat, $ptable.taskcategories_id AS ptaskcat FROM $table + LEFT JOIN $ptable ON $ptable.id=$table.plugin_processmaker_processes_id"; + + $ptaskcats = []; + $temp = new TaskCategory; + foreach ($DB->request($query) as $row) { + if (!isset($ptaskcats[$row['ptaskcat']])) { + $temp->getFromDB($row['ptaskcat']); + $ptaskcats[$row['ptaskcat']] = $temp->fields['name']; + } + $temp->getFromDB($row['taskcat']); + + foreach($defaultEvents as $events) { + $actions[$events['event'].$row['taskcat']] = $ptaskcats[$row['ptaskcat']]." > ".$temp->fields['name'].": " . $events['label']; + } + } + + return $actions; + } + + + /** + * Get all data needed for template processing + **/ + public function addDataForTemplate($event, $options = []) { + global $PM_DB, $CFG_GLPI; + + if (!isset($options['case']) || $options['case'] == null) { + $mycase = new PluginProcessmakerCase; + $mycase->getFromDB($options['plugin_processmaker_cases_id']); + $options['case'] = $mycase; + } + parent::addDataForTemplate($event, $options); + + $events = self::getDefaultEvents(); + $locevent = explode('_', $event); + $baseevent = $locevent[0].'_'.$locevent[1]; + $taskcat_id = $locevent[2]; + + // task action: add, update or done + $this->data['##task.action##'] = $events[$baseevent]['label']; + + // task category information: meta data on task + $tmp_taskcatinfo['name'] = DropdownTranslation::getTranslatedValue($taskcat_id, 'TaskCategory', 'name'); + $tmp_taskcatinfo['comment'] = DropdownTranslation::getTranslatedValue($taskcat_id, 'TaskCategory', 'comment'); + $this->data['##task.categoryid##'] = $taskcat_id; + $this->data['##task.category##'] = $tmp_taskcatinfo['name']; + $this->data['##task.categorycomment##'] = $tmp_taskcatinfo['comment']; + + // task information + $taskobj = $this->obj; + + // del index + $this->data['##task.delindex##'] = $taskobj->fields['del_index']; + + // is private? + $this->data['##task.isprivate##'] = Dropdown::getYesNo(false); + if ($taskobj->maybePrivate()) { + $this->data['##task.isprivate##'] = Dropdown::getYesNo($taskobj->fields['is_private']); + } + // status + $this->data['##task.status##'] = Planning::getState($taskobj->fields['state']); + // creation date + $this->data['##task.date##'] = Html::convDateTime($taskobj->fields['date_creation']); + // update date + $this->data['##task.update##'] = Html::convDateTime($taskobj->fields['date_mod']); + // content: don't know if this could be interesting + $this->data['##task.description##'] = $taskobj->fields['content']; + + // task creator + // should always be Process Maker user + $dbu = new DbUtils(); + $this->data['##task.author##'] = Html::clean($dbu->getUserName($taskobj->fields['users_id'])); + + // task editor + $this->data['##task.lastupdater##'] = Html::clean($dbu->getUserName($taskobj->fields['users_id_editor'])); + + // task technician + $this->data['##task.user##'] = ''; + $this->data['##task.user.login##'] = ''; // by default + $tech = new User; + if ($taskobj->fields['users_id_tech'] > 0 + && $tech->getFromDB($taskobj->fields['users_id_tech'])) { + $this->data['##task.user##'] = Html::clean($dbu->getUserName($taskobj->fields['users_id_tech'])); + $this->data['##task.user.login##'] = $tech->fields['name']; + } + $oldtech = new User; + if (isset($options['old_users_id_tech']) + && $options['old_users_id_tech'] > 0 + && $oldtech->getFromDB($options['old_users_id_tech'])) { + $this->data['##task.former.user##'] = Html::clean($dbu->getUserName($options['old_users_id_tech'])); + $this->data['##task.former.user.login##'] = $oldtech->fields['name']; + } + + // task group technician + $this->data['##task.group##'] = Html::clean(Toolbox::clean_cross_side_scripting_deep(Dropdown::getDropdownName("glpi_groups", $taskobj->fields['groups_id_tech'])), true, 2, false); + + // task planning + $this->data['##task.begin##'] = ''; + $this->data['##task.end##'] = ''; + if (!is_null($taskobj->fields['begin'])) { + $this->data['##task.begin##'] = Html::convDateTime($taskobj->fields['begin']); + $this->data['##task.end##'] = Html::convDateTime($taskobj->fields['end']); + } + // task duration + $this->data['##task.time##'] = Html::timestampToString($taskobj->fields['actiontime'], false); + + // add labels to tags that are not set + $this->getTags(); + foreach ($this->tag_descriptions[NotificationTarget::TAG_LANGUAGE] as $tag => $values) { + if (!isset($this->data[$tag])) { + $this->data[$tag] = $values['label']; + } + } + } + + + /** + * Summary of getTags + */ + public function getTags() { + + parent::getTags(); + + $tags = ['task.action' => __('Task action', 'processmaker'), + 'task.author' => __('Writer'), + 'task.isprivate' => __('Private'), + 'task.date' => __('Opening date'), + 'task.description' => __('Description'), + 'task.categoryid' => __('Category id'), + 'task.category' => __('Category'), + 'task.categorycomment' => __('Category comment'), + 'task.time' => __('Total duration'), + 'task.user' => __('User assigned to task'), + 'task.user.login' => __('User login assigned to task'), + 'task.former.user' => __('Former user assigned to task'), + 'task.former.user.login' => __('Former user login assigned to task'), + 'task.group' => __('Group assigned to task'), + 'task.begin' => __('Start date'), + 'task.end' => __('End date'), + 'task.status' => __('Status'), + 'task.lastupdater' => __('Last updater'), + 'task.update' => __('Last update'), + 'task.delindex' => __('Delegation index') + ]; + foreach ($tags as $tag => $label) { + $elt= ['tag' => $tag, + 'label' => $label, + 'value' => true]; + + $this->addTagToList($elt); + } + asort($this->tag_descriptions); + } + + + /** + * Summary of addAdditionalTargets + * @param mixed $event + */ + function addAdditionalTargets($event = '') { + + $this->addTarget(Notification::TASK_ASSIGN_TECH, __('Technician in charge of the task')); + $this->addTarget(Notification::TASK_ASSIGN_GROUP, __('Group in charge of the task')); + + $this->addTarget(Notification::OBSERVER_GROUP, __('Watcher group')); + $this->addTarget(Notification::OBSERVER, __('Watcher')); + + $this->addTarget(Notification::AUTHOR, __('Requester'), PluginProcessmakerNotificationTargetProcessmaker::PM_USER_TYPE); + + if (strpos($event, 'task_update_') === 0) { + $this->addTarget(Notification::OLD_TECH_IN_CHARGE, + __('Former technician in charge of the task')); + } + + } + + + /** + * Summary of addSpecificTargets + * @param mixed $data + * @param mixed $options + */ + function addSpecificTargets($data, $options) { + + $obj = $this->obj; + $this->obj = $options['obj']; + + switch ($data['type']) { + case PluginProcessmakerNotificationTargetProcessmaker::PM_USER_TYPE : + + switch ($data['items_id']) { + + //Send to the requester of the ITIL object + case Notification::AUTHOR : + $this->addItemAuthor(); + break; + } + break; + + case Notification::USER_TYPE : + + switch ($data['items_id']) { + + //Notification to the ITIL object's observer group + case Notification::OBSERVER_GROUP : + $this->addLinkedGroupByType(CommonITILActor::OBSERVER); + break; + + //Notification to the ITIL object's observer user + case Notification::OBSERVER : + $this->addLinkedUserByType(CommonITILActor::OBSERVER); + break; + + //Send to the ITIL object followup author + case Notification::TASK_ASSIGN_TECH : + $this->addTaskAssignUser($options); + break; + + //Send to the ITIL object task group assigned + case Notification::TASK_ASSIGN_GROUP : + $this->addTaskAssignGroup($options); + break; + + //Send to the technician previously in charge of the task (before re-assignment) + case Notification::OLD_TECH_IN_CHARGE : + $this->addOldAssignTechnician($options); + break; + + } + } + + $this->obj = $obj; + } + + + /** + * Summary of addOldAssignTechnician + * @param $options + */ + function addOldAssignTechnician($options = []) { + global $DB; + + // In case of delete task pass user id + if (isset($options['old_users_id_tech'])) { + $query = $this->getDistinctUserSql()." + FROM `glpi_users` ". + $this->getProfileJoinSql()." + WHERE `glpi_users`.`id` = '".$options['old_users_id_tech']."'"; + + foreach ($DB->request($query) as $data) { + $this->addToRecipientsList($data); + } + } + } + +} diff --git a/inc/process.class.php b/inc/process.class.php index 8d8d3c6..af4defa 100644 --- a/inc/process.class.php +++ b/inc/process.class.php @@ -44,6 +44,19 @@ function maybeDeleted() { return false; } + + /** + * Get default values to search engine to override + **/ + static function getDefaultSearchRequest() { + + $search = ['sort' => 1, + 'order' => 'ASC']; + + return $search; + } + + /** * Summary of refreshTasks * will refresh (re-synch) all process task list @@ -486,6 +499,18 @@ function getSearchOptions() { $tab[19]['massiveaction'] = true; $tab[19]['datatype'] = 'bool'; + $tab[20]['table'] = 'glpi_plugin_processmaker_processes'; + $tab[20]['field'] = 'maintenance'; + $tab[20]['name'] = __('Maintenance', 'processmaker'); + $tab[20]['massiveaction'] = true; + $tab[20]['datatype'] = 'bool'; + + $tab[21]['table'] = 'glpi_plugin_processmaker_processes'; + $tab[21]['field'] = 'max_cases_per_item'; + $tab[21]['name'] = __('Max cases per item (0=unlimited)', 'processmaker'); + $tab[21]['massiveaction'] = true; + $tab[21]['datatype'] = 'number'; + return $tab; } @@ -594,7 +619,7 @@ function showForm ($ID, $options = ['candel'=>false]) { echo ""; echo ""; - echo "".__("Active").""; + echo "".__('Active').""; Dropdown::showYesNo("is_active", $this->fields["is_active"]); echo ""; @@ -608,6 +633,11 @@ function showForm ($ID, $options = ['candel'=>false]) { Dropdown::showYesNo("insert_task_comment", $this->fields["insert_task_comment"]); echo ""; + echo ""; + echo "" . __('Max cases per item (0=unlimited)', 'processmaker') . ""; + echo ""; + echo "\n"; + echo ""; echo "".__('Visible in Incident for Central interface', 'processmaker').""; Dropdown::showYesNo("is_incident", $this->fields["is_incident"]); @@ -680,6 +710,15 @@ function showForm ($ID, $options = ['candel'=>false]) { Dropdown::showFromArray( 'project_type', self::getAllTypeArray(), [ 'value' => $this->fields["project_type"] ] ); echo ""; + echo ""; + echo "".__('Maintenance mode').""; + Dropdown::showYesNo("maintenance", $this->fields["maintenance"]); + if ($this->fields["maintenance"]) { + echo ""; + echo "Synchronize Task List"; + } + echo ""; + $this->showFormButtons($options); } @@ -713,7 +752,12 @@ static function getSqlSearchResult ($count = true, $search = '') { } if (strlen($search)>0 && $search!=$CFG_GLPI["ajax_wildcard"]) { - $where .= " AND (glpi_plugin_processmaker_processes.name $search + if ($where == '') { + $where = ' WHERE '; + } else { + $where .= ' AND '; + } + $where .= " (glpi_plugin_processmaker_processes.name $search OR glpi_plugin_processmaker_processes.comment $search) "; } @@ -801,5 +845,23 @@ static function dropdown($options = []) { } + + /** + * Summary of underMaintenance + * Shows a nice(?) under maintenance message + */ + static function showUnderMaintenance($ptitle, $size = '') { + global $CFG_GLPI; + if ($size != '') { + $size .= '-'; + } + echo "
"; + + echo Html::image($CFG_GLPI['root_doc']."/plugins/processmaker/pics/{$size}under_maintenance.png"); + echo "

"; + echo sprintf(__('Process \'%s\' is under maintenance, please retry later, thank you.', 'processmaker'), $ptitle); + echo "

"; + echo "
"; + } } diff --git a/inc/processmaker.class.php b/inc/processmaker.class.php index aaa3d22..c049a74 100644 --- a/inc/processmaker.class.php +++ b/inc/processmaker.class.php @@ -84,7 +84,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM { private $pmWorkspace = ""; private $pmAdminSession = false; - private $taskWriter = 0; + var $taskWriter = 0; private $pm_group_guid = ''; // guid for default user group in Process Maker is used for all GLPI user synchronization into ProcessMaker var $lasterror; var $lang; @@ -114,8 +114,8 @@ static function getTable($classname = null) { static function getAllPMErrorArray() { $tab = [self::ERROR_CREATING_CASE => _x('errors', 'Error creating case!', 'processmaker'), - self::ERROR_NO_RIGHTS => _x('errors', 'Can\'t create case: no rights for it!', 'processmaker'), - self::ERROR_CREATING_CASE2 => _x('errors', 'Error creating case!', 'processmaker')]; + self::ERROR_NO_RIGHTS => _x('errors', 'Can\'t create case: no rights for it!', 'processmaker'), + self::ERROR_CREATING_CASE2 => _x('errors', 'Error creating case!', 'processmaker')]; return $tab; } @@ -180,16 +180,22 @@ private function openSoap() { $this->taskWriter = $this->config->fields['users_id']; $this->pm_group_guid = $this->config->fields['pm_group_guid']; + //$cipher_list = openssl_get_cipher_methods(true); + $wsdl = $this->serverURL."/services/wsdl2"; $context['ssl'] = ['verify_peer_name' => $this->config->fields['ssl_verify'], // Verification of peer name 'verify_peer' => $this->config->fields['ssl_verify'], // Verification of SSL certificate used + //'ciphers' => 'RSA', ]; - $options = [ 'stream_context' => stream_context_create($context), - 'soap_version' => SOAP_1_2, - 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, - //'proxy_host' => 'localhost', - //'proxy_port' => 8888 + $options = ['stream_context' => stream_context_create($context), + 'soap_version' => SOAP_1_2, + 'compression' => SOAP_COMPRESSION_ACCEPT | SOAP_COMPRESSION_GZIP, + 'keep_alive' => false, + //'trace' => true, + //'exceptions' => false, + //'proxy_host' => 'localhost', + //'proxy_port' => 8889 ]; $this->pmSoapClient = new SoapClient($wsdl, $options); @@ -246,7 +252,7 @@ function login($admin_or_user = false, $case_guid = 'default') { $gusr = new User; if (is_numeric($admin_or_user)) { $gusr->getFromDB($admin_or_user); - } elseif ($admin_or_user !== false) { + } else if ($admin_or_user !== false) { $gusr->getFromDBbyName($admin_or_user); } else { $gusr->getFromDB(Session::getLoginUserID()); @@ -367,9 +373,9 @@ function getCaseInfo($caseGuid, $delIndex = '') { * routes a case (i.e., moves the case to the next task in the process according to its routing rules). * Embedded routeCase() PM web service call (definition: http://wiki.processmaker.com/index.php/2.0/ProcessMaker_WSDL_Web_Services#routeCase.28.29) * A session must be open before with login() - * @param $case_guid The case ID, which can be obtained with the caseList() function - * @param $delIndex The delegation index, which is a positive integer to identify the current task of the case. If empty then use current delIndex. - * @return a routeCaseResponse object, or false exception occured. routing is normalized to be always an array of routeListStruct + * @param $case_guid string The case GUID, which can be obtained with the caseList() function + * @param $delIndex integer The delegation index, which is a positive integer to identify the current task of the case. If empty then use current delIndex. + * @return stdClass|boolean routeCaseResponse object or false when exception occured. routing is normalized to be always an array of routeListStruct */ function routeCase($case_guid, $delIndex) { try { @@ -1105,12 +1111,12 @@ static function cronPMTaskActions($crontask = null) { } // do not send notifications - $donotif = self::saveNotification(false); + $donotif = PluginProcessmakerNotificationTargetProcessmaker::saveNotificationState(false); // now manage tasks associated with item $PM_SOAP->claimTask( $postdata['APP_UID'], $postdata['DEL_INDEX'], $users_id ); - self::restoreNotification($donotif); + PluginProcessmakerNotificationTargetProcessmaker::restoreNotificationState($donotif); } @@ -1290,9 +1296,9 @@ static function cronPMUsers($task) { // insert into DB the link between glpi users and pm user $pmuser = new PluginProcessmakerUser; if ($pmuser->getFromDB( $user['id'] )) { - $pmuser->update( [ 'id' => $user['id'], 'pm_users_id' => $pmResult->userUID, 'password' => md5( $pass ) ] ); + $pmuser->update( [ 'id' => $user['id'], 'pm_users_id' => $pmResult->userUID ] ); } else { - $pmuser->add( [ 'id' => $user['id'], 'pm_users_id' => $pmResult->userUID, 'password' => md5( $pass ) ] ); + $pmuser->add( [ 'id' => $user['id'], 'pm_users_id' => $pmResult->userUID ] ); } $actionCode = 1; @@ -1440,18 +1446,35 @@ public static function plugin_pre_item_add_processmaker($parm) { $caseInfo = $myProcessMaker->getCaseInfo( $parm->input['processmaker_caseguid'], $parm->input['processmaker_delindex']); $parm->input['name'] = $PM_DB->escape($caseInfo->caseName ); - $caseInitialDueDate = $myProcessMaker->getVariables( $parm->input['processmaker_caseguid'], [ 'GLPI_ITEM_TITLE', 'GLPI_ITEM_INITIAL_DUE_DATE' ]); - if (array_key_exists( 'GLPI_ITEM_INITIAL_DUE_DATE', $caseInitialDueDate )) { - $parm->input['time_to_resolve'] = $caseInitialDueDate[ 'GLPI_ITEM_INITIAL_DUE_DATE' ]." 23:59:59"; + $casegetvariables = ['GLPI_ITEM_TITLE', 'GLPI_ITEM_INITIAL_DUE_DATE', 'GLPI_ITEM_DUE_DATE']; + $caseresetvariables = []; + + $caseDueDate = $myProcessMaker->getVariables( $parm->input['processmaker_caseguid'], $casegetvariables); + if (array_key_exists('GLPI_ITEM_INITIAL_DUE_DATE', $caseDueDate)) { + $parm->input['time_to_resolve'] = $caseDueDate['GLPI_ITEM_INITIAL_DUE_DATE']; + $caseresetvariables['GLPI_ITEM_INITIAL_DUE_DATE'] = ''; + } + if (array_key_exists( 'GLPI_ITEM_DUE_DATE', $caseDueDate )) { + $parm->input['time_to_resolve'] = $caseDueDate['GLPI_ITEM_DUE_DATE']; + $caseresetvariables['GLPI_ITEM_DUE_DATE'] = ''; + } + $re = '/^(?\'date\'[0-9]{4}-[0-1][0-9]-[0-3][0-9])( (?\'time\'[0-2][0-9]:[0-5][0-9]:[0-5][0-9]))*$/'; + if (preg_match($re, $parm->input['time_to_resolve'], $matches) && !array_key_exists('time', $matches)) { + $parm->input['time_to_resolve'] .= " 23:59:59"; } + $txtItemTitle = $caseInfo->caseName; - if (array_key_exists( 'GLPI_ITEM_TITLE', $caseInitialDueDate )) { - $txtItemTitle = $caseInitialDueDate[ 'GLPI_ITEM_TITLE' ]; - // reset those variables - $resultSave = $myProcessMaker->sendVariables( $parm->input['processmaker_caseguid'], [ "GLPI_ITEM_TITLE" => ''] ); + if (array_key_exists( 'GLPI_ITEM_TITLE', $caseDueDate )) { + $txtItemTitle = $caseDueDate['GLPI_ITEM_TITLE']; + // reset item title case variable + $caseresetvariables['GLPI_ITEM_TITLE'] = ''; } $parm->input['name'] = $PM_DB->escape($txtItemTitle ); + if (count($caseresetvariables)) { + $resultSave = $myProcessMaker->sendVariables( $parm->input['processmaker_caseguid'], $caseresetvariables ); + } + $procDef = new PluginProcessmakerProcess; $procDef->getFromGUID( $caseInfo->processId ); if (isset($parm->input['type'])) { @@ -1465,6 +1488,12 @@ public static function plugin_pre_item_add_processmaker($parm) { } } + + /** + * Summary of plugin_item_add_processmaker + * @param mixed $parm + * @return void + */ public static function plugin_item_add_processmaker($parm) { global $DB, $GLOBALS, $PM_SOAP; @@ -1493,74 +1522,12 @@ public static function plugin_item_add_processmaker($parm) { // before routing, send items_id and itemtype // as this information was not available at case creation - $myCase->sendVariables( [ "GLPI_TICKET_ID" => $items_id ] ); - - // route case - $pmRouteCaseResponse = $PM_SOAP->routeCase($case_guid, $parm->input['processmaker_delindex'] ); - - // gets new case status - $caseInfo = $myCase->getCaseInfo();//$parm->input['processmaker_delindex']); - // now manage tasks associated with item - // create new tasks - if (property_exists( $pmRouteCaseResponse, 'routing' )) { - // now tries to get some variables to setup content for new task and to append text to solved task - $txtForTasks = $myCase->getVariables( [ "GLPI_ITEM_APPEND_TO_TASK", - "GLPI_ITEM_SET_STATUS", - "GLPI_TICKET_FOLLOWUP_CONTENT", - "GLPI_TICKET_FOLLOWUP_IS_PRIVATE", - "GLPI_TICKET_FOLLOWUP_REQUESTTYPES_ID" ] ); - $itemSetStatus = ''; - if (array_key_exists( 'GLPI_ITEM_SET_STATUS', $txtForTasks )) { - $itemSetStatus = $txtForTasks[ 'GLPI_ITEM_SET_STATUS' ]; - } - if (array_key_exists( 'GLPI_ITEM_APPEND_TO_TASK', $txtForTasks )) { - $txtToAppendToTask = $txtForTasks[ 'GLPI_ITEM_APPEND_TO_TASK' ]; - } else { - $txtToAppendToTask = ''; - } - $createFollowup = false; // by default - if (array_key_exists( 'GLPI_TICKET_FOLLOWUP_CONTENT', $txtForTasks ) && $txtForTasks[ 'GLPI_TICKET_FOLLOWUP_CONTENT' ] != '') { - $createFollowup = true; - } - - // reset those variables - $resultSave = $myCase->sendVariables( [ "GLPI_ITEM_APPEND_TO_TASK" => '', - "GLPI_ITEM_SET_STATUS" => '', - "GLPI_TICKET_FOLLOWUP_CONTENT" => '', - "GLPI_TICKET_FOLLOWUP_IS_PRIVATE" => '', - "GLPI_TICKET_FOLLOWUP_REQUESTTYPES_ID" => '' ] ); + $myCase->sendVariables( [ "GLPI_TICKET_ID" => $items_id, + "GLPI_ITEM_ID" => $items_id, + "GLPI_ITEM_TYPE" => $itemtype, + ] ); - // routing has been done, then solve 1st task - $PM_SOAP->solveTask($myCase->getID(), $parm->input['processmaker_delindex'], [ 'txtToAppend' => $txtToAppendToTask, 'notif' => false] ); - - // create a followup if requested - if ($createFollowup && $itemtype == 'Ticket') { - $PM_SOAP->addTicketFollowup( $items_id, $txtForTasks ); - } - - // and create GLPI tasks for the newly created PM tasks. - foreach ($pmRouteCaseResponse->routing as $route) { - $PM_SOAP->addTask( $myCase->getID(), - $myCase->fields['itemtype'], - $myCase->fields['items_id'], - $caseInfo, - $route->delIndex, - PluginProcessmakerUser::getGLPIUserId( $route->userId ), - 0, - $route->taskId, - $route->delThread ); - } - - if ($itemSetStatus != '') { - $PM_SOAP->setItemStatus($myCase->fields['itemtype'], $myCase->fields['items_id'], $itemSetStatus ); - } - } - - // evolution of case status: DRAFT, TO_DO, COMPLETED, CANCELLED - $myCase->update( ['id' => $myCase->getID(), - 'case_status' => $caseInfo->caseStatus, - 'name' => $caseInfo->caseName - ]); + $PM_SOAP->derivateCase($myCase, ['DEL_INDEX' => $parm->input['processmaker_delindex']]); } else {//if( array_key_exists('_head', $parm->input) ) { // this ticket have been created via email receiver. $ptnProcessToStart = "/##TicketProcess:\s*#([0-9a-f]{32})\s*##/i"; @@ -1627,9 +1594,9 @@ public static function addWatcher($itemType, $itemId, $techId) { $glpi_item_user = $dbu->getItemForItemtype( $glpi_item->getType() . "_User" ); // do not send notifications - $donotif = self::saveNotification(false); + $donotif = PluginProcessmakerNotificationTargetProcessmaker::saveNotificationState(false); $glpi_item_user->add( [ $glpi_item::getForeignKeyField() => $glpi_item->getId(), 'users_id' => $techId, 'type' => CommonITILActor::OBSERVER, '_disablenotif' => true ] ); - self::restoreNotification($donotif); + PluginProcessmakerNotificationTargetProcessmaker::restoreNotificationState($donotif); return true; } } @@ -1657,13 +1624,17 @@ public static function addWatcher($itemType, $itemId, $techId) { */ public function addTask($cases_id, $itemtype, $items_id, $caseInfo, $delIndex, $techId, $groupId, $pmTaskId, $delThread, $options = []) { global $DB, $PM_DB, $_SESSION; + $dbu = new DbUtils; + $default_options = [ 'txtTaskContent' => '', 'start_date' => '', 'end_date' => '', + 'reminder' => '', 'notif' => true ]; + foreach ($default_options as $key => $opt) { if (!isset($options[$key])) { $options[$key] = $opt; @@ -1710,12 +1681,13 @@ public function addTask($cases_id, $itemtype, $items_id, $caseInfo, $delIndex, $ $input['users_id'] = $this->taskWriter; // manage groups - if ($techId == 0) { // then we must look-up DB to get the pseudo-group that will be assigned to the task + if ($techId == 0) { // then we must look-up DB to get the group that will be assigned to the task $groupname=''; if ($groupId == 0) { + // TU_RELATION=2 is groups and TU_TYPE=1 means normal (= not adhoc) $query = "SELECT CONTENT.CON_VALUE FROM TASK_USER JOIN CONTENT ON CONTENT.CON_ID=TASK_USER.USR_UID AND CONTENT.CON_CATEGORY='GRP_TITLE' AND CONTENT.CON_LANG = 'en' - WHERE TASK_USER.TAS_UID='$pmTaskId' AND TASK_USER.TU_RELATION=2 LIMIT 1;"; + WHERE TASK_USER.TAS_UID='$pmTaskId' AND TASK_USER.TU_RELATION=2 AND TASK_USER.TU_TYPE=1 LIMIT 1;"; } else { $query = "SELECT CON_VALUE FROM CONTENT WHERE CONTENT.CON_ID='$groupId' AND CONTENT.CON_CATEGORY='GRP_TITLE' AND CONTENT.CON_LANG='en' ;"; @@ -1728,13 +1700,7 @@ public function addTask($cases_id, $itemtype, $items_id, $caseInfo, $delIndex, $ $groupname = $onlyrec['CON_VALUE']; } - $groups_id_tech = 0; - $query = "SELECT id AS glpi_group_id FROM glpi_groups WHERE name LIKE '$groupname';"; - $res = $DB->query($query); - if ($DB->numrows($res) > 0) { - $row = $DB->fetch_array( $res ); - $groups_id_tech = $row['glpi_group_id']; - } + $groups_id_tech = self::getGLPIGroupId($groupname); } else { // adds the user tech to ticket watcher if neccessary @@ -1758,7 +1724,7 @@ public function addTask($cases_id, $itemtype, $items_id, $caseInfo, $delIndex, $ $input['is_private'] = 0; $input['actiontime'] = 0; - $input['state'] = 1; // == TO_DO + $input['state'] = Planning::TODO; // == TO_DO $input['users_id_tech'] = 0; // by default as it can't be empty if ($techId) { $input['users_id_tech'] = $techId; @@ -1766,13 +1732,21 @@ public function addTask($cases_id, $itemtype, $items_id, $caseInfo, $delIndex, $ $input['groups_id_tech'] = $groups_id_tech; } - $donotif = self::saveNotification(false); // do not send notification yet as the PluginProcessmakerTask is not yet added to DB + if ($options['reminder'] != '' && $techId) { + $input['_planningrecall'] = ['before_time' => $options['reminder'], + 'itemtype' => get_class($glpi_task), + 'items_id' => '', + 'users_id' => $techId, + 'field' => 'begin']; + } + + $donotif = PluginProcessmakerNotificationTargetProcessmaker::saveNotificationState(false); // do not send notification yet as the PluginProcessmakerTask is not yet added to DB $glpi_task->add( Toolbox::addslashes_deep( $input ) ); - self::restoreNotification($donotif); + PluginProcessmakerNotificationTargetProcessmaker::restoreNotificationState($donotif); // to prevent error message for overlapping planning - if (isset($_SESSION["MESSAGE_AFTER_REDIRECT"][ERROR])) { - unset($_SESSION["MESSAGE_AFTER_REDIRECT"][ERROR]); + if (isset($_SESSION["MESSAGE_AFTER_REDIRECT"][WARNING])) { + unset($_SESSION["MESSAGE_AFTER_REDIRECT"][WARNING]); } if ($glpi_task->getId() > 0) { @@ -1786,33 +1760,39 @@ public function addTask($cases_id, $itemtype, $items_id, $caseInfo, $delIndex, $ $query = "INSERT INTO glpi_plugin_processmaker_tasks (items_id, itemtype, plugin_processmaker_cases_id, plugin_processmaker_taskcategories_id, del_index, del_thread) VALUES ({$glpi_task->getId()}, '{$glpi_task->getType()}', $cases_id, {$pmtaskcat->fields['id']}, $delIndex, $delThread);"; $DB->query( $query ); - } - - // send notification if needed for new task as now we have the PluginProcessmakerTask in the DB - $donotif = self::saveNotification($options['notif']); - $item = new $itemtype; - $item->getFromDB($items_id); - NotificationEvent::raiseEvent('add_task', $item, ['task_id' => $glpi_task->getID(), 'is_private' => isset($glpi_task->fields['is_private']) ? $glpi_task->fields['is_private'] : 0]); - self::restoreNotification($donotif); - } + // send notification if needed for new task as now we have the PluginProcessmakerTask in the DB + $donotif = PluginProcessmakerNotificationTargetProcessmaker::saveNotificationState($options['notif']); + // send notification now! + $pm_task = new PluginProcessmakerTask($glpi_task->getType()); + $pm_task->getFromDB($glpi_task->getId()); + $glpi_item = new $itemtype; + $glpi_item->getFromDB($items_id); + $pm_task->sendNotification('task_add', $glpi_task, $glpi_item); - private static function saveNotification($donotif) { - global $CFG_GLPI; - // $CFG_GLPI["use_notifications"] is available since 9.2 - $savenotif = isset($CFG_GLPI["use_notifications"]) ? $CFG_GLPI["use_notifications"] : $CFG_GLPI["use_mailing"]; - if (!$donotif) { - isset($CFG_GLPI["use_notifications"]) ? $CFG_GLPI["use_notifications"] = false : $CFG_GLPI["use_mailing"] = false; + PluginProcessmakerNotificationTargetProcessmaker::restoreNotificationState($donotif); } - return $savenotif; + } - private static function restoreNotification($savenotif) { - global $CFG_GLPI; - // $CFG_GLPI["use_notifications"] is available since 9.2 - isset($CFG_GLPI["use_notifications"]) ? $CFG_GLPI["use_notifications"] = $savenotif : $CFG_GLPI["use_mailing"] = $savenotif; + /** + * Summary of getGLPIGroupId + * returns GLPI group id from pm group name + * returns false when not found + * @param string $pmGroupName + * @return bool|integer + */ + static function getGLPIGroupId(string $pmGroupName) { + global $DB; + $query = "SELECT id AS glpi_group_id FROM glpi_groups WHERE name LIKE '$pmGroupName';"; + $res = $DB->query($query); + if ($DB->numrows($res) > 0) { + $row = $DB->fetch_array($res); + return $row['glpi_group_id']; + } + return false; } /** @@ -1884,10 +1864,27 @@ public function setItemStatus($itemtype, $itemId, $newstatus) { * @param mixed $newtitle */ public function setItemTitle($itemtype, $itemId, $newtitle) { + global $DB; + $dbu = new DbUtils; $item = $dbu->getItemForItemtype( $itemtype ); if ($item->getFromDB( $itemId )) { - $item->update( ['id' => $itemId, 'name' => $newtitle] ); + $item->update( ['id' => $itemId, 'name' => $DB->escape($newtitle)] ); + } + } + + + /** + * Summary of setItemDuedate + * @param mixed $itemtype + * @param mixed $itemId + * @param mixed $duedate + */ + public function setItemDuedate($itemtype, $itemId, $duedate) { + $dbu = new DbUtils; + $item = $dbu->getItemForItemtype( $itemtype ); + if ($item->getFromDB( $itemId )) { + $item->update( ['id' => $itemId, 'time_to_resolve' => $duedate] ); } } @@ -1899,6 +1896,8 @@ public function setItemTitle($itemtype, $itemId, $newtitle) { * @param mixed $casevariablevalues */ public function setItemSolution($itemType, $itemId, $casevariablevalues) { + global $DB; + $dbu = new DbUtils; $item = $dbu->getItemForItemtype( $itemType ); if ($item->getFromDB( $itemId )) { @@ -1946,7 +1945,7 @@ public function setItemSolution($itemType, $itemId, $casevariablevalues) { if ($solution != '') { $solution .= "\n"; } - $solution .= $casevariablevalues[ 'GLPI_ITEM_APPEND_TO_SOLUTION_DESCRIPTION' ]; + $solution .= $DB->escape($casevariablevalues[ 'GLPI_ITEM_APPEND_TO_SOLUTION_DESCRIPTION' ]); $to_update = true; } @@ -1989,7 +1988,7 @@ function computeTaskDuration($begin, $end, $entity) { * 'begin' => is the new begin date of the task * 'end' => is the new end date of the task * 'toInformation' => is the new status of the task (usually set to INFORMATION) - * + * @return false|object the solved task, when found */ public function solveTask($cases_id, $delIndex, $options = []) { global $DB; @@ -2002,12 +2001,11 @@ public function solveTask($cases_id, $delIndex, $options = []) { $glpi_task = new $row['itemtype']; $glpi_task->getFromDB( $row['items_id'] ); - $hostItem = $dbu->getItemForItemtype( $glpi_task->getItilObjectItemType() ); + $glpi_item = $dbu->getItemForItemtype( $glpi_task->getItilObjectItemType() ); $itemFKField = getForeignKeyFieldForItemType( $glpi_task->getItilObjectItemType() ); - $hostItem->getFromDB( $glpi_task->fields[ $itemFKField ] ); + $glpi_item->getFromDB( $glpi_task->fields[ $itemFKField ] ); // change current glpi_currenttime to be sure that date_mode for solved task will not be identical than date_mode of the newly started task - //$end_date = new DateTime( $_SESSION["glpi_currenttime"] ); $saved_date_time = $_SESSION["glpi_currenttime"]; $_SESSION["glpi_currenttime"] = (new DateTime($saved_date_time))->sub(new DateInterval("PT1S"))->format("Y-m-d H:i:s"); @@ -2027,7 +2025,7 @@ public function solveTask($cases_id, $delIndex, $options = []) { } } - $duration = $this->computeTaskDuration($options['begin'], $options['end'], $hostItem->fields['entities_id']); + $duration = $this->computeTaskDuration($options['begin'], $options['end'], $glpi_item->fields['entities_id']); if ($options['txtToAppend'] != "") { $options['txtToAppend'] = "\n
".$options['txtToAppend']; } @@ -2035,24 +2033,37 @@ public function solveTask($cases_id, $delIndex, $options = []) { 'state' => $options['toInformation'] ? Planning::INFO : Planning::DONE, 'begin' => $options['begin'], 'end' => $options['end'], - $itemFKField => $hostItem->getID(), + $itemFKField => $glpi_item->getID(), 'actiontime' => $duration, 'users_id_tech' => (isset($options['users_id_tech']) ? $options['users_id_tech'] : Session::getLoginUserID()), //'groups_id_tech' => 0, 'content' => $DB->escape($glpi_task->fields[ 'content' ].$options['txtToAppend']) ]; - $donotif = self::saveNotification($options['notif']); + + $donotif = PluginProcessmakerNotificationTargetProcessmaker::saveNotificationState(false); // do not send notification yet $glpi_task->update($params); - self::restoreNotification($donotif); + PluginProcessmakerNotificationTargetProcessmaker::restoreNotificationState($donotif); // Close the task $DB->query("UPDATE glpi_plugin_processmaker_tasks SET del_thread_status = '".PluginProcessmakerTask::CLOSED."' WHERE id = {$row['id']}"); + // send notification if needed for new task as now the PluginProcessmakerTask has been updated in the DB + $donotif = PluginProcessmakerNotificationTargetProcessmaker::saveNotificationState($options['notif']); + + // send notification now! + $pm_task = new PluginProcessmakerTask($glpi_task->getType()); + $pm_task->getFromDB($glpi_task->getId()); + $pm_task->sendNotification('task_done', $glpi_task, $glpi_item); + + PluginProcessmakerNotificationTargetProcessmaker::restoreNotificationState($donotif); + // restore current glpi time $_SESSION["glpi_currenttime"] = $saved_date_time; + return $glpi_task; } + return false; } /** @@ -2078,10 +2089,11 @@ public function claimTask($cases_id, $delIndex, $users_id_tech = null) { $glpi_item = $dbu->getItemForItemtype( $itemType ); $glpi_item->getFromDB( $glpi_task->fields[ getForeignKeyFieldForItemType( $itemType ) ] ); - $glpi_task->update( [ 'id' => $row['items_id'], - $glpi_item->getForeignKeyField() => $glpi_item->getId(), - 'users_id_tech' => (isset($users_id_tech)?$users_id_tech: Session::getLoginUserID()), - 'groups_id_tech' => 0 ]); + $glpi_task->update( [ 'id' => $row['items_id'], + $glpi_item->getForeignKeyField() => $glpi_item->getId(), + 'users_id_tech' => (isset($users_id_tech)?$users_id_tech: Session::getLoginUserID()), + 'groups_id_tech' => 0, + 'update' => true]); } } @@ -2174,10 +2186,24 @@ static function multiexplode($delimiters, $string) { */ public static function pre_show_item_processmaker($params) { - if (!is_array($params['item']) && is_subclass_of( $params['item'], 'CommonITILTask')) { + if (!is_array($params['item']) && is_subclass_of($params['item'], 'CommonITILTask')) { // must check if Task is bound to a PM task $pmTask = new PluginProcessmakerTask($params['item']->getType()); - if ($pmTask->getFromDB($params['item']->getId())) {//$pmTask->getFromDBByQuery("WHERE itemtype='".$params['item']->getType()."' and items_id=".$params['item']->getId())) { + $is_pmtask = $pmTask->getFromDB($params['item']->getId()); + if (!$is_pmtask && $params['item']->fields['state'] == Planning::INFO) { + // look if it is a meta task for this process + // means a re-assign or an un-claim task info + $pm_process = new PluginProcessmakerProcess; + if ($pm_process->getFromDBByQuery( " WHERE `taskcategories_id` = ".$params['item']->fields['taskcategories_id'])) { + // then look into content to get case id + $re = '//'; + if (preg_match($re, $params['item']->fields['content'], $matches)) { + // here we get the case id and the task id + $is_pmtask = $pmTask->getFromDB($matches['taskid']); + } + } + } + if ($is_pmtask) { $params['item']->fields['can_edit'] = false; // to prevent task edition // replace ##ticket.url##_PluginProcessmakerCase$processmakercases by a setActiveTab to the Case panel @@ -2384,25 +2410,12 @@ public static function getItemUsers($itemtype, $itemId, $userType) { /** * Summary of saveForm * This function posts dynaform variables to PM, using the CURL module. - * @param mixed $request: is the $_REQUEST server array + * @param array $request: is the $_REQUEST server array * //@param string $cookie: is the $_SERVER['HTTP_COOKIE'] string * @return mixed: returns false if request failed, otherwise, returns true */ public function saveForm($request) { - //, $cookie ) { - - //if (!function_exists( 'HandleHeaderLine' )) { - // function HandleHeaderLine( $curl, $header_line ) { - // //global $cookies; - // $temp = explode( ": ", $header_line ); - // if (is_array( $temp ) && $temp[0] == 'Set-Cookie') { - // $temp2 = explode( "; ", $temp[1]); - // //$cookies .= $temp2[0].'; ' ; - // curl_setopt($curl, CURLOPT_COOKIE, $temp2[0]."; " ); - // } - // return strlen($header_line); - // } - //} + $loggable = false; $request = stripcslashes_deep( $request ); @@ -2411,7 +2424,6 @@ public function saveForm($request) { //to be able to trace network traffic with a local proxy // curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 1 ); // curl_setopt($ch, CURLOPT_PROXY, "localhost:8888"); - // curl_setopt($ch, CURLOPT_PROXY, "fry07689.fr.ray.group:8889"); //curl_setopt($ch, CURLINFO_HEADER_OUT, 1); //curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); @@ -2423,7 +2435,7 @@ public function saveForm($request) { curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, $this->config->fields['ssl_verify']); //curl_setopt($ch, CURLOPT_HEADERFUNCTION, "HandleHeaderLine"); - // to stock cookies in memory + // to store cookies in memory // ( replace HandleHeaderLine function ) curl_setopt($ch, CURLOPT_COOKIEFILE, ""); @@ -2440,7 +2452,8 @@ public function saveForm($request) { $data = http_formdata_flat_hierarchy( $request ); // check if any files are in the $_FILES global array // and add them to the curl POST - if (isset($_FILES['form']['name'])) { + $fileForm = isset($_FILES['form']['name']) ? $_FILES['form']['name'] : null; + if (isset($fileForm) && !empty($fileForm[array_keys($fileForm)[0]][1][array_keys($fileForm[array_keys($fileForm)[0]][1])[0]])) { foreach ($_FILES['form']['name'] as $key => $file) { if (is_array($file)) { // it's a grid which contains documents @@ -2457,7 +2470,7 @@ public function saveForm($request) { } } // to get all cookies in one variable - $cookies = curl_getinfo($ch, CURLINFO_COOKIELIST); + //$cookies = curl_getinfo($ch, CURLINFO_COOKIELIST); curl_setopt($ch, CURLOPT_HTTPHEADER, ["Expect:"]); curl_setopt($ch, CURLOPT_POSTFIELDS, $data); // inject POST values // add agent and referer params @@ -2476,10 +2489,6 @@ public function saveForm($request) { } return ($response ? true : false); - - //$n = preg_match("/HTTP\/1.1 302 /", $response, $matches); - - //return ($n < 1 ? false : true) ; } /** @@ -2597,7 +2606,8 @@ public static function plugin_item_get_pdfdata_processmaker($item) { if (in_array( $config->fields['taskcategories_id'], $ancestors)) { $loc_completename = DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'completename', $_SESSION['glpilanguage'], $taskCat->fields['completename'] ); $loc_comment = DropdownTranslation::getTranslatedValue( $taskCat->getID(), 'TaskCategory', 'comment', $_SESSION['glpilanguage'], $taskCat->fields['comment'] ); - $item->datas['content'] = $loc_completename."\n\n".str_replace( "##processmaker.taskcomment##\n##processmakercase.url##", $loc_comment, $item->datas['content']); + $item->datas['content'] = $loc_completename."\n\n".str_replace( "##processmaker.taskcomment##", $loc_comment, $item->datas['content']); + $item->datas['content'] = str_replace( "##processmakercase.url##", '', $item->datas['content']); } // restore default translations if (isset( $trans )) { @@ -2641,15 +2651,15 @@ public static function getProcessesWithCategoryAndProfile($category, $type, $pro /** * Summary of startNewCase * @param mixed $processes_id integer: GLPI process id - * @param mixed $itemType string: item type 'Ticket', 'Change' or 'Problem' + * @param mixed $itemtype string: item type 'Ticket', 'Change' or 'Problem' * @param mixed $items_id integer: id to thte item * @param mixed $users_id integer: GLPI user id * @return mixed */ - public function startNewCase($processes_id, $itemType, $items_id, $users_id = null) { + public function startNewCase($processes_id, $itemtype, $items_id, $users_id = null) { global $DB, $CFG_GLPI; - $requesters = PluginProcessmakerProcessmaker::getItemUsers( $itemType, $items_id, CommonITILActor::REQUESTER); // 1 for requesters + $requesters = PluginProcessmakerProcessmaker::getItemUsers( $itemtype, $items_id, CommonITILActor::REQUESTER); // 1 for requesters if (!key_exists( 0, $requesters )) { $requesters[0]['glpi_id'] = 0; $requesters[0]['pm_id'] = 0; @@ -2663,65 +2673,72 @@ public function startNewCase($processes_id, $itemType, $items_id, $users_id = nu //} // get item info to retreive title, description and duedate - $locItem = new $itemType; // $_POST['itemtype'] ; //Ticket(); - $locItem->getFromDB( $items_id ); // $_POST['id'] ) ; + $item = new $itemtype; + $item->getFromDB( $items_id ); - if ($locItem->countUsers(CommonITILActor::ASSIGN) == 0 - || !$locItem->isUser(CommonITILActor::ASSIGN, $users_id) ) { - $locItem->update( [ 'id' => $items_id, '_itil_assign' => [ '_type' => 'user', 'users_id' => $users_id ] ] ); + if ($item->countUsers(CommonITILActor::ASSIGN) == 0 + || !$item->isUser(CommonITILActor::ASSIGN, $users_id) ) { + $item->update( [ 'id' => $items_id, '_itil_assign' => [ '_type' => 'user', 'users_id' => $users_id ] ] ); } - if (!isset($locItem->fields['time_to_resolve']) || $locItem->fields['time_to_resolve'] == null) { - $locItem->fields['time_to_resolve'] = ""; + if (!isset($item->fields['time_to_resolve']) || $item->fields['time_to_resolve'] == null) { + $item->fields['time_to_resolve'] = ""; } $resultCase = $this->newCase( $processes_id, - ['GLPI_ITEM_CAN_BE_SOLVED' => 0, - 'GLPI_TICKET_ID' => $items_id, - 'GLPI_ITEM_ID' => $items_id, - 'GLPI_ITEM_TYPE' => $itemType, - 'GLPI_TICKET_REQUESTER_GLPI_ID' => $requesters[0]['glpi_id'], - 'GLPI_ITEM_REQUESTER_GLPI_ID' => $requesters[0]['glpi_id'], - 'GLPI_TICKET_REQUESTER_PM_ID' => $requesters[0]['pm_id'], - 'GLPI_ITEM_REQUESTER_PM_ID' => $requesters[0]['pm_id'], - 'GLPI_TICKET_TITLE' => $locItem->fields['name'], - 'GLPI_ITEM_TITLE' => $locItem->fields['name'], - 'GLPI_TICKET_DESCRIPTION' => $locItem->fields['content'], - 'GLPI_ITEM_DESCRIPTION' => $locItem->fields['content'], - 'GLPI_TICKET_DUE_DATE' => $locItem->fields['time_to_resolve'], - 'GLPI_ITEM_OPENING_DATE' => $locItem->fields['date'], - 'GLPI_ITEM_DUE_DATE' => $locItem->fields['time_to_resolve'], - 'GLPI_ITEM_ITIL_CATEGORY_ID' => $locItem->fields['itilcategories_id'], - 'GLPI_TICKET_URGENCY' => $locItem->fields['urgency'], - 'GLPI_ITEM_URGENCY' => $locItem->fields['urgency'], - 'GLPI_ITEM_IMPACT' => $locItem->fields['impact'], - 'GLPI_ITEM_PRIORITY' => $locItem->fields['priority'], - 'GLPI_TICKET_GLOBAL_VALIDATION' => $locItem->fields['global_validation'] , - 'GLPI_TICKET_TECHNICIAN_GLPI_ID' => $users_id, - 'GLPI_ITEM_TECHNICIAN_GLPI_ID' => $users_id, - 'GLPI_TICKET_TECHNICIAN_PM_ID' => PluginProcessmakerUser::getPMUserId( $users_id ), - 'GLPI_ITEM_TECHNICIAN_PM_ID' => PluginProcessmakerUser::getPMUserId( $users_id ), - 'GLPI_URL' => $CFG_GLPI['url_base'] - ] ); + ['GLPI_ITEM_CAN_BE_SOLVED' => 0, + 'GLPI_TICKET_ID' => $items_id, + 'GLPI_ITEM_ID' => $items_id, + 'GLPI_ITEM_TYPE' => $itemtype, + 'GLPI_ITEM_STATUS' => $item->fields['status'], + 'GLPI_TICKET_REQUESTER_GLPI_ID' => $requesters[0]['glpi_id'], + 'GLPI_ITEM_REQUESTER_GLPI_ID' => $requesters[0]['glpi_id'], + 'GLPI_TICKET_REQUESTER_PM_ID' => $requesters[0]['pm_id'], + 'GLPI_ITEM_REQUESTER_PM_ID' => $requesters[0]['pm_id'], + 'GLPI_TICKET_TITLE' => $item->fields['name'], + 'GLPI_ITEM_TITLE' => $item->fields['name'], + 'GLPI_TICKET_DESCRIPTION' => $item->fields['content'], + 'GLPI_ITEM_DESCRIPTION' => $item->fields['content'], + 'GLPI_ITEM_OPENING_DATE' => $item->fields['date'], + 'GLPI_TICKET_DUE_DATE' => $item->fields['time_to_resolve'], + 'GLPI_ITEM_DUE_DATE' => $item->fields['time_to_resolve'], + 'GLPI_ITEM_ITIL_CATEGORY_ID' => $item->fields['itilcategories_id'], + 'GLPI_TICKET_URGENCY' => $item->fields['urgency'], + 'GLPI_ITEM_URGENCY' => $item->fields['urgency'], + 'GLPI_ITEM_IMPACT' => $item->fields['impact'], + 'GLPI_ITEM_PRIORITY' => $item->fields['priority'], + // Specific to Tickets and Changes + // GLPI_ITEM_GLOBAL_VALIDATION will be '' when Problem, else it will be the global_validation field + 'GLPI_TICKET_GLOBAL_VALIDATION' => $itemtype == 'Problem' ? '' : $item->fields['global_validation'], + 'GLPI_ITEM_GLOBAL_VALIDATION' => $itemtype == 'Problem' ? '' : $item->fields['global_validation'], + 'GLPI_TICKET_TECHNICIAN_GLPI_ID' => $users_id, + 'GLPI_ITEM_TECHNICIAN_GLPI_ID' => $users_id, + 'GLPI_TICKET_TECHNICIAN_PM_ID' => PluginProcessmakerUser::getPMUserId( $users_id ), + 'GLPI_ITEM_TECHNICIAN_PM_ID' => PluginProcessmakerUser::getPMUserId( $users_id ), + 'GLPI_URL' => $CFG_GLPI['url_base'], + // Specific to Tickets + // GLPI_TICKET_TYPE will contains 1 (= incident) or 2 (= request), or '' if itemtype is not Ticket + 'GLPI_TICKET_TYPE' => $itemtype == 'Ticket' ? $item->fields['type'] : '' + ]); if ($resultCase->status_code === 0) { $caseInfo = $this->getCaseInfo( $resultCase->caseId ); // save info to DB $locCase = new PluginProcessmakerCase; - $locCase->add( ['id' => $resultCase->caseNumber, - 'itemtype' => $itemType, - 'items_id' => $items_id, - 'case_guid' => $resultCase->caseId, - 'case_status' => $caseInfo->caseStatus, - 'name' => $caseInfo->caseName, - 'entities_id' => $locItem->fields['entities_id'], + $locCase->add( ['id' => $resultCase->caseNumber, + 'itemtype' => $itemtype, + 'items_id' => $items_id, + 'case_guid' => $resultCase->caseId, + 'case_status' => $caseInfo->caseStatus, + 'name' => $caseInfo->caseName, + 'entities_id' => $item->fields['entities_id'], 'plugin_processmaker_processes_id' => $processes_id, - 'plugin_processmaker_cases_id' => 0 + 'plugin_processmaker_cases_id' => 0 ], [], true ); - $this->add1stTask($locCase->getID(), $itemType, $items_id, $caseInfo, ['userId' => $users_id] ); + $this->add1stTask($locCase->getID(), $itemtype, $items_id, $caseInfo, ['userId' => $users_id] ); } return $resultCase; @@ -2739,97 +2756,78 @@ public function startNewCase($processes_id, $itemType, $items_id, $users_id = nu */ public function derivateCase($myCase, $request, $users_id = null) { //$cookies, - global $PM_DB, $CFG_GLPI; + global $PM_DB, $CFG_GLPI, $DB; $itemtype = $myCase->getField('itemtype'); $items_id = $myCase->getField('items_id'); $item = new $itemtype; $item->getFromDB($items_id); + //Toolbox::logInFile("processmaker_derivate", Toolbox::backtrace(false) . "derivateCase: myCase = " . print_r($myCase, true) . "\nrequest = " . print_r($request, true) . "\nusers_id = " . print_r($users_id, true) ); + // save the dynaform variables into the current case - $resultSave = $this->saveForm( $request ); + if (isset($request['UID']) && isset($request['APP_UID']) && isset($request['__DynaformName__'])) { + $resultSave = $this->saveForm( $request ); + } // now derivate the case !!! $pmRouteCaseResponse = $this->routeCase($myCase->fields['case_guid'], $request['DEL_INDEX']); + //Toolbox::logInFile("processmaker_derivate", "routeCase: pmRouteCaseResponse = " . print_r($pmRouteCaseResponse, true)); - //if (property_exists($pmRouteCaseResponse, 'routing')) { - // // must check if case has started a sub-process - // // we may have several new cases for this case - // // must check if all child cases are existing in GLPI - // $locTaskCat = new PluginProcessmakerTaskCategory; - // foreach($pmRouteCaseResponse->routing as $route) { - // if ($locTaskCat->getFromGUID($route->taskId) && $locTaskCat->fields['is_subprocess']) { - // // look for APP_UID - // foreach($PM_DB->request("SELECT APP_UID FROM SUB_APPLICATION WHERE APP_PARENT='{$myCase->fields['case_guid']}' AND DEL_INDEX_PARENT={$route->delIndex} AND DEL_THREAD_PARENT={$route->delThread} AND SA_STATUS='ACTIVE'") as $subCase) { - // // normally only one case for this delIndex and delThread - // // now need to get the PRO_UID - // $sub_caseInfo = self::getCaseInfo($subCase['APP_UID']); - - // $locProc = new PluginProcessmakerProcess; - // $locProc->getFromGUID($sub_caseInfo->processId); - // $locCase = new PluginProcessmakerCase; - // $locCase->add(['id' => $sub_caseInfo->caseNumber, - // 'case_guid'=> $sub_caseInfo->caseId, - // 'itemtype' => $itemtype, - // 'items_id' => $items_id, - // 'name' => $sub_caseInfo->caseName, - // 'entities_id' => $item->fields['entities_id'], - // 'case_status' => $sub_caseInfo->caseStatus, - // 'plugin_processmaker_processes_id' => $locProc->getID(), - // 'plugin_processmaker_cases_id' => $myCase->getID()]); - - // // then create associated task - // if (property_exists( $sub_caseInfo, 'currentUsers' )) { - // foreach ($sub_caseInfo->currentUsers as $sub_route) { - // $this->addTask($locCase->getID(), $itemtype, - // $items_id, - // $sub_caseInfo, - // $sub_route->delIndex, - // PluginProcessmakerUser::getGLPIUserId($sub_route->userId), - // 0, - // $sub_route->taskId, - // $sub_route->delThread, - // [] - // //array( 'txtTaskContent' => $txtTaskContent, - // // 'start_date' => $taskStartDate, - // // 'end_date' => $taskEndDate) - // ); - - // } - // } - - // } - - // } - // } - - //} + if ($pmRouteCaseResponse->status_code != 0) { + Session::addMessageAfterRedirect(sprintf(__('Unable to derivate case! Retry in a moment, or ask your administrator.
Error code: %u
Error message: %s
', 'processmaker'), + $pmRouteCaseResponse->status_code, + $pmRouteCaseResponse->message), + true, + ERROR); + return; + } $casevariables = ["GLPI_ITEM_TASK_CONTENT", "GLPI_ITEM_APPEND_TO_TASK", "GLPI_NEXT_GROUP_TO_BE_ASSIGNED", + "GLPI_ITEM_TASK_GROUP", "GLPI_ITEM_TITLE", "GLPI_TICKET_FOLLOWUP_CONTENT", "GLPI_TICKET_FOLLOWUP_IS_PRIVATE", "GLPI_TICKET_FOLLOWUP_REQUESTTYPES_ID", "GLPI_ITEM_TASK_ENDDATE", "GLPI_ITEM_TASK_STARTDATE", + "GLPI_ITEM_TASK_REMINDER", "GLPI_ITEM_SOLVED_TASK_ENDDATE", "GLPI_ITEM_SOLVED_TASK_STARTDATE", "GLPI_ITEM_SOLVED_TASK_SETINFO", "GLPI_ITEM_SET_STATUS", + "GLPI_ITEM_STATUS", "GLPI_ITEM_SET_SOLUTION_TEMPLATE_ID", "GLPI_ITEM_SET_SOLUTION_TYPE_ID", - "GLPI_ITEM_APPEND_TO_SOLUTION_DESCRIPTION" + "GLPI_ITEM_APPEND_TO_SOLUTION_DESCRIPTION", + "GLPI_ITEM_INITIAL_DUE_DATE", + "GLPI_ITEM_DUE_DATE", + "GLPI_SEND_EMAIL", + "GLPI_ITEM_INFORMATION_TASK" ]; // now tries to get some variables to setup content for new task and to append text to solved task $casevariablevalues = $myCase->getVariables($casevariables); + $information_task = ''; + if (array_key_exists( 'GLPI_ITEM_INFORMATION_TASK', $casevariablevalues ) && $casevariablevalues[ 'GLPI_ITEM_INFORMATION_TASK' ] != '') { + $information_task = $casevariablevalues[ 'GLPI_ITEM_INFORMATION_TASK' ]; + } + + $sendemail = ''; + if (array_key_exists( 'GLPI_SEND_EMAIL', $casevariablevalues ) && $casevariablevalues[ 'GLPI_SEND_EMAIL' ] != '') { + $sendemail = json_decode($casevariablevalues[ 'GLPI_SEND_EMAIL' ], true); + } + $itemSetStatus = ''; if (array_key_exists( 'GLPI_ITEM_SET_STATUS', $casevariablevalues )) { $itemSetStatus = $casevariablevalues[ 'GLPI_ITEM_SET_STATUS' ]; } + if (array_key_exists( 'GLPI_ITEM_STATUS', $casevariablevalues )) { + $itemSetStatus = $casevariablevalues[ 'GLPI_ITEM_STATUS' ]; + } $txtItemTitle = ''; if (array_key_exists( 'GLPI_ITEM_TITLE', $casevariablevalues )) { @@ -2850,6 +2848,9 @@ public function derivateCase($myCase, $request, $users_id = null) { if (array_key_exists( 'GLPI_NEXT_GROUP_TO_BE_ASSIGNED', $casevariablevalues )) { $groupId = $casevariablevalues[ 'GLPI_NEXT_GROUP_TO_BE_ASSIGNED' ]; } + if (array_key_exists( 'GLPI_ITEM_TASK_GROUP', $casevariablevalues )) { + $groupId = $casevariablevalues[ 'GLPI_ITEM_TASK_GROUP' ]; + } $taskStartDate = ''; $taskEndDate = ''; @@ -2864,6 +2865,11 @@ public function derivateCase($myCase, $request, $users_id = null) { } } + $taskReminder = ''; + if (array_key_exists( 'GLPI_ITEM_TASK_REMINDER', $casevariablevalues )) { + $taskReminder = $casevariablevalues[ 'GLPI_ITEM_TASK_REMINDER' ]; + } + $solvedTaskStartDate = ''; $solvedTaskEndDate = ''; if (array_key_exists( 'GLPI_ITEM_SOLVED_TASK_ENDDATE', $casevariablevalues )) { @@ -2889,6 +2895,18 @@ public function derivateCase($myCase, $request, $users_id = null) { $createFollowup = true; } + $item_duedate = ''; + if (array_key_exists('GLPI_ITEM_INITIAL_DUE_DATE', $casevariablevalues)) { + $item_duedate = $casevariablevalues['GLPI_ITEM_INITIAL_DUE_DATE']; + } + if (array_key_exists( 'GLPI_ITEM_DUE_DATE', $casevariablevalues )) { + $item_duedate = $casevariablevalues['GLPI_ITEM_DUE_DATE']; + } + $re = '/^(?\'date\'[0-9]{4}-[0-1][0-9]-[0-3][0-9])( (?\'time\'[0-2][0-9]:[0-5][0-9]:[0-5][0-9]))*$/'; + if (preg_match($re, $item_duedate, $matches) && !array_key_exists('time', $matches)) { + $item_duedate .= " 23:59:59"; + } + // reset those variables $resetcasevariables = []; foreach ($casevariables as $val) { @@ -2896,19 +2914,17 @@ public function derivateCase($myCase, $request, $users_id = null) { } $resultSave = $myCase->sendVariables($resetcasevariables); - // print_r( $pmRouteCaseResponse ) ; - // die() ; - // now manage tasks associated with item // switch own task to 'done' and create a new one - $this->solveTask($myCase->getID(), - $request['DEL_INDEX'], - ['txtToAppend' => $txtToAppendToTask, - 'users_id_tech' => $users_id, - 'begin' => $solvedTaskStartDate, - 'end' => $solvedTaskEndDate, - 'toInformation' => $solvedTaskSetToInformation - ] ); + $glpi_task = $this->solveTask($myCase->getID(), + $request['DEL_INDEX'], + ['txtToAppend' => $txtToAppendToTask, + 'users_id_tech' => $users_id, + 'begin' => $solvedTaskStartDate, + 'end' => $solvedTaskEndDate, + 'toInformation' => $solvedTaskSetToInformation + ] + ); // create a followup if requested if ($createFollowup && $itemtype == 'Ticket') { @@ -2920,8 +2936,9 @@ public function derivateCase($myCase, $request, $users_id = null) { $this->setItemTitle($itemtype, $items_id, $txtItemTitle); } - if ($itemSetStatus != '') { - $this->setItemStatus($itemtype, $items_id, $itemSetStatus ); + if ($item_duedate != '') { + // we are going to change the due date (time to resolve) of current GLPI Item + $this->setItemDuedate($itemtype, $items_id, $item_duedate); } if (array_key_exists( 'GLPI_ITEM_SET_SOLUTION_TEMPLATE_ID', $casevariablevalues ) @@ -2931,9 +2948,45 @@ public function derivateCase($myCase, $request, $users_id = null) { $this->setItemSolution($itemtype, $items_id, $casevariablevalues); } + if ($itemSetStatus != '') { + $this->setItemStatus($itemtype, $items_id, $itemSetStatus ); + } + // get the new case info $caseInfo = $myCase->getCaseInfo($request['DEL_INDEX']); // not sure that it should passed this + // create an information task if requested + if ($information_task != '' && $glpi_task) { + // create an information task and add comment + // $information_task is the content of the task + $pm_process = $myCase->getProcess(); + $taskCat = new TaskCategory; + $taskCat->getFromDB($glpi_task->fields['taskcategories_id']); + // we may replace ##casename## by the name of the case, and ##taskname## by the task name + $search = ['##casename##', + '##taskname##' + ]; + $replace = [$caseInfo->caseName." (".$myCase->getID().")", + DropdownTranslation::getTranslatedValue($glpi_task->fields['taskcategories_id'], 'TaskCategory', 'name', $_SESSION['glpilanguage'], $taskCat->fields['name']) + ]; + $info = str_replace($search, $replace, $information_task); + + $info .= ""; + + // unescape some chars and replace CRLF, CR or LF by
+ $info = str_replace(["\\'", '\\"', '\r\n', '\r', '\n'], ["'", '"', '
', '
', '
'], $info); + + $foreignkey = getForeignKeyFieldForItemType($glpi_task->getItilObjectItemType()); + $glpi_task->add([$foreignkey => $glpi_task->fields[$foreignkey], + 'is_private' => 1, + 'taskcategories_id' => $pm_process->fields['taskcategories_id'], + 'content' => $DB->escape($info), + 'users_id' => $this->taskWriter, + 'state' => Planning::INFO, + 'users_id_tech' => Session::getLoginUserID(), + ]); + } + // now create the new tasks if any if (property_exists( $pmRouteCaseResponse, 'routing' )) { @@ -2978,8 +3031,9 @@ public function derivateCase($myCase, $request, $users_id = null) { $sub_route->taskId, $sub_route->delThread, [ 'txtTaskContent' => $txtTaskContent, - 'start_date' => $taskStartDate, - 'end_date' => $taskEndDate] + 'start_date' => $taskStartDate, + 'end_date' => $taskEndDate, + 'reminder' => $taskReminder] ); // if end date was specified, then must change due date of the PM task @@ -3002,6 +3056,7 @@ public function derivateCase($myCase, $request, $users_id = null) { 'GLPI_TICKET_ID' => $items_id, 'GLPI_ITEM_ID' => $items_id, 'GLPI_ITEM_TYPE' => $itemtype, + 'GLPI_ITEM_STATUS' => $item->fields['status'], 'GLPI_TICKET_REQUESTER_GLPI_ID' => $requesters[0]['glpi_id'], 'GLPI_ITEM_REQUESTER_GLPI_ID' => $requesters[0]['glpi_id'], 'GLPI_TICKET_REQUESTER_PM_ID' => $requesters[0]['pm_id'], @@ -3010,20 +3065,26 @@ public function derivateCase($myCase, $request, $users_id = null) { 'GLPI_ITEM_TITLE' => $item->fields['name'], 'GLPI_TICKET_DESCRIPTION' => $item->fields['content'], 'GLPI_ITEM_DESCRIPTION' => $item->fields['content'], - 'GLPI_TICKET_DUE_DATE' => $item->fields['time_to_resolve'], 'GLPI_ITEM_OPENING_DATE' => $item->fields['date'], + 'GLPI_TICKET_DUE_DATE' => $item->fields['time_to_resolve'], 'GLPI_ITEM_DUE_DATE' => $item->fields['time_to_resolve'], 'GLPI_ITEM_ITIL_CATEGORY_ID' => $item->fields['itilcategories_id'], 'GLPI_TICKET_URGENCY' => $item->fields['urgency'], 'GLPI_ITEM_URGENCY' => $item->fields['urgency'], 'GLPI_ITEM_IMPACT' => $item->fields['impact'], 'GLPI_ITEM_PRIORITY' => $item->fields['priority'], - 'GLPI_TICKET_GLOBAL_VALIDATION' => $item->fields['global_validation'] , + // Specific to Tickets and Changes + // GLPI_ITEM_GLOBAL_VALIDATION will be '' when Problem, else it will be the global_validation field + 'GLPI_TICKET_GLOBAL_VALIDATION' => $itemtype == 'Problem' ? '' : $item->fields['global_validation'], + 'GLPI_ITEM_GLOBAL_VALIDATION' => $itemtype == 'Problem' ? '' : $item->fields['global_validation'], 'GLPI_TICKET_TECHNICIAN_GLPI_ID' => $users_id, 'GLPI_ITEM_TECHNICIAN_GLPI_ID' => $users_id, 'GLPI_TICKET_TECHNICIAN_PM_ID' => PluginProcessmakerUser::getPMUserId( $users_id ), 'GLPI_ITEM_TECHNICIAN_PM_ID' => PluginProcessmakerUser::getPMUserId( $users_id ), - 'GLPI_URL' => $CFG_GLPI['url_base'] + 'GLPI_URL' => $CFG_GLPI['url_base'], + // Specific to Tickets + // GLPI_TICKET_TYPE will contains 1 (= incident) or 2 (= request) + 'GLPI_TICKET_TYPE' => $itemtype == 'Ticket' ? $item->fields['type'] : '' ]; $subCase->sendVariables($glpi_variables); @@ -3042,8 +3103,9 @@ public function derivateCase($myCase, $request, $users_id = null) { $route->taskId, $route->delThread, [ 'txtTaskContent' => $txtTaskContent, - 'start_date' => $taskStartDate, - 'end_date' => $taskEndDate] + 'start_date' => $taskStartDate, + 'end_date' => $taskEndDate, + 'reminder' => $taskReminder] ); // if end date was specified, then must change due date of the PM task if ($taskEndDate != '') { @@ -3066,7 +3128,7 @@ public function derivateCase($myCase, $request, $users_id = null) { foreach ($parentCaseInfo->currentUsers as $open_task) { // must check if $open_task is not is_subprocess and is not already existing in the item $locTaskCat = new PluginProcessmakerTaskCategory; - $locTask = new PluginProcessmakerTask(); + $locTask = new PluginProcessmakerTask($itemtype.'Task'); if ($locTaskCat->getFromGUID($open_task->taskId) && !$locTaskCat->fields['is_subprocess'] && !$locTask->getFromDBByQuery("WHERE `plugin_processmaker_cases_id`={$parentCase->getID()} AND `plugin_processmaker_taskcategories_id`={$locTaskCat->getID()} AND `del_index`={$open_task->delIndex}")) { @@ -3075,17 +3137,18 @@ public function derivateCase($myCase, $request, $users_id = null) { $parentCaseInfo, $open_task->delIndex, PluginProcessmakerUser::getGLPIUserId($open_task->userId), - 0, + $groupId, $open_task->taskId, $open_task->delThread, [ 'txtTaskContent' => $txtTaskContent, - 'start_date' => $taskStartDate, - 'end_date' => $taskEndDate] + 'start_date' => $taskStartDate, + 'end_date' => $taskEndDate, + 'reminder' => $taskReminder] ); // if end date was specified, then must change due date of the PM task if ($taskEndDate != '') { - $PM_DB->query( "UPDATE APP_DELEGATION SET DEL_TASK_DUE_DATE='$taskEndDate' WHERE APP_UID='".$sub_caseInfo->caseId."' AND DEL_INDEX=".$open_task->delIndex); + $PM_DB->query( "UPDATE APP_DELEGATION SET DEL_TASK_DUE_DATE='$taskEndDate' WHERE APP_UID='".$parentCaseInfo->caseId."' AND DEL_INDEX=".$open_task->delIndex); } } } @@ -3098,6 +3161,15 @@ public function derivateCase($myCase, $request, $users_id = null) { // evolution of case status: DRAFT, TO_DO, COMPLETED, CANCELLED $myCase->update( [ 'id' => $myCase->getID(), 'case_status' => $caseInfo->caseStatus, 'name' => $caseInfo->caseName ] ); + // send email if requested + if (is_array($sendemail)) { + NotificationEvent::raiseEvent('send_email', + $myCase, + ['glpi_send_email' => $sendemail, + 'case' => $myCase + ]); + } + } @@ -3210,8 +3282,32 @@ static function showUnderMaintenance() { echo "
"; echo Html::image($CFG_GLPI['root_doc'].'/plugins/processmaker/pics/under_maintenance.png'); echo "

"; - __('ProcessMaker plugin is under maintenance, please retry later, thank you.', 'processmaker'); + echo __('ProcessMaker plugin is under maintenance, please retry later, thank you.', 'processmaker'); echo "

"; echo "
"; } -} + + + /** + * Summary of echoDomain + */ + function echoDomain() { + if (isset($this->config->fields['domain']) && $this->config->fields['domain'] != '') { + $script = " + (function() { + var id = 'commonDomainGlpiPmScript_Wjd4uWisWHLt9I'; + //debugger; + if ($('#' + id).length == 0) { + //debugger; + var d = document, g = d.createElement('script'), s = d.getElementsByTagName('script')[0]; + g.type = 'text/javascript'; + g.id = id; + g.text = 'try { document.domain = \'".$this->config->fields['domain']."\'; } catch(ev) { /*console.log(ev);*/ }'; + s.parentNode.insertBefore(g, s); + } + })();"; + + echo Html::scriptBlock($script); + } + } +} \ No newline at end of file diff --git a/inc/profile.class.php b/inc/profile.class.php index fa6690d..c83cdbe 100644 --- a/inc/profile.class.php +++ b/inc/profile.class.php @@ -20,7 +20,7 @@ static function getAllRights() { ['itemtype' => 'PluginProcessmakerConfig', 'label' => __('Cases', 'processmaker'), 'field' => 'plugin_processmaker_case', - 'rights' => [READ => __('Read'), CANCEL => __('Cancel', 'processmaker'), DELETE => __('Delete')]] + 'rights' => [READ => __('Read'), CANCEL => __('Cancel', 'processmaker'), DELETE => __('Delete'), ADHOC_REASSIGN => __('Ad Hoc user re-assign', 'processmaker')]] ]; return $rights; @@ -69,7 +69,7 @@ function showForm($ID = 0, $openform = true, $closeform = true) { * @param mixed $ID */ static function createAdminAccess($ID) { - self::addDefaultProfileInfos($ID, ['plugin_processmaker_config' => READ + UPDATE, 'plugin_processmaker_case' => READ + DELETE + CANCEL], true); + self::addDefaultProfileInfos($ID, ['plugin_processmaker_config' => READ + UPDATE, 'plugin_processmaker_case' => READ + DELETE + CANCEL + ADHOC_REASSIGN], true); } /** diff --git a/inc/selfservicedraft.class.php b/inc/selfservicedraft.class.php index 705d4bc..df45378 100644 --- a/inc/selfservicedraft.class.php +++ b/inc/selfservicedraft.class.php @@ -10,4 +10,4 @@ */ class PluginProcessmakerSelfservicedraft extends CommonDBTM { -} \ No newline at end of file +} diff --git a/inc/task.class.php b/inc/task.class.php index c6e02d6..0099e47 100644 --- a/inc/task.class.php +++ b/inc/task.class.php @@ -41,7 +41,7 @@ function getItilObjectItemType() { function getFromDB($items_id) { global $DB; - if ($this->getFromDBByQuery(" WHERE itemtype='".$this->itemtype."' AND items_id=$items_id;" )) { + if ($this->getFromDBByQuery(" WHERE itemtype='".$this->itemtype."' AND items_id='$items_id';" )) { $task = new $this->itemtype; if ($task->getFromDB( $items_id )) { // then we should add our own fields @@ -61,6 +61,15 @@ function getFromDB($items_id) { return false; } + + /** + * Summary of getPMTaskID + * @return mixed + */ + function getPMTaskID() { + return $this->fields['items_id']; + } + /** * Summary of getToDoTasks * returns all 'to do' tasks associated with this case @@ -319,22 +328,52 @@ static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtem } if (isset($currentUser)) { - if ($currentUser->userId && $task[$tabnum]['del_index']) { - // to load users for task re-assign only when task is not to be 'claimed' and if task is not a sub-case + if ($task[$tabnum]['del_index']) { + // to load users for task re-assign only when task is not a sub-case echo "
".__('Loading...')."
"; - echo ""; - } else { + + // try to get users whom can't be assigned to this task + // already assigned user can't be assigned again to this task + $current_assigned_user = PluginProcessmakerUser::getGLPIUserId($currentUser->userId); + // and then any forbiden users defined from the case itself + $casevariablevalues = $case->getVariables(['GLPI_TASK_PREVENT_REASSIGN']); + $prevent_assign = []; + if (array_key_exists( 'GLPI_TASK_PREVENT_REASSIGN', $casevariablevalues ) && $casevariablevalues[ 'GLPI_TASK_PREVENT_REASSIGN' ] != '') { + $prevent_assign = json_decode($casevariablevalues[ 'GLPI_TASK_PREVENT_REASSIGN' ], true); + } + + + $used_users = []; + $used_users[] = $current_assigned_user; + if (array_key_exists($currentUser->taskId, $prevent_assign)) { + if (!is_array($prevent_assign[$currentUser->taskId])) { + $prevent_assign[$currentUser->taskId] = [$prevent_assign[$currentUser->taskId]]; + } + foreach ($prevent_assign[$currentUser->taskId] as $pmuser) { + $usr_id = PluginProcessmakerUser::getGlpiIdFromAny($pmuser); + if ($usr_id) { + $used_users[] = $usr_id; + } + } + } + + $data = "{ + cases_id : {$case->getID()}, + items_id : {$case->fields['items_id']}, + itemtype : '{$case->fields['itemtype']}', + tasktype : '{$task[$tabnum]['itemtype']}', + tasks_id : {$task[$tabnum]['items_id']}, + users_id : {$current_assigned_user}, + taskGuid : '{$currentUser->taskId}', + delIndex : {$task[$tabnum]['del_index']}, + delThread : {$currentUser->delThread}, + used : [".join(',', array_unique($used_users))."] + }"; + echo html::scriptBlock("$('#divUsers-{$task[$tabnum]['del_index']}').load('".$CFG_GLPI["root_doc"]."/plugins/processmaker/ajax/task_users.php', $data);"); + } + + if (!$currentUser->userId || !$task[$tabnum]['del_index']) { // manages the claim // current task is to be claimed // get the assigned group to the item task @@ -347,22 +386,11 @@ static function displayTabContentForItem(CommonGLPI $case, $tabnum = 1, $withtem } } + $PM_SOAP->echoDomain(); echo ""; $csrf = Session::getNewCSRFToken(); - //echo "
"; $url = $PM_SOAP->serverURL ."/cases/cases_Open?sid=".$PM_SOAP->getPMSessionID() ."&APP_UID=".$case->fields['case_guid'] @@ -400,6 +428,42 @@ function urldecode(url) { } }); "); + } + + + /** + * Summary of sendNotification + * Will send either dedicated notification, or standard one + * @param string $type is 'task_add', 'task_reassign', 'task_done', 'task_reminder' + * @param CommonITILTask $task is the task (TicketTask,...) + * @param CommonITILObject $item is the ITIL item (Ticket,...) + * @param PluginProcessmakerCase $case is the case + */ + function sendNotification(string $type, CommonITILTask $task, CommonITILObject $item, PluginProcessmakerCase $case = null) { + // Notification management + // search if at least one active notification is existing for that pm task with that event 'task_update_'.$glpi_task->fields['taskcategories_id'] + $res = PluginProcessmakerNotificationTargetTask::getNotifications($type, $task->fields['taskcategories_id'], $item->fields['entities_id']); + if ($res['notifications'] && count($res['notifications']) > 0) { + NotificationEvent::raiseEvent($res['event'], + $this, + ['plugin_processmaker_cases_id' => $this->fields['plugin_processmaker_cases_id'], + 'itemtype' => $item->getType(), + 'task_id' => $task->getID(), + 'old_users_id_tech' => isset($task->oldvalues['users_id_tech']) ? $task->oldvalues['users_id_tech'] : 0, + 'is_private' => isset($task->fields['is_private']) ? $task->fields['is_private'] : 0, + 'entities_id' => $item->fields['entities_id'], + 'case' => $case, + 'obj' => $item + ]); + } else { + NotificationEvent::raiseEvent(PluginProcessmakerNotificationTargetTask::getDefaultGLPIEvents($type), + $item, + ['plugin_processmaker_cases_id' => $this->fields['plugin_processmaker_cases_id'], + 'itemtype' => $item->getType(), + 'task_id' => $task->getID(), + 'is_private' => isset($task->fields['is_private']) ? $task->fields['is_private'] : 0 + ]); + } } diff --git a/inc/taskcategory.class.php b/inc/taskcategory.class.php index d0952e1..46e773d 100644 --- a/inc/taskcategory.class.php +++ b/inc/taskcategory.class.php @@ -18,11 +18,19 @@ class PluginProcessmakerTaskCategory extends CommonDBTM { function getTabNameForItem(CommonGLPI $item, $withtemplate = 0) { - return __('Task List', 'processmaker'); + if ($item->getType() == 'TaskCategory') { + $pmtaskcat = new PluginProcessmakerTaskCategory; + if ($pmtaskcat->getFromDBbyCategory($item->fields['id'])) { + return __('Process task', 'processmaker'); + } else { + return ''; // means no tab + } + } + return __('Task list', 'processmaker'); } - static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { + static function displayTabContentForProcess(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { global $DB, $CFG_GLPI; self::title($item); @@ -86,6 +94,114 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtem return true; } + + /** + * Summary of displayTabContentForTaskCategory + * @param CommonGLPI $item + * @param mixed $tabnum + * @param mixed $withtemplate + * @return boolean + */ + static function displayTabContentForTaskCategory(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { + global $DB, $CFG_GLPI; + + $is_taskcat = false; + $processes_id = 0; + $pmtaskcat = new PluginProcessmakerTaskCategory; + $is_taskcat = $pmtaskcat->getFromDBbyCategory($item->fields['id']); + $processes_id = $pmtaskcat->fields['plugin_processmaker_processes_id']; + + echo "

"; + + echo ""; + echo ""; + echo ""; + + echo "" . + "" . + "" . + "" . + "" . + "" . + ""; + + $query = "SELECT pm.pm_task_guid, pm.taskcategories_id, pm.`is_start`, glp.name as 'pname', gl.name, gl.completename, gl.`comment`, pm.is_active, pm.is_subprocess FROM glpi_plugin_processmaker_taskcategories AS pm + LEFT JOIN glpi_taskcategories AS gl ON pm.taskcategories_id=gl.id + LEFT JOIN glpi_taskcategories AS glp ON glp.id=gl.taskcategories_id + WHERE pm.taskcategories_id=".$item->getID().";"; + + foreach ($DB->request($query) as $taskCat) { + echo ""; + + echo ""; + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + + echo ""; + } + echo "
".__('Process task', 'processmaker')."
".__('Process name', 'processmaker')."".__('Task name', 'processmaker')."".__('Complete name')."".__('Start', 'processmaker')."".__('Task GUID', 'processmaker')."".__('Comments')."".__('Active')."".__('Sub-process', 'processmaker')."
" . $taskCat['pname']; + if ($_SESSION["glpiis_ids_visible"]) { + echo " (" . $processes_id . ")"; + } + echo ""; + echo $taskCat['name']; + + if ($_SESSION["glpiis_ids_visible"]) { + echo " (" . $taskCat['taskcategories_id'] . ")"; + } + echo "" . $taskCat['completename'] . ""; + if ($taskCat['is_start']) { + echo "\""."; + } + echo "".$taskCat['pm_task_guid']."".$taskCat['comment'].""; + if ($taskCat['is_active']) { + echo "\""."; + } + echo ""; + if ($taskCat['is_subprocess']) { + echo "\""."; + } + echo "
"; + + return true; + } + + + /** + * Summary of displayTabContentForItem + * @param CommonGLPI $item + * @param mixed $tabnum + * @param mixed $withtemplate + * @return boolean + */ + static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtemplate = 0) { + $ret = false; + switch ($item->getType()) { + case 'PluginProcessmakerProcess': + $ret = self::displayTabContentForProcess($item, $tabnum, $withtemplate); + break; + case 'TaskCategory': + $ret = self::displayTabContentForTaskCategory($item, $tabnum, $withtemplate); + break; + } + return $ret; + } + /** * Print a good title for task categories tab * add button for re-synchro of taskcategory list (only if rigths are w) @@ -94,13 +210,14 @@ static function displayTabContentForItem(CommonGLPI $item, $tabnum = 1, $withtem static function title(CommonGLPI $item) { global $CFG_GLPI; - $buttons = []; - $title = __('Synchronize Task List', 'processmaker'); - if (Session::haveRight('plugin_processmaker_config', UPDATE)) { - $buttons["process.form.php?refreshtask=1&id=".$item->getID()] = $title; - Html::displayTitle($CFG_GLPI["root_doc"] . "/plugins/processmaker/pics/gears.png", $title, "", - $buttons); + $title = __('Synchronize Task List', 'processmaker'); + $buttons = ["process.form.php?refreshtask=1&id=".$item->getID() => $title]; + $pic = $CFG_GLPI["root_doc"] . "/plugins/processmaker/pics/gears.png"; + if ($item->fields['maintenance']) { + $pic = $CFG_GLPI["root_doc"] . "/plugins/processmaker/pics/verysmall-under_maintenance.png"; + } + Html::displayTitle($pic, $title, "", $buttons); } } diff --git a/inc/user.class.php b/inc/user.class.php index 9d3a007..2ed155f 100644 --- a/inc/user.class.php +++ b/inc/user.class.php @@ -30,13 +30,14 @@ static function getSqlSearchResult ($taskId, $count = true, $right = "all", $ent global $DB, $PM_DB, $CFG_GLPI; // first need to get all users from $taskId - //$db_pm = PluginProcessmakerConfig::getInstance()->getProcessMakerDB(); + $adhoc_users = Session::haveRight('plugin_processmaker_case', ADHOC_REASSIGN) ? 2 : -1; + // TU_TYPE in (1, 2) means 1 is normal user, 2 is for adhoc users $pmQuery = "SELECT GROUP_USER.USR_UID AS pm_user_id FROM TASK_USER - JOIN GROUP_USER ON GROUP_USER.GRP_UID=TASK_USER.USR_UID AND TASK_USER.TU_RELATION = 2 AND TASK_USER.TU_TYPE=1 + JOIN GROUP_USER ON GROUP_USER.GRP_UID=TASK_USER.USR_UID AND TASK_USER.TU_RELATION = 2 AND TASK_USER.TU_TYPE IN (1, $adhoc_users) WHERE TAS_UID = '$taskId' UNION SELECT TASK_USER.USR_UID AS pm_user_id FROM TASK_USER - WHERE TAS_UID = '$taskId' AND TASK_USER.TU_RELATION = 1 AND TASK_USER.TU_TYPE=1 ; "; + WHERE TAS_UID = '$taskId' AND TASK_USER.TU_RELATION = 1 AND TASK_USER.TU_TYPE IN (1, $adhoc_users); "; $pmUsers = [ ]; foreach ($PM_DB->request( $pmQuery ) as $pmUser) { $pmUsers[ ] = $pmUser[ 'pm_user_id' ]; @@ -50,7 +51,7 @@ static function getSqlSearchResult ($taskId, $count = true, $right = "all", $ent break; case "all" : - $where = " `glpi_users`.`id` > '1' "; + $where = " `glpi_users`.`id` > '0' "; break; } @@ -184,6 +185,7 @@ public static function getGLPIUserId($pmUserId) { return 0; } + /** * Summary of getPMUserId * returns processmaker user id for given GLPI user id @@ -191,13 +193,40 @@ public static function getGLPIUserId($pmUserId) { * @return string which is the uid of user in Processmaker database, or false if not found */ public static function getPMUserId($glpiUserId) { - $obj = new self; - if ($obj->getFromDB( Toolbox::cleanInteger($glpiUserId) )) { - return $obj->fields['pm_users_id']; + if (is_numeric($glpiUserId)) { + $obj = new self; + if ($obj->getFromDB($glpiUserId)) { + return $obj->fields['pm_users_id']; + } } return false; } + + /** + * Summary of getGlpiIdFromAny + * Returns the GLPI id of the user or false if not found + * Accept either PM GUID, GLPI logon, or GLPI ID + * @param $any + * @return mixed GLPI ID of the user or false if not found + */ + public static function getGlpiIdFromAny($any) { + $ret = self::getGLPIUserId($any); + if ($ret) { + return $ret; + } + $ret = self::getPMUserId($any); + if ($ret) { + return $any; + } + $usr = new User; + if ($usr->getFromDBbyName($any)) { + return $usr->getId(); + } + return false; + } + + ///** // * Summary of getNewPassword // * @param mixed $username diff --git a/install/install.php b/install/install.php index ec0b43d..0f1825d 100644 --- a/install/install.php +++ b/install/install.php @@ -4,29 +4,10 @@ function processmaker_install() { global $DB; // installation from scratch - include_once(GLPI_ROOT."/plugins/processmaker/setup.php"); - $info = plugin_version_processmaker(); - switch ($info['version']) { - case '3.3.0' : - $version = '3.3.0'; - break; - case '3.3.1' : - case '3.3.2' : - case '3.3.3' : - case '3.3.4' : - case '3.3.5' : - case '3.3.6' : - case '3.3.7' : - $version = '3.3.1'; - break; - case '3.3.8' : - default : - $version = '3.3.8'; - break; - } - $DB->runFile(GLPI_ROOT . "/plugins/processmaker/install/mysql/$version-empty.sql"); + $DB->runFile(GLPI_ROOT . "/plugins/processmaker/install/mysql/processmaker-empty.sql"); // add configuration singleton $query = "INSERT INTO `glpi_plugin_processmaker_configs` (`id`) VALUES (1);"; $DB->query( $query ) or die("error creating default record in glpi_plugin_processmaker_configs" . $DB->error()); + } diff --git a/install/mysql/3.2.8-empty.sql b/install/mysql/3.2.8-empty.sql deleted file mode 100644 index 6a217a1..0000000 --- a/install/mysql/3.2.8-empty.sql +++ /dev/null @@ -1,167 +0,0 @@ -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET NAMES utf8 */; -/*!50503 SET NAMES utf8mb4 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; - --- Dumping structure for table glpi.glpi_plugin_processmaker_caselinkactions -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinkactions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_caselinks_id` int(11) DEFAULT NULL, - `name` varchar(255) NOT NULL, - `value` text, - PRIMARY KEY (`id`), - UNIQUE KEY `caselinks_id_name` (`plugin_processmaker_caselinks_id`,`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_caselinks -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `is_active` tinyint(1) NOT NULL DEFAULT '0', - `is_externaldata` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas', - `is_self` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self', - `sourcetask_guid` varchar(32) DEFAULT NULL, - `targettask_guid` varchar(32) DEFAULT NULL, - `targetprocess_guid` varchar(32) DEFAULT NULL, - `targetdynaform_guid` varchar(32) DEFAULT NULL, - `sourcecondition` text, - `is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0', - `externalapplication` text, - `date_mod` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `is_active` (`is_active`), - KEY `is_externaldata` (`is_externaldata`), - KEY `is_self` (`is_self`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_cases -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` ( - `id` varchar(32) NOT NULL, - `items_id` int(11) NOT NULL, - `itemtype` varchar(10) NOT NULL DEFAULT 'Ticket', - `case_num` int(11) NOT NULL, - `case_status` varchar(20) NOT NULL DEFAULT 'DRAFT', - `processes_id` int(11) DEFAULT NULL, - UNIQUE KEY `items` (`itemtype`,`items_id`), - KEY `case_status` (`case_status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_configs -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(50) NOT NULL DEFAULT 'ProcessMaker', - `pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://localhost/', - `pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow', - `pm_admin_user` varchar(255) DEFAULT NULL, - `pm_admin_passwd` varchar(255) DEFAULT NULL, - `pm_theme` varchar(50) NOT NULL DEFAULT 'glpi_classic', - `date_mod` timestamp NULL DEFAULT NULL, - `taskcategories_id` int(11) DEFAULT NULL, - `users_id` int(11) DEFAULT NULL, - `pm_group_guid` varchar(32) DEFAULT NULL, - `comment` text, - `pm_dbserver_name` varchar(255) DEFAULT 'localhost', - `pm_dbname` varchar(50) DEFAULT 'wf_workflow', - `pm_dbserver_user` varchar(255) DEFAULT NULL, - `pm_dbserver_passwd` varchar(255) DEFAULT NULL, - `domain` varchar(50) DEFAULT '', - `maintenance` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_caselinks_id` int(11) DEFAULT NULL, - `itemtype` varchar(100) NOT NULL, - `items_id` int(11) NOT NULL DEFAULT '0', - `users_id` int(11) NOT NULL DEFAULT '0', - `is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0', - `postdata` mediumtext, - `logs_out` mediumtext, - `state` int(11) NOT NULL, - `date_mod` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_processes -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `process_guid` varchar(32) NOT NULL, - `name` varchar(255) NOT NULL, - `is_active` tinyint(1) NOT NULL DEFAULT '0', - `hide_case_num_title` tinyint(1) NOT NULL DEFAULT '0', - `insert_task_comment` tinyint(1) NOT NULL DEFAULT '0', - `comment` text, - `taskcategories_id` int(11) DEFAULT NULL, - `itilcategories_id` int(11) NOT NULL DEFAULT '0', - `type` int(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets', - `date_mod` timestamp NULL DEFAULT NULL, - `project_type` varchar(50) NOT NULL DEFAULT 'classic', - PRIMARY KEY (`id`), - UNIQUE KEY `process_guid` (`process_guid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes_profiles` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `processes_id` int(11) NOT NULL DEFAULT '0', - `profiles_id` int(11) NOT NULL DEFAULT '0', - `entities_id` int(11) NOT NULL DEFAULT '0', - `is_recursive` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - KEY `entities_id` (`entities_id`), - KEY `profiles_id` (`profiles_id`), - KEY `processes_id` (`processes_id`), - KEY `is_recursive` (`is_recursive`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_taskcategories` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `processes_id` int(11) NOT NULL, - `pm_task_guid` varchar(32) NOT NULL, - `taskcategories_id` int(11) NOT NULL, - `start` bit(1) NOT NULL DEFAULT b'0', - `is_active` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - UNIQUE KEY `pm_task_guid` (`pm_task_guid`), - UNIQUE KEY `items` (`taskcategories_id`), - KEY `processes_id` (`processes_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_tasks -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `items_id` int(11) NOT NULL, - `itemtype` varchar(32) NOT NULL, - `case_id` varchar(32) NOT NULL, - `del_index` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `case_id` (`case_id`,`del_index`), - UNIQUE KEY `items` (`itemtype`,`items_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_users -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `pm_users_id` varchar(32) NOT NULL, - `password` varchar(32) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `pm_users_id` (`pm_users_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; -/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/install/mysql/3.2.9-empty.sql b/install/mysql/3.2.9-empty.sql deleted file mode 100644 index 3ee30cd..0000000 --- a/install/mysql/3.2.9-empty.sql +++ /dev/null @@ -1,168 +0,0 @@ -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET NAMES utf8 */; -/*!50503 SET NAMES utf8mb4 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; - --- Dumping structure for table glpi.glpi_plugin_processmaker_caselinkactions -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinkactions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_caselinks_id` int(11) DEFAULT NULL, - `name` varchar(255) NOT NULL, - `value` text, - PRIMARY KEY (`id`), - UNIQUE KEY `caselinks_id_name` (`plugin_processmaker_caselinks_id`,`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_caselinks -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `is_active` tinyint(1) NOT NULL DEFAULT '0', - `is_externaldata` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas', - `is_self` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self', - `sourcetask_guid` varchar(32) DEFAULT NULL, - `targettask_guid` varchar(32) DEFAULT NULL, - `targetprocess_guid` varchar(32) DEFAULT NULL, - `targetdynaform_guid` varchar(32) DEFAULT NULL, - `sourcecondition` text, - `is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0', - `externalapplication` text, - `date_mod` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `is_active` (`is_active`), - KEY `is_externaldata` (`is_externaldata`), - KEY `is_self` (`is_self`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_cases -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` ( - `id` varchar(32) NOT NULL, - `items_id` int(11) NOT NULL, - `itemtype` varchar(10) NOT NULL DEFAULT 'Ticket', - `case_num` int(11) NOT NULL, - `case_status` varchar(20) NOT NULL DEFAULT 'DRAFT', - `processes_id` int(11) DEFAULT NULL, - UNIQUE KEY `items` (`itemtype`,`items_id`), - KEY `case_status` (`case_status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_configs -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(50) NOT NULL DEFAULT 'ProcessMaker', - `pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://localhost/', - `pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow', - `pm_admin_user` varchar(255) DEFAULT NULL, - `pm_admin_passwd` varchar(255) DEFAULT NULL, - `pm_theme` varchar(50) NOT NULL DEFAULT 'glpi_classic', - `date_mod` timestamp NULL DEFAULT NULL, - `taskcategories_id` int(11) DEFAULT NULL, - `users_id` int(11) DEFAULT NULL, - `pm_group_guid` varchar(32) DEFAULT NULL, - `comment` text, - `pm_dbserver_name` varchar(255) DEFAULT 'localhost', - `pm_dbname` varchar(50) DEFAULT 'wf_workflow', - `pm_dbserver_user` varchar(255) DEFAULT NULL, - `pm_dbserver_passwd` varchar(255) DEFAULT NULL, - `domain` varchar(50) DEFAULT '', - `maintenance` tinyint(1) NOT NULL DEFAULT '0', - `db_version` varchar(10) NOT NULL DEFAULT '3.2.9', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_caselinks_id` int(11) DEFAULT NULL, - `itemtype` varchar(100) NOT NULL, - `items_id` int(11) NOT NULL DEFAULT '0', - `users_id` int(11) NOT NULL DEFAULT '0', - `is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0', - `postdata` mediumtext, - `logs_out` mediumtext, - `state` int(11) NOT NULL, - `date_mod` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_processes -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `process_guid` varchar(32) NOT NULL, - `name` varchar(255) NOT NULL, - `is_active` tinyint(1) NOT NULL DEFAULT '0', - `hide_case_num_title` tinyint(1) NOT NULL DEFAULT '0', - `insert_task_comment` tinyint(1) NOT NULL DEFAULT '0', - `comment` text, - `taskcategories_id` int(11) DEFAULT NULL, - `itilcategories_id` int(11) NOT NULL DEFAULT '0', - `type` int(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets', - `date_mod` timestamp NULL DEFAULT NULL, - `project_type` varchar(50) NOT NULL DEFAULT 'classic', - PRIMARY KEY (`id`), - UNIQUE KEY `process_guid` (`process_guid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes_profiles` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `processes_id` int(11) NOT NULL DEFAULT '0', - `profiles_id` int(11) NOT NULL DEFAULT '0', - `entities_id` int(11) NOT NULL DEFAULT '0', - `is_recursive` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - KEY `entities_id` (`entities_id`), - KEY `profiles_id` (`profiles_id`), - KEY `processes_id` (`processes_id`), - KEY `is_recursive` (`is_recursive`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_taskcategories` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `processes_id` int(11) NOT NULL, - `pm_task_guid` varchar(32) NOT NULL, - `taskcategories_id` int(11) NOT NULL, - `start` bit(1) NOT NULL DEFAULT b'0', - `is_active` tinyint(1) NOT NULL DEFAULT '1', - PRIMARY KEY (`id`), - UNIQUE KEY `pm_task_guid` (`pm_task_guid`), - UNIQUE KEY `items` (`taskcategories_id`), - KEY `processes_id` (`processes_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_tasks -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `items_id` int(11) NOT NULL, - `itemtype` varchar(32) NOT NULL, - `case_id` varchar(32) NOT NULL, - `del_index` int(11) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `case_id` (`case_id`,`del_index`), - UNIQUE KEY `items` (`itemtype`,`items_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_users -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `pm_users_id` varchar(32) NOT NULL, - `password` varchar(32) DEFAULT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `pm_users_id` (`pm_users_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; -/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/install/mysql/3.3.0-empty.sql b/install/mysql/3.3.0-empty.sql deleted file mode 100644 index 3049ca9..0000000 --- a/install/mysql/3.3.0-empty.sql +++ /dev/null @@ -1,179 +0,0 @@ -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET NAMES utf8 */; -/*!50503 SET NAMES utf8mb4 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; - --- Dumping structure for table glpi.glpi_plugin_processmaker_caselinkactions -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinkactions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_caselinks_id` int(11) DEFAULT NULL, - `name` varchar(255) NOT NULL, - `value` text, - PRIMARY KEY (`id`), - UNIQUE KEY `caselinks_id_name` (`plugin_processmaker_caselinks_id`,`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_caselinks -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `is_active` tinyint(1) NOT NULL DEFAULT '0', - `is_externaldata` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas', - `is_self` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self', - `sourcetask_guid` varchar(32) DEFAULT NULL, - `targettask_guid` varchar(32) DEFAULT NULL, - `targetprocess_guid` varchar(32) DEFAULT NULL, - `targetdynaform_guid` varchar(32) DEFAULT NULL, - `sourcecondition` text, - `is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0', - `externalapplication` text, - `date_mod` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `is_active` (`is_active`), - KEY `is_externaldata` (`is_externaldata`), - KEY `is_self` (`is_self`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_cases -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` ( - `id` INT(11) NOT NULL, - `itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket', - `items_id` INT(11) NOT NULL, - `entities_id` INT(11) NOT NULL DEFAULT '0', - `name` MEDIUMTEXT NOT NULL DEFAULT '', - `case_guid` VARCHAR(32) NOT NULL, - `case_status` VARCHAR(20) NOT NULL DEFAULT 'DRAFT', - `plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL, - `plugin_processmaker_cases_id` INT(11) NULL DEFAULT NULL, - INDEX `items` (`itemtype`, `items_id`), - INDEX `case_status` (`case_status`), - PRIMARY KEY (`id`), - UNIQUE INDEX `case_guid` (`case_guid`), - INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`), - INDEX `plugin_processmaker_cases_id` (`plugin_processmaker_cases_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_configs -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(50) NOT NULL DEFAULT 'ProcessMaker', - `pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://localhost/', - `pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow', - `pm_admin_user` varchar(255) DEFAULT NULL, - `pm_admin_passwd` varchar(255) DEFAULT NULL, - `pm_theme` varchar(50) NOT NULL DEFAULT 'glpi_classic', - `date_mod` timestamp NULL DEFAULT NULL, - `taskcategories_id` int(11) DEFAULT NULL, - `users_id` int(11) DEFAULT NULL, - `pm_group_guid` varchar(32) DEFAULT NULL, - `comment` text, - `pm_dbserver_name` varchar(255) DEFAULT 'localhost', - `pm_dbname` varchar(50) DEFAULT 'wf_workflow', - `pm_dbserver_user` varchar(255) DEFAULT NULL, - `pm_dbserver_passwd` varchar(255) DEFAULT NULL, - `domain` varchar(50) DEFAULT '', - `maintenance` tinyint(1) NOT NULL DEFAULT '0', - `db_version` varchar(10) NOT NULL DEFAULT '3.3.0', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_caselinks_id` int(11) DEFAULT NULL, - `plugin_processmaker_cases_id` int(11) DEFAULT '0', - `users_id` int(11) NOT NULL DEFAULT '0', - `is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0', - `postdata` mediumtext, - `logs_out` mediumtext, - `state` int(11) NOT NULL, - `date_mod` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_processes -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `process_guid` varchar(32) NOT NULL, - `name` varchar(255) NOT NULL, - `is_active` tinyint(1) NOT NULL DEFAULT '0', - `hide_case_num_title` tinyint(1) NOT NULL DEFAULT '0', - `insert_task_comment` tinyint(1) NOT NULL DEFAULT '0', - `comment` text, - `taskcategories_id` int(11) DEFAULT NULL, - `itilcategories_id` int(11) NOT NULL DEFAULT '0', - `type` int(11) NOT NULL DEFAULT '1' COMMENT 'Only used for Tickets', - `date_mod` timestamp NULL DEFAULT NULL, - `project_type` varchar(50) NOT NULL DEFAULT 'classic', - PRIMARY KEY (`id`), - UNIQUE KEY `process_guid` (`process_guid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles -CREATE TABLE `glpi_plugin_processmaker_processes_profiles` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_processes_id` int(11) NOT NULL, - `profiles_id` int(11) NOT NULL, - `entities_id` int(11) NOT NULL, - `is_recursive` tinyint(1) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE INDEX `plugin_processmaker_processes_id_profiles_id_entities_id` (`plugin_processmaker_processes_id`, `profiles_id`, `entities_id`), - KEY `entities_id` (`entities_id`), - KEY `profiles_id` (`profiles_id`), - KEY `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`), - KEY `is_recursive` (`is_recursive`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories -CREATE TABLE `glpi_plugin_processmaker_taskcategories` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_processes_id` INT(11) NOT NULL, - `pm_task_guid` VARCHAR(32) NOT NULL, - `taskcategories_id` INT(11) NOT NULL, - `is_start` TINYINT(1) NOT NULL DEFAULT '0', - `is_active` TINYINT(1) NOT NULL DEFAULT '1', - `is_subprocess` TINYINT(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE INDEX `pm_task_guid` (`pm_task_guid`), - UNIQUE INDEX `items` (`taskcategories_id`), - INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_tasks -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `items_id` int(11) NOT NULL, - `itemtype` varchar(32) NOT NULL, - `plugin_processmaker_cases_id` int(11) NOT NULL, - `plugin_processmaker_taskcategories_id` int(11) NOT NULL, - `del_index` int(11) NOT NULL, - `del_thread` INT(11) NOT NULL, - `del_thread_status` varchar(32) NOT NULL DEFAULT 'OPEN', - PRIMARY KEY (`id`), - UNIQUE KEY `tasks` (`plugin_processmaker_cases_id`,`del_index`), - UNIQUE KEY `items` (`itemtype`,`items_id`), - KEY `del_thread_status` (`del_thread_status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_users -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `pm_users_id` varchar(32) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `pm_users_id` (`pm_users_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; -/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/install/mysql/3.3.1-empty.sql b/install/mysql/3.3.1-empty.sql deleted file mode 100644 index cb7d897..0000000 --- a/install/mysql/3.3.1-empty.sql +++ /dev/null @@ -1,186 +0,0 @@ -/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; -/*!40101 SET NAMES utf8 */; -/*!50503 SET NAMES utf8mb4 */; -/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; -/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; - --- Dumping structure for table glpi.glpi_plugin_processmaker_caselinkactions -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinkactions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_caselinks_id` int(11) DEFAULT NULL, - `name` varchar(255) NOT NULL, - `value` text, - PRIMARY KEY (`id`), - UNIQUE KEY `caselinks_id_name` (`plugin_processmaker_caselinks_id`,`name`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_caselinks -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_caselinks` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(255) NOT NULL, - `is_active` tinyint(1) NOT NULL DEFAULT '0', - `is_externaldata` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:insert data from case,1:wait for external application to set datas', - `is_self` tinyint(1) NOT NULL DEFAULT '0' COMMENT '0:use linked tickets, 1:use self', - `sourcetask_guid` varchar(32) DEFAULT NULL, - `targettask_guid` varchar(32) DEFAULT NULL, - `targetprocess_guid` varchar(32) DEFAULT NULL, - `targetdynaform_guid` varchar(32) DEFAULT NULL, - `sourcecondition` text, - `is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0', - `is_targettoreassign` TINYINT(1) NOT NULL DEFAULT '0', - `is_targettoimpersonate` TINYINT(1) NOT NULL DEFAULT '0', - `externalapplication` TEXT NULL, - `is_synchronous` TINYINT(1) NOT NULL DEFAULT '0', - `date_mod` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `is_active` (`is_active`), - KEY `is_externaldata` (`is_externaldata`), - KEY `is_self` (`is_self`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_cases -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` ( - `id` INT(11) NOT NULL, - `itemtype` VARCHAR(10) NOT NULL DEFAULT 'Ticket', - `items_id` INT(11) NOT NULL, - `entities_id` INT(11) NOT NULL DEFAULT '0', - `name` MEDIUMTEXT NOT NULL DEFAULT '', - `case_guid` VARCHAR(32) NOT NULL, - `case_status` VARCHAR(20) NOT NULL DEFAULT 'DRAFT', - `plugin_processmaker_processes_id` INT(11) NULL DEFAULT NULL, - `plugin_processmaker_cases_id` INT(11) NULL DEFAULT NULL, - INDEX `items` (`itemtype`, `items_id`), - INDEX `case_status` (`case_status`), - PRIMARY KEY (`id`), - UNIQUE INDEX `case_guid` (`case_guid`), - INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`), - INDEX `plugin_processmaker_cases_id` (`plugin_processmaker_cases_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_configs -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `name` varchar(50) NOT NULL DEFAULT 'ProcessMaker', - `pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://localhost/', - `pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow', - `pm_admin_user` varchar(255) DEFAULT NULL, - `pm_admin_passwd` varchar(255) DEFAULT NULL, - `pm_theme` varchar(50) NOT NULL DEFAULT 'glpi_classic', - `date_mod` timestamp NULL DEFAULT NULL, - `taskcategories_id` int(11) DEFAULT NULL, - `users_id` int(11) DEFAULT NULL, - `pm_group_guid` varchar(32) DEFAULT NULL, - `comment` text, - `pm_dbserver_name` varchar(255) DEFAULT 'localhost', - `pm_dbname` varchar(50) DEFAULT 'wf_workflow', - `pm_dbserver_user` varchar(255) DEFAULT NULL, - `pm_dbserver_passwd` varchar(255) DEFAULT NULL, - `domain` varchar(50) DEFAULT '', - `maintenance` tinyint(1) NOT NULL DEFAULT '0', - `db_version` varchar(10) NOT NULL DEFAULT '3.3.0', - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_crontaskactions -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_crontaskactions` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_caselinks_id` int(11) DEFAULT NULL, - `plugin_processmaker_cases_id` int(11) DEFAULT '0', - `users_id` int(11) NOT NULL DEFAULT '0', - `is_targettoclaim` tinyint(1) NOT NULL DEFAULT '0', - `postdata` mediumtext, - `logs_out` mediumtext, - `state` int(11) NOT NULL, - `date_mod` timestamp NULL DEFAULT NULL, - PRIMARY KEY (`id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_processes -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `process_guid` varchar(32) NOT NULL, - `name` varchar(255) NOT NULL, - `is_active` tinyint(1) NOT NULL DEFAULT '0', - `hide_case_num_title` tinyint(1) NOT NULL DEFAULT '0', - `insert_task_comment` tinyint(1) NOT NULL DEFAULT '0', - `comment` text, - `taskcategories_id` int(11) DEFAULT NULL, - `itilcategories_id` int(11) NOT NULL DEFAULT '0', - `type` int(11) NOT NULL DEFAULT '1' COMMENT 'Only used for self-service Tickets', - `date_mod` timestamp NULL DEFAULT NULL, - `project_type` varchar(50) NOT NULL DEFAULT 'classic', - `is_change` tinyint(1) NOT NULL DEFAULT '0', - `is_problem` tinyint(1) NOT NULL DEFAULT '0', - `is_incident` tinyint(1) NOT NULL DEFAULT '0', - `is_request` tinyint(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE KEY `process_guid` (`process_guid`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_processes_profiles -CREATE TABLE `glpi_plugin_processmaker_processes_profiles` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_processes_id` int(11) NOT NULL, - `profiles_id` int(11) NOT NULL, - `entities_id` int(11) NOT NULL, - `is_recursive` tinyint(1) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE INDEX `plugin_processmaker_processes_id_profiles_id_entities_id` (`plugin_processmaker_processes_id`, `profiles_id`, `entities_id`), - KEY `entities_id` (`entities_id`), - KEY `profiles_id` (`profiles_id`), - KEY `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`), - KEY `is_recursive` (`is_recursive`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8 ; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_taskcategories -CREATE TABLE `glpi_plugin_processmaker_taskcategories` ( - `id` INT(11) NOT NULL AUTO_INCREMENT, - `plugin_processmaker_processes_id` INT(11) NOT NULL, - `pm_task_guid` VARCHAR(32) NOT NULL, - `taskcategories_id` INT(11) NOT NULL, - `is_start` TINYINT(1) NOT NULL DEFAULT '0', - `is_active` TINYINT(1) NOT NULL DEFAULT '1', - `is_subprocess` TINYINT(1) NOT NULL DEFAULT '0', - PRIMARY KEY (`id`), - UNIQUE INDEX `pm_task_guid` (`pm_task_guid`), - UNIQUE INDEX `items` (`taskcategories_id`), - INDEX `plugin_processmaker_processes_id` (`plugin_processmaker_processes_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_tasks -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_tasks` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `items_id` int(11) NOT NULL, - `itemtype` varchar(32) NOT NULL, - `plugin_processmaker_cases_id` int(11) NOT NULL, - `plugin_processmaker_taskcategories_id` int(11) NOT NULL, - `del_index` int(11) NOT NULL, - `del_thread` INT(11) NOT NULL, - `del_thread_status` varchar(32) NOT NULL DEFAULT 'OPEN', - PRIMARY KEY (`id`), - UNIQUE KEY `tasks` (`plugin_processmaker_cases_id`,`del_index`), - UNIQUE KEY `items` (`itemtype`,`items_id`), - KEY `del_thread_status` (`del_thread_status`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - --- Dumping structure for table glpi.glpi_plugin_processmaker_users -CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_users` ( - `id` int(11) NOT NULL AUTO_INCREMENT, - `pm_users_id` varchar(32) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `pm_users_id` (`pm_users_id`) -) ENGINE=InnoDB DEFAULT CHARSET=utf8; - - -/*!40101 SET SQL_MODE=IFNULL(@OLD_SQL_MODE, '') */; -/*!40014 SET FOREIGN_KEY_CHECKS=IF(@OLD_FOREIGN_KEY_CHECKS IS NULL, 1, @OLD_FOREIGN_KEY_CHECKS) */; -/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; diff --git a/install/mysql/3.3.8-empty.sql b/install/mysql/processmaker-empty.sql similarity index 96% rename from install/mysql/3.3.8-empty.sql rename to install/mysql/processmaker-empty.sql index a5be338..3e8dd8d 100644 --- a/install/mysql/3.3.8-empty.sql +++ b/install/mysql/processmaker-empty.sql @@ -64,7 +64,7 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_cases` ( CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(50) NOT NULL DEFAULT 'ProcessMaker', - `pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://localhost/', + `pm_server_URL` varchar(250) NOT NULL DEFAULT 'http://itsm-pm.acme.com/', `pm_workspace` varchar(50) NOT NULL DEFAULT 'workflow', `pm_admin_user` varchar(255) DEFAULT NULL, `pm_admin_passwd` varchar(255) DEFAULT NULL, @@ -81,7 +81,8 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_configs` ( `domain` varchar(50) DEFAULT '', `maintenance` tinyint(1) NOT NULL DEFAULT '0', `ssl_verify` tinyint(1) NOT NULL DEFAULT '0', - `db_version` varchar(10) NOT NULL DEFAULT '3.3.8', + `db_version` varchar(10) NOT NULL DEFAULT '3.4.10', + `max_cases_per_item` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; @@ -119,6 +120,8 @@ CREATE TABLE IF NOT EXISTS `glpi_plugin_processmaker_processes` ( `is_problem` tinyint(1) NOT NULL DEFAULT '0', `is_incident` tinyint(1) NOT NULL DEFAULT '0', `is_request` tinyint(1) NOT NULL DEFAULT '0', + `maintenance` TINYINT(1) NOT NULL DEFAULT '0', + `max_cases_per_item` int(11) NOT NULL DEFAULT '0', PRIMARY KEY (`id`), UNIQUE KEY `process_guid` (`process_guid`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8; diff --git a/install/update.php b/install/update.php index 06f713a..78b4c60 100644 --- a/install/update.php +++ b/install/update.php @@ -11,6 +11,9 @@ function processmaker_update() { include_once(GLPI_ROOT."/plugins/processmaker/inc/config.class.php"); $config = PluginProcessmakerConfig::getInstance(); $current_version = $config->fields['db_version']; + if (empty($current_version)) { + $current_version = '2.4.1'; + } } switch ($current_version) { @@ -37,6 +40,14 @@ function processmaker_update() { // will upgrade 3.3.1 to 3.3.8 include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_1_to_3_3_8.php"); $new_version = update_3_3_1_to_3_3_8(); + case '3.3.8' : + // will upgrade 3.3.8 to 3.4.9 + include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_3_8_to_3_4_9.php"); + $new_version = update_3_3_8_to_3_4_9(); + case '3.4.9' : + // will upgrade 3.4.9 to 3.4.10 + include_once(GLPI_ROOT."/plugins/processmaker/install/update_3_4_9_to_3_4_10.php"); + $new_version = update_3_4_9_to_3_4_10(); } if (isset($new_version)) { diff --git a/install/update_3_3_1_to_3_3_8.php b/install/update_3_3_1_to_3_3_8.php index ebac746..1a4e4f7 100644 --- a/install/update_3_3_1_to_3_3_8.php +++ b/install/update_3_3_1_to_3_3_8.php @@ -1,6 +1,6 @@ fieldExists("glpi_plugin_processmaker_configs", "max_cases_per_item" )) { + $query = "ALTER TABLE `glpi_plugin_processmaker_configs` + ADD COLUMN `max_cases_per_item` INT(11) NOT NULL DEFAULT '0' AFTER `db_version`;"; + + $DB->query($query) or die("error adding max_cases_per_item to glpi_plugin_processmaker_configs table" . $DB->error()); + } + + // Alter table glpi_plugin_processmaker_processes + if (!$DB->fieldExists("glpi_plugin_processmaker_processes", "maintenance" )) { + $query = "ALTER TABLE `glpi_plugin_processmaker_processes` + ADD COLUMN `maintenance` TINYINT(1) NOT NULL DEFAULT '0' AFTER `is_request`;"; + + $DB->query($query) or die("error adding maintenance to glpi_plugin_processmaker_processes table" . $DB->error()); + } + // Alter table glpi_plugin_processmaker_processes + if (!$DB->fieldExists("glpi_plugin_processmaker_processes", "max_cases_per_item" )) { + $query = "ALTER TABLE `glpi_plugin_processmaker_processes` + ADD COLUMN `max_cases_per_item` INT(11) NOT NULL DEFAULT '0' AFTER `maintenance`;"; + + $DB->query($query) or die("error adding max_cases_per_item to glpi_plugin_processmaker_processes table" . $DB->error()); + } + + return '3.4.9'; +} \ No newline at end of file diff --git a/install/update_3_4_9_to_3_4_10.php b/install/update_3_4_9_to_3_4_10.php new file mode 100644 index 0000000..365cbc1 --- /dev/null +++ b/install/update_3_4_9_to_3_4_10.php @@ -0,0 +1,12 @@ +query($query) or die("error when updating event field in glpi_notifications" . $DB->error()); + + return '3.4.10'; +} \ No newline at end of file diff --git a/install/update_to_3_2_8.php b/install/update_to_3_2_8.php index 47f48df..d9784b3 100644 --- a/install/update_to_3_2_8.php +++ b/install/update_to_3_2_8.php @@ -71,7 +71,7 @@ function update_to_3_2_8() { } } - if (!$DB->fieldExists('glpi_plugin_processmaker_users', 'password')) { + if (!$DB->fieldExists('glpi_plugin_processmaker_users', 'password') && !$DB->fieldExists('glpi_plugin_processmaker_users', 'id')) { $query = "ALTER TABLE `glpi_plugin_processmaker_users` ADD COLUMN `id` INT NOT NULL AUTO_INCREMENT FIRST, ADD COLUMN `password` VARCHAR(32) NULL DEFAULT NULL AFTER `pm_users_id`, diff --git a/js/cases.helpdesk.js b/js/cases.helpdesk.js index b846e59..fb1c062 100644 --- a/js/cases.helpdesk.js +++ b/js/cases.helpdesk.js @@ -21,7 +21,7 @@ function onClickContinue(obj) { // hide the iFrame caseIFrame.style.visibility = 'hidden'; - // trigger a click on the 'add' button of the ticket + // trigger a click on the 'add' button of the ticket submitButton.click(); } @@ -59,17 +59,17 @@ function onLoadFrame( evt, caseId, delIndex, caseNumber, processName ) { if (caseIFrame != undefined && contentDocument) { var buttonContinue = contentDocument.getElementById('form[btnGLPISendRequest]'); var linkList = contentDocument.getElementsByTagName('a'); - + 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 //debugger; bGLPIHideElement(linkList, 'href', 'cases_Step?TYPE=ASSIGN_TASK&UID=-1&POSITION=10000&ACTION=ASSIGN'); - + oldHandler = buttonContinue.onclick; buttonContinue.onclick = onClickContinue; - + submitButton = $("input[name='add'][type=submit]")[0]; submitButton.insertAdjacentHTML('beforebegin', ""); submitButton.insertAdjacentHTML('beforebegin', ""); @@ -116,4 +116,4 @@ function redimTaskFrame(taskFrame) { taskFrame.height = newHeight; } catch (e) { } -} \ No newline at end of file +} diff --git a/js/cases.js b/js/cases.js index d4b93ef..841dc8a 100644 --- a/js/cases.js +++ b/js/cases.js @@ -1,4 +1,4 @@ -//debugger; +//debugger; // To manage submits to case.front.php var GLPI_HTTP_CASE_FORM = window.location.href.replace(window.location.search, ''); //window.location.href.split('/', loc_split.length - 2).join('/') + '/plugins/processmaker/front/case.front.php'; // http://hostname/glpi/... // to manage reloads diff --git a/js/central.js b/js/central.js index 593e425..fe4b7eb 100644 --- a/js/central.js +++ b/js/central.js @@ -1,19 +1,18 @@ -$(function () { +$(function () { $(document).ajaxComplete(function (event, jqXHR, ajaxOptions) { //debugger; var pattern = /##processmaker.*(##|...)/g; - + $('tr.tab_bg_2 td a').each(function (index) { - + var textToChange = $(this).text(); var matches = textToChange.match(pattern); if (matches) { textToChange = textToChange.replace(pattern, ''); - if (!textToChange.trim().length>0) - { + if (!textToChange.trim().length>0) { var title = $(this).parent().prev().text(); textToChange = title; - } + } $(this).text(textToChange); } }); diff --git a/js/domain.js.php b/js/domain.js.php deleted file mode 100644 index 3d10868..0000000 --- a/js/domain.js.php +++ /dev/null @@ -1,19 +0,0 @@ -isActivated('processmaker')) { - $config = PluginProcessmakerConfig::getInstance(); - if (isset($config->fields['domain']) && $config->fields['domain'] != '') { - echo " - //debugger; - var d = document, - g = d.createElement('script'), - s = d.getElementsByTagName('script')[0]; - g.type = 'text/javascript'; - g.text = 'try { document.domain = \'".$config->fields['domain']."\'; } catch(ev) { /*console.log(ev);*/ }'; - s.parentNode.insertBefore(g, s); - "; - } -} \ No newline at end of file diff --git a/js/helpdesk.public.js.php b/js/helpdesk.public.js.php index c93b8d4..6d2bd5d 100644 --- a/js/helpdesk.public.js.php +++ b/js/helpdesk.public.js.php @@ -14,7 +14,7 @@ $config = PluginProcessmakerConfig::getInstance(); if (!$config->fields['maintenance']) { - echo "$(function () { + echo "$(function () { // look if name='helpdeskform' is present. If yes replace the form.location var ahrefTI = '".$CFG_GLPI["root_doc"]."/plugins/processmaker/front/tracking.injector.php'; var formLink = $(\"form[name='helpdeskform']\")[0]; diff --git a/locales/fr_FR.mo b/locales/fr_FR.mo index 9299adb..a72879c 100644 Binary files a/locales/fr_FR.mo and b/locales/fr_FR.mo differ diff --git a/locales/fr_FR.po b/locales/fr_FR.po index 96c93d8..dadf1bc 100644 --- a/locales/fr_FR.po +++ b/locales/fr_FR.po @@ -1,22 +1,23 @@ msgid "" msgstr "" "Project-Id-Version: processmaker-plugin\n" -"POT-Creation-Date: 2018-08-06 14:32+0200\n" -"PO-Revision-Date: 2018-08-06 14:44+0200\n" +"POT-Creation-Date: 2020-07-13 09:41+0200\n" +"PO-Revision-Date: 2020-07-13 11:02+0200\n" "Last-Translator: tomolimo\n" "Language-Team: French\n" "Language: fr_FR\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.1.1\n" +"X-Generator: Poedit 2.3.1\n" "X-Poedit-Basepath: ..\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -"X-Poedit-KeywordsList: ;__:1,2t;_e:1,2t;_x:1c,2,3t;_n:1,2,4t;__s:1,2t;" -"_ex:1c,2,3t;_sx:1c,2,3t;_nx:1c,2,3,5t\n" +"X-Poedit-KeywordsList: ;__:1,2t;_e:1,2t;_x:1c,2,3t;_n:1,2,4t;__s:1,2t;_ex:1c,2,3t;_sx:1c,2,3t;_nx:1c,2,3,5t\n" "X-Crowdin-Project: processmaker-plugin\n" +"X-Crowdin-Project-ID: 310131\n" "X-Crowdin-Language: fr\n" -"X-Crowdin-File: /3.3.0/source.po\n" +"X-Crowdin-File: /3.4 - GLPI 9.2/source.po\n" +"X-Crowdin-File-ID: 20\n" "X-Poedit-SearchPath-0: ajax\n" "X-Poedit-SearchPath-1: front\n" "X-Poedit-SearchPath-2: inc\n" @@ -25,239 +26,306 @@ msgstr "" "X-Poedit-SearchPath-5: hook.php\n" "X-Poedit-SearchPath-6: setup.php\n" -#: ajax/task_users.php:25 +#: ajax/task_users.php:36 msgid "Re-assign task to" msgstr "Ré-affecter tâche à" -#: ajax/task_users.php:45 +#: ajax/task_users.php:60 ajax/task_users.php:61 ajax/task_users.php:124 msgid "Re-assign" msgstr "Ré-affecter" -#: front/case.form.php:35 +#: ajax/task_users.php:110 +#| msgid "Task already assigned to this person!" +msgid "Task is already assigned to this user or group!" +msgstr "La tâche est déjà affectée à cet utilisateur (ou ce groupe) !" + +#: ajax/task_users.php:110 ajax/task_users.php:122 +#| msgid "Re-assign task to" +msgid "Re-assign task" +msgstr "Ré-affecter tâche" + +#: ajax/task_users.php:114 ajax/task_users.php:119 +#| msgid "Claim target task" +msgid "Un-claim task" +msgstr "Annuler affectation de la tâche" + +#: ajax/task_users.php:115 +msgid "Please input reason to un-claim
(task will be re-assigned to former group):" +msgstr "Saisir la raison pour l'annulation de l'affectation
(la tâche sera ré-affectée au groupe précédent) :" + +#: ajax/task_users.php:116 +msgid "Un-claim" +msgstr "Annulation de l'affectation" + +#: ajax/task_users.php:119 +msgid "Can\\'t un-assign Task!" +msgstr "Annulation de l'affectation impossible !" + +#: ajax/task_users.php:123 +msgid "Please input reason to re-assign:" +msgstr "Saisir la raison pour la ré-affectation :" + +#: ajax/task_users.php:134 +msgid "Send reminder" +msgstr "Envoyer un rappel" + +#: front/case.form.php:32 msgid "Case has been deleted!" msgstr "Le cas a été effacé !" -#: front/case.form.php:37 +#: front/case.form.php:34 msgid "Unable to delete case!" msgstr "Impossible d'effacer le cas !" -#: front/case.form.php:50 +#: front/case.form.php:46 msgid "Case has been cancelled!" msgstr "Le cas a été annulé !" -#: front/case.form.php:52 front/case.form.php:55 +#: front/case.form.php:48 front/case.form.php:51 msgid "Unable to cancel case!" msgstr "Impossible d'annuler le cas !" -#: front/case.form.php:76 front/case.form.php:78 inc/case.class.php:1018 +#: front/case.form.php:70 front/case.form.php:72 inc/case.class.php:1310 msgid "Process cases" msgstr "Cas des processus" -#: front/case.php:5 front/caselink.form.php:27 front/caselink.php:5 -#: front/process.form.php:25 front/process.php:5 inc/caselink.class.php:143 -#: inc/config.class.php:50 inc/config.class.php:354 inc/process.class.php:393 +#: front/case.php:5 front/caselink.form.php:29 front/caselink.php:5 +#: front/process.form.php:27 front/process.php:5 inc/caselink.class.php:157 +#: inc/config.class.php:50 inc/config.class.php:363 inc/process.class.php:409 #: inc/profile.class.php:52 inc/profile.class.php:83 msgid "ProcessMaker" msgstr "ProcessMaker" -#: front/processmaker.form.php:85 +#: front/processmaker.form.php:80 msgid "Task re-assigned!" msgstr "Tâche ré-affectée !" -#: front/processmaker.form.php:87 +#: front/processmaker.form.php:82 msgid "Error re-assigning task: " -msgstr "Impossible de re-affecter cette tâche : " +msgstr "Impossible de ré-affecter cette tâche :" + +#: front/processmaker.form.php:93 +#| msgid "Task name" +msgid "Task un-claimed!" +msgstr "Annulation de l'affectation de la tâche effectuée !" -#: front/processmaker.form.php:90 -msgid "Task already assigned to this person!" -msgstr "Tâche déjà affectée à cette personne !" +#: front/processmaker.form.php:95 +msgid "Can't un-claim task! Verify 'Assignement Rules' in the process definition." +msgstr "Annulation de l'affectation impossible ! Vérifiez les règles d'assignation dans la définition du Processus." #: front/processmaker.helpdesk.form.php:21 msgid "Process - Case" msgstr "Processus - Cas" -#: front/processmaker.helpdesk.form.php:24 inc/case.class.php:605 +#: front/processmaker.helpdesk.form.php:24 inc/case.class.php:799 msgid "Select the process you want to add" msgstr "Choisir le processus à démarrer" -#: hook.php:31 inc/taskcategory.class.php:98 +#: hook.php:9 inc/taskcategory.class.php:214 msgid "Synchronize Task List" msgstr "Synchroniser la liste des Tâches" -#: hook.php:158 inc/case.class.php:77 +#: hook.php:76 inc/case.class.php:89 msgid "Case" msgstr "Cas" -#: hook.php:158 inc/case.class.php:586 inc/case.class.php:1062 +#: hook.php:76 inc/case.class.php:778 inc/case.class.php:1355 msgid "Status" msgstr "Statut" -#: inc/case.class.php:23 inc/case.class.php:90 inc/case.class.php:92 +#: inc/case.class.php:25 inc/case.class.php:102 inc/case.class.php:104 msgid "Process case" msgid_plural "Process cases" msgstr[0] "Cas du processus" msgstr[1] "Cas des processus" -#: inc/case.class.php:80 +#: inc/case.class.php:92 msgid "Sub-case" msgstr "Sous-cas" -#: inc/case.class.php:312 +#: inc/case.class.php:303 +#, php-format +msgid "Task un-claimed!
Case: %s
Task: \"%s\" has been un-assigned from \"%s\" and assigned to \"%s\" group.
Reason: %s" +msgstr "Annulation de l'affection de la tâche effectuée !
Cas : %s
Tâche : \"%s\" a été libérée de \"%s\" et assignée au groupe \"%s\".
Motif : %s" + +#: inc/case.class.php:420 +#, php-format +msgid "Task re-assigned!
Case: %s
Task: \"%s\" has been re-assigned from \"%s\" to \"%s\".
Reason: %s" +msgstr "Tâche ré-assignée !
Cas : %s
Tâche : \"%s\" a été ré-assignée de \"%s\" à \"%s\".
Motif : %s" + +#: inc/case.class.php:429 +#, php-format +msgid "Task assigned!
Case: %s
Task: \"%s\" has been assigned to \"%s\".
Reason: %s" +msgstr "Tâche assignée !
Cas : %s
Tâche : \"%s\" a été asignée à \"%s\".
Motif : %s" + +#: inc/case.class.php:510 msgid "Current task(s) properties" msgstr "Propriétés des tâches en cours" -#: inc/case.class.php:316 inc/task.class.php:263 +#: inc/case.class.php:514 inc/task.class.php:283 msgid "Task" msgstr "Tâche" -#: inc/case.class.php:317 inc/task.class.php:264 +#: inc/case.class.php:515 inc/task.class.php:284 msgid "Task guid" msgstr "Guid de la tâche" -#: inc/case.class.php:318 inc/task.class.php:265 +#: inc/case.class.php:516 inc/task.class.php:285 msgid "Current user" msgstr "Utilisateur actuel" -#: inc/case.class.php:319 inc/task.class.php:266 +#: inc/case.class.php:517 inc/task.class.php:286 msgid "Task delegation date" msgstr "Date de délégation de tâche" -#: inc/case.class.php:341 inc/task.class.php:275 +#: inc/case.class.php:539 inc/task.class.php:295 msgid "To be claimed" msgstr "A réclamer" -#: inc/case.class.php:377 +#: inc/case.class.php:575 msgid "Sub-case properties" msgstr "Propriétés du sous-cas" -#: inc/case.class.php:380 +#: inc/case.class.php:578 msgid "Parent case properties" msgstr "Propriétés du cas parent" -#: inc/case.class.php:382 +#: inc/case.class.php:580 msgid "Case properties" msgstr "Propriétés du cas" -#: inc/case.class.php:387 inc/case.class.php:584 inc/case.class.php:1036 -#: inc/process.class.php:548 +#: inc/case.class.php:585 inc/case.class.php:776 inc/case.class.php:1328 +#: inc/process.class.php:576 msgid "Process" msgstr "Processus" -#: inc/case.class.php:388 +#: inc/case.class.php:586 inc/notificationtargetprocessmaker.class.php:64 msgid "Case title" msgstr "Titre du cas" -#: inc/case.class.php:389 +#: inc/case.class.php:587 msgid "Case number" msgstr "Numéro du cas" -#: inc/case.class.php:390 +#: inc/case.class.php:588 msgid "Case status" msgstr "Statut du cas" -#: inc/case.class.php:391 +#: inc/case.class.php:589 msgid "Case guid" msgstr "Guid du cas" -#: inc/case.class.php:392 +#: inc/case.class.php:590 msgid "Creator" msgstr "Créateur" -#: inc/case.class.php:393 +#: inc/case.class.php:591 inc/case.class.php:1370 msgid "Creation date" msgstr "Date de création" -#: inc/case.class.php:394 +#: inc/case.class.php:592 msgid "Last update" msgstr "Dernière mise à jour" -#: inc/case.class.php:479 +#: inc/case.class.php:675 #, php-format msgid "Case is linked to a %1s" msgstr "Le cas est lié à un %1s" -#: inc/case.class.php:481 +#: inc/case.class.php:677 #, php-format msgid "Sub-case is linked to a %1s" msgstr "Le sous-cas est lié à un %1s" -#: inc/case.class.php:506 +#: inc/case.class.php:698 msgid "Case cancellation" msgstr "Annulation du cas" -#: inc/case.class.php:507 +#: inc/case.class.php:699 msgid "Cancel case" msgstr "Annuler cas" -#: inc/case.class.php:511 +#: inc/case.class.php:703 msgid "Confirm cancellation?" msgstr "Confirmer l’annulation ?" -#: inc/case.class.php:511 inc/profile.class.php:23 +#: inc/case.class.php:703 inc/profile.class.php:23 msgid "Cancel" msgstr "Annuler" -#: inc/case.class.php:532 +#: inc/case.class.php:717 msgid "Case deletion" msgstr "Suppression du cas" -#: inc/case.class.php:533 -msgid "Delete case" -msgstr "Supprimer le cas" - -#: inc/case.class.php:585 inc/case.class.php:1029 +#: inc/case.class.php:777 inc/case.class.php:1321 msgid "Title" msgstr "Titre" -#: inc/case.class.php:587 inc/case.class.php:1070 +#: inc/case.class.php:779 inc/case.class.php:1362 msgid "Sub-case of" msgstr "Sous-cas de" -#: inc/case.class.php:602 +#: inc/case.class.php:796 msgid "Add a new case" msgstr "Ajouter un nouveau cas" -#: inc/case.class.php:995 +#: inc/case.class.php:1227 msgctxt "case_status" msgid "Draft" msgstr "Brouillon" -#: inc/case.class.php:996 +#: inc/case.class.php:1228 msgctxt "case_status" msgid "To do" msgstr "A faire" -#: inc/case.class.php:997 +#: inc/case.class.php:1229 msgctxt "case_status" msgid "Completed" msgstr "Terminé" -#: inc/case.class.php:998 +#: inc/case.class.php:1230 msgctxt "case_status" msgid "Cancelled" msgstr "Annulé" -#: inc/case.class.php:1022 +#: inc/case.class.php:1314 msgid "ID" msgstr "ID" -#: inc/case.class.php:1049 +#: inc/case.class.php:1335 inc/notificationtargetprocessmaker.class.php:72 +#| msgid "Item entity" +msgid "Item type" +msgstr "Type de l'item" + +#: inc/case.class.php:1342 msgid "Item" msgstr "Item" -#: inc/case.class.php:1056 +#: inc/case.class.php:1349 msgid "Item entity" msgstr "Entité de l'item" -#: inc/casechangelog.class.php:35 +#: inc/case.class.php:1379 +#| msgid "Last update" +msgid "Last update date" +msgstr "Date de dernière mise à jour" + +#: inc/case.class.php:1392 +#, php-format +#| msgid "Case status" +msgid "Case status is '%s'" +msgstr "L'état du cas est '%s'" + +#: inc/casechangelog.class.php:36 msgid "Change log" msgstr "Evolution" -#: inc/casedynaform.class.php:80 +#: inc/casedynaform.class.php:83 msgid "Dynaforms" msgstr "DynaForms" -#: inc/casehistory.class.php:35 +#: inc/casehistory.class.php:36 msgid "History" msgstr "Historique" @@ -269,43 +337,51 @@ msgstr "Liens-cas" msgid "Case-link" msgstr "Lien-cas" -#: inc/caselink.class.php:75 inc/caselink.class.php:165 +#: inc/caselink.class.php:75 +msgid "Synchronous" +msgstr "Synchrone" + +#: inc/caselink.class.php:80 inc/caselink.class.php:179 msgid "External data" msgstr "Données externes" -#: inc/caselink.class.php:80 inc/caselink.class.php:171 +#: inc/caselink.class.php:85 inc/caselink.class.php:185 msgid "Self" msgstr "Self" -#: inc/caselink.class.php:85 inc/caselink.class.php:189 +#: inc/caselink.class.php:90 inc/caselink.class.php:203 msgid "Source task GUID" msgstr "GUID de la tâche source" -#: inc/caselink.class.php:93 inc/caselink.class.php:195 +#: inc/caselink.class.php:98 inc/caselink.class.php:209 msgid "Target task GUID" msgstr "GUID de la tâche cible" -#: inc/caselink.class.php:101 inc/caselink.class.php:207 +#: inc/caselink.class.php:106 inc/caselink.class.php:221 msgid "Target process GUID" msgstr "GUID du Processus cible" -#: inc/caselink.class.php:110 inc/caselink.class.php:201 +#: inc/caselink.class.php:115 inc/caselink.class.php:215 msgid "Target dynaform GUID" msgstr "GUID du dynaform cible" -#: inc/caselink.class.php:115 inc/caselink.class.php:213 +#: inc/caselink.class.php:120 inc/caselink.class.php:227 msgid "Source condition" msgstr "Condition d'activation du lien" -#: inc/caselink.class.php:121 inc/caselink.class.php:177 +#: inc/caselink.class.php:126 inc/caselink.class.php:191 msgid "Claim target task" msgstr "Tâche cible 'à réclamer'" -#: inc/caselink.class.php:126 inc/caselink.class.php:183 +#: inc/caselink.class.php:136 +msgid "Impersonate target task user" +msgstr "Personnifier l'utilisateur de la tâche cible" + +#: inc/caselink.class.php:141 inc/caselink.class.php:197 msgid "External application JSON config" msgstr "Configuration JSON de l'application externe" -#: inc/casemap.class.php:43 +#: inc/casemap.class.php:44 msgid "Map" msgstr "Carte" @@ -314,190 +390,294 @@ msgid "ProcessMaker setup" msgstr "Configuration du serveur ProcessMaker" #: inc/config.class.php:159 -msgid "Server URL (must be in same domain than GLPI)" -msgstr "URL du serveur (doit être dans le même domaine que GLPI)" +#| msgid "Server URL (must be in same domain than GLPI)" +msgid "Server URL (must be in same domain than GLPI, if GLPI is using HTTPS, PM server must also use HTTPS)" +msgstr "URL du serveur (doit être dans le même domaine que GLPI, si GLPI utilise HTTPS, alors PM doit aussi utiliser HTTPS)" -#: inc/config.class.php:164 +#: inc/config.class.php:163 msgid "Common domain with GLPI" msgstr "Domaine commun avec GLPI" -#: inc/config.class.php:193 +#: inc/config.class.php:192 msgid "None!" msgstr "Aucun !" -#: inc/config.class.php:202 +#: inc/config.class.php:201 +msgid "Verify SSL certificate" +msgstr "Verification du certificat SSL" + +#: inc/config.class.php:206 msgid "Workspace Name" msgstr "Nom du Workspace" -#: inc/config.class.php:207 +#: inc/config.class.php:211 msgid "Server administrator name" msgstr "Non de l'administreur du server ProcessMaker" -#: inc/config.class.php:212 +#: inc/config.class.php:216 msgid "Server administrator password" msgstr "Mot de passe de l'administrateur du serveur ProcessMaker" -#: inc/config.class.php:218 inc/config.class.php:258 +#: inc/config.class.php:222 inc/config.class.php:262 msgid "Connection status" msgstr "Status de la connexion" -#: inc/config.class.php:234 +#: inc/config.class.php:238 msgid "SQL server setup" msgstr "Configuration du serveur SQL" -#: inc/config.class.php:237 +#: inc/config.class.php:241 msgid "SQL server (MariaDB or MySQL)" msgstr "SQL server (MariaDB ou MySQL)" -#: inc/config.class.php:242 +#: inc/config.class.php:246 msgid "Database name" msgstr "Nom de la base de données" -#: inc/config.class.php:247 +#: inc/config.class.php:251 msgid "SQL user" msgstr "Utilisateur SQL" -#: inc/config.class.php:252 +#: inc/config.class.php:256 msgid "SQL password" msgstr "Mot de passe SQL" -#: inc/config.class.php:269 +#: inc/config.class.php:273 msgid "Theme Name" msgstr "Nom du thème" -#: inc/config.class.php:275 +#: inc/config.class.php:279 msgid "Main Task Category (edit to change name)" msgstr "Catégorie principale des tâches (éditer pour changer le nom)" -#: inc/config.class.php:282 +#: inc/config.class.php:286 msgid "Task Writer (edit to change name)" msgstr "Auteur des tâches (éditer pour changer le nom)" -#: inc/config.class.php:302 +#: inc/config.class.php:306 msgid "Group in ProcessMaker which will contain all GLPI users" msgstr "Groupe dans ProcessMaker qui contiendra les utilisateurs de GLPI" -#: inc/config.class.php:331 +#: inc/config.class.php:321 inc/process.class.php:510 inc/process.class.php:637 +msgid "Max cases per item (0=unlimited)" +msgstr "Nombre de cas maxi par item (0 = pas de limite)" + +#: inc/config.class.php:340 msgid "Processmaker system information" msgstr "Informations système du serveur ProcessMaker" -#: inc/config.class.php:334 inc/config.class.php:344 +#: inc/config.class.php:343 inc/config.class.php:353 msgid "Version" msgstr "Version" -#: inc/config.class.php:335 +#: inc/config.class.php:344 msgid "Web server" msgstr "Serveur web" -#: inc/config.class.php:336 +#: inc/config.class.php:345 msgid "Server name" msgstr "Nom du serveur" -#: inc/config.class.php:337 +#: inc/config.class.php:346 msgid "PHP version" msgstr "Version de PHP" -#: inc/config.class.php:338 +#: inc/config.class.php:347 msgid "DB version" msgstr "Version de la Db" -#: inc/config.class.php:339 +#: inc/config.class.php:348 msgid "DB server IP" msgstr "IP du serveur DB" -#: inc/config.class.php:340 +#: inc/config.class.php:349 msgid "DB name" msgstr "Nom de la BD" -#: inc/config.class.php:341 +#: inc/config.class.php:350 msgid "User browser" msgstr "Navigateur de l’utilisateur" -#: inc/config.class.php:342 +#: inc/config.class.php:351 msgid "User IP" msgstr "IP de l'utilisateur" -#: inc/config.class.php:344 +#: inc/config.class.php:353 msgid "Not yet!" msgstr "Pas encore !" -#: inc/process.class.php:350 +#: inc/notificationtargetcase.class.php:26 +msgid "Send email" +msgstr "Envoi d'email" + +#: inc/notificationtargetcase.class.php:37 +msgid "eMail recipients" +msgstr "Destinataires des emails" + +#: inc/notificationtargetprocessmaker.class.php:60 +#| msgid "Process case" +#| msgid_plural "Process cases" +msgid "Process category" +msgstr "Catégorie du processus" + +#: inc/notificationtargetprocessmaker.class.php:61 +#| msgid "Process case" +#| msgid_plural "Process cases" +msgid "Process category id" +msgstr "ID de la catégorie du processus" + +#: inc/notificationtargetprocessmaker.class.php:62 +#| msgid "Process case task" +#| msgid_plural "Process case tasks" +msgid "Process category comment" +msgstr "Commentaire de la catégorie du processus" + +#: inc/notificationtargetprocessmaker.class.php:63 +#| msgid "Case guid" +msgid "Case id" +msgstr "ID du cas" + +#: inc/notificationtargetprocessmaker.class.php:65 +#| msgid "Case deletion" +msgid "Case description" +msgstr "Description du cas" + +#: inc/notificationtargetprocessmaker.class.php:67 +msgid "Case variable 'XXX'" +msgstr "Variable de cas 'XXX'" + +#: inc/notificationtargetprocessmaker.class.php:68 +msgid "List of values in 'YYY' array" +msgstr "Liste des valeurs du tableau 'YYY'" + +#: inc/notificationtargetprocessmaker.class.php:69 +msgid "Number of rows in 'YYY' array" +msgstr "Nombre de lignes du tableau 'YYY'" + +#: inc/notificationtargetprocessmaker.class.php:70 +msgid "Value for colname in 'YYY' array" +msgstr "Valeur de la colonne 'colname' du tableau 'YYY'" + +#: inc/notificationtargetprocessmaker.class.php:71 +msgid "Value for key in 'ZZZ' assoc array (1-dimension array)" +msgstr "Valeur pour la clé 'key' du tableau associatif à une dimension 'ZZZ'" + +#: inc/notificationtargetprocessmaker.class.php:73 +#| msgid "Item" +msgid "Item id" +msgstr "ID de l'item" + +#: inc/notificationtargetprocessmaker.class.php:74 +#| msgid "Item" +msgid "Item URL" +msgstr "URL de l'item" + +#: inc/notificationtargetprocessmaker.class.php:75 +#| msgid "Item entity" +msgid "Item title" +msgstr "Titre de l'item" + +#: inc/notificationtargetprocessmaker.class.php:83 +msgid "XXX is to be replaced by any case variable names" +msgstr "XXX doit être remplacé par n'importe quel nom de variable de cas" + +#: inc/notificationtargetprocessmaker.class.php:86 +msgid "YYY is to be replaced by any array variables" +msgstr "YYY doit être remplacé par n'importe quel nom de tableau" + +#: inc/notificationtargetprocessmaker.class.php:90 +msgid "ZZZ is to be replaced by any assoc array variables (1-dimension array with key/value pairs)" +msgstr "ZZZ doit être replacé par n'importe quel nom de tableau associatif à une dimension (paire clé/valeur)" + +#: inc/notificationtargettask.class.php:195 +#| msgid "Task delegation date" +msgid "Task action" +msgstr "Action de la tâche" + +#: inc/process.class.php:366 msgid "Synchronize Process List" msgstr "Synchroniser la liste des processus" -#: inc/process.class.php:427 inc/process.class.php:589 +#: inc/process.class.php:443 inc/process.class.php:617 msgid "Process GUID" msgstr "GUID du Processus" -#: inc/process.class.php:433 +#: inc/process.class.php:449 msgid "Process type" msgstr "Type de processus" -#: inc/process.class.php:439 +#: inc/process.class.php:455 msgid "Hide case num. & title" msgstr "Cacher num. et titre du cas" -#: inc/process.class.php:445 +#: inc/process.class.php:461 msgid "Insert Task Category" msgstr "Insérer la catégorie des tâches" -#: inc/process.class.php:457 +#: inc/process.class.php:473 msgid "Ticket type (self-service)" msgstr "Type de ticket (self-service)" -#: inc/process.class.php:464 inc/process.class.php:609 +#: inc/process.class.php:480 inc/process.class.php:642 msgid "Visible in Incident for Central interface" msgstr "Visible pour un Incident sur l'interface Centrale" -#: inc/process.class.php:470 inc/process.class.php:614 +#: inc/process.class.php:486 inc/process.class.php:647 msgid "Visible in Request for Central interface" msgstr "Visible pour une demande sur l'interface Centrale" -#: inc/process.class.php:476 inc/process.class.php:666 +#: inc/process.class.php:492 inc/process.class.php:699 msgid "Visible in Change" msgstr "Visible dans un Changement" -#: inc/process.class.php:482 inc/process.class.php:671 +#: inc/process.class.php:498 inc/process.class.php:704 msgid "Visible in Problem" msgstr "Visible dans un Problème" -#: inc/process.class.php:519 +#: inc/process.class.php:504 +msgid "Maintenance" +msgstr "Maintenance" + +#: inc/process.class.php:547 msgctxt "process_type" msgid "Classic" msgstr "Classique" -#: inc/process.class.php:520 +#: inc/process.class.php:548 msgctxt "process_type" msgid "BPMN" msgstr "BPMN" -#: inc/process.class.php:546 +#: inc/process.class.php:574 msgid "Processes" msgstr "Processus" -#: inc/process.class.php:599 +#: inc/process.class.php:627 msgid "Hide case number and title in task descriptions" msgstr "Masquer numéro et titre des cas dans les descriptions des tâches" -#: inc/process.class.php:604 +#: inc/process.class.php:632 msgid "Insert Task Category comments in Task Description" -msgstr "" -"Insérer les commentaires des Catégories de Tâches dans les descriptions des " -"Tâches" +msgstr "Insérer les commentaires des Catégories de Tâches dans les descriptions des Tâches" -#: inc/process.class.php:619 +#: inc/process.class.php:652 msgid "ITIL Category for Self-service interface (left empty to disable)" -msgstr "" -"Catégorie ITIL pour l'interface libre-service (laissez vide pour désactiver)" +msgstr "Catégorie ITIL pour l'interface libre-service (laissez vide pour désactiver)" -#: inc/process.class.php:646 +#: inc/process.class.php:679 msgid "Type for Self-service interface" msgstr "Type de ticket pour l'interface libre-service" -#: inc/process.class.php:676 +#: inc/process.class.php:709 msgid "Process type (to be changed only if not up-to-date)" msgstr "Type de processus (à modifier uniquement si pas à jour)" +#: inc/process.class.php:862 +#, php-format +#| msgid "ProcessMaker plugin is under maintenance, please retry later, thank you." +msgid "Process '%s' is under maintenance, please retry later, thank you." +msgstr "Le processus '%s' est en maintenance, ré-essayez plus tard, merci." + #: inc/process_profile.class.php:26 inc/process_profile.class.php:45 msgid "Authorizations" msgstr "Autorisations" @@ -516,40 +696,42 @@ msgctxt "errors" msgid "Can't create case: no rights for it!" msgstr "Impossible de créer le cas : pas de droits pour cela !" -#: inc/processmaker.class.php:984 +#: inc/processmaker.class.php:1012 msgid "Syncs GLPI users and groups into ProcessMaker." msgstr "Synchronisation des utilisateurs GLPI et des groups avec ProcessMaker." -#: inc/processmaker.class.php:986 +#: inc/processmaker.class.php:1014 msgid "Cleaning of orphan cases." msgstr "Nettoyage des cas orphelins." -#: inc/processmaker.class.php:986 +#: inc/processmaker.class.php:1014 msgid "Number of days to keep orphan cases" msgstr "Nombre de jours avant nettoyage des cas orphelins" -#: inc/processmaker.class.php:988 +#: inc/processmaker.class.php:1016 msgid "To apply task actions between cases." msgstr "Pour appliquer des actions de tâches entre cas." -#: inc/processmaker.class.php:1696 +#: inc/processmaker.class.php:1720 msgid "Case title: " msgstr "Titre du cas : " -#: inc/processmaker.class.php:2178 +#: inc/processmaker.class.php:2275 msgid "A 'Case' is running!" msgstr "Un 'Cas' est en cours !" -#: inc/processmaker.class.php:2179 +#: inc/processmaker.class.php:2276 msgid "You must manage it first (see 'Process - Case' tab)!" msgstr "Vous devez d'abord le terminer (voir onglet 'Processus - Cas') !" -#: inc/processmaker.class.php:3038 -msgid "" -"ProcessMaker plugin is under maintenance, please retry later, thank you." -msgstr "" -"Le plugin ProcessMaker est en maintenance, veuillez ré-essayer plus tard, " -"merci." +#: inc/processmaker.class.php:2774 +#, php-format +msgid "Unable to derivate case! Retry in a moment, or ask your administrator.
Error code: %u
Error message: %s
" +msgstr "Impossible de dériver le cas ! Ré-essayez dans un moment, ou demandez à votre administrateur.
Code d'erreur : %u
Message d'erreur : %s
" + +#: inc/processmaker.class.php:3281 +msgid "ProcessMaker plugin is under maintenance, please retry later, thank you." +msgstr "Le plugin ProcessMaker est en maintenance, veuillez ré-essayer plus tard, merci." #: inc/profile.class.php:17 msgid "Process configuration" @@ -559,36 +741,62 @@ msgstr "Configuration des Processus" msgid "Cases" msgstr "Cas" +#: inc/profile.class.php:23 +msgid "Ad Hoc user re-assign" +msgstr "Ré-assignation d'un utilisateur Ad Hoc" + #: inc/task.class.php:29 msgid "Process case task" msgid_plural "Process case tasks" msgstr[0] "Tâche d'un cas" msgstr[1] "Tâches d'un cas" -#: inc/task.class.php:258 +#: inc/task.class.php:278 msgid "Sub-case task(s)" msgstr "Tache(s) du sous-cas" -#: inc/taskcategory.class.php:21 inc/taskcategory.class.php:31 +#: inc/taskcategory.class.php:24 inc/taskcategory.class.php:116 +#| msgid "Process case" +#| msgid_plural "Process cases" +msgid "Process task" +msgstr "Tâche du processus" + +#: inc/taskcategory.class.php:29 +#| msgid "Task List" +msgid "Task list" +msgstr "List des tâches" + +#: inc/taskcategory.class.php:39 msgid "Task List" msgstr "Liste des tâches" -#: inc/taskcategory.class.php:32 +#: inc/taskcategory.class.php:40 inc/taskcategory.class.php:118 msgid "Task name" msgstr "Nom de la Tâche" -#: inc/taskcategory.class.php:34 inc/taskcategory.class.php:60 +#: inc/taskcategory.class.php:42 inc/taskcategory.class.php:68 +#: inc/taskcategory.class.php:121 inc/taskcategory.class.php:155 msgid "Start" msgstr "Démarrer" -#: inc/taskcategory.class.php:35 +#: inc/taskcategory.class.php:43 inc/taskcategory.class.php:122 msgid "Task GUID" msgstr "GUID de la Tâche" -#: inc/taskcategory.class.php:38 inc/taskcategory.class.php:78 +#: inc/taskcategory.class.php:46 inc/taskcategory.class.php:86 +#: inc/taskcategory.class.php:125 inc/taskcategory.class.php:173 msgid "Sub-process" msgstr "Sous-processus" +#: inc/taskcategory.class.php:117 +#| msgid "Process case" +#| msgid_plural "Process cases" +msgid "Process name" +msgstr "Nom du procesus" + +#~ msgid "Delete case" +#~ msgstr "Delete case" + #~ msgid "Case item" #~ msgstr "Case item" diff --git a/locales/source.po b/locales/source.po index 17ae5a9..ea91229 100644 --- a/locales/source.po +++ b/locales/source.po @@ -1,15 +1,15 @@ msgid "" msgstr "" "Project-Id-Version: Processmaker plugin 3.3.0\n" -"POT-Creation-Date: 2018-08-06 14:32+0200\n" -"PO-Revision-Date: 2018-08-06 14:33+0200\n" +"POT-Creation-Date: 2020-07-13 09:41+0200\n" +"PO-Revision-Date: 2020-07-13 11:03+0200\n" "Last-Translator: tomolimo\n" "Language-Team: en_GB\n" "Language: en_GB\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"X-Generator: Poedit 2.1.1\n" +"X-Generator: Poedit 2.3.1\n" "X-Poedit-Basepath: ..\n" "Plural-Forms: nplurals=2; plural=(n != 1);\n" "X-Poedit-KeywordsList: ;__:1,2t;_e:1,2t;_x:1c,2,3t;_n:1,2,4t;__s:1,2t;" @@ -22,239 +22,324 @@ msgstr "" "X-Poedit-SearchPath-5: hook.php\n" "X-Poedit-SearchPath-6: setup.php\n" -#: ajax/task_users.php:25 +#: ajax/task_users.php:36 msgid "Re-assign task to" msgstr "Re-assign task to" -#: ajax/task_users.php:45 +#: ajax/task_users.php:60 ajax/task_users.php:61 ajax/task_users.php:124 msgid "Re-assign" msgstr "Re-assign" -#: front/case.form.php:35 +#: ajax/task_users.php:110 +#| msgid "Task already assigned to this person!" +msgid "Task is already assigned to this user or group!" +msgstr "Task is already assigned to this user or group!" + +#: ajax/task_users.php:110 ajax/task_users.php:122 +#| msgid "Re-assign task to" +msgid "Re-assign task" +msgstr "Re-assign task" + +#: ajax/task_users.php:114 ajax/task_users.php:119 +#| msgid "Claim target task" +msgid "Un-claim task" +msgstr "Un-claim task" + +#: ajax/task_users.php:115 +msgid "" +"Please input reason to un-claim
(task will be re-assigned to former " +"group):" +msgstr "" +"Please input reason to un-claim
(task will be re-assigned to former " +"group):" + +#: ajax/task_users.php:116 +msgid "Un-claim" +msgstr "Un-claim" + +#: ajax/task_users.php:119 +msgid "Can\\'t un-assign Task!" +msgstr "Can\\'t un-assign Task!" + +#: ajax/task_users.php:123 +msgid "Please input reason to re-assign:" +msgstr "Please input reason to re-assign:" + +#: ajax/task_users.php:134 +msgid "Send reminder" +msgstr "Send reminder" + +#: front/case.form.php:32 msgid "Case has been deleted!" msgstr "Case has been deleted!" -#: front/case.form.php:37 +#: front/case.form.php:34 msgid "Unable to delete case!" msgstr "Unable to delete case!" -#: front/case.form.php:50 +#: front/case.form.php:46 msgid "Case has been cancelled!" msgstr "Case has been cancelled!" -#: front/case.form.php:52 front/case.form.php:55 +#: front/case.form.php:48 front/case.form.php:51 msgid "Unable to cancel case!" msgstr "Unable to cancel case!" -#: front/case.form.php:76 front/case.form.php:78 inc/case.class.php:1018 +#: front/case.form.php:70 front/case.form.php:72 inc/case.class.php:1310 msgid "Process cases" msgstr "Process cases" -#: front/case.php:5 front/caselink.form.php:27 front/caselink.php:5 -#: front/process.form.php:25 front/process.php:5 inc/caselink.class.php:143 -#: inc/config.class.php:50 inc/config.class.php:354 inc/process.class.php:393 +#: front/case.php:5 front/caselink.form.php:29 front/caselink.php:5 +#: front/process.form.php:27 front/process.php:5 inc/caselink.class.php:157 +#: inc/config.class.php:50 inc/config.class.php:363 inc/process.class.php:409 #: inc/profile.class.php:52 inc/profile.class.php:83 msgid "ProcessMaker" msgstr "ProcessMaker" -#: front/processmaker.form.php:85 +#: front/processmaker.form.php:80 msgid "Task re-assigned!" msgstr "Task re-assigned!" -#: front/processmaker.form.php:87 +#: front/processmaker.form.php:82 msgid "Error re-assigning task: " msgstr "Error re-assigning task: " -#: front/processmaker.form.php:90 -msgid "Task already assigned to this person!" -msgstr "Task already assigned to this person!" +#: front/processmaker.form.php:93 +#| msgid "Task name" +msgid "Task un-claimed!" +msgstr "Task un-claimed!" + +#: front/processmaker.form.php:95 +msgid "" +"Can't un-claim task! Verify 'Assignement Rules' in the process definition." +msgstr "" +"Can't un-claim task! Verify 'Assignement Rules' in the process definition." #: front/processmaker.helpdesk.form.php:21 msgid "Process - Case" msgstr "Process - Case" -#: front/processmaker.helpdesk.form.php:24 inc/case.class.php:605 +#: front/processmaker.helpdesk.form.php:24 inc/case.class.php:799 msgid "Select the process you want to add" msgstr "Select the process you want to add" -#: hook.php:31 inc/taskcategory.class.php:98 +#: hook.php:9 inc/taskcategory.class.php:214 msgid "Synchronize Task List" msgstr "Synchronize Task List" -#: hook.php:158 inc/case.class.php:77 +#: hook.php:76 inc/case.class.php:89 msgid "Case" msgstr "Case" -#: hook.php:158 inc/case.class.php:586 inc/case.class.php:1062 +#: hook.php:76 inc/case.class.php:778 inc/case.class.php:1355 msgid "Status" msgstr "Status" -#: inc/case.class.php:23 inc/case.class.php:90 inc/case.class.php:92 +#: inc/case.class.php:25 inc/case.class.php:102 inc/case.class.php:104 msgid "Process case" msgid_plural "Process cases" msgstr[0] "Process case" msgstr[1] "Process cases" -#: inc/case.class.php:80 +#: inc/case.class.php:92 msgid "Sub-case" msgstr "Sub-case" -#: inc/case.class.php:312 +#: inc/case.class.php:303 +#, php-format +msgid "" +"Task un-claimed!
Case: %s
Task: \"%s\" has been " +"un-assigned from \"%s\" and assigned to \"%s\" group.
Reason: %s" +msgstr "" +"Task un-claimed!
Case: %s
Task: \"%s\" has been " +"un-assigned from \"%s\" and assigned to \"%s\" group.
Reason: %s" + +#: inc/case.class.php:420 +#, php-format +msgid "" +"Task re-assigned!
Case: %s
Task: \"%s\" has " +"been re-assigned from \"%s\" to \"%s\".
Reason: %s" +msgstr "" +"Task re-assigned!
Case: %s
Task: \"%s\" has " +"been re-assigned from \"%s\" to \"%s\".
Reason: %s" + +#: inc/case.class.php:429 +#, php-format +msgid "" +"Task assigned!
Case: %s
Task: \"%s\" has been " +"assigned to \"%s\".
Reason: %s" +msgstr "" +"Task assigned!
Case: %s
Task: \"%s\" has been " +"assigned to \"%s\".
Reason: %s" + +#: inc/case.class.php:510 msgid "Current task(s) properties" msgstr "Current task(s) properties" -#: inc/case.class.php:316 inc/task.class.php:263 +#: inc/case.class.php:514 inc/task.class.php:283 msgid "Task" msgstr "Task" -#: inc/case.class.php:317 inc/task.class.php:264 +#: inc/case.class.php:515 inc/task.class.php:284 msgid "Task guid" msgstr "Task guid" -#: inc/case.class.php:318 inc/task.class.php:265 +#: inc/case.class.php:516 inc/task.class.php:285 msgid "Current user" msgstr "Current user" -#: inc/case.class.php:319 inc/task.class.php:266 +#: inc/case.class.php:517 inc/task.class.php:286 msgid "Task delegation date" msgstr "Task delegation date" -#: inc/case.class.php:341 inc/task.class.php:275 +#: inc/case.class.php:539 inc/task.class.php:295 msgid "To be claimed" msgstr "To be claimed" -#: inc/case.class.php:377 +#: inc/case.class.php:575 msgid "Sub-case properties" msgstr "Sub-case properties" -#: inc/case.class.php:380 +#: inc/case.class.php:578 msgid "Parent case properties" msgstr "Parent case properties" -#: inc/case.class.php:382 +#: inc/case.class.php:580 msgid "Case properties" msgstr "Case properties" -#: inc/case.class.php:387 inc/case.class.php:584 inc/case.class.php:1036 -#: inc/process.class.php:548 +#: inc/case.class.php:585 inc/case.class.php:776 inc/case.class.php:1328 +#: inc/process.class.php:576 msgid "Process" msgstr "Process" -#: inc/case.class.php:388 +#: inc/case.class.php:586 inc/notificationtargetprocessmaker.class.php:64 msgid "Case title" msgstr "Case title" -#: inc/case.class.php:389 +#: inc/case.class.php:587 msgid "Case number" msgstr "Case number" -#: inc/case.class.php:390 +#: inc/case.class.php:588 msgid "Case status" msgstr "Case status" -#: inc/case.class.php:391 +#: inc/case.class.php:589 msgid "Case guid" msgstr "Case guid" -#: inc/case.class.php:392 +#: inc/case.class.php:590 msgid "Creator" msgstr "Creator" -#: inc/case.class.php:393 +#: inc/case.class.php:591 inc/case.class.php:1370 msgid "Creation date" msgstr "Creation date" -#: inc/case.class.php:394 +#: inc/case.class.php:592 msgid "Last update" msgstr "Last update" -#: inc/case.class.php:479 +#: inc/case.class.php:675 #, php-format msgid "Case is linked to a %1s" msgstr "Case is linked to a %1s" -#: inc/case.class.php:481 +#: inc/case.class.php:677 #, php-format msgid "Sub-case is linked to a %1s" msgstr "Sub-case is linked to a %1s" -#: inc/case.class.php:506 +#: inc/case.class.php:698 msgid "Case cancellation" msgstr "Case cancellation" -#: inc/case.class.php:507 +#: inc/case.class.php:699 msgid "Cancel case" msgstr "Cancel case" -#: inc/case.class.php:511 +#: inc/case.class.php:703 msgid "Confirm cancellation?" msgstr "Confirm cancellation?" -#: inc/case.class.php:511 inc/profile.class.php:23 +#: inc/case.class.php:703 inc/profile.class.php:23 msgid "Cancel" msgstr "Cancel" -#: inc/case.class.php:532 +#: inc/case.class.php:717 msgid "Case deletion" msgstr "Case deletion" -#: inc/case.class.php:533 -msgid "Delete case" -msgstr "Delete case" - -#: inc/case.class.php:585 inc/case.class.php:1029 +#: inc/case.class.php:777 inc/case.class.php:1321 msgid "Title" msgstr "Title" -#: inc/case.class.php:587 inc/case.class.php:1070 +#: inc/case.class.php:779 inc/case.class.php:1362 msgid "Sub-case of" msgstr "Sub-case of" -#: inc/case.class.php:602 +#: inc/case.class.php:796 msgid "Add a new case" msgstr "Add a new case" -#: inc/case.class.php:995 +#: inc/case.class.php:1227 msgctxt "case_status" msgid "Draft" msgstr "Draft" -#: inc/case.class.php:996 +#: inc/case.class.php:1228 msgctxt "case_status" msgid "To do" msgstr "To do" -#: inc/case.class.php:997 +#: inc/case.class.php:1229 msgctxt "case_status" msgid "Completed" msgstr "Completed" -#: inc/case.class.php:998 +#: inc/case.class.php:1230 msgctxt "case_status" msgid "Cancelled" msgstr "Cancelled" -#: inc/case.class.php:1022 +#: inc/case.class.php:1314 msgid "ID" msgstr "ID" -#: inc/case.class.php:1049 +#: inc/case.class.php:1335 inc/notificationtargetprocessmaker.class.php:72 +#| msgid "Item entity" +msgid "Item type" +msgstr "Item type" + +#: inc/case.class.php:1342 msgid "Item" msgstr "Item" -#: inc/case.class.php:1056 +#: inc/case.class.php:1349 msgid "Item entity" msgstr "Item entity" -#: inc/casechangelog.class.php:35 +#: inc/case.class.php:1379 +#| msgid "Last update" +msgid "Last update date" +msgstr "Last update date" + +#: inc/case.class.php:1392 +#, php-format +#| msgid "Case status" +msgid "Case status is '%s'" +msgstr "Case status is '%s'" + +#: inc/casechangelog.class.php:36 msgid "Change log" msgstr "Change log" -#: inc/casedynaform.class.php:80 +#: inc/casedynaform.class.php:83 msgid "Dynaforms" msgstr "Dynaforms" -#: inc/casehistory.class.php:35 +#: inc/casehistory.class.php:36 msgid "History" msgstr "History" @@ -266,43 +351,51 @@ msgstr "Case-links" msgid "Case-link" msgstr "Case-link" -#: inc/caselink.class.php:75 inc/caselink.class.php:165 +#: inc/caselink.class.php:75 +msgid "Synchronous" +msgstr "Synchronous" + +#: inc/caselink.class.php:80 inc/caselink.class.php:179 msgid "External data" msgstr "External data" -#: inc/caselink.class.php:80 inc/caselink.class.php:171 +#: inc/caselink.class.php:85 inc/caselink.class.php:185 msgid "Self" msgstr "Self" -#: inc/caselink.class.php:85 inc/caselink.class.php:189 +#: inc/caselink.class.php:90 inc/caselink.class.php:203 msgid "Source task GUID" msgstr "Source task GUID" -#: inc/caselink.class.php:93 inc/caselink.class.php:195 +#: inc/caselink.class.php:98 inc/caselink.class.php:209 msgid "Target task GUID" msgstr "Target task GUID" -#: inc/caselink.class.php:101 inc/caselink.class.php:207 +#: inc/caselink.class.php:106 inc/caselink.class.php:221 msgid "Target process GUID" msgstr "Target process GUID" -#: inc/caselink.class.php:110 inc/caselink.class.php:201 +#: inc/caselink.class.php:115 inc/caselink.class.php:215 msgid "Target dynaform GUID" msgstr "Target dynaform GUID" -#: inc/caselink.class.php:115 inc/caselink.class.php:213 +#: inc/caselink.class.php:120 inc/caselink.class.php:227 msgid "Source condition" msgstr "Source condition" -#: inc/caselink.class.php:121 inc/caselink.class.php:177 +#: inc/caselink.class.php:126 inc/caselink.class.php:191 msgid "Claim target task" msgstr "Claim target task" -#: inc/caselink.class.php:126 inc/caselink.class.php:183 +#: inc/caselink.class.php:136 +msgid "Impersonate target task user" +msgstr "Impersonate target task user" + +#: inc/caselink.class.php:141 inc/caselink.class.php:197 msgid "External application JSON config" msgstr "External application JSON config" -#: inc/casemap.class.php:43 +#: inc/casemap.class.php:44 msgid "Map" msgstr "Map" @@ -311,187 +404,303 @@ msgid "ProcessMaker setup" msgstr "ProcessMaker setup" #: inc/config.class.php:159 -msgid "Server URL (must be in same domain than GLPI)" -msgstr "Server URL (must be in same domain than GLPI)" +#| msgid "Server URL (must be in same domain than GLPI)" +msgid "" +"Server URL (must be in same domain than GLPI, if GLPI is using HTTPS, PM " +"server must also use HTTPS)" +msgstr "" +"Server URL (must be in same domain than GLPI, if GLPI is using HTTPS, PM " +"server must also use HTTPS)" -#: inc/config.class.php:164 +#: inc/config.class.php:163 msgid "Common domain with GLPI" msgstr "Common domain with GLPI" -#: inc/config.class.php:193 +#: inc/config.class.php:192 msgid "None!" msgstr "None!" -#: inc/config.class.php:202 +#: inc/config.class.php:201 +msgid "Verify SSL certificate" +msgstr "Verify SSL certificate" + +#: inc/config.class.php:206 msgid "Workspace Name" msgstr "Workspace Name" -#: inc/config.class.php:207 +#: inc/config.class.php:211 msgid "Server administrator name" msgstr "Server administrator name" -#: inc/config.class.php:212 +#: inc/config.class.php:216 msgid "Server administrator password" msgstr "Server administrator password" -#: inc/config.class.php:218 inc/config.class.php:258 +#: inc/config.class.php:222 inc/config.class.php:262 msgid "Connection status" msgstr "Connection status" -#: inc/config.class.php:234 +#: inc/config.class.php:238 msgid "SQL server setup" msgstr "SQL server setup" -#: inc/config.class.php:237 +#: inc/config.class.php:241 msgid "SQL server (MariaDB or MySQL)" msgstr "SQL server (MariaDB or MySQL)" -#: inc/config.class.php:242 +#: inc/config.class.php:246 msgid "Database name" msgstr "Database name" -#: inc/config.class.php:247 +#: inc/config.class.php:251 msgid "SQL user" msgstr "SQL user" -#: inc/config.class.php:252 +#: inc/config.class.php:256 msgid "SQL password" msgstr "SQL password" -#: inc/config.class.php:269 +#: inc/config.class.php:273 msgid "Theme Name" msgstr "Theme Name" -#: inc/config.class.php:275 +#: inc/config.class.php:279 msgid "Main Task Category (edit to change name)" msgstr "Main Task Category (edit to change name)" -#: inc/config.class.php:282 +#: inc/config.class.php:286 msgid "Task Writer (edit to change name)" msgstr "Task Writer (edit to change name)" -#: inc/config.class.php:302 +#: inc/config.class.php:306 msgid "Group in ProcessMaker which will contain all GLPI users" msgstr "Group in ProcessMaker which will contain all GLPI users" -#: inc/config.class.php:331 +#: inc/config.class.php:321 inc/process.class.php:510 inc/process.class.php:637 +msgid "Max cases per item (0=unlimited)" +msgstr "Max cases per item (0=unlimited)" + +#: inc/config.class.php:340 msgid "Processmaker system information" msgstr "Processmaker system information" -#: inc/config.class.php:334 inc/config.class.php:344 +#: inc/config.class.php:343 inc/config.class.php:353 msgid "Version" msgstr "Version" -#: inc/config.class.php:335 +#: inc/config.class.php:344 msgid "Web server" msgstr "Web server" -#: inc/config.class.php:336 +#: inc/config.class.php:345 msgid "Server name" msgstr "Server name" -#: inc/config.class.php:337 +#: inc/config.class.php:346 msgid "PHP version" msgstr "PHP version" -#: inc/config.class.php:338 +#: inc/config.class.php:347 msgid "DB version" msgstr "DB version" -#: inc/config.class.php:339 +#: inc/config.class.php:348 msgid "DB server IP" msgstr "DB server IP" -#: inc/config.class.php:340 +#: inc/config.class.php:349 msgid "DB name" msgstr "DB name" -#: inc/config.class.php:341 +#: inc/config.class.php:350 msgid "User browser" msgstr "User browser" -#: inc/config.class.php:342 +#: inc/config.class.php:351 msgid "User IP" msgstr "User IP" -#: inc/config.class.php:344 +#: inc/config.class.php:353 msgid "Not yet!" msgstr "Not yet!" -#: inc/process.class.php:350 +#: inc/notificationtargetcase.class.php:26 +msgid "Send email" +msgstr "Send email" + +#: inc/notificationtargetcase.class.php:37 +msgid "eMail recipients" +msgstr "eMail recipients" + +#: inc/notificationtargetprocessmaker.class.php:60 +#| msgid "Process case" +#| msgid_plural "Process cases" +msgid "Process category" +msgstr "Process category" + +#: inc/notificationtargetprocessmaker.class.php:61 +#| msgid "Process case" +#| msgid_plural "Process cases" +msgid "Process category id" +msgstr "Process category id" + +#: inc/notificationtargetprocessmaker.class.php:62 +#| msgid "Process case task" +#| msgid_plural "Process case tasks" +msgid "Process category comment" +msgstr "Process category comment" + +#: inc/notificationtargetprocessmaker.class.php:63 +#| msgid "Case guid" +msgid "Case id" +msgstr "Case id" + +#: inc/notificationtargetprocessmaker.class.php:65 +#| msgid "Case deletion" +msgid "Case description" +msgstr "Case description" + +#: inc/notificationtargetprocessmaker.class.php:67 +msgid "Case variable 'XXX'" +msgstr "Case variable 'XXX'" + +#: inc/notificationtargetprocessmaker.class.php:68 +msgid "List of values in 'YYY' array" +msgstr "List of values in 'YYY' array" + +#: inc/notificationtargetprocessmaker.class.php:69 +msgid "Number of rows in 'YYY' array" +msgstr "Number of rows in 'YYY' array" + +#: inc/notificationtargetprocessmaker.class.php:70 +msgid "Value for colname in 'YYY' array" +msgstr "Value for colname in 'YYY' array" + +#: inc/notificationtargetprocessmaker.class.php:71 +msgid "Value for key in 'ZZZ' assoc array (1-dimension array)" +msgstr "Value for key in 'ZZZ' assoc array (1-dimension array)" + +#: inc/notificationtargetprocessmaker.class.php:73 +#| msgid "Item" +msgid "Item id" +msgstr "Item id" + +#: inc/notificationtargetprocessmaker.class.php:74 +#| msgid "Item" +msgid "Item URL" +msgstr "Item URL" + +#: inc/notificationtargetprocessmaker.class.php:75 +#| msgid "Item entity" +msgid "Item title" +msgstr "Item title" + +#: inc/notificationtargetprocessmaker.class.php:83 +msgid "XXX is to be replaced by any case variable names" +msgstr "XXX is to be replaced by any case variable names" + +#: inc/notificationtargetprocessmaker.class.php:86 +msgid "YYY is to be replaced by any array variables" +msgstr "YYY is to be replaced by any array variables" + +#: inc/notificationtargetprocessmaker.class.php:90 +msgid "" +"ZZZ is to be replaced by any assoc array variables (1-dimension array with " +"key/value pairs)" +msgstr "" +"ZZZ is to be replaced by any assoc array variables (1-dimension array with " +"key/value pairs)" + +#: inc/notificationtargettask.class.php:195 +#| msgid "Task delegation date" +msgid "Task action" +msgstr "Task action" + +#: inc/process.class.php:366 msgid "Synchronize Process List" msgstr "Synchronize Process List" -#: inc/process.class.php:427 inc/process.class.php:589 +#: inc/process.class.php:443 inc/process.class.php:617 msgid "Process GUID" msgstr "Process GUID" -#: inc/process.class.php:433 +#: inc/process.class.php:449 msgid "Process type" msgstr "Process type" -#: inc/process.class.php:439 +#: inc/process.class.php:455 msgid "Hide case num. & title" msgstr "Hide case num. & title" -#: inc/process.class.php:445 +#: inc/process.class.php:461 msgid "Insert Task Category" msgstr "Insert Task Category" -#: inc/process.class.php:457 +#: inc/process.class.php:473 msgid "Ticket type (self-service)" msgstr "Ticket type (self-service)" -#: inc/process.class.php:464 inc/process.class.php:609 +#: inc/process.class.php:480 inc/process.class.php:642 msgid "Visible in Incident for Central interface" msgstr "Visible in Incident for Central interface" -#: inc/process.class.php:470 inc/process.class.php:614 +#: inc/process.class.php:486 inc/process.class.php:647 msgid "Visible in Request for Central interface" msgstr "Visible in Request for Central interface" -#: inc/process.class.php:476 inc/process.class.php:666 +#: inc/process.class.php:492 inc/process.class.php:699 msgid "Visible in Change" msgstr "Visible in Change" -#: inc/process.class.php:482 inc/process.class.php:671 +#: inc/process.class.php:498 inc/process.class.php:704 msgid "Visible in Problem" msgstr "Visible in Problem" -#: inc/process.class.php:519 +#: inc/process.class.php:504 +msgid "Maintenance" +msgstr "Maintenance" + +#: inc/process.class.php:547 msgctxt "process_type" msgid "Classic" msgstr "Classic" -#: inc/process.class.php:520 +#: inc/process.class.php:548 msgctxt "process_type" msgid "BPMN" msgstr "BPMN" -#: inc/process.class.php:546 +#: inc/process.class.php:574 msgid "Processes" msgstr "Processes" -#: inc/process.class.php:599 +#: inc/process.class.php:627 msgid "Hide case number and title in task descriptions" msgstr "Hide case number and title in task descriptions" -#: inc/process.class.php:604 +#: inc/process.class.php:632 msgid "Insert Task Category comments in Task Description" msgstr "Insert Task Category comments in Task Description" -#: inc/process.class.php:619 +#: inc/process.class.php:652 msgid "ITIL Category for Self-service interface (left empty to disable)" msgstr "ITIL Category for Self-service interface (left empty to disable)" -#: inc/process.class.php:646 +#: inc/process.class.php:679 msgid "Type for Self-service interface" msgstr "Type for Self-service interface" -#: inc/process.class.php:676 +#: inc/process.class.php:709 msgid "Process type (to be changed only if not up-to-date)" msgstr "Process type (to be changed only if not up-to-date)" +#: inc/process.class.php:862 +#, php-format +#| msgid "" +#| "ProcessMaker plugin is under maintenance, please retry later, thank you." +msgid "Process '%s' is under maintenance, please retry later, thank you." +msgstr "Process '%s' is under maintenance, please retry later, thank you." + #: inc/process_profile.class.php:26 inc/process_profile.class.php:45 msgid "Authorizations" msgstr "Authorizations" @@ -510,35 +719,44 @@ msgctxt "errors" msgid "Can't create case: no rights for it!" msgstr "Can't create case: no rights for it!" -#: inc/processmaker.class.php:984 +#: inc/processmaker.class.php:1012 msgid "Syncs GLPI users and groups into ProcessMaker." msgstr "Syncs GLPI users and groups into ProcessMaker." -#: inc/processmaker.class.php:986 +#: inc/processmaker.class.php:1014 msgid "Cleaning of orphan cases." msgstr "Cleaning of orphan cases." -#: inc/processmaker.class.php:986 +#: inc/processmaker.class.php:1014 msgid "Number of days to keep orphan cases" msgstr "Number of days to keep orphan cases" -#: inc/processmaker.class.php:988 +#: inc/processmaker.class.php:1016 msgid "To apply task actions between cases." msgstr "To apply task actions between cases." -#: inc/processmaker.class.php:1696 +#: inc/processmaker.class.php:1720 msgid "Case title: " msgstr "Case title: " -#: inc/processmaker.class.php:2178 +#: inc/processmaker.class.php:2275 msgid "A 'Case' is running!" msgstr "A 'Case' is running!" -#: inc/processmaker.class.php:2179 +#: inc/processmaker.class.php:2276 msgid "You must manage it first (see 'Process - Case' tab)!" msgstr "You must manage it first (see 'Process - Case' tab)!" -#: inc/processmaker.class.php:3038 +#: inc/processmaker.class.php:2774 +#, php-format +msgid "" +"Unable to derivate case! Retry in a moment, or ask your administrator." +"
Error code: %u
Error message: %s
" +msgstr "" +"Unable to derivate case! Retry in a moment, or ask your administrator." +"
Error code: %u
Error message: %s
" + +#: inc/processmaker.class.php:3281 msgid "" "ProcessMaker plugin is under maintenance, please retry later, thank you." msgstr "" @@ -552,36 +770,62 @@ msgstr "Process configuration" msgid "Cases" msgstr "Cases" +#: inc/profile.class.php:23 +msgid "Ad Hoc user re-assign" +msgstr "Ad Hoc user re-assign" + #: inc/task.class.php:29 msgid "Process case task" msgid_plural "Process case tasks" msgstr[0] "Process case task" msgstr[1] "Process case tasks" -#: inc/task.class.php:258 +#: inc/task.class.php:278 msgid "Sub-case task(s)" msgstr "Sub-case task(s)" -#: inc/taskcategory.class.php:21 inc/taskcategory.class.php:31 +#: inc/taskcategory.class.php:24 inc/taskcategory.class.php:116 +#| msgid "Process case" +#| msgid_plural "Process cases" +msgid "Process task" +msgstr "Process task" + +#: inc/taskcategory.class.php:29 +#| msgid "Task List" +msgid "Task list" +msgstr "Task list" + +#: inc/taskcategory.class.php:39 msgid "Task List" msgstr "Task List" -#: inc/taskcategory.class.php:32 +#: inc/taskcategory.class.php:40 inc/taskcategory.class.php:118 msgid "Task name" msgstr "Task name" -#: inc/taskcategory.class.php:34 inc/taskcategory.class.php:60 +#: inc/taskcategory.class.php:42 inc/taskcategory.class.php:68 +#: inc/taskcategory.class.php:121 inc/taskcategory.class.php:155 msgid "Start" msgstr "Start" -#: inc/taskcategory.class.php:35 +#: inc/taskcategory.class.php:43 inc/taskcategory.class.php:122 msgid "Task GUID" msgstr "Task GUID" -#: inc/taskcategory.class.php:38 inc/taskcategory.class.php:78 +#: inc/taskcategory.class.php:46 inc/taskcategory.class.php:86 +#: inc/taskcategory.class.php:125 inc/taskcategory.class.php:173 msgid "Sub-process" msgstr "Sub-process" +#: inc/taskcategory.class.php:117 +#| msgid "Process case" +#| msgid_plural "Process cases" +msgid "Process name" +msgstr "Process name" + +#~ msgid "Delete case" +#~ msgstr "Delete case" + #~ msgid "Case item" #~ msgstr "Case item" diff --git a/pics/small-under_maintenance.png b/pics/small-under_maintenance.png new file mode 100644 index 0000000..0f4749a Binary files /dev/null and b/pics/small-under_maintenance.png differ diff --git a/pics/verysmall-under_maintenance.png b/pics/verysmall-under_maintenance.png new file mode 100644 index 0000000..b659749 Binary files /dev/null and b/pics/verysmall-under_maintenance.png differ diff --git a/processmaker.xml b/processmaker.xml index 607189d..75a951b 100644 --- a/processmaker.xml +++ b/processmaker.xml @@ -27,7 +27,7 @@ 9.1 - 3.4.5 + 3.4.26 9.2 diff --git a/setup.php b/setup.php index f894ae2..d451dba 100644 --- a/setup.php +++ b/setup.php @@ -1,8 +1,11 @@ $objects]); + Plugin::registerClass('PluginProcessmakerCase', ['addtabon' => $objects, 'notificationtemplates_types' => true]); + + Plugin::registerClass('PluginProcessmakerTask', ['notificationtemplates_types' => true]); - Plugin::registerClass('PluginProcessmakerTaskCategory'); + Plugin::registerClass('PluginProcessmakerTaskCategory', ['addtabon' => 'TaskCategory']); if (Session::haveRightsOr("config", [READ, UPDATE])) { Plugin::registerClass('PluginProcessmakerConfig', ['addtabon' => 'Config']); @@ -45,8 +50,13 @@ function plugin_init_processmaker() { // Display a menu entry ? if (Session::haveRightsOr('plugin_processmaker_config', [READ, UPDATE])) { - // tools and helpdesk - $PLUGIN_HOOKS['menu_toadd']['processmaker'] = ['tools' => 'PluginProcessmakerMenu', 'helpdesk' => 'PluginProcessmakerCase']; + // tools + $PLUGIN_HOOKS['menu_toadd']['processmaker']['tools'] = 'PluginProcessmakerMenu'; + } + + if (Session::haveRightsOr('plugin_processmaker_case', [READ, UPDATE])) { + // helpdesk + $PLUGIN_HOOKS['menu_toadd']['processmaker']['helpdesk'] = 'PluginProcessmakerCase'; } Plugin::registerClass('PluginProcessmakerProcess', [ 'massiveaction_nodelete_types' => true] ); @@ -63,7 +73,8 @@ function plugin_init_processmaker() { } $PLUGIN_HOOKS['pre_item_update']['processmaker'] = $hooks; - $hooks = ['TicketSatisfaction' => 'plugin_item_update_processmaker_satisfaction']; + $hooks = ['TicketSatisfaction' => 'plugin_item_update_processmaker_satisfaction', + 'User' => 'plugin_item_update_processmaker_user']; foreach ($objects as $obj) { $hooks[$obj.'Task'] = 'plugin_item_update_processmaker_tasks'; } @@ -83,7 +94,7 @@ function plugin_init_processmaker() { $hooks = []; foreach ($objects as $obj) { - $hooks["PluginPdf'.$obj.'Task"] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_pdfdata_processmaker']; + $hooks["PluginPdf".$obj."Task"] = ['PluginProcessmakerProcessmaker', 'plugin_item_get_pdfdata_processmaker']; } $PLUGIN_HOOKS['item_get_pdfdatas']['processmaker'] = $hooks; @@ -99,27 +110,29 @@ function plugin_init_processmaker() { //} //$PLUGIN_HOOKS['item_purge']['processmaker'] = $hooks; + + // Javascript $plugin = new Plugin(); if ($plugin->isActivated('processmaker') && Session::getLoginUserID() ) { - + $url = explode("/", $_SERVER['PHP_SELF']); $pageName = explode("?", array_pop($url)); switch ($pageName[0]) { case "tracking.injector.php": case "helpdesk.public.php": - $PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/helpdesk.public.js.php"; + $PLUGIN_HOOKS['add_javascript']['processmaker'] = "js/helpdesk.public.js.php"; break; case "planning.php": - $PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/planning.js"; + $PLUGIN_HOOKS['add_javascript']['processmaker'] = "js/planning.js"; break; case "central.php": - $PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/central.js"; + $PLUGIN_HOOKS['add_javascript']['processmaker'] = "js/central.js"; break; case "case.form.php": case "processmaker.helpdesk.form.php" : - $PLUGIN_HOOKS['add_javascript']['processmaker'] = ["js/domain.js.php"]; - break; + //$PLUGIN_HOOKS['add_javascript']['processmaker'] = "js/domain.js.php"; + break; } }