Instructions on how I got this working for 7.2.1 running on LAMP (php5.5)…
This assumes you already have a “Generate PDF” button working (this will help you understand the instructions below) in your detailview of your custom module if you don’t, follow this forum posting here.
For the first step I created a YourModuleNameListviewSmarty.php file in custom/modules/YourModuleName…
I did this by copying the file LeadsListViewSmarty.php from custom/modules/leads/ then placing it in custom/modules/YourModuleName.
Then edited the file by replacing the module name “Leads” with my custom module name, for example: LeadsListViewSmarty is now “MyModuleNameListViewSmarty”, do this throughout the entire file
here is LeadsListViewSmarty.php file text below with Add to TargetList and Maps commented out…
<?php
require_once('include/ListView/ListViewSmarty.php');
require_once('modules/AOS_PDF_Templates/formLetter.php');
class [b]Leads[/b]ListViewSmarty extends ListViewSmarty {
function [b]Leads[/b]ListViewSmarty(){
parent::ListViewSmarty();
//$this->targetList = true;
}
function process($file, $data, $htmlVar) {
parent::process($file, $data, $htmlVar);
if(!ACLController::checkAccess($this->seed->module_dir,'export',true) || !$this->export) {
$this->ss->assign('exportLink', $this->buildExportLink());
}
}
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;
}
}
?>
For the 2nd step, we need to create a view.list.php file in the same place as you created the view.detail.php file which is in custom/modules/YourModuleName/views.
To do this simply copy the same file in custom/modules/leads/views to custom/modules/YourModuleName/views.
After you have the file copied over into custom/modules/YourModuleName/views you will want to edit and change the module name “leads” to YourModuleName throughout the file.
here is the view.list.php from custom/modules/leads/views…
<?php
require_once('include/MVC/View/views/view.list.php');
require_once('custom/modules/[b]Leads[/b]/[b]Leads[/b]ListViewSmarty.php');
class [b]Leads[/b]ViewList extends ViewList
{
/**
* @see ViewList::preDisplay()
*/
public function preDisplay(){
require_once('modules/AOS_PDF_Templates/formLetter.php');
formLetter::LVPopupHtml('Leads');
parent::preDisplay();
$this->lv = new [b]Leads[/b]ListViewSmarty();
}
}
After you've added these files to your custom module, refresh your listview of your custom module select at list 1 record in the list view and click on the action menu dropdown and you should see Generate Letter and as long as you have a PDF Template created for your custom module you will be able to select the template and it will download.
Hope this helps out others...
Cheers!