How to add an option in the action menu of contract module listview

Hi,

I use sugarcrm 7.6 and I want to add an option in the action menu of the contracts listview. Contracts has the old version of the user interface and I can't use the new method for 7.6 to add the options.

I try to follow this page: https://developer.sugarcrm.com/2010/11/22/howto-adding-your-own-listview-action-items/  but I can't understand where I have to put the two code files.

Please can you help me?

Thanks a lot

Stefano

  • You'll put the first file in custom/modules/Contracts/views/view.list.php. The second you put in custom/modules/Contracts/controller.php.

  • Thanks for the reply,

    now I have my custom action in the menu but when i click the result is a blank page with: "There is no action by that name."

     

    My code in \custom\modules\Contracts\views\view.list.php is:

    <?php
    require_once('include/MVC/View/views/view.list.php');
    class CustomContractsViewList extends ViewList
    {
        /**
         * @see ViewList::preDisplay()
         */
        public function preDisplay()
        {
            parent::preDisplay();
            $this->lv->actionsMenuExtraItems[] = $this->buildMyMenuItem();
        }
        /**
         * @return string HTML
         */
        protected function buildMyMenuItem()
        {
            global $app_strings;

            return <<<EOHTML
    <a class="menuItem" style="width: 150px;" href="#" onmouseover='hiliteItem(this,"yes");'
            onmouseout='unhiliteItem(this);'
            onclick="sugarListView.get_checks();
            if(sugarListView.get_checks_count() < 1) {
                app.alert.show('custom-message-id',
                                    {
                                        level: 'fail',
                                        messages: 'ATTENZIONE: selezionare almeno un record',
                                        autoClose: true
                                    });
                return false;
            }
            document.MassUpdate.action.value='displaypassedids';
            document.MassUpdate.submit();">Applica Tacito Rinnovo!</a>
    EOHTML;
        }
    }




    and the other file in \custom\modules\Contracts\Controller.php is:

    <?php
    class CustomContractsController extends SugarController
    {
        public function action_displaypassedids() {
            if ( !empty($_REQUEST['uid']) ) {
                $recordIds = explode(',',$_REQUEST['uid']);
                foreach ( $recordIds as $recordId ) {
                    $bean = BeanFactory::getBean("Contracts", $recordId);
                    $GLOBALS['log']->fatal("ID: ".$bean->id);
                }
            }
            sugar_die('');
        }
    }


    Why this happens?

    Stefano

     

  • Thanks Bhavin for the help,

    this is not a solution for me because I work with Sugarcrm 7.6 but the Contracts interface is not the new version 7.6 but still remains the 6.7 version. 

    I can't apply this solution.

    Stefano

  • Sorry, my mistake, put the file in controller.php (lowercase not uppercase). It worked for me once I did that. It's case sensitive. I've edited my original response to be correct.