Osticket: Merging tickets causes duplicate records and fatal error.

Created on 16 Feb 2020  Â·  6Comments  Â·  Source: osTicket/osTicket

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

When merging tickets in a certain situation/order, the following error message can occur when viewing the merged ticket, making it impossible to ever view again without manual intervention in the database.

Fatal error: Uncaught ObjectNotUnique: One object was expected; however multiple objects in the database matched the query. In fact, there are 2 matching objects. in /var/www/osticket/include/class.orm.php:1363
Stack trace: #0 /var/www/osticket/include/class.orm.php(606): QuerySet->one()

1 /var/www/osticket/include/class.orm.php(381): VerySimpleModel::lookup(Array)

2 /var/www/osticket/include/class.orm.php(801): VerySimpleModel->get('merge_info')

3 /var/www/osticket/include/class.orm.php(417): AnnotatedModel___ThreadEntry->get('merge_info', NULL)

4 /var/www/osticket/include/class.thread.php(1576): VerySimpleModel->__get('merge_info')

5 /var/www/osticket/include/class.thread.php(1584): ThreadEntry->getMergeData()

6 /var/www/osticket/include/staff/templates/thread-entries.tmpl.php(33): ThreadEntry::sortEntries(Object(QuerySet), Object(Ticket))

7 /var/www/osticket/include/class.thread.php(408): in /var/www/osticket/include/class.orm.php on line 1363

I believe this is also related to the merge issue described here: https://forum.osticket.com/d/96658-can-t-view-new-tickets-after-upgrade-to-v1-14-1/7

Steps to Reproduce

This is fairly long, but essentially it involves sending four emails to osTicket, merging two into group 1, and two into group 2, then merging group 1 into group 2.

Here are the steps in detail:

Create Group 1 tickets:

  1. Send email to osTicket with subject/body of: "Parent 1"
  2. Send email to osTicket with subject/body of: "Parent 1 (child1)"
    Open this ticket, copy its Ticket number.
  1. Go to Parent 1 ticket:
    Click More > Merge Tickets
    Click Select Ticket field
    Paste Ticket Number from above "Parent 1 (child1)" ticket.
    Click the child's number that appears (not the name, apparently clicking the name causes other problems)
    Click Add ticket
    Check Delete Child Ticket
    Click Save changes

Create Group 2 tickets:

  1. Send email to osTicket with subject/body of: "Parent 2"
  2. Send email to osTicket with subject/body of: "Parent 2 (child1)"
    Open this ticket, copy its Ticket number.
  1. Open Parent 2
    Click More > Merge Tickets
    Click Select Ticket field
    Paste Ticket Number from above "Parent 2 (child1)" ticket.
    Click the child's number that appears (not the name)
    Click Add ticket
    Check Delete Child Ticket
    Click Save changes

Now merge both groups of tickets into one:

  1. Go to Parent 2 ticket:
    Click More > Merge Tickets
    Click Select Ticket field
    Paste Ticket Number from above "Parent 1" ticket.
    Click the child's number that appears (not the name)
    Click Add ticket
    Check Delete Child Ticket
    Click Save changes

The above error message should appear as soon as you save the changes and it refreshes Parent 2 ticket on the screen.

Versions

v1.14-git on Ubuntu 18.04

bug

Most helpful comment

Yes, located...THANKS!

[image: image.png]

El lun., 6 abr. 2020 a las 17:14, JediKev (notifications@github.com)
escribió:

@inphower https://github.com/inphower

You need to find the duplicate record in the ost_thread_entry_merge table
and either modify it or delete it altogether.

Cheers.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/osTicket/osTicket/issues/5379#issuecomment-609856413,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AGMGLVT2TMUU4NNIFIYYTA3RLHWVTANCNFSM4KWHJOMA
.

--
Gabriel Font

Perfil públicohttps://es.linkedin.com/in/gabrielfont

All 6 comments

@Mike-Benoit

I can replicate the same issues with latest develop-next. We will look into this.

Cheers.

@Mike-Benoit

This is addressed with:

  • #5425

Cheers.

I can confirm #5425 this fixes this bug, greatly appreciated!

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

When merging tickets in a certain situation/order, the following error message can occur when viewing the merged ticket, making it impossible to ever view again without manual intervention in the database.

Fatal error: Uncaught ObjectNotUnique: One object was expected; however multiple objects in the database matched the query. In fact, there are 2 matching objects. in /var/www/osticket/include/class.orm.php:1363
Stack trace: #0 /var/www/osticket/include/class.orm.php(606): QuerySet->one()

1 /var/www/osticket/include/class.orm.php(381): VerySimpleModel::lookup(Array)

2 /var/www/osticket/include/class.orm.php(801): VerySimpleModel->get('merge_info')

3 /var/www/osticket/include/class.orm.php(417): AnnotatedModel___ThreadEntry->get('merge_info', NULL)

4 /var/www/osticket/include/class.thread.php(1576): VerySimpleModel->__get('merge_info')

5 /var/www/osticket/include/class.thread.php(1584): ThreadEntry->getMergeData()

6 /var/www/osticket/include/staff/templates/thread-entries.tmpl.php(33): ThreadEntry::sortEntries(Object(QuerySet), Object(Ticket))

7 /var/www/osticket/include/class.thread.php(408): in /var/www/osticket/include/class.orm.php on line 1363

I believe this is also related to the merge issue described here: https://forum.osticket.com/d/96658-can-t-view-new-tickets-after-upgrade-to-v1-14-1/7

Steps to Reproduce

This is fairly long, but essentially it involves sending four emails to osTicket, merging two into group 1, and two into group 2, then merging group 1 into group 2.

Here are the steps in detail:

Create Group 1 tickets:

  1. Send email to osTicket with subject/body of: "Parent 1"
  2. Send email to osTicket with subject/body of: "Parent 1 (child1)"
    Open this ticket, copy its Ticket number.
  3. Go to Parent 1 ticket:
    Click More > Merge Tickets
    Click Select Ticket field
    Paste Ticket Number from above "Parent 1 (child1)" ticket.
    Click the child's number that appears (not the name, apparently clicking the name causes other problems)
    Click Add ticket
    Check Delete Child Ticket
    Click Save changes

Create Group 2 tickets:

  1. Send email to osTicket with subject/body of: "Parent 2"
  2. Send email to osTicket with subject/body of: "Parent 2 (child1)"
    Open this ticket, copy its Ticket number.
  3. Open Parent 2
    Click More > Merge Tickets
    Click Select Ticket field
    Paste Ticket Number from above "Parent 2 (child1)" ticket.
    Click the child's number that appears (not the name)
    Click Add ticket
    Check Delete Child Ticket
    Click Save changes

Now merge both groups of tickets into one:

  1. Go to Parent 2 ticket:
    Click More > Merge Tickets
    Click Select Ticket field
    Paste Ticket Number from above "Parent 1" ticket.
    Click the child's number that appears (not the name)
    Click Add ticket
    Check Delete Child Ticket
    Click Save changes

The above error message should appear as soon as you save the changes and it refreshes Parent 2 ticket on the screen.

Versions

v1.14-git on Ubuntu 18.04

Hi, I have a merged tickets with this problem and content disappear , how i can resolve the Duplicate?? .. I have patched for avoid future problems.

Thanks!

@inphower

You need to find the duplicate record in the ost_thread_entry_merge table and either modify it or delete it altogether.

Cheers.

Yes, located...THANKS!

[image: image.png]

El lun., 6 abr. 2020 a las 17:14, JediKev (notifications@github.com)
escribió:

@inphower https://github.com/inphower

You need to find the duplicate record in the ost_thread_entry_merge table
and either modify it or delete it altogether.

Cheers.

—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/osTicket/osTicket/issues/5379#issuecomment-609856413,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AGMGLVT2TMUU4NNIFIYYTA3RLHWVTANCNFSM4KWHJOMA
.

--
Gabriel Font

Perfil públicohttps://es.linkedin.com/in/gabrielfont

Was this page helpful?
0 / 5 - 0 ratings