How to hide “Checkbox” for contracts ListView in Sugarcrm for the records having status = 'Signed'?

Hi dpccrt87

You’ve placed it in the wrong section.

Try placing it within function listViewProcess, like so:


function listViewProcess(){
        if(isset($_REQUEST['displayColumns'])  && isset($_REQUEST['hideTabs'])) {
            $dpos = strpos($_REQUEST['displayColumns'], 'STATUS');
            $hpos = strpos($_REQUEST['hideTabs'], 'STATUS');
            if ($dpos !== false && $hpos !== false) {  // the assumption that the field being in the hide columns was a user decision! So it will take precidence
                $dCol = explode('|', $_REQUEST['displayColumns']);
                if (($key = array_search('STATUS', $dCol)) !== false) {
                    unset($dCol[$key]);
                }
                $_REQUEST['displayColumns'] = implode('|', $dCol);
            }
        }

1 Like

Remember you also need to follow the instructions for the function listViewPrepare in that file as well…

and I would also encapsulate the custom code within that function (listViewPrepare) with the isset check as well.



if(isset($_REQUEST['displayColumns'])  && isset($_REQUEST['hideTabs'])) {
            $pos = strpos($_REQUEST['displayColumns'], 'STATUS');
            if ($pos === false) {
                // Add the field manually doesn't matter where
                $_REQUEST['displayColumns'] .= '|STATUS';
                $_GET['displayColumns'] .= '|STATUS';
            }
        }
1 Like

yes i did it but all pencil btn r removed and the layout option link not working

Are you able to attach both attach the view.list.php and ListView<MODULE_NAME>.tpl as txt files so I can look at it?

1 Like

ok, but the extension is not supported

I don’t see anything wrong with regards to the template to display that tabbing error. But I do see for the edit pencil icon you haven’t set the value as you did for the checkbox. It’s set for ‘Signed’ when I’m assuming it should be ‘Signé’ just like the checkboxes. Also set the Module value the same as the Checkboxes i.e. P_Asw_Contrat and not in capitals I’ll need to see regarding that columns error.

Just for testing, try taking out the

{if $colHeader == ‘STATUT_CTR_C’ and $pageData.queries.baseURL.hideTabs|strstr:‘STATUT_CTR_C’}
{php}continue;{/php}
{/if}

From your template.

1 Like

In listView.tpl
1- i did
{if $pageData.bean.moduleDir == ‘P_Asw_Contrat’ && $rowData.STATUT_CTR_C == ‘Signé’}

2- i removed the if statment
3- quick repair
And i get this error when i put Status of contract in the hide columns

And the list view after clicking in search is like

Ok.

Step 1. Looks like you successfully have the checkboxes and pencil removed which is good!

Step 2. You’ve removed the IF statement from the template and what I see is what I expected, which is also good.

However, the Orange Error, still indicates you have something wrong in your listViewPrepare. Try removing the

$_GET['displayColumns'] .= '|STATUS';

Do a Quick Repair & Rebuild and see if the Orange Error disappears.

1 Like

ok, it works :smiley: :smiley:
you are really a fairy Miss AshleyNic
thank you alot for all your efforts, you deserve a gold medal