mailanalyzer icon indicating copy to clipboard operation
mailanalyzer copied to clipboard

Add followup to the parent ticket when the ticket son was merged as a followup and create a new ticket when a ticket was deleted/purged

Open jcervantes-sipecom opened this issue 4 years ago • 0 comments

Describe the bug

This is about to an improvement and to a bug:

  1. When a ticket (son ticket) is merged as a followup to another ticket (parent ticket), this ticket (son ticket) is deleted (not purged yet). So when someone replies to the email that is associated to that deleted ticket, mailanalyzer add the email followup to the deleted ticket, instead to the parent ticket.

  2. When a deleted ticket is purged, and someone else reply a email associated to that purged ticket, emailanalyzer doesn't create a new ticket, because in database its guid is associated to that deleted ticket. But that followup doesn't appear in any place.

To reproduce

Steps to reproduce the behavior:

Scenario num. 1)

  1. Send differents 2 emails to email receiver/collector:

image

image

image

  1. Merge the second ticket (197 in the image) as a followup for the first one (196 in the image):

image

The second ticket (ID 197) is deleted:

image

image

image

  1. Reply to the second email, and execute receiver.
  2. The followup is added to the deleted ticket, instead to the parent ticket:

image

image

Scenario num. 2)

  1. Purge the deleted Ticket (197 in the image). The ticket ID is deleted from database tables: glpi_tickets and glpi_tickets_tickets, but not from glpi_plugin_mailanalyzer_message_id

  2. Send a email reply for the second email previously sent (the email associated for the ticket ID purged), and execute receiver.

  3. The followup is nowhere, the messageid is created in the table and associated to the purged ticket id, instead of create a new one:

image

Expected behavior

For Scenario num. 1)

That the reply for the second email, that is associated for the merged and deleted ticket, is added as a followup for the parent ticket, instead of the deleted ticket.

For Scenario num. 2)

That the reply for the second email, that is associated to the purged ticket, it should create a new ticket. That a purged ticket ID should be purged in the table glpi_plugin_mailanalyzer_message_id.ticket_id as well.

Logs

Nothing in php-errors nor sql-errors

Your GLPI setup (you can find it in Setup > General menu, System tab)

[code]   GLPI 9.5.6 (/glpi => C:\inetpub\wwwroot\glpi) Installation mode: TARBALL
--

Operating system: Windows NT PC 10.0 build 19043 (Windows 10) AMD64 PHP 7.4.27 cgi-fcgi (Core, PDO, Phar, Reflection, SPL, SimpleXML, bcmath, bz2, calendar, cgi-fcgi, ctype, curl, date, dom, exif, 	fileinfo, filter, gd, gettext, hash, iconv, imap, intl, json, ldap, libxml, mbstring, mysqli, mysqlnd, openssl, pcre, pdo_mysql, 	pdo_sqlite, readline, session, soap, sodium, standard, tidy, tokenizer, xdebug, xml, xmlreader, xmlrpc, xmlwriter, zend-test, 	zip, zlib) Setup: max_execution_time="300" memory_limit="128M" post_max_size="8M" safe_mode="" session.save_handler="files" 	upload_max_filesize="2M"  Software: Microsoft-IIS/10.0 	Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.71 Safari/537.36 Edg/97.0.1072.55 Server Software: mariadb.org binary distribution 	Server Version: 10.3.32-MariaDB 	Server SQL Mode:  	Parameters: [email protected]/glpi_new 	Host info: 127.0.0.1 via TCP/IP 	 PHP version is at least 7.2.0 - Perfect! Sessions support is available - Perfect! Allocated memory > 64 Mio - Perfect! mysqli extension is installed ctype extension is installed fileinfo extension is installed json extension is installed mbstring extension is installed iconv extension is installed zlib extension is installed curl extension is installed gd extension is installed simplexml extension is installed intl extension is installed ldap extension is installed apcu extension is not present Zend OPcache extension is not present xmlrpc extension is installed exif extension is installed zip extension is installed bz2 extension is installed sodium extension is installed Database version seems correct (10.3.32) - Perfect! Timezones seems not loaded, see https://glpi-install.readthedocs.io/en/latest/timezones.html. The log file has been created successfully. Write access to C:\inetpub\wwwroot\glpi/files/_cache has been validated. Write access to C:\inetpub\wwwroot\glpi/config has been validated. Write access to C:\inetpub\wwwroot\glpi/files/_cron has been validated. Write access to C:\inetpub\wwwroot\glpi/files has been validated. Write access to C:\inetpub\wwwroot\glpi/files/_dumps has been validated. Write access to C:\inetpub\wwwroot\glpi/files/_graphs has been validated. Write access to C:\inetpub\wwwroot\glpi/files/_lock has been validated. Write access to C:\inetpub\wwwroot\glpi/files/_pictures has been validated. Write access to C:\inetpub\wwwroot\glpi/files/_plugins has been validated. Write access to C:\inetpub\wwwroot\glpi/files/_rss has been validated. Write access to C:\inetpub\wwwroot\glpi/files/_sessions has been validated. Write access to C:\inetpub\wwwroot\glpi/files/_tmp has been validated. Write access to C:\inetpub\wwwroot\glpi/files/_uploads has been validated. Write access to C:\inetpub\wwwroot\glpi/marketplace has been validated. Web access to the files directory should not be allowed but this cannot be checked automatically on this instance. Make sure access to error log file (/glpi/files/_log/php-errors.log) is forbidden; otherwise review .htaccess file and web server configuration.

GLPI_ROOT: C:\inetpub\wwwroot\glpi GLPI_CONFIG_DIR: C:\inetpub\wwwroot\glpi/config GLPI_VAR_DIR: C:\inetpub\wwwroot\glpi/files GLPI_MARKETPLACE_DIR: C:\inetpub\wwwroot\glpi/marketplace GLPI_USE_CSRF_CHECK: 1 GLPI_CSRF_EXPIRES: 7200 GLPI_CSRF_MAX_TOKENS: 100 GLPI_USE_IDOR_CHECK: 1 GLPI_IDOR_EXPIRES: 7200 GLPI_ALLOW_IFRAME_IN_RICH_TEXT:  GLPI_TELEMETRY_URI: https://telemetry.glpi-project.org GLPI_INSTALL_MODE: TARBALL GLPI_NETWORK_MAIL: [email protected] GLPI_NETWORK_SERVICES: https://services.glpi-network.com GLPI_MARKETPLACE_PRERELEASES:  GLPI_MARKETPLACE_ALLOW_OVERRIDE: 1 GLPI_MARKETPLACE_MANUAL_DOWNLOADS: 1 GLPI_USER_AGENT_EXTRA_COMMENTS:  GLPI_AJAX_DASHBOARD: 1 GLPI_CALDAV_IMPORT_STATE: 0 GLPI_DEMO_MODE: 0 GLPI_FORCE_EMPTY_SQL_MODE: 1 GLPI_DOC_DIR: C:\inetpub\wwwroot\glpi/files GLPI_CACHE_DIR: C:\inetpub\wwwroot\glpi/files/_cache GLPI_CRON_DIR: C:\inetpub\wwwroot\glpi/files/_cron GLPI_DUMP_DIR: C:\inetpub\wwwroot\glpi/files/_dumps GLPI_GRAPH_DIR: C:\inetpub\wwwroot\glpi/files/_graphs GLPI_LOCAL_I18N_DIR: C:\inetpub\wwwroot\glpi/files/_locales GLPI_LOCK_DIR: C:\inetpub\wwwroot\glpi/files/_lock GLPI_LOG_DIR: C:\inetpub\wwwroot\glpi/files/_log GLPI_PICTURE_DIR: C:\inetpub\wwwroot\glpi/files/_pictures GLPI_PLUGIN_DOC_DIR: C:\inetpub\wwwroot\glpi/files/_plugins GLPI_RSS_DIR: C:\inetpub\wwwroot\glpi/files/_rss GLPI_SESSION_DIR: C:\inetpub\wwwroot\glpi/files/_sessions GLPI_TMP_DIR: C:\inetpub\wwwroot\glpi/files/_tmp GLPI_UPLOAD_DIR: C:\inetpub\wwwroot\glpi/files/_uploads GLPI_NETWORK_REGISTRATION_API_URL: https://services.glpi-network.com/api/registration/ GLPI_MARKETPLACE_PLUGINS_API_URI: https://services.glpi-network.com/api/glpi-plugins/ GLPI_I18N_DIR: C:\inetpub\wwwroot\glpi/locales GLPI_VERSION: 9.5.6 GLPI_SCHEMA_VERSION: 9.5.6 GLPI_MIN_PHP: 7.2.0 GLPI_YEAR: 2021 GLPI_MOD_DIR: C:\inetpub\wwwroot\glpi/plugins/mod

htmlawed/htmlawed version 1.2.5 in (C:\inetpub\wwwroot\glpi\vendor\htmlawed\htmlawed) phpmailer/phpmailer version 6.1.6 in (C:\inetpub\wwwroot\glpi\vendor\phpmailer\phpmailer\src) simplepie/simplepie version 1.5.6 in (C:\inetpub\wwwroot\glpi\vendor\simplepie\simplepie\library) tecnickcom/tcpdf version 6.3.5 in (C:\inetpub\wwwroot\glpi\vendor\tecnickcom\tcpdf) michelf/php-markdown in (C:\inetpub\wwwroot\glpi\vendor\michelf\php-markdown\Michelf) true/punycode in (C:\inetpub\wwwroot\glpi\vendor\true\punycode\src) iamcal/lib_autolink in (C:\inetpub\wwwroot\glpi\vendor\iamcal\lib_autolink) sabre/dav in (C:\inetpub\wwwroot\glpi\vendor\sabre\dav\lib\DAV) sabre/http in (C:\inetpub\wwwroot\glpi\vendor\sabre\http\lib) sabre/uri in (C:\inetpub\wwwroot\glpi\vendor\sabre\uri\lib) sabre/vobject in (C:\inetpub\wwwroot\glpi\vendor\sabre\vobject\lib) laminas/laminas-cache in (C:\inetpub\wwwroot\glpi\vendor\laminas\laminas-cache\src) laminas/laminas-i18n in (C:\inetpub\wwwroot\glpi\vendor\laminas\laminas-i18n\src) laminas/laminas-serializer in (C:\inetpub\wwwroot\glpi\vendor\laminas\laminas-serializer\src) monolog/monolog in (C:\inetpub\wwwroot\glpi\vendor\monolog\monolog\src\Monolog) sebastian/diff in (C:\inetpub\wwwroot\glpi\vendor\sebastian\diff\src) elvanto/litemoji in (C:\inetpub\wwwroot\glpi\vendor\elvanto\litemoji\src) symfony/console in (C:\inetpub\wwwroot\glpi\vendor\symfony\console) scssphp/scssphp in (C:\inetpub\wwwroot\glpi\vendor\scssphp\scssphp\src) laminas/laminas-mail in (C:\inetpub\wwwroot\glpi\vendor\laminas\laminas-mail\src\Protocol) laminas/laminas-mime in (C:\inetpub\wwwroot\glpi\vendor\laminas\laminas-mime\src) rlanvin/php-rrule in (C:\inetpub\wwwroot\glpi\vendor\rlanvin\php-rrule\src) blueimp/jquery-file-upload in (C:\inetpub\wwwroot\glpi\vendor\blueimp\jquery-file-upload\server\php) ramsey/uuid in (C:\inetpub\wwwroot\glpi\vendor\ramsey\uuid\src) psr/log in (C:\inetpub\wwwroot\glpi\vendor\psr\log\Psr\Log) psr/simple-cache in (C:\inetpub\wwwroot\glpi\vendor\psr\simple-cache\src) mexitek/phpcolors in (C:\inetpub\wwwroot\glpi\vendor\mexitek\phpcolors\src\Mexitek\PHPColors) guzzlehttp/guzzle in (C:\inetpub\wwwroot\glpi\vendor\guzzlehttp\guzzle\src) guzzlehttp/psr7 in (C:\inetpub\wwwroot\glpi\vendor\guzzlehttp\psr7\src) wapmorgan/unified-archive in (C:\inetpub\wwwroot\glpi\vendor\wapmorgan\unified-archive\src) paragonie/sodium_compat in (C:\inetpub\wwwroot\glpi\vendor\paragonie\sodium_compat\src)

Not active

Way of sending emails: SMTP+SSL ([email protected]@smtp.gmail.com)

Name: '[email protected]' Active: Yes 	Server: '{imap.gmail.com:993/imap/ssl}INBOX' Login: '[email protected]' Password: Yes Name: '[email protected]' Active: Yes 	Server: '{imap.gmail.com:993/imap/ssl}INBOX' Login: '[email protected]' Password: Yes

accounts             Name: Accounts                       Version: 2.6.0      State: Installed / not activated 	activity             Name: Activities                     Version: 3.0.0      State: Installed / not activated 	actualtime           Name: ActualTime                     Version: 1.5.1      State: Enabled 	fields               Name: Additionnal fields             Version: 1.12.8     State: Installed / not activated 	advancedplanning     Name: advancedplanning               Version: 0.2.0      State: Installed / not activated 	news                 Name: Alerts                         Version: 1.9.0      State: Enabled 	cleanarchivedemails  Name: Archived eMail clean           Version: 2.0.0      State: Enabled 	impacts              Name: Asset impacts                  Version: 2.0.5      State: Not installed 	barcode              Name: Barcode                        Version: 2.6.1      State: Not installed 	behaviors            Name: Behaviours                     Version: 2.5.0      State: Enabled 	positions            Name: Cartography                    Version: 5.0.0      State: Not installed 	cmdb                 Name: CMDB                           Version: 2.2.1      State: Not installed 	consumables          Name: Consumable request             Version: 1.6.0      State: Not installed 	dashboard            Name: Dashboard                      Version: 1.0.2      State: Not installed 	datainjection        Name: Data injection                 Version: 2.9.0      State: Not installed 	databases            Name: Databases                      Version: 2.3.2      State: Not installed 	archimap             Name: Diagrams                       Version: 3.1.0      State: Not installed 	environment          Name: Environment                    Version: 2.4.2      State: Not installed 	escalade             Name: Escalation                     Version: 2.7.1      State: Enabled 	father               Name: Father&Sons                Version: 1.2.0      State: Installed / not activated 	formcreator          Name: Form Creator                   Version: 2.12.3     State: Not installed 	fusioninventory      Name: FusionInventory                Version: 9.5+3.0    State: Not installed 	mod                  Name: GLPI Modifications             Version: 2.0.2      State: Enabled 	resources            Name: Human Resources                Version: 2.7.0      State: Not installed 	geninventorynumber   Name: Inventory number generation    Version: 2.5.0      State: Not installed 	addressing           Name: IP Adressing                   Version: 2.9.0      State: Not installed 	uninstall            Name: Item's Lifecycle (uninstall)   Version: 2.7.1      State: Not installed 	mailanalyzer         Name: Mail Analyzer                  Version: 2.0.2      State: Enabled 	mreporting           Name: Más informes                   Version: 1.7.3      State: Not installed 	satisfaction         Name: More satisfaction              Version: 1.5.2      State: Enabled 	moreticket           Name: More ticket                    Version: 1.6.1      State: Enabled 	mydashboard          Name: My Dashboard                   Version: 1.8.2      State: Not installed 	genericobject        Name: Objects management             Version: 2.11.0     State: Not installed 	ocsinventoryng       Name: OCS Inventory NG               Version: 1.7.3      State: Not installed 	officeonline         Name: Office Online                  Version: 2.0.2      State: Enabled 	order                Name: Orders management              Version: 2.7.3      State: Not installed 	pdf                  Name: Print to pdf                   Version: 2.0.0      State: Not installed 	protocolsmanager     Name: Protocols manager              Version: 1.4.2      State: Not installed 	reports              Name: Reportes                       Version: 1.14.1     State: Not installed 	screenshot           Name: Screenshot                     Version: 1.1.6      State: Not installed 	taskdrop             Name: TaskDrop                       Version: 1.2.0      State: Not installed 	tasklists            Name: Tasks list                     Version: 1.6.2      State: Not installed 	ticketcleaner        Name: Ticket Cleaner                 Version: 3.0.0      State: Enabled 	timelineticket       Name: Timeline of tickets            Version: 9.5+1.1    State: Installed / not activated 	useditemsexport      Name: Used items export              Version: 2.4.0      State: Not installed 	webapplications      Name: Web applications               Version: 3.0.0      State: Not installed 	yagp                 Name: yagp                           Version: 1.2.0      State: Enabled
[/code]

Additional context

Also, I guess for scenario num. 1), a reply or followup to a email for a deleted ticket, should generate a new ticket, instead of adding it the followup to the deleted one.

jcervantes-sipecom avatar Jan 18 '22 22:01 jcervantes-sipecom