Hi
I am learning how to generate a pdf template in custom module. For learning simplicity, Im using the Accounts module. So, i have its files in /var/www/html/democrm/custom/modules/Accounts.
Now to generate PDF I have added a button to the bottom of the create account page as shown in the screen shot.
Here is the list of steps ive completed:
In the file /var/www/html/democrm/custom/modules/Accounts/language/en_us.lang.php
Iāve added 'LBL_PRINT_AS_PDF' => 'Generate PDF'
, label.
Ive added the button to the page using the following code after campaign_name :
3 =>
array (
0 => 'campaign_name',
),
[b] 4 => array (
'customCode' => '<input type="button" class="button" onClick="showPopup(\'pdf\');" value="{$MOD.LBL_PRINT_AS_PDF}">',
),[/b]
),
Next in the file /var/www/html/democrm/custom/modules/Accounts/views/view.detail.php
Iāve added the following function:
public function display(){
global $sugar_config;
//$aop_portal_enabled = !empty($sugar_config) && !empty($sugar_config);
//$this->ss->assign("AOP_PORTAL_ENABLED", $aop_portal_enabled);
require_once('modules/AOS_PDF_Templates/formLetter.php');
formLetter::DVPopupHtml('Accounts');
parent::display();
}
in the file /var/www/html/democrm/custom/modules/Accounts/metadata/detailviewdefs.php
Ive added a fourth item:
array (
0 => 'EDIT',
1 => 'DUPLICATE',
2 => 'DELETE',
3 => 'FIND_DUPLICATES',
4 =>
array (
'customCode' => '<input type="button" class="button" onClick="showPopup();" value="{$APP.LBL_GENERATE_LETTER}">',
),
In the file /var/www/html/democrm/custom/modules/Accounts/metadata/editviewdefs.php
Ive added the following code in 6:
array (
0 => 'campaign_name',
),
6 => array(
0 => array(
'name' => 'GenerateQuote',
'studio' => 'visible',
//'label' => 'Quotation',
'customCode' => '<input type="button" value="Generate PDF">',
)),
Since Im new to this, I did not make my own module from scratch and tried to custmise the existing one (Accounts) with Generate pdf button but no luck. I searched all forums and refered to books but still nothing is working. My Generate pdf button as shown in the pic is not doing anything. Can anyone pls guide me where Im wrong?
ANy help will be greatly appreciated.
Thanks