Hiding the Quotes Module PDF Buttons
Overview
How to hide the PDF buttons on a Quote.
The PDF buttons on quotes are rendered differently than the standard buttons on most layouts. Since these buttons can't be removed directly from the DetailView in the detailviewdefs, the best approach is using jQuery to hide the buttons.
Note: This customization is only applicable for the quotes module as it is in backward compatibility mode.
Hidding the PDF Buttons
This approach involves modifying the detailviewdefs.php in the custom/modules/Quotes/metadata directory to include a custom JavaScript file. If a custom detailviewdefs.php file doesn't exist, you will need to create it through Studio or by manually coping the detailviewdefs.php from the Quotes stock module metadata directory.
First, we will create a javascript file, say removePdfBtns.js, in the ./custom/modules/Quotes directory. This javascript file will contain the jQuery statements to hide the Quotes "Download PDF" and "Email PDF" buttons on the DetailView of the Quote.
./custom/modules/Quotes/removePdfBtns.js
SUGAR.util.doWhen("typeof $ != 'undefined'", function(){
YAHOO.util.Event.onDOMReady(function(){
$("#pdfview_button").hide();
$("#pdfemail_button").hide();
});
});
Next, we will modify the custom detailviewdefs.php file to contain the 'includes' array element in the templateMeta array as follows:
./custom/modules/Quotes/metadata/detailviewdefs.php
$viewdefs['Quotes'] = array (
'DetailView' =>
array (
'templateMeta' =>
array (
'form' =>
array (
'closeFormBeforeCustomButtons' => true,
'buttons' =>
array (
0 => 'EDIT',
1 => 'SHARE',
2 => 'DUPLICATE',
3 => 'DELETE',
4 =>
array (
'customCode' => '<form action="index.php" method="POST" name="Quote2Opp" id="form">
<input type="hidden" name="module" value="Quotes">
<input type="hidden" name="record" value="{$fields.id.value}">
<input type="hidden" name="user_id" value="{$current_user->id}">
<input type="hidden" name="team_id" value="{$fields.team_id.value}">
<input type="hidden" name="user_name" value="{$current_user->user_name}">
<input type="hidden" name="action" value="QuoteToOpportunity">
<input type="hidden" name="opportunity_subject" value="{$fields.name.value}">
<input type="hidden" name="opportunity_name" value="{$fields.name.value}">
<input type="hidden" name="opportunity_id" value="{$fields.billing_account_id.value}">
<input type="hidden" name="amount" value="{$fields.total.value}">
<input type="hidden" name="valid_until" value="{$fields.date_quote_expected_closed.value}">
<input type="hidden" name="currency_id" value="{$fields.currency_id.value}">
<input id="create_opp_from_quote_button" title="{$APP.LBL_QUOTE_TO_OPPORTUNITY_TITLE}"
class="button" type="submit" name="opp_to_quote_button"
value="{$APP.LBL_QUOTE_TO_OPPORTUNITY_LABEL}" {$DISABLE_CONVERT}></form>',
),
),
'footerTpl' => 'modules/Quotes/tpls/DetailViewFooter.tpl',
),
'maxColumns' => '2',
'widths' =>
array (
0 =>
array (
'label' => '10',
'field' => '30',
),
1 =>
array (
'label' => '10',
'field' => '30',
),
),
'includes' =>
array (
0 =>
array (
'file' => 'custom/modules/Quotes/removePdfBtns.js',
),
),
'useTabs' => false,
'tabDefs' =>
array (
'LBL_QUOTE_INFORMATION' =>
array (
'newTab' => false,
'panelDefault' => 'expanded',
),
'LBL_PANEL_ASSIGNMENT' =>
array (
'newTab' => false,
'panelDefault' => 'expanded',
),
),
),
...
Finally, navigate to:
Admin > Repair > Quick Repair and Rebuild
The buttons will then be removed from the DetailView layouts.