We use HESK PHP/MySQL open source software. At the moment the software will merge (keep together) a conversation if it has the same 13 character "reference" code, e.g. "TES-TCO-DE44" will merge it with other conversations with this reference.
My emails come from a SMS gateway so the sender will always be the same, e.g. 07xxxxxxxxx at [url removed, login to view], likewise the subject. I need the script modified so that it merges conversations with the same email address.
There is already a merge function where you pass the two thread ids you want to merge so this could be used. Alternatively to merge the threads the script appends a merged field in the tickets database with the thread ID to merge, e.g. just adds #TES-TCO-DE44# to the merged field of the database. Either way it needs to automatically append the conversation to any previous conversations and make sure it is marked as "New" so users know a new message has been added.
Finally, I need an SQL script written that will blank (remove all content) from the email, subject and message field after 6 days for tickets that are marked medium or low priority, and 1 year for high priority or critical tickets.
I hope this explains the problem. I've uploaded the common_inc file which has the new ticket function and the admin_functions file which has the file merge.