Problem in the Report module with columns width in the Total row of a report table.

Hi team,

Problem in the Report module with columns width in the Total row of a report table.

I worked with reports in 7.10.4 version good enough.
After upgrade to 7.10.15 I have the problem.

I tested this problem with up to 10 reports worked well in 7.10.4 version right before upgrade.
All reports have the same problem.

Screenshot attached to the post.

RedHat. Linux Version 7.10.15 ( Sugar Version 6.5.25 (Build 344) )

Thanks, Alex

I found where is the problem could be.

In 7.10.4 template its OK. And a report shows me the structure of bottom row with totals correctly:

But in 7.10.15 after upgrade I see the problem with column width.
I think it happens because in the new template last raw starts wit TABLE tag.
But should starts just as new only.

Hope you fix it soon :slight_smile:
Thanks, Alex.

Yep. Just moving all content without

tags from the 2nd table “Total” with total raw to main table before the last
tag, then we get right template solution as before.


<table id="report_table_95693c2d-cce3-a58f-86b2-5cbef5d7be35" class="list view table-responsive aor_reports".......

<!-- second table moved here -->
<thead class="fc-head"><tr><th>Count Sum</th><th>Name Count</th><th></th><th></th><th></th><th></th></tr></thead><tbody><tr class="oddListRowS1"><td>36</td><td>19</td><td></td><td></td><td></td><td></td></tr></tbody>



Do you know which template file is this in? I mean, the original source file on the server.

Sorry I miss it.
No. I test it in the browser inspector (FireFox).

Version 7.10.15 Sugar Version 6.5.25 (Build 344)
Template is origin Suitecrm.
Admin > Profile > Themes = SuiteP



Hi. Found it here /modules/AOR_Reports//AOR_Report.php

reason - splitting to different tables cause columns width losses

Line 857 or near depends on code revision
original = $html .= $this->getTotalHTML($fields, $totals);

test code

$html .= htmlspecialchars( $this->getTotalHTML($fields, $totals) );


ID Sum Area of help Count
230 36

1st problem is line 855 $html .= “”;
tag TABLE is closed

2nd problem is line 857 - the function getTotalHTML() returns raw but wrapped in tags TABLE

Where your team prepare total html code I dont know. I’m just newby in Suitecrm :slight_smile:


Hi. Temporaral solution is:
a) cut the table tag after main tbody
b) cut

tag for total raws in result of function $this->getTotalHTML($fields, $totals),

line 855

//        $html .= "</tbody></table>";
<------>$html .= "</tbody>"; // avoid closing current table to save column width in total raws

//        $html .= $this->getTotalHTML($fields, $totals);
<------>$html .= substr( $this->getTotalHTML($fields, $totals), 7); // trim starting 7 chars of tag  <table> tag to avoid une
        $html .= '</div>';



If you check this view

it tells you the latest commits that affected each part of the code. This way we can try to find when this was broken. I suspect it was here

so I left a comment to the author here:

Let’s see if he answers…

Hi, thanks for posting the issue.
I opened my prod server with 7.10.4 and here is code withoud this issue and with the same logic as my fix.


822 $html .= “”;
824 $html .= $this->getTotalHTML($fields, $totals);
826 $html .= ‘’;


How to delete an old message?

Hi, PGR :slight_smile:
I found your blog about my new question.
Here is the link to your article about it

I wanna to fix the bug we discussed before with custom module to be upgrade safe in the future.

  1. I creaded the /suitecrm/custom/modules/AOR_Reports/ folder (directory).
  2. Copy and made changes in AOR_Report.php
    Nothing changed.
    In the article you wrote that changes in php file works right after reload.

Any changes in the file /suitecrm/modules/AOR_Reports/AOR_Report.php work immediately and correctly.

a. Delete cache directory
= nothing chenged, same bug

b. Add some directories as I saw in other custom modules:
= nothing chenged, same bug

c. Rename original AOR_Report.php in ./modules/AOR_Reports/ to force CRM to use custom code
= error with module - it was expected

So it looks I did all right to add custom module php file.
But CRM doesn’t use it. Always use php file from original ./modules/

How to solve it ?
Red Hat, Apache
PS: Version 7.10.15 Sugar Version 6.5.25 (Build 344)

Thanks in advance, Alex

If this is a bug, it should be fixed by contributing to the core code on Github…

Not all files are customizable with that “custom folder” mechanism. It depends on how they are loaded.

In this case I believe you should use the Extension mechanism instead:

That part about modules.ext.php will let you override this:

The version 7.10.16 has the same Total raw problem.

The reason is splitting to different tables as descibed above.
The same way to solve it.


Thanks @alex

7.11.5 this issue has not been fixed

I used your code to solve it.

Hi duongnk. For nothing :slight_smile: Have a nice time and CRM :slight_smile:

Hello, I am testing your solution, but I want to notice that the patch causes problems in PDF export.
After edit, I am experiencing empty pages in multipage pdf report export.
I will update you if I find a fix.


Hi guys !
Back to you with a little hack in getTotalHTML function to make everything work.
The PDF export problem was created by thead html tag.
Maybe somebody better than me can find a way to keep the style without breaking CSS.

        $html .= "</tbody>"; //removed </table>

        $html .= $this->getTotalHTML($fields, $totals);

        $html .= '</table></div>'; //moved </table

and rewrite fix the getTotalHTML function like that:

   public function getTotalHTML($fields, $totals)
        global $app_list_strings;

        $currency = new Currency();

        $showTotal = false;
        $html .= "<tbody><tr>"; //hack to fix PDF export

        foreach ($fields as $label => $field) {
            if (!$field['display']) {

            $fieldTotal = null;
            if (!isset($field['total'])) {
                LoggerManager::getLogger()->warn('AOR_Report problem: field[total] is not set for getTotalHTML()');
            } else {
                $fieldTotal = $field['total'];

            $appListStringsAorTotalOptionsFieldTotal = null;
            if (!isset($app_list_strings['aor_total_options'][$fieldTotal])) {
                LoggerManager::getLogger()->warn('AOR_Report problem: app_list_strings[aor_total_options][fieldTotal] is not set for getTotalHTML()');
            } else {
                $appListStringsAorTotalOptionsFieldTotal = $app_list_strings['aor_total_options'][$fieldTotal];

            if ($fieldTotal) {
                $showTotal = true;
                $totalLabel = $field['label'] . ' ' . $appListStringsAorTotalOptionsFieldTotal;
                $html .= "<th style='color:black'>{$totalLabel}</th>"; //added font color
            } else {
                $html .= '<th></th>';
        $html .= '<tbody></tr>';

        if (!$showTotal) {
            return '';


Note that this was already opened as an issue on Github

and it has a fix

which was merged 25 days ago.