SuiteCRM: A PDF Guide (part 2)


Since I wrote a guide for adding PDF functionality (here, if you missed it) I’ve had a few people ask if it is possible to do this but for bulk export. The answer fortunately is yes!

As with the single version you have to go to your module path

/var/www/html/suitecrm/custom/modulebuilder/packages/[PACKAGE NAME]/modules/[CUSTOM MODULE NAME]

Also, before you begin…

Replace all [CUSTOM MODULE NAME] with your module name and [PACKAGE NAME] with your package name. All files should be owned by www-data, to do this run ‘chown www-data:www-data’ on any and all new files you create.

1. Create a views.list.php with the following

lv = new [CUSTOM MODULE NAME]ListViewSmarty();
    }
}

2. Create a [modulename]ListViewSmarty.php with the following

targetList = true;

        }

    /**
     * @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
     */
    function [CUSTOM MODULE NAME]ListViewSmarty(){
        $deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
        if(isset($GLOBALS['log'])) {
            $GLOBALS['log']->deprecated($deprecatedMessage);
        }
        else {
            trigger_error($deprecatedMessage, E_USER_DEPRECATED);
        }
        self::__construct();
    }


    /**
     *
     * @param file $file Template file to use
     * @param array $data from ListViewData
     * @param string $htmlVar the corresponding html public in xtpl per row
     * @return bool|void
     */
    public function process($file, $data, $htmlVar)
    {
        $configurator = new Configurator();
        if ($configurator->isConfirmOptInEnabled()) {
            $this->actionsMenuExtraItems[] = $this->buildSendConfirmOptInEmailToPersonAndCompany();
        }

        $ret = parent::process($file, $data, $htmlVar);

        if (!ACLController::checkAccess($this->seed->module_dir, 'export', true) || !$this->export) {
            $this->ss->assign('exportLink', $this->buildExportLink());
        }

        return $ret;
    }

    function buildExportLink($id = 'export_link'){
                global $app_strings;
                global $sugar_config;

                $script = "";
                if(ACLController::checkAccess($this->seed->module_dir,'export',true)) {
                        if($this->export) {
                                $script = parent::buildExportLink($id);
                        }
                }

            $script .= "{$app_strings['LBL_MAP']}";

                return formLetter::LVSmarty().$script;
        }

}
,

Leave a Reply

Your email address will not be published. Required fields are marked *