Reports Dashlet configuration bug for date “Period” parameters when using more than one report parameter, causing a fatal error and empty dashlet. #5288

Open
opened 2026-02-20 16:32:24 -05:00 by deekerman · 1 comment
Owner

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:

<select name="parameter_value[]">
    ...
</select>

instead of

<select name="parameter_value[{$condition.key}]">
    ...
</select>

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:

<tr>
    ...
    {if $condition.value_type == "Period"}
        <select name='parameter_value[]'>
            {html_options options=$date_time_period_list selected=$condition.value}
        </select>
    {/if}
    ...
</tr>

replace with

<select name="parameter_value[{$condition.key}]">
    {html_options options=$date_time_period_list selected=$condition.value}
</select>

Steps to Reproduce the Issue

  1. Create a report in AOR_Reports with at least one parameter of type “Period” (e.g., “today,” “yesterday,” etc.).
    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

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: ``` <select name="parameter_value[]"> ... </select> ``` instead of ``` <select name="parameter_value[{$condition.key}]"> ... </select> ``` 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: ``` <tr> ... {if $condition.value_type == "Period"} <select name='parameter_value[]'> {html_options options=$date_time_period_list selected=$condition.value} </select> {/if} ... </tr> ``` replace with ``` <select name="parameter_value[{$condition.key}]"> {html_options options=$date_time_period_list selected=$condition.value} </select> ``` ### Steps to Reproduce the Issue 1. Create a report in AOR_Reports with at least one parameter of type “Period” (e.g., “today,” “yesterday,” etc.). 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
Author
Owner

@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:
Image

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 above


I 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

@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: ![Image](https://github.com/user-attachments/assets/ae1c46ec-816d-42ec-8fa3-5993f6329eec) 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 above <br> I 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
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#5288
No description provided.