salesagility / SuiteCRM

SuiteCRM - Open source CRM for the world
https://www.suitecrm.com
GNU Affero General Public License v3.0
4.27k stars 2.03k forks source link

Fix #10410 - Check report has been loaded before setting user params #10411

Closed simonr44 closed 1 month ago

simonr44 commented 2 months ago

Description

The reports dashlet allows you to add reports to your homescreen. If you delete a report which is used in a reports dashlet, the home screen fails to load and throws a 500 error.

Uncaught Error: Attempt to assign property "user_parameters" on bool in /var/www/modules/AOR_Reports/Dashlets/AORReportsDashlet/AORReportsDashlet.php:44

Motivation and Context

When this happens, the main workarounds are to clear user preferences or restore the deleted report. This fix prevents the unrecoverable error and allows the user to interact with the dashlet as normal.

How To Test This

  1. Create a test report
  2. Add a reports dashlet to your dashboard
  3. Assign the test report to your new reports dashlet
  4. Confirm the home screen loads
  5. Delete the report
  6. Confirm the home screen fails to load, with the error shown above in the logs

Types of changes

Final checklist

serhiisamko091184 commented 2 months ago

Hey @simonr44,

thanks for your contribution!

Regards, Serhii