mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
Deleting an item from a Contact History throws exception. #1935
Labels
No labels
Area: API
Area: Campaigns
Area: Cases
Area: Clean Up
Area: Clean Up: Performance
Area: Dashlets
Area: Databases
Area: Developer Tools
Area: Elasticsearch
Area: Elasticsearch
Area: Emails
Area: Emails:Campaigns
Area: Emails:Cases
Area: Emails:Compose
Area: Emails:Config
Area: Emails:Templates
Area: Environment
Area: Installation
Area: Language
Area: Mobile
Area: Module
Area: PDFs
Area: PHP8
Area: Reports
Area: Studio
Area: Styling
Area: Upgrading
Area: Workflow
Area:Activity Stream
Area:Calls
Area:Import
Area:Projects
Area:Search
Area:Surveys
Area:Themes
Area:Users
Branch:Hotfix
Good First Issue
Hacktoberfest
Help Wanted
PR:Community Contribution
PR:Type:Enhancement
Priority:Critical
Priority:Important
Priority:Moderate
Severity: Major
Severity: Minor
Severity: Moderate
Status: Requires Code Review
Status: Requires Updates
Status: Stale
Status: Team Investigating
Status:Assessed
Status:Fix Proposed
Status:Needs Assessed
Status:Requires Automated Tests
Type: Bug
Type:Deprecated
Type:Discussion
Type:Duplicate
Type:Invalid
Type:Question
Type:Suggestion
Type:Suggestion
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/SuiteCRM-SuiteCRM#1935
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jobst on GitHub (May 24, 2017).
Cannot delete an item from the history, it throws an exceptions.
Using the output of a suitecrm instance running on a PHP 7.1.2 host as this is way more informative:
[24-May-2017 15:36:48 Australia/Melbourne] PHP Notice: Undefined property: Contact::$get_unlinked_email_query in SUITECRM/include/generic/DeleteRelationship.php on line 90
[24-May-2017 15:36:48 Australia/Melbourne] PHP Notice: Trying to get property of non-object in SUITECRM/include/generic/DeleteRelationship.php on line 90
[24-May-2017 15:36:48 Australia/Melbourne] PHP Notice: Trying to get property of non-object in SUITECRM/include/generic/DeleteRelationship.php on line 90
[24-May-2017 15:36:48 Australia/Melbourne] PHP Notice: Undefined property: Contact::$get_unlinked_email_query in SUITECRM/include/generic/DeleteRelationship.php on line 92
[24-May-2017 15:36:48 Australia/Melbourne] PHP Fatal error: Uncaught Error: Call to a member function delete() on null in SUITECRM/include/generic/DeleteRelationship.php:92
Stack trace:
#0 SUITECRM/include/MVC/Controller/SugarController.php(928): require_once()
#1 SUITECRM/include/MVC/Controller/SugarController.php(394): SugarController->handleActionMaps()
#2 SUITECRM/include/MVC/Controller/SugarController.php(307): SugarController->process()
#3 SUITECRM/include/MVC/SugarApplication.php(105): SugarController->execute()
#4 SUITECRM/index.php(54): SugarApplication->execute()
#5 {main}
thrown in SUITECRM/include/generic/DeleteRelationship.php on line 92
Issue
This has been tried on PHP7.1.2 and 5.6.30 so it's not PHP related but also not Theme related as I tried it in 3 different themes Suite [7|P|R].
When clicking on the right dialog box (remove function) to remove an item a confirm box ask whether to do this, clicking yes will make all history disappear (as an error occurs in the script) and nothing happens.
A refresh of the page will show the list as it was, the item was NOT deleted.
Expected Behavior
Item deleted
Actual Behavior
Item still there
Possible Fix
too many other things to do.
Steps to Reproduce
6 history list gone but item still there after refresh
Context
cant delete anything.
Your Environment
@SohanTirpude commented on GitHub (May 24, 2017):
I am unable to recreate the scenario, as it is working fine on my side.
@Dillon-Brown commented on GitHub (May 24, 2017):
@jobst I was able to replicate this by quick composing an email through the activities subpanel and changing the "related to" field to "none". However I am unable to replicate this with any other record type.
Can you confirm if this is the same on your end? or are emails with contacts/notes causing the same issue?
@jobst commented on GitHub (May 24, 2017):
@Dillon-Brown I am trying to figure this one out, too:
Luckily you were able to find ONE way to replicate this which make my debugging easier ...
@jobst commented on GitHub (May 25, 2017):
@Dillon-Brown I was able to delete some but not others (mostly old ones), however I am able to delete a newly created one ... you might want to check older ones?
I do not understand why this happened. I know the cause - the relationship info IS missing in the database, but I cannot look back in time to see why it was not created and/or whether is was a problem of the rest interface OR the application entering the data OR an upgrade of SugarCRM or SuiteCRM.
One thing that should be if this happens: it should be able to display an error message to the user and what can be done to still delete this information. You can delete this information by clicking on the subject line then delete it there.
If you look at the code in SUITECRM/include/generic/DeleteRelationship.php on line 91
$focus->$linked_field->delete($record,$linked_id);
if the $linked_field does not exist or is null it throws an exception and wipes the history list. Really before the function is CALLED it should be checked whether the object exist.
Depending on the browser and the setting in the php.ini it will either display the thrown error (chrome) or nothing (firefox) ... but in any case the history is gone - this should not be if the OBJECT is not defined but simply alert the user to the missing info.
@dgailwhitt commented on GitHub (Mar 11, 2018):
This issue is as a result of the enhancement of the list of emails in the History sub-panel.
The list of Emails that you see in the History section are "enriched" with a query/function (get_unlinked_email_query) that returns additional historical information related to the Lead/Account/Contact/Prospect. The relationship is established due to the fact that the same email address is found somewhere in the email. So you could be seeing linked and unlinked emails in the History list.
When you try to remove the link for any of these unlinked emails, an error occurs because it is not really linked.
So I am suggesting the following possible solutions...
or
or
@pgorod commented on GitHub (Sep 5, 2018):
I have someone in the Forums getting this problem. I tried in my test system and I can reproduce. I don't have time to bugfix and debug, though. But @Dillon-Brown tell me if you think there's anything I can do for this issue...
@Kevconry commented on GitHub (Mar 10, 2023):
Can't replicate in 7.13.2. When I remove the record from the history subpanel it remains removed after the refresh
please re-raise or get in touch if you are still having this issue