This commit is contained in:
tomolimo
2017-04-28 14:57:49 +02:00
parent 59c5abecf6
commit cf5f638030
15 changed files with 659 additions and 584 deletions

View File

@@ -1,42 +1,40 @@
<?php
//define('DO_NOT_CHECK_HTTP_REFERER', 1);
include_once '../../../inc/includes.php';
//include_once '../inc/processmaker.class.php' ;
//include_once '../inc/case.class.php' ;
// check if it is from PM pages
if( isset( $_REQUEST['UID'] ) && isset( $_REQUEST['APP_UID'] ) && isset( $_REQUEST['__DynaformName__'] ) ) {
// then get item id from DB
$myCase = new PluginProcessmakerCase ;
if( $myCase->getFromDB( $_REQUEST['APP_UID'] ) ) {
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker->login( ) ;
if( isset( $_REQUEST['form'] ) ) {
// then get item id from DB
$myCase = new PluginProcessmakerCase ;
if( $myCase->getFromDB( $_REQUEST['APP_UID'] ) ) {
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker->login( ) ;
if( isset( $_REQUEST['form'] ) ) {
$myProcessMaker->derivateCase( $myCase, $_REQUEST); //, $_SERVER['HTTP_COOKIE'] ) ;
}
}
}
}
}
// Claim task management
elseif( isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && isset( $_REQUEST['form']['APP_UID']) ){
// here we are in a Claim request
$myCase = new PluginProcessmakerCase ;
if( $myCase->getFromDB( $_REQUEST['form']['APP_UID'] ) ) {
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker->login( ) ;
} elseif ( isset( $_REQUEST['form'] ) && isset( $_REQUEST['form']['BTN_CATCH'] ) && isset( $_REQUEST['form']['APP_UID']) ) {
// Claim task management
// here we are in a Claim request
$myCase = new PluginProcessmakerCase ;
if( $myCase->getFromDB( $_REQUEST['form']['APP_UID'] ) ) {
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker->login( ) ;
$pmClaimCase = $myProcessMaker->claimCase( $myCase->getID(), $_REQUEST['DEL_INDEX'] ) ;
// now manage tasks associated with item
$myProcessMaker->claimTask( $myCase->getID(), $_REQUEST['DEL_INDEX'] ) ;
}
$pmClaimCase = $myProcessMaker->claimCase( $myCase->getID(), $_REQUEST['DEL_INDEX'] ) ;
// now manage tasks associated with item
$myProcessMaker->claimTask( $myCase->getID(), $_REQUEST['DEL_INDEX'] ) ;
}
}
// now redirect to item form page
//Html::redirect( Toolbox::getItemTypeFormURL($myCase->getField('itemtype')));
echo "<html><body><script></script><input id='GLPI_FORCE_RELOAD' type='hidden' value='GLPI_FORCE_RELOAD'/></body></html>" ;
$config = PluginProcessmakerConfig::getInstance() ;
echo "<html><body><script>";
if( isset($config->fields['domain']) && $config->fields['domain'] != '' ) {
echo "document.domain='{$config->fields['domain']}';";
}
echo "</script><input id='GLPI_FORCE_RELOAD' type='hidden' value='GLPI_FORCE_RELOAD'/></body></html>" ;

View File

@@ -9,49 +9,51 @@ switch( $_POST["action"] ) {
// we must check if a case is not already existing
// to manage the problem of F5 (Refresh)
$hasCase = PluginProcessmakerProcessmaker::getCaseIdFromItem( $_POST['itemtype'], $_POST['id'] ) ;
if( $hasCase === false && $_POST['plugin_processmaker_process_id'] > 0 ) { //$DB->numrows($res) == 0) {
if( $hasCase === false && $_POST['plugin_processmaker_process_id'] > 0 ) { //$DB->numrows($res) == 0) {
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker->login() ; //openSession();
$resultCase = $myProcessMaker->startNewCase( $_POST['plugin_processmaker_process_id'], $_POST['itemtype'], $_POST['id'], Session::getLoginUserID() ) ;
if ($resultCase->status_code == 0){
Html::back();
}
else
else
Session::addMessageAfterRedirect($LANG['processmaker']['item']['error'][$resultCase->status_code]."<br>".$resultCase->message." (".$resultCase->status_code.")", true, ERROR);
} else
Html::back();
Html::back();
}
else { // the case is created before the ticket (used for post-only case creation before ticket creation)
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker->login() ;
$resultCase = $myProcessMaker->newCase( $_POST['plugin_processmaker_process_id'], array( 'GLPI_ITEM_CAN_BE_SOLVED' => 0, 'GLPI_SELFSERVICE_CREATED' => '1', 'GLPI_URL' => $CFG_GLPI['url_base'].$CFG_GLPI['root_doc']) ) ;
if ($resultCase->status_code == 0){
// case is created
$myProcessMaker->login() ;
$resultCase = $myProcessMaker->newCase( $_POST['plugin_processmaker_process_id'],
array( 'GLPI_ITEM_CAN_BE_SOLVED' => 0,
'GLPI_SELFSERVICE_CREATED' => '1',
'GLPI_URL' => $CFG_GLPI['url_base'].$CFG_GLPI['root_doc']) ) ;
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?process_id=".$_POST['plugin_processmaker_process_id']."&case_id=".$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?process_id=".$_POST['plugin_processmaker_process_id']."&case_id=".$resultCase->caseId."&rand=$rand&itilcategories_id=".$_POST["itilcategories_id"]."&type=".$_REQUEST["type"]."&entities_id=".$_REQUEST['entities_id']);
} else {
Session::addMessageAfterRedirect($LANG['processmaker']['item']['error'][$resultCase->status_code]."<br>$resultCase->message ($resultCase->status_code)", true, ERROR); //echo "Error creating case: $resultCase->message \n";
Html::redirect($CFG_GLPI["root_doc"]."/front/helpdesk.public.php?create_ticket=1");
}
}
break;
break;
case 'unpausecase_or_reassign_or_delete' :
if( isset( $_POST['unpause'] ) ) {
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker->login() ; //openSession();
$pmResultUnpause = $myProcessMaker->unpauseCase( $_POST['plugin_processmaker_caseId'], $_POST['plugin_processmaker_delIndex'], $_POST['plugin_processmaker_userId'] ) ;
if ($pmResultUnpause->status_code == 0){
Html::back();
}
else
else
echo "Error unpausing case: ".$pmResultUnpause->message." \n";
}
else if( isset( $_POST['reassign'] ) ) {
@@ -63,7 +65,7 @@ switch( $_POST["action"] ) {
$pmResponse = $locPM->reassignCase( $_POST['plugin_processmaker_caseId'], $_POST['plugin_processmaker_delIndex'], $_POST['plugin_processmaker_userId'], $GLPINewPMUserId ) ;
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 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
// search for new delindex
$newCaseInfo = $locPM->getCaseInfo( $_POST['plugin_processmaker_caseId'] ) ;
@@ -75,11 +77,11 @@ switch( $_POST["action"] ) {
}
}
$locPM->reassignTask( $_POST['plugin_processmaker_caseId'], $_POST['plugin_processmaker_delIndex'], $newDelIndex, $_POST['users_id_recipient'] ) ;
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['reassigned'], true, INFO);
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['reassigned'], true, INFO);
// Html::back();
}
else
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['notreassigned'].$pmResponse->message, true, ERROR);
else
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['notreassigned'].$pmResponse->message, true, ERROR);
} else
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['assignedtoyou'], true, ERROR); // Html::back();
}
@@ -89,34 +91,34 @@ switch( $_POST["action"] ) {
$locCase->getFromDB( $_POST['plugin_processmaker_caseId'] ) ;
if( $locCase->deleteCase() ) {
// request delete from pm itself
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker->login(true) ;
$resultPM = $myProcessMaker->deleteCase( $_POST['plugin_processmaker_caseId'] ) ;
if( $resultPM->status_code == 0 ) {
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO);
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['deleted'], true, INFO);
} else
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
} else
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errordeleted'], true, ERROR);
}
else if( isset($_POST['cancel']) ) {
// cancel case from PM
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker->login() ;
$resultPM = $myProcessMaker->cancelCase( $_POST['plugin_processmaker_caseId'] ) ; //, $_POST['plugin_processmaker_delIndex'], $_POST['plugin_processmaker_userId'] ) ;
$myProcessMaker = new PluginProcessmakerProcessmaker() ;
$myProcessMaker->login() ;
$resultPM = $myProcessMaker->cancelCase( $_POST['plugin_processmaker_caseId'] ) ; //, $_POST['plugin_processmaker_delIndex'], $_POST['plugin_processmaker_userId'] ) ;
if( $resultPM->status_code === 0 ) {
$locCase = new PluginProcessmakerCase ;
$locCase->getFromDB( $_POST['plugin_processmaker_caseId'] ) ;
if( $locCase->cancelCase() )
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['cancelled'], true, INFO);
if( $locCase->cancelCase() )
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['cancelled'], true, INFO);
else
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR);
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR);
} else
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR);
Session::addMessageAfterRedirect($LANG['processmaker']['item']['case']['errorcancelled'], true, ERROR);
}
break;
break;
}

View File

@@ -56,6 +56,24 @@ if( isset($_POST["_from_helpdesk"]) && $_POST["_from_helpdesk"] == 1
}
if( !function_exists('stripcslashes_deep') ){
/**
* Strip c slash for variable & array
*
* @param $value array or string: item to stripslashes (array or string)
*
* @return stripcslashes item
**/
function stripcslashes_deep($value) {
$value = is_array($value) ?
array_map('stripcslashes_deep', $value) :
stripcslashes($value);
return $value;
}
}
if( !function_exists('http_formdata_flat_hierarchy') ) {
/**
* Summary of http_formdata_flat_hierarchy
@@ -118,6 +136,9 @@ if( GLPI_USE_CSRF_CHECK ) {
$data['_glpi_csrf_token'] = Session::getNewCSRFToken() ;
}
$data = array_map('Toolbox::unclean_cross_side_scripting_deep', $data);
$data = array_map('stripcslashes_deep', $data);
// need to add files if some are uploaded
$files = array() ;
$paths = array() ;

854
hook.php

File diff suppressed because it is too large Load Diff

View File

@@ -330,16 +330,10 @@ class PluginProcessmakerCase extends CommonDBTM {
// normally there is only one task
$task = getItemForItemtype( $row['itemtype'] ) ;
$task->getFromDB( $row['items_id'] ) ;
$user = new User; // pseudo-group
$user->getFromDB( $task->fields['users_id_tech'] ) ;
// check if this pseudo-group can be found in the current user's groups
foreach($DB->request("SELECT id FROM ".getTableForItemType( 'Group' )." WHERE name = '".$user->fields['name']."'") as $grp ){
// normally there is only one record
if( isset($_SESSION['glpigroups']) && !in_array( $grp['id'], $_SESSION['glpigroups'] ) ) {
$hide_claim_button=true;
}
// check if this group can be found in the current user's groups
if( !isset($_SESSION['glpigroups']) || !in_array( $task->fields['groups_id_tech'], $_SESSION['glpigroups'] ) ) {
$hide_claim_button=true;
}
}
}
echo "<div id='task-".$caseUser->delIndex."'>";

View File

@@ -53,6 +53,7 @@ class PluginProcessmakerConfig extends CommonDBTM {
* @return array the modified $input array
**/
function prepareInputForUpdate($input) {
global $CFG_GLPI;
if( !isset($input["maintenance"]) ) {
$input["maintenance"] = 0 ;
@@ -82,10 +83,40 @@ class PluginProcessmakerConfig extends CommonDBTM {
$input['pm_admin_passwd'] = '';
}
$input['domain'] = self::getCommonDomain( $CFG_GLPI['url_base'], $input['pm_server_URL'] ) ;
return $input;
}
/**
* Summary of getCommonDomain
* @param mixed $url1
* @param mixed $url2
* @return string the common domain part of the given urls
*/
static function getCommonDomain($url1, $url2) {
$domain = '';
try {
$glpi = explode( "/", $url1) ;
$glpi = explode( ".", $glpi[2] );
$pm = explode( "/", $url2) ;
$pm = explode( ".", $pm[2] );
$cglpi = array_pop( $glpi ) ;
$cpm = array_pop( $pm) ;
while( $cglpi && $cpm && $cglpi == $cpm ) {
$domain = $cglpi.($domain==''?'':'.'.$domain) ;
$cglpi = array_pop( $glpi ) ;
$cpm = array_pop( $pm ) ;
}
if( $domain != '' ) {
return $domain ;
}
} catch(Exception $e) {}
return '';
}
static function showConfigForm($item) {
global $LANG, $PM_DB;
global $LANG, $PM_DB, $CFG_GLPI;
$ui_theme = array(
'glpi_classic' => 'glpi_classic',
@@ -101,6 +132,38 @@ class PluginProcessmakerConfig extends CommonDBTM {
echo "<input size='50' type='text' name='pm_server_URL' value='".$config->fields['pm_server_URL']."'>" ;
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td>" . $LANG['processmaker']['config']['domain'] . "</td>";
echo "<td><font color='red'><div name='domain'>".$config->fields['domain']."</div></font>";
echo Html::scriptBlock("
function setCommonDomain() {
var domain = '';
try {
var glpi= '".$CFG_GLPI['url_base']."'.split('/')[2].split('.') ;
var pm = $('input[name=pm_server_URL]').val().split('/')[2].split('.');
var cglpi = glpi.pop() ;
var cpm = pm.pop() ;
while( cglpi && cpm && cglpi == cpm ) {
domain = cglpi + (domain==''?'':'.' + domain) ;
cglpi = glpi.pop() ;
cpm = pm.pop() ;
}
if( domain != '' ) {
$('div[name=domain]').text(domain) ;
$('div[name=domain]').parent().attr('color', 'green');
return;
}
} catch(ex) {}
$('div[name=domain]').text('".$LANG['processmaker']['config']['domain-error']."') ;
$('div[name=domain]').parent().attr('color', 'red');
};
$('input[name=pm_server_URL]').on('keyup', setCommonDomain ) ;
setCommonDomain() ;
");
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
echo "<td >".$LANG['processmaker']['config']['workspace']."</td><td >";
echo "<input type='text' name='pm_workspace' value='".$config->fields['pm_workspace']."'>" ;
@@ -120,8 +183,11 @@ class PluginProcessmakerConfig extends CommonDBTM {
echo "<tr class='tab_bg_1'>";
echo "<td >".$LANG['processmaker']['config']['connectionstatus']."</td><td >";
$pm = new PluginProcessmakerProcessmaker ;
$ret = $pm->login(true);
if( $ret ) {
//$pmconnected=false ; // by default
if( $config->fields['pm_server_URL'] != ''
&& $config->fields['pm_workspace'] != ''
&& $config->fields["pm_admin_user"] != ''
&& ($pm->login(true))) {
echo "<font color='green'>".__('Test successful');
} else {
echo "<font color='red'>".__('Test failed')."<br>".print_r($pm->lasterror,true);
@@ -163,26 +229,31 @@ class PluginProcessmakerConfig extends CommonDBTM {
array('value' => $config->fields['pm_theme']));
echo "</td></tr>";
$taskCatogrie = new TaskCategory;
$taskCatogrie->getFromDB( $config->fields['taskcategories_id'] ) ;
echo "<tr class='tab_bg_1'>";
echo "<td >".$LANG['processmaker']['config']['main_task_category']."</td><td >";
echo "<a href='".Toolbox::getItemTypeFormURL( 'TaskCategory' )."?id=". $config->fields['taskcategories_id']."'>".str_replace(" ", "&nbsp;", $taskCatogrie->fields['name']);
if ($_SESSION["glpiis_ids_visible"]) {
echo " (".$config->fields['taskcategories_id'].")";
}
echo "</a>" ;
TaskCategory::dropdown(array('name' => 'taskcategories_id',
'display_emptychoice' => true,
'value' => $config->fields['taskcategories_id']));
echo "</td></tr>\n";
$taskUser = new User;
$taskUser->getFromDB( $config->fields['users_id'] ) ;
echo "<tr class='tab_bg_1'>";
echo "<td >".$LANG['processmaker']['config']['taskwriter']."</td><td >";
echo "<a href='".Toolbox::getItemTypeFormURL( 'User' )."?id=". $config->fields['users_id']."'>".str_replace(" ", "&nbsp;", $taskUser->getName());
if ($_SESSION["glpiis_ids_visible"]) {
echo " (".$config->fields['users_id'].")";
}
echo "</a>" ;
$rand = mt_rand() ;
User::dropdown(array('name' => 'users_id',
'display_emptychoice' => true,
'right' => 'all',
'rand' => $rand,
'value' => $config->fields['users_id']));
// this code adds the + sign to the form
echo "<img alt='' title=\"".__s('Add')."\" src='".$CFG_GLPI["root_doc"].
"/pics/add_dropdown.png' style='cursor:pointer; margin-left:2px;'
onClick=\"".Html::jsGetElementbyID('add_dropdown'.$rand).".dialog('open');\">";
echo Ajax::createIframeModalWindow('add_dropdown'.$rand,
User::getFormURL(),
array('display' => false));
// end of + sign
echo "</td></tr>\n";
echo "<tr class='tab_bg_1'>";
@@ -201,17 +272,6 @@ class PluginProcessmakerConfig extends CommonDBTM {
echo "</td></tr>\n";
//echo "<tr class='tab_bg_1'>";
//echo "<td >".$LANG['processmaker']['config']['comments']."";
//echo "</td><td rowspan='5' >";
//echo "<textarea cols='60' rows='5' name='comment' >".$config->fields['comment']."</textarea>";
//echo "</td></tr>\n";
//echo "<tr></tr>";
//echo "<tr></tr>";
//echo "<tr></tr>";
//echo "<tr></tr>";
echo "<tr><td colspan='4' class='center b'>".__('Maintenance')."</td></tr>";
echo "<tr class='tab_bg_1'>";

View File

@@ -2,21 +2,25 @@
class PluginProcessmakerDB extends DBmysql {
var $dbhost ;
var $dbhost ;
var $dbuser ;
var $dbuser ;
var $dbpassword ;
var $dbpassword ;
var $dbdefault ;
var $dbdefault ;
function __construct() {
$config = PluginProcessmakerConfig::getInstance() ;
$this->dbhost = $config->fields['pm_dbserver_name'] ;
$this->dbuser = $config->fields['pm_dbserver_user'] ;
$this->dbpassword = Toolbox::decrypt($config->fields['pm_dbserver_passwd'], GLPIKEY);
$this->dbdefault = "wf_".$config->fields['pm_workspace'] ;
parent::__construct();
if( $config->fields['pm_dbserver_name'] != ''
&& $config->fields['pm_dbserver_user'] != ''
&& $config->fields['pm_workspace'] != '' ) {
$this->dbhost = $config->fields['pm_dbserver_name'] ;
$this->dbuser = $config->fields['pm_dbserver_user'] ;
$this->dbpassword = Toolbox::decrypt($config->fields['pm_dbserver_passwd'], GLPIKEY);
$this->dbdefault = "wf_".$config->fields['pm_workspace'] ;
parent::__construct();
}
}
}

View File

@@ -232,7 +232,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
$this->pmAdminSession = false ;
unset($_SESSION["pluginprocessmaker"]["session"]) ;
Toolbox::logDebug( "Processmaker Plugin: Soap problem: ". print_r( $locSession, true ) );
Toolbox::logDebug( "Processmaker Plugin: $admin_or_user - Soap problem: ". print_r( $locSession, true ) );
$this->lasterror = $locSession ;
return false ;
}
@@ -957,7 +957,11 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
* 0 : nothing to do
*/
static function cronPMTaskActions($task) {
global $DB, $CFG_GLPI;
global $DB, $CFG_GLPI, $PM_DB;
if (!isset($PM_DB)) {
$PM_DB = new PluginProcessmakerDB ;
}
$actionCode = 0; // by default
$error = false ;
@@ -1167,7 +1171,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
*/
static function cronPMUsers($task) {
global $DB, $PM_DB ;
if (!isset($PM_DB)) {
$PM_DB = new PluginProcessmakerDB ;
}
@@ -1678,6 +1682,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
$input['is_private'] = 0 ;
$input['actiontime'] = 0 ;
$input['state'] = 1 ; // == TO_DO
$input['users_id_tech'] = 0; // by default as it can't be empty
if( $techId ) {
$input['users_id_tech'] = $techId;
} elseif( $groups_id_tech ) {
@@ -1847,6 +1852,11 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
public function solveTask( $caseId, $delIndex, $options=array() ) {
global $DB, $CFG_GLPI ;
// 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
$start_date = new DateTime( $_SESSION["glpi_currenttime"] ) ;
$official_date_time = $_SESSION["glpi_currenttime"] ;
$_SESSION["glpi_currenttime"] = $start_date->sub(new DateInterval("PT1S"))->format("Y-m-d H:i:s") ;
$default_options = array(
'txtToAppend' => '',
'notif' => true,
@@ -1889,6 +1899,10 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
$glpi_task->update( $params ) ;
$CFG_GLPI["use_mailing"]= $donotif;
}
// restore current glpi time
$_SESSION["glpi_currenttime"] = $official_date_time ;
}
/**
@@ -2121,7 +2135,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
// don't display message if arbehaviours is install
if (!($plugin->isInstalled('arbehaviours') && $plugin->isActivated('arbehaviours'))) {
self::displayMessage($message, '', WARNING);
//save current $_SESSION['glpiactiveprofile'][$itemtype.'_status'']
$_SESSION['glpiactiveprofile'][$itemtype.'_status_save'] = $_SESSION['glpiactiveprofile'][$itemtype.'_status'];
// for all $params['options']['itemtype']. status, disable solved ( life cycles )
@@ -2468,6 +2482,7 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
$locItem->fields['due_date'] = "";
}
$resultCase = $this->newCase( $processId,
array('GLPI_ITEM_CAN_BE_SOLVED' => 0,
'GLPI_TICKET_ID' => $itemId,
@@ -2482,9 +2497,9 @@ class PluginProcessmakerProcessmaker extends CommonDBTM {
'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' => $userId, //$technicians[0]['glpi_id'],
'GLPI_URL' => $CFG_GLPI['url_base'].$CFG_GLPI['root_doc'],
'GLPI_TICKET_TECHNICIAN_PM_ID' => PluginProcessmakerUser::getPMUserId( $userId ) //$technicians[0]['pm_id']
'GLPI_TICKET_TECHNICIAN_GLPI_ID' => $userId,
'GLPI_TICKET_TECHNICIAN_PM_ID' => PluginProcessmakerUser::getPMUserId( $userId ),
'GLPI_URL' => $CFG_GLPI['url_base'].$CFG_GLPI['root_doc']
) ) ;
if ($resultCase->status_code === 0){

View File

@@ -94,6 +94,11 @@ class PluginProcessmakerTask extends CommonITILTask
$events = array() ;
if( isset($params['start']) ) {
$params['begin'] = '2000-01-01 00:00:00';
if ($params['type'] == 'group') {
$params['who_group'] = $params['who'];
$params['whogroup'] = $params['who'];
$params['who'] = 0 ;
}
$ret = CommonITILTask::genericPopulatePlanning( 'TicketTask', $params ) ;
foreach( $ret as $key => $event ) {

View File

@@ -63,10 +63,10 @@ function onTaskFrameLoad(event, delIndex, hideClaimButton, csrf) {
// if task resumé, then hide the form part
//debugger;
var form_resume = locContentDocument.getElementsByName('cases_Resume');
if (form_resume.length > 0 && form_resume[0].style.display != 'none') {
form_resume[0].style.display = 'none';
}
//var form_resume = locContentDocument.getElementsByName('cases_Resume');
//if (form_resume.length > 0 && form_resume[0].style.display != 'none') {
// form_resume[0].style.display = 'none';
//}
// then look if btnGLPISendRequest exists,
var locElt = locContentDocument.getElementById('form[btnGLPISendRequest]');

17
js/domain.js.php Normal file
View File

@@ -0,0 +1,17 @@
<?php
define('GLPI_ROOT','../../..');
include (GLPI_ROOT."/inc/includes.php");
header("Content-type: application/javascript");
$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 = 'document.domain = \'".$config->fields['domain']."\';';
s.parentNode.insertBefore(g, s);
" ;
}

View File

@@ -30,12 +30,7 @@ $LANG['processmaker']['process']['profile']="Delete permanently";
$LANG['processmaker']['config']['name']="Name";
$LANG['processmaker']['config']['setup']="ProcessMaker setup";
$LANG['processmaker']['config']['mysql']="SQL server setup";
$LANG['processmaker']['config']['URL']="Server URL";
//$LANG['processmaker']['config']['db_server']="mySQL server";
//$LANG['processmaker']['config']['db_user']="mySQL user";
//$LANG['processmaker']['config']['db_password']="mySQL password (leave blank if unchanged)";
//$LANG['processmaker']['config']['admin_user']="PM administrator user";
//$LANG['processmaker']['config']['admin_password']="PM administrator password (leave blank if unchanged)";
$LANG['processmaker']['config']['URL']="Server URL (must be in same domain than GLPI)";
$LANG['processmaker']['config']['workspace']="Workspace Name";
$LANG['processmaker']['config']['admin']['user']="Server administrator name";
$LANG['processmaker']['config']['admin']['password']="Server administrator password";
@@ -51,6 +46,8 @@ $LANG['processmaker']['config']['undermaintenance']="Under maintenance, please t
$LANG['processmaker']['config']['empty_pm_group_name']="To select group, input ProcessMaker config first!";
$LANG['processmaker']['config']['test']="Test";
$LANG['processmaker']['config']['connectionstatus']="Connection status";
$LANG['processmaker']['config']['domain']="Common domain with GLPI";
$LANG['processmaker']['config']['domain-error']="None!";
$LANG['processmaker']['item']['tab']="Process - Case";
$LANG['processmaker']['item']['cancelledcase']="Status: Cancelled";
@@ -90,6 +87,7 @@ $LANG['processmaker']['item']['case']['casechangeloghistory']='Change log histor
$LANG['processmaker']['item']['error'][11]="Error creating case!";
$LANG['processmaker']['item']['error'][14]="Can't create case: no rights for it!";
$LANG['processmaker']['item']['error'][100]=$LANG['processmaker']['item']['error'][11];
$LANG['processmaker']['item']['preventsolution'][1]="A 'Case' is running!";
$LANG['processmaker']['item']['preventsolution'][2]="You must manage it first (see 'Process - Case' tab)!";
@@ -116,4 +114,4 @@ $LANG['processmaker']['cron']['pmusers']="Syncs GLPI users and groups into Proce
$LANG['processmaker']['cron']['pmtaskactions']="To apply task actions between cases." ;
$LANG['processmaker']['cron']['pmorphancases']['description']="Cleaning of orphan cases." ;
$LANG['processmaker']['cron']['pmorphancases']['parameter']="Number of days to keep orphan cases";
$LANG['processmaker']['cron']['pmorphancases']['parameter']="Number of days to keep orphan cases";

View File

@@ -30,12 +30,7 @@ $LANG['processmaker']['process']['profile']="Effacer définitivement";
$LANG['processmaker']['config']['name']="Nom";
$LANG['processmaker']['config']['setup']="Configuration du serveur ProcessMaker";
$LANG['processmaker']['config']['mysql']="Configuration du serveur SQL";
$LANG['processmaker']['config']['URL']="URL du serveur";
//$LANG['processmaker']['config']['db_server']="Serveur mySQL";
//$LANG['processmaker']['config']['db_user']="Utilisateur mySQL";
//$LANG['processmaker']['config']['db_password']="Mot de passe mySQL (vide si inchangé)";
//$LANG['processmaker']['config']['admin_user']="Administrateur de PM";
//$LANG['processmaker']['config']['admin_password']="Mot de passed de l'administrateur de PM (vide si inchangé)";
$LANG['processmaker']['config']['URL']="URL du serveur (doit être dans le même domaine que GLPI)";
$LANG['processmaker']['config']['workspace']="Nom du Workspace";
$LANG['processmaker']['config']['admin']['user']="Non de l'administreur du server ProcessMaker";
$LANG['processmaker']['config']['admin']['password']="Mot de passe de l'administrateur du serveur ProcessMaker";
@@ -51,6 +46,8 @@ $LANG['processmaker']['config']['undermaintenance']="En maintenance, veuillez r
$LANG['processmaker']['config']['empty_pm_group_name']="Pour sélectionner un groupe, renseigner d'abord la config de ProcessMaker !";
$LANG['processmaker']['config']['test']="Test";
$LANG['processmaker']['config']['connectionstatus']="Status de la connexion";
$LANG['processmaker']['config']['domain']="Domaine utilisé";
$LANG['processmaker']['config']['domain-error']="Aucun !";
$LANG['processmaker']['item']['tab']="Processus - Cas";
$LANG['processmaker']['item']['cancelledcase']="Statut : Annulé";
@@ -90,6 +87,7 @@ $LANG['processmaker']['item']['case']['casechangeloghistory']='Historique évolu
$LANG['processmaker']['item']['error'][11]="Erreur à la création du cas !";
$LANG['processmaker']['item']['error'][14]="Impossible de créer le cas : pas de droits pour cela !";
$LANG['processmaker']['item']['error'][100]=$LANG['processmaker']['item']['error'][11];
$LANG['processmaker']['item']['preventsolution'][1]="Un 'Cas' est en cours !";
$LANG['processmaker']['item']['preventsolution'][2]="Vous devez d'abord le terminer (voir onglet 'Processus - Cas') !";
@@ -116,4 +114,4 @@ $LANG['processmaker']['cron']['pmusers']="Synchro des utilisateurs GLPI et des g
//$LANG['processmaker']['cron']['pmnotifications']="Notifications des tâches GLPI liées à des tâches de ProcessMaker." ;
$LANG['processmaker']['cron']['pmtaskactions']="Pour appliquer les actions de tâches entre cas." ;
$LANG['processmaker']['cron']['pmorphancases']['description']="Nettoyage des cas orphelins." ;
$LANG['processmaker']['cron']['pmorphancases']['parameter']="Nombre de jours avant nettoyage des cas orphelins.";
$LANG['processmaker']['cron']['pmorphancases']['parameter']="Nombre de jours avant nettoyage des cas orphelins.";

View File

@@ -23,7 +23,7 @@
</authors>
<versions>
<version>
<num>3.1.0</num>
<num>3.1.1</num>
<compatibility>9.1</compatibility>
</version>
</versions>

View File

@@ -72,7 +72,6 @@ function plugin_init_processmaker() {
$PLUGIN_HOOKS['pre_item_update']['processmaker'] = array(
'Ticket' => 'plugin_pre_item_update_processmaker'
);
// , 'TicketFollowup' => 'plugin_pre_item_update_processmaker_followup'
$PLUGIN_HOOKS['item_update']['processmaker'] = array(
'TicketSatisfaction' => 'plugin_item_update_processmaker_satisfaction',
@@ -99,6 +98,7 @@ function plugin_init_processmaker() {
'Ticket_User' => 'plugin_item_purge_processmaker'
) ;
$PLUGIN_HOOKS['add_javascript']['processmaker'] = array("js/domain.js.php");
$url = explode("/", $_SERVER['PHP_SELF']);
$pageName = explode("?", array_pop($url));
switch($pageName[0]) {
@@ -106,9 +106,8 @@ function plugin_init_processmaker() {
case "helpdesk.public.php":
//$plug = new Plugin;
//if( !$plug->isActivated('rayusermanagementticket') )
$PLUGIN_HOOKS['add_javascript']['processmaker'] = "js/helpdesk.public.js.php";
$PLUGIN_HOOKS['add_javascript']['processmaker'][] = "js/helpdesk.public.js.php";
break;
}
$PLUGIN_HOOKS['use_massive_action']['processmaker'] = 1;
@@ -124,7 +123,7 @@ function plugin_version_processmaker(){
global $LANG;
return array ('name' => 'Process Maker',
'version' => '3.1.0',
'version' => '3.1.1',
'author' => 'Olivier Moron',
'homepage' => '',
'minGlpiVersion' => '9.1');