tomolimo / mailanalyzer

Mail Analyzer GLPI Plugin may be used to combine CC mails into one Ticket
25 stars 10 forks source link

Mail Analyzer not work with GLPI 9.4.1.1 #26

Closed jpogor closed 5 years ago

jpogor commented 5 years ago

Mail Analyzer not work with GLPI 9.4.1.1 How to fix it ?

fgendorf commented 5 years ago

Same problem here, it stuck in some cases.

Skouat commented 5 years ago

Hi there,

This is the backtrace :

PHP Fatal error:  Uncaught Error: Class name must be a valid object or a string in /var/www/glpi/inc/itilfollowup.class.php:321
Stack trace:
#0 /var/www/glpi/inc/commondbtm.class.php(1100): ITILFollowup->prepareInputForAdd(Array)
#1 /var/www/glpi/plugins/mailanalyzer/hook.php(365): CommonDBTM->add(Array)
#2 /var/www/glpi/inc/plugin.class.php(1074): PluginMailAnalyzer::plugin_pre_item_add_mailanalyzer(Object(Ticket))
#3 /var/www/glpi/inc/commondbtm.class.php(1091): Plugin::doHook('pre_item_add', Object(Ticket))
#4 /var/www/glpi/inc/mailcollector.class.php(726): CommonDBTM->add(Array)
#5 /var/www/glpi/inc/mailcollector.class.php(1794): MailCollector->collect('1')
#6 /var/www/glpi/inc/crontask.class.php(829): MailCollector::cronMailgate(Object(CronTask))
#7 /var/www/glpi/front/crontask.form.php(49): CronTask::launch(-1, 1, 'mailgate')
#8 {main}
  thrown in /var/www/glpi/inc/itilfollowup.class.php on line 321, referer: http://glpi.x-prime.local/front/crontask.form.php?id=9
Skouat commented 5 years ago

@tomolimo Since this change in GLPI, the method prepareInputForAdd($input) of the class ITILFollowup expects an itemtype. But this one is unset in your code.

hd49182 commented 5 years ago

hi @Skouat I changed the code you passed here and now the plugin is functional again (GLPI 9.4.1.1 and 9.4.2). Cron does not hang anymore. But there are still errors in the PHP log, it follows:

*** PHP Notice(8): Undefined index: tickets_id Backtrace : plugins/mailanalyzer/hook.php:368 inc/plugin.class.php:1121 PluginMailAnalyzer::plugin_pre_item_add_mailanalyzer() inc/commondbtm.class.php:1092 Plugin::doHook() inc/mailcollector.class.php:726 CommonDBTM->add() inc/mailcollector.class.php:1794 MailCollector->collect() inc/crontask.class.php:829 MailCollector::cronMailgate() front/cron.php:77 CronTask::launch()

Anyway, thanks for your time. Tks man... Great work!

@tomolimo Since this change in GLPI, the method prepareInputForAdd($input) of the class ITILFollowup expects an itemtype. But this one is unset in your code.

Skouat commented 5 years ago

Hi @hd49182 Please, can you paste your line 368 from the file plugins/mailanalyzer/hook.php?

Skouat commented 5 years ago

@hd49182

*** PHP Notice(8): Undefined index: tickets_id

PR updated with the fix for this error.

hd49182 commented 5 years ago

Hi @hd49182 Please, can you paste your line 368 from the file plugins/mailanalyzer/hook.php?

Follow the print of the file

Captura de Tela 2019-04-04 às 15 33 09

hd49182 commented 5 years ago

Hi @hd49182 Please, can you paste your line 368 from the file plugins/mailanalyzer/hook.php?

Follow the print of the file

Captura de Tela 2019-04-04 às 15 33 09

Its funny... i get with this error

I applied the fix on line 368 now. I'll monitor the logs, let's wait. Tks for your time!

hd49182 commented 5 years ago

@hd49182

*** PHP Notice(8): Undefined index: tickets_id

PR updated with the fix for this error.

Great work, man! I did a test now and ran without fail! I've monitored the PHP log and has not added new entries so far!

Tks a lot!