Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to link multiple tickets to the same parent ticket. #5333

Open
Mike-Benoit opened this issue Jan 13, 2020 · 7 comments
Open

Unable to link multiple tickets to the same parent ticket. #5333

Mike-Benoit opened this issue Jan 13, 2020 · 7 comments

Comments

@Mike-Benoit
Copy link

Prerequisites

  • [Yes] Can you reproduce the problem in a fresh installation of the "develop" branch?
  • [Yes] Do you have any errors in the PHP error log, or javascript console?
  • [Yes] Did you check the osTicket forums?
  • [Yes] Did you perform a cursory search to see if your bug or enhancement is already reported?

Description

Unable to link multiple tickets to a single parent ticket.

[Description of the bug or feature]

Steps to Reproduce

  1. Have Ticket A (parent), Ticket B (child 1), Ticket C (child 2).
  2. Link Ticket B to Ticket A (success)
  3. Link Ticket C to Ticket A (PHP fatal error as shown below)

Expected behavior: [What you expected to happen]

Link multiple tickets to a single parent ticket.

Actual behavior: [What actually happened]

PHP Fatal error: Uncaught Error: Call to a member function getMergeType() on null in /var/www/osticket/include/class.ticket.php:2539\n
Stack trace:\n#0 /var/www/osticket/include/ajax.tickets.php(429): Ticket::merge(Array)\n
#1 /var/www/osticket/include/class.dispatcher.php(145): TicketsAjaxAPI->updateMerge('92880')\n
#2 /var/www/osticket/include/class.dispatcher.php(38): UrlMatcher->dispatch('92880/merge', Array)\n
#3 /var/www/osticket/include/class.dispatcher.php(120): Dispatcher->resolve('92880/merge', Array)\n
#4 /var/www/osticket/include/class.dispatcher.php(38): UrlMatcher->dispatch('/tickets/92880/...', NULL)\n
#5 /var/www/osticket/scp/ajax.php(308): Dispatcher->resolve('/tickets/92880/...')\n
#6 {main}\n thrown in /var/www/osticket/include/class.ticket.php on line 2539, referer: https://helpdesk.mycompany.com/scp/tickets.php?id=92880

Versions

v1.14.1

@JediKev
Copy link
Contributor

JediKev commented Jan 13, 2020

@Mike-Benoit

I cannot replicate the issue you are experiencing, I can Link as many tickets together as I want regardless if I do them all at once or separately. Please provide exact steps to replicate the issue.

Cheers.

@Mike-Benoit
Copy link
Author

I seem to be able to replicate it on a consistent basis. Checking the code where the fatal error occurred, there appears to be at least an error condition that isn't handled:

   function merge($tickets) {
        $options = $tickets;
        if (!$tickets = self::manageMerge($tickets))
            return false;
        if (is_bool($tickets))
            return true;

        $children = array();
        foreach ($tickets as $ticket) {
            if ($ticket->isParent())
                $parent = $ticket;
            else
                $children[] = $ticket;
        }

        if ($parent->getMergeType() != 'visual') {

Its looping through all the tickets passed in to this function and pulling out the parent and children. If there isn't a parent ticket in there, it will throw a fatal error on that last line.

Of course I'm not sure why there isn't a parent ticket when we're doing the linking, but its definitely a scenario that is happening and should probably be checked.

@JediKev
Copy link
Contributor

JediKev commented Jan 14, 2020

@Mike-Benoit

Right, which is why I asked for exact steps to replicate so we can attempt to replicate the issue.

Cheers.

@Mike-Benoit
Copy link
Author

I'm having a hard time narrowing it down.

When I get the PHP fatal error, simply swapping the parent/child order when linking the ticket appears to avoid the issue. So when viewing a ticket and performing the link to another ticket, the ticket you are viewing normally defaults to the child, this is where the error occurs, if I switch it to the parent it doesn't occur.

I'm not sure what the significance is with the parent/child relationship when linking, I understand it in a merge case, but for linking it doesn't make a lot of sense to me.

I tried creating three fresh tickets and they linked no problem. So my best guess is its specific to the tickets that are being linked themselves, but I have yet to find the exact set of steps to replicate it from scratch.

@Mike-Benoit
Copy link
Author

Mike-Benoit commented Jan 14, 2020

Any ideas what the circumstances are where when linking a ticket it automatically unlinks other tickets?

Mike Benoit unlinked this ticket from Ticket #673990 13-Jan-2020 5:09 PM
Mike Benoit linked this ticket with Ticket #897070 13-Jan-2020 5:09 PM

As you can see from the above events, I had a ticket linked to 673990, then tried to link it also to 897070, but it unlinked it from 673990 automatically at the exact same time.

@JediKev
Copy link
Contributor

JediKev commented Jan 14, 2020

@Mike-Benoit

I don’t think you can link a child to multiple parents. Only multiple children to one parent.

Cheers.

@Mike-Benoit
Copy link
Author

Its possible this is related to the following forum post and possibly duplicate thread_entry_id records appearing in multiple tables:
https://forum.osticket.com/d/96658-can-t-view-new-tickets-after-upgrade-to-v1-14-1/7

May also be related to #5339

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants