mirror of
https://github.com/SuiteCRM/SuiteCRM.git
synced 2026-03-02 19:16:58 -05:00
Reports Dashlet configuration bug for date “Period” parameters when using more than one report parameter, causing a fatal error and empty dashlet. #5288
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#5288
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 @maclordaj on GitHub (Jan 8, 2025).
Issue
Description of the Issue
When an Advanced Open Reports (AOR) dashlet has multiple parameters and one of them is a “Period” parameter that is not the first parameter in the report, the dashlet config template renders that parameter using:
instead of
Meanwhile, the associated hidden fields for that parameter use [{$condition.key}]. As a result, SuiteCRM’s backend receives inconsistent array indexes for this parameter in requestToUserParameters(), passing an empty or invalid value to getPeriodEndDate(). Eventually, this can trigger a fatal error (“Call to a member function sub() on null”).
Possible Fix
In the dashlet configuration template, change the select for Period to include the condition.key index.
For Instance, in:
replace with
Steps to Reproduce the Issue
2. Add this report as a dashlet on the Home page.
3. In the dashlet configuration screen, check that the “Period” parameter is displayed. Observe that the generated HTML select uses name="parameter_value[]" instead of something like name="parameter_value[0]".
4. After saving or changing the parameter in the dashlet, SuiteCRM’s changeReportPage action may throw a fatal error or fail to load the correct data.
If the “Period” parameter is the first parameter in the report, you may not see the issue because the code and indexes sometimes align. The bug appears when the Period parameter is not the first in the list, causing mismatched indexes in the dashlet config form.
Context
Context
• This bug affects any user trying to configure an AOR Report Dashlet that includes “Period” type parameters.
• It can result in an empty or incorrect value for the parameter, sometimes causing a PHP fatal error if SuiteCRM attempts to manipulate a null date object.
Version
7.14.6
What browser are you currently using?
Chrome
Browser Version
Chrome
Environment Information
Mysql, PHP
Operating System and Version
Ubuntu
@johnM2401 commented on GitHub (Feb 11, 2025):
Hey!
Thank you for getting in touch
I've been giving this a try locally and have not been able to replicate yet, I'm afraid
See gif:

My report has a Period Parameter on Date Created, that is not the first option in the list.
However, I'm able to paginate and view results as expected.
It also seems to have built with
<select name='parameter_value[]'>as you say aboveI was using:
Chromium Version 112.0.5615.49 / PHP 8.2 / MariaDB 10.4.12
Also seems to be working on Firefox
Would you have any other steps to replicate this, by chance?
Please let me know if there's something I missed!
Thanks