New cases display orphaned case attachments #5055

Closed
opened 2026-02-20 16:28:52 -05:00 by deekerman · 2 comments
Owner

Originally created by @ojs87 on GitHub (Aug 21, 2023).

Issue

When a Cases record with Notes related to it is deleted, the orphaned notes will be loaded into the Case Attachements field when creating a new Cases record.

This causes a display bug on the Create Case view

Expected Behavior

If a Case has no id yet on the edit view, no Case Attachments should be loaded

Actual Behavior

Orphaned Case Attachments are displayed in the Case Attachments field

Possible Fix

in the display_case_attachments function in Case_Updated.php, return if the $case->id is empty

Steps to Reproduce

  1. Create a Cases record
  2. Add/relate a Notes record to the Cases record
  3. Delete the Case
  4. Click on Create Case
  5. The Case Attachments field will contain the orphaned Note

Your Environment

  • SuiteCRM Version used: SuietCRM 7.12.12
  • Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Firefox 106
  • Environment name and version (e.g. MySQL, PHP 7): PHP 7.4
  • Operating System and version (e.g Ubuntu 16.04): Ubuntu 22.04.3 LTS
Originally created by @ojs87 on GitHub (Aug 21, 2023). <!--- Provide a general summary of the issue in the **Title** above --> <!--- Before you open an issue, please check if a similar issue already exists or has been closed before. ---> <!--- If you have discovered a security risk please report it by emailing security@suitecrm.com. This will be delivered to the product team who handle security issues. Please don't disclose security bugs publicly until they have been handled by the security team. ---> <!--- Please be aware that as of the 31st January 2022 we no longer support 7.10.x. New issues referring to 7.10.x will only be valid if applicable to 7.12.x and above. If your issue is still applicable in 7.12.x, please create the issue following the template below --> #### Issue When a Cases record with Notes related to it is deleted, the orphaned notes will be loaded into the Case Attachements field when creating a new Cases record. This causes a display bug on the Create Case view #### Expected Behavior If a Case has no id yet on the edit view, no Case Attachments should be loaded #### Actual Behavior Orphaned Case Attachments are displayed in the Case Attachments field #### Possible Fix in the display_case_attachments function in Case_Updated.php, return if the $case->id is empty #### Steps to Reproduce <!--- Provide a link to a live example, or an unambiguous set of steps to --> <!--- reproduce this bug include code to reproduce, if relevant --> 1. Create a Cases record 2. Add/relate a Notes record to the Cases record 3. Delete the Case 4. Click on Create Case 5. The Case Attachments field will contain the orphaned Note #### Your Environment <!--- Include as many relevant details about the environment you experienced the bug in --> * SuiteCRM Version used: SuietCRM 7.12.12 * Browser name and version (e.g. Chrome Version 51.0.2704.63 (64-bit)): Firefox 106 * Environment name and version (e.g. MySQL, PHP 7): PHP 7.4 * Operating System and version (e.g Ubuntu 16.04): Ubuntu 22.04.3 LTS
Author
Owner

@johnM2401 commented on GitHub (Aug 30, 2023):

Hey!

I've given this a try in 7.14, but I'm not sure if I can replicate

OOTB, when creating a new Case, the "Case Attachments"/"Case Updates" fields don't show on the Editview

Do you know if you perhaps need any customizations to Cases for this?

After following the steps above, (and adding the Case Attachments/Updates fields to editview), it shows as following after Deleting a Case->Creating a new case:
image

Do you maybe have some more steps to help replicate this?

Thanks!

@johnM2401 commented on GitHub (Aug 30, 2023): Hey! I've given this a try in 7.14, but I'm not sure if I can replicate OOTB, when creating a new Case, the "Case Attachments"/"Case Updates" fields don't show on the Editview Do you know if you perhaps need any customizations to Cases for this? After following the steps above, (and adding the Case Attachments/Updates fields to editview), it shows as following after Deleting a Case->Creating a new case: ![image](https://github.com/salesagility/SuiteCRM/assets/13675281/2eac97ee-e76a-40a8-98c7-751276efc50c) Do you maybe have some more steps to help replicate this? Thanks!
Author
Owner

@ojs87 commented on GitHub (Sep 7, 2023):

Hi @johnM2401,

Thanks for testing that, sorry my steps were not as comprehensive as they should have been.

There has to be a note with an attachment added to a Case before deleting it, if the note doesn't have an attachment it doesn't show the link.

So the easiest way to recreate this is to just create a Note, relate to a Case with no Case selected, and upload a random image/file to the Note.

You can also relate it to a Case and then delete the case, which is how this issue first arose.

This should then show the orphaned link on the Create Case view.

Thanks

@ojs87 commented on GitHub (Sep 7, 2023): Hi @johnM2401, Thanks for testing that, sorry my steps were not as comprehensive as they should have been. There has to be a note with an attachment added to a Case before deleting it, if the note doesn't have an attachment it doesn't show the link. So the easiest way to recreate this is to just create a Note, relate to a Case with no Case selected, and upload a random image/file to the Note. You can also relate it to a Case and then delete the case, which is how this issue first arose. This should then show the orphaned link on the Create Case view. Thanks
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SuiteCRM-SuiteCRM#5055
No description provided.