Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

OSTicket v1.10 Merge / Duplicate Ticket mods attached

I am attaching a Merge modification for OSTicket  v1.10 (901e5ea). 

- The replacement PHP files.
- The SQL needed (if you changed your ost prefix from ost_ to something else then you will need to modify the sql file)

The Merge Ticket functionality basically sets up a master/child ticket relationship.  
- You can merge two tickets by opening the child ticket, entering the maser ticket number and clicking MERGE.
- You can merge multiple children into a master by simply selecting multiple tickets, entering the master ticket number and clicking MERGE.
- You can not merge a "master ticket" into another "master ticket" or a "child ticket" into multiple "master tickets".   It is just a "master" / "children" relationship.
- Viewing either the master or child tickets includes a "Relations" tab where you can see all the related tickets.
- You can delete the links between master and child tickets from the master ticket.

Couple of notes..

- This is NOT the final version.   I will post the rest of the code when it becomes available.
- If you select multiple child tickets and click MERGE it will fail if one of the children are already assigned to a master ticket.  The dev is working to resolve this by putting up a warning but merging the remaining tickets.
- The developer is also working to add a "duplicate ticket" button for the ticket view.   This will allow us to take an existing ticket and split it into 2 then delegate out the appropriate workload between staff members or departments.   

Attached are some screenshots in case you were curious what it looks like.

If any of the links/files are missing and you need a copy then please PM me.  I will share them with you. 

The coding work was done to our specification by Martynas Miniots.  Please contact him if you need any customization for your project.   



  • Missing images.imageimageimageimage
  • edited January 2017
    Attached is the SQL file and the replacement PHP files.  
  • Any reason why you wouldn't' submit this via github as a Pull Request?

    Then it would have a much better chance of making it into core.
  • edited January 2017
    I would be happy too. My concerns are 1) This feature has been requested hundreds of times dating back several versions. If Martynas can get this feature back to us in 3 days then I would assume there is a reason this feature has been excluded by the OST team. I was merely "taking a hint" they did not want this feature in their code base for some reason. 2) I am not a dev. I will be happy to contribute the work but I have no way of knowing if it would meet their standards or fixing any deficiencies. I am not implying Martynas would write "bad code" but I purposely told him not to spend a lot of time refactoring the code into a modular form. This probably reflects in the work.

    I hate to be the kind of guy who just dumps "bad code" into Github then runs for the hills. Drive-by-coding never makes anyone happy. ;-)

    When I have a final product from Martynas I will be happy to submit it as long as it is welcomed by the OST team.
  • edited January 2017
    Does the code have a way to split tickets back into two?  [or 2+ to 1 or 1 to 2+?] etc?

    How is he handling the ticket thats being merged?  Does he just delete it?  Is it being marked as closed with a reference to the new merged ticket? 
  • Yes. Just open the master ticket and remove the link to the child ticket.

    The child tickets are closed. It does not remove them from the system. The master just contains a nice, detailed table of child tickets so you can find them easily. It does not move the contents of the child tickets into the master ticket.
  • Hi All.   I am posting the final contents of the changes for v1.10.  

    This includes the ability to link / merge multiple tickets into a master/child ticket relationship.

    This also includes the ability to duplicate a ticket including the entire thread and all the ticket properties (except attachments).  

    I am 100% positive this code works and seems to work well.   We've used it dozens of time in both dev and prod.   If you run into a problem please let me know.  I probably just missed a file.  If I did then I am sorry in advance.  

  • This is amazing, do you mind providing some instructions for folks who come accross this post?
  • edited February 2017
    It's pretty simple.

    - From the ticket list or search results check all the child tickets you need to merge, enter the master ticket number into the MASTER ID field then click the MERGE button (it's to the right of the MASTER ID field).  All of your child tickets will automatically close and leave you with the master ticket.   
    - If you view the master ticket there is a RELATED tab that shows you all the child tickets.
    - If you view the child ticket it wills how you the master ticket number

    -While viewing any ticket you can enter the master ticket number into the MASTER ID field and click the MERGE button to merge the tickets.

    - While viewing any ticket you can click the DUPLICATE TICKET button and it will create a duplicate ticket with a message telling you the new ticket number. 

    There are some screenshots above with red lines around the important parts to note.   

    Keep in mind this was done for our own needs but you are welcome to contact the developer and ask him to customize it for you:

    He was reasonably priced and great to work with.  

    All of this code is licensed under the MIT license so he's welcome to modify / adjust it for you then sell it back to you.   The OSTicket team is also welcome to incorporate the code into future versions.  
  • If I wanted to use this code, where would I insert it? 
  • I'm sorry Synt..  I hired a dev to handle the integration.  

    Here is his info:

    I would assume if you are self hosting then you're comfortable with these things or have someone who is. 
  • Hi there,

    That development is really god :)
    I tried to download the latest file, but I'm unable, can you post it again?

  • Hi again,

    Don't know why but was able to download only with Safari.

  • Hello,

    could anyone please tell me what I have to do with the files to get this working? The .php files are probably just to overwrite the default ones, but what have I to do with the 93dd855b7c283d798f9d9befa729d2 file?
    We are using osTicket in our small business since a few weeks and this feature would be really neat to get working.

  • Can this be merged into the main codebase to be published with the next release please?
    This feature is default in ticket systems and several customers don't want to use osTickets because it lacks this feature.

    As others said, why wasn't this included in earlier version?

  • Q: Can this be merged into the main codebase to be published with the next release please? 
    A: Things that have not been made as a PR (pull request) at github have 0% chance of being included in the next or any version.  

    Q: As others said, why wasn't this included in earlier version?
    A: exact same answer with the point that this was posted after that last release was made.

    I did however give the link to this thread to the devs back when this thread was started.
  • Looks really good!! Thanks for the work. Woul love to see it in the official release!
  • Looks really good indeed, I've added the files posted to a  github
    Also added so that there is a event entry when a ticket is merged or split(?) and when you merge the tickets the master ticket gets the other tickets users and collaborators as collaborators.
    2 other things that i'm probably gonna look at is it would be nice to have a search function rather than having to enter the number of the ticket and also a mass option for splitting the tickets.
  • I finally implemented this merge function our enviroment, but it feels like the ticket system is now way slower. Any tips?
  • Hello Everyone,

    How can i implement this mod to our current osTicket which is running in v1.10. I have downloaded the files. Please advise.

    Thank you,
  • @Lorf do you have any particular page that is slower or is it on every page?
    What webserver, php, database version are you using?

    @apanelo013 Just download all 3 files and extract the tar.gz files and zip files, you first need to replace the files you've on your site with the first posts files and then replace again with the files from the second post, then you will need to import the sql file to your database.
    And finally to enable it for you, you need to set it so that your role in the admin panel have merge access.
  • @Micke1100

    I have replaced the files on my site however, when I tried to import the database on phpMyAdmin, I encountered an error (see attached image). Can you please help me how to import the database? Thank you.

  • You could try and manually execute the commands to see which one is creating those errors.

    CREATE TABLE IF NOT EXISTS `ost_ticket_relation` (
    `id` int(11) NOT NULL,
    `agent_id` int(11) NOT NULL,
    `master_id` int(11) NOT NULL,
    `ticket_id` int(11) NOT NULL,
    `date_merged` datetime NOT NULL

    ALTER TABLE `ost_ticket_relation`
    ADD PRIMARY KEY (`id`);

    ALTER TABLE `ost_ticket_relation`
  • Hi @Micke1101,

    Thank you for your assistance. I will try this and I will let you know how it goes. 
  • Hi @Micke1101,

    It is now working :) Thank you for your help. I really appreciate it. 

  • edited March 2017
    Hey @Micke1101 - Have you made this a pull request within OSTicket? This would be a great addition if it were in the core system. 
  • Hey @Synt4xError - I have not, mostly because the original modifications are not mine.
    It also needs some translation and database modifications.
    Also not sure, but have contemplated if the thread entries of the child tickets should show in the master ticket?
    Also if a user tries to open a child ticket, should it redirect to the master ticket?
    If a user still answers a child ticket should that answer be added to the master ticket? (Wont be needed if the threads are combined in the master i guess)
  • @Micke1101

    Just an FYI..  The reason we implemented the way we did was ..

    "if the thread entries of the child tickets should show in the master ticket" = we avoided this because a child ticket may have an alternative requestor who should not be included in the conversation.  For example..  Lets say the customer opens up a ticket about a problem with an upstream vendor.  We dupe the ticket, change the requestor and pass the information along upstream.   The customer should not be involved in that part of the conversation.   If we wanted the original requestor included in the ticket then we would have just CC'd them on the master ticket.   There are other ways to hide this information from the downstream customer but it would add unnecessary complexity.  

    "if a user tries to open a child ticket, should it redirect to the master ticket"  = adds unnecessary complexity.   The agents can "merge" the duplicates.

    "user still answers a child ticket should that answer be added to the master ticket"  = The system will automatically re-open the child.  If necessary we'll mark the child "closed" (preventing the customer from posting additional updates to the child) and redirect them to the master ticket for updates.   This allows us more control over the process without forcing us into a specific pattern of constraints by the ticket system.  

  • I am going to post this again.  I am not a developer and I can not help you guys with implementation.   This is the beauty of open source.  

    If you need help contact the developer:

Sign In or Register to comment.