Closed lekzz closed 7 years ago
Hello, Could you screen copy the PM plugin configuration form? thank you, Tomolimo
Could you try to change the getCommonDomain function in plugins/processmaker/config.class.php? replace it by:
static function getCommonDomain($url1, $url2) {
$domain = '';
try {
$glpi = explode( "/", $url1) ;
$glpi = explode( ".", $glpi[2] );
$pm = explode( "/", $url2) ;
$pm = explode( ".", $pm[2] );
$cglpi = explode(":", array_pop( $glpi ));
$cglpi = array_shift($cglpi) ;
$cpm = explode(":", array_pop( $pm));
$cpm = array_shift($cpm) ;
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 '';
}
I tried the new function but same result. Plugin config screenshot:
btw: joe (joe's own editor) thinks the $domain line's syntax is not right:
the number of errors in glpi's errors log seems to have reduced tho:
2017-05-05 13:32:06 [512@glpi01] *** PHP Notice(8): Undefined offset: 2 Backtrace : plugins/processmaker/inc/config.class.php:101 plugins/processmaker/inc/config.class.php:86 PluginProcessmakerConfig::getCommonDomain() inc/commondbtm.class.php:1065 PluginProcessmakerConfig->prepareInputForUpdate() plugins/processmaker/front/config.form.php:15 CommonDBTM->update() 2017-05-05 13:32:06 [512@glpi01] *** PHP Notice(8): Undefined index: pm_admin_user Backtrace : plugins/processmaker/inc/config.class.php:177 plugins/processmaker/inc/config.class.php:304 PluginProcessmakerConfig::showConfigForm() inc/commonglpi.class.php:483 PluginProcessmakerConfig::displayTabContentForItem() ajax/common.tabs.php:97 CommonGLPI::displayStandardTab() 2017-05-05 13:32:06 [512@glpi01] *** PHP Notice(8): Undefined index: pm_admin_user Backtrace : plugins/processmaker/inc/config.class.php:192 plugins/processmaker/inc/config.class.php:304 PluginProcessmakerConfig::showConfigForm() inc/commonglpi.class.php:483 PluginProcessmakerConfig::displayTabContentForItem() ajax/common.tabs.php:97 CommonGLPI::displayStandardTab()
Instructions according to https://github.com/tomolimo/processmaker-server/wiki where followed. I do however just notice i'm still running mysql 5.5 which is unsupported, i'll try to get it updated to 5.7. (A bit annoying that processmaker doesn't support php7 and thus no ubuntu 16.04, but also doesn't support the default ubuntu 14.04 php/mysql versions, but that is ofcourse not your problem). But i doubt the mysql version prevents the glpi pm integration.
Your problem is coming from the fact that GLPI URL is not defined in the "General setup" tab. As you can see, the "None!" in red shows that GLPI URL and PM URL don't share the same root domain. So define GLPI URL in the "General Setup" tab Keep your current version of MySQL: you'll see later if it's necessary to upgrade Regards, Tomolimo
Also I've prepared a new and more efficient function:
static function getCommonDomain($url1, $url2) {
$domain = '';
try {
$glpi = explode(".", parse_url($url1, PHP_URL_HOST));
$pm = explode( ".", parse_url($url2, PHP_URL_HOST));
$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 '';
}
And also for javascript:
echo Html::scriptBlock("
function setCommonDomain() {
function parseUrl( url ) {
var a = document.createElement('a');
a.href = url;
return { host: a.hostname, port: a.port, scheme: a.protocol.slice(0, -1), path: a.pathname, query: a.search.slice(1), fragment: a.hash.slice(1) } ;
}
var domain = '';
try {
var glpi = parseUrl( '".$CFG_GLPI['url_base']."' ).host.split('.') ;
var pm = parseUrl( $('input[name=pm_server_URL]').val()).host.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() ;
");
Thanks again for your fast answer(s).
The GLPI URL was definied but apparently not in the right way. It was set to ticket.intra, after changing it to http://ticket.intra/. "None!" now changed to "intra" in green.
However even after changing the URL and updating the function and the javascript still the same problem. Mysql has been upgraded to 5.7 using the official mysql repository.
The errors now seem to have go down to only 2 lines:
2017-05-05 16:37:08 [512@glpi01] *** PHP Notice(8): Undefined index: pm_admin_user Backtrace : plugins/processmaker/inc/config.class.php:180 plugins/processmaker/inc/config.class.php:307 PluginProcessmakerConfig::showConfigForm() inc/commonglpi.class.php:483 PluginProcessmakerConfig::displayTabContentForItem() ajax/common.tabs.php:97 CommonGLPI::displayStandardTab() 2017-05-05 16:37:08 [512@glpi01] *** PHP Notice(8): Undefined index: pm_admin_user Backtrace : plugins/processmaker/inc/config.class.php:195 plugins/processmaker/inc/config.class.php:307 PluginProcessmakerConfig::showConfigForm() inc/commonglpi.class.php:483 PluginProcessmakerConfig::displayTabContentForItem() ajax/common.tabs.php:97 CommonGLPI::displayStandardTab()
Regards, Lex
You need to define the pm admin that will be used by the plug-in when needed. This user is a PM admin. And you must set it in the plug-in configuration.
Just discovered something else. Looks like the problem is with the pm_admin_user variable which doesn't seem to get filled.
I removed the mysql user/pass to empty all user/pass fields. Then if i fill in only the username for mysql and press save, the connection obviously fails but the settings page will reload and username will stay filled in to what was just entered. However if i do the same with the username for pmos and press save, the page will reload but the pmos username will be empty again.
This will clear the error message 'test failed'
Could you check the config table in the DB?
Before pressing save:
After pressing save:
The glpi_plugin_processmaker_configs table?
There is something wrong between config form and PHP script and table
mysql> select * from glpi_plugin_processmaker_configs; +----+-----------------+--------------------+--------------+-----------------+---------------------+-------------------+ ----------+---------------+------------------+------------------+--------------------+--------+-------------+---------+ | id | name | pm_server_URL | pm_workspace | pm_theme | date_mod | taskcategories_id | users_id | pm_group_guid | pm_dbserver_name | pm_dbserver_user | pm_dbserver_passwd | domain | maintenance | comment | +----+-----------------+--------------------+--------------+-----------------+---------------------+-------------------+ ----------+---------------+------------------+------------------+--------------------+--------+-------------+---------+ | 1 | Process Maker 1 | http://pmos.intra/ | workflow | glpi_neoclassic | 2017-05-05 16:49:13 | 1 | 283 | 0 | localhost | root | *REMOVED* | intra | 0 | NULL | +----+-----------------+--------------------+--------------+-----------------+---------------------+-------------------+ ----------+---------------+------------------+------------------+--------------------+--------+-------------+---------+ 1 row in set (0.00 sec)
btw: i tried some reinstalls by removing /opt/processmaker and droping the processmaker database. However i never did something with the glpi database.
It seems like you did an upgrade of plug in? Could you try to uninstall the plug-in, drop glpi_plugin_processmaker_xxx tables And re-install the plug-in ?
Normally in the config table you should be able to find pm_admin_xxx fields
uninstall/drop/install seemed to have fixed the issue! thnx!
I can't select any group in "Group in ProcessMaker which will contain all GLPi users" yet tho. The group does exist in pmos. Is there anything else that needs to be done to be able to select a group or should it just work right away?
The group list comes from the db, which is accessed by the identification set in the config form, above.
Yeah was afraid of that :)
It stays empty even after rebooting the server and relaunching the browser (to make sure everything is reloaded):
pmos screenshot:
Did you change the name of the std workspace?
Someone else have had that issue also, check in the solved issues
It was Satyan01
Ok will do! Thnx so far for your fast support!
Hi,
I can't get GLPI to connect to PM.
Ubuntu: 14.04 with php5.6 from ondrej ppa GLPI: 9.1.3 ProcessMaker: 3.0.1.8-RE-1.5 GLPI URL: http://ticket.intra/ PM URL: http://pmos.intra/ user/pass during testing: admin / admin (no special characters)
No problems with PM itself. Install and operation seem to work fine.
GLPI's php-errors.log:
2017-05-05 11:51:00 [512@glpi01] *** PHP Notice(8): Undefined offset: 2 Backtrace : plugins/processmaker/inc/config.class.php:101 plugins/processmaker/inc/config.class.php:86 PluginProcessmakerConfig::getCommonDomain() inc/commondbtm.class.php:1065 PluginProcessmakerConfig->prepareInputForUpdate() plugins/processmaker/front/config.form.php:15 CommonDBTM->update() 2017-05-05 11:51:00 [512@glpi01] *** PHP Runtime Notice(2048): Only variables should be passed by reference Backtrace : plugins/processmaker/inc/config.class.php:104 plugins/processmaker/inc/config.class.php:86 PluginProcessmakerConfig::getCommonDomain() inc/commondbtm.class.php:1065 PluginProcessmakerConfig->prepareInputForUpdate() plugins/processmaker/front/config.form.php:15 CommonDBTM->update() 2017-05-05 11:51:00 [512@glpi01] *** PHP Runtime Notice(2048): Only variables should be passed by reference Backtrace : plugins/processmaker/inc/config.class.php:105 plugins/processmaker/inc/config.class.php:86 PluginProcessmakerConfig::getCommonDomain() inc/commondbtm.class.php:1065 PluginProcessmakerConfig->prepareInputForUpdate() plugins/processmaker/front/config.form.php:15 CommonDBTM->update() 2017-05-05 11:51:01 [512@glpi01] *** PHP Notice(8): Undefined index: pm_admin_user Backtrace : plugins/processmaker/inc/config.class.php:175 plugins/processmaker/inc/config.class.php:302 PluginProcessmakerConfig::showConfigForm() inc/commonglpi.class.php:483 PluginProcessmakerConfig::displayTabContentForItem() ajax/common.tabs.php:97 CommonGLPI::displayStandardTab() 2017-05-05 11:51:01 [512@glpi01] *** PHP Notice(8): Undefined index: pm_admin_user Backtrace : plugins/processmaker/inc/config.class.php:190 plugins/processmaker/inc/config.class.php:302 PluginProcessmakerConfig::showConfigForm() inc/commonglpi.class.php:483 PluginProcessmakerConfig::displayTabContentForItem() ajax/common.tabs.php:97 CommonGLPI::displayStandardTab()
Maybe an issue with pm_admin_user?