DonutsNL / ticketfilter

Matches foreign identifiers in the mailsubject and adds these as followups to existing GLPI tickets with the same patern.
GNU General Public License v2.0
2 stars 0 forks source link

filter same ticket with same object #11

Open eckop opened 6 months ago

eckop commented 6 months ago

Good morning,

I would like to know if you have an idea or the order in question. I would like the plugin to be able to analyze the objects and if there is the same object, put it in the ticket concerned. Currently, all emails arrive in the same ticket... thanks in advance

DonutsNL commented 6 months ago

Hi @eckop

Im not sure i fully understand your question.

Could you explain the problem in a bit more detail. Do take into account that the received email only has so many data available to 'match' with an existing ticket.

eckop commented 5 months ago

Hi,

I would like the plugin to be able to analyze the arrival of the email and add it following an already opened email. Example: the subject is "Outlook password problem", the filter analyzes the subject and puts it in the same subject. At the moment, everything is put in a ticket or there are new emails constantly image The command I use: /.*?(?<match>.+).*/gm

DonutsNL commented 5 months ago

Hi,

Just a quick peek at your pattern. The .*? is too ambigues. It will actually match nothing. In the greedy first statement nothing will be matched, matching everything in the matchgroup. This will create a new ticket because the result is different from the ticket without the RE:.

https://regex101.com/r/GPsYEF/1

To fix this you should match the "RE: "(including trailing spaces) specifically and then match the remainder in your matchgroup. Dont add the /gm. Its covered in the php function used.

https://regex101.com/r/nFiFm9/1