How to remove standard vtiger “Send Email with PDF” and “Export to PDF” from More button?

How to hide standard vtiger Export to PDF or Send Email with PDF

Hello dear our customers.

Have you ever met with this situation?

You or your company bought PDF Maker, create beautiful PDF template.
Everything works like charm.

But  some of your employes say you that they still export standard vtiger template?

You know that they use standard vtiger Export to PDF from More button instead of PDF Maker export button. But how to hide this button and leave only PDF Maker button to export template that you want?

How to hide standard vtiger Export to PDF or Send Email with PDF

How to hide standard vtiger Export to PDF or Send Email with PDF

We must not change vtiger source code with our extensions but you, as customer, can change whatever you want.

To hide “Send Email with PDF” and “Export to PDF” you need to make small changes in source code of vtiger.

So please find file:

[yourvtiger]/modules/Inventory/models/DetailView.php

<?php
/*+***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 *************************************************************************************/

class Inventory_DetailView_Model extends Vtiger_DetailView_Model {

  /**
   * Function to get the detail view links (links and widgets)
   * @param <array> $linkParams - parameters which will be used to calicaulate the params
   * @return <array> - array of link models in the format as below
   *					 array('linktype'=>list of link models);
   */
  public function getDetailViewLinks($linkParams) {
    $linkModelList = parent::getDetailViewLinks($linkParams);
    $recordModel = $this->getRecord();
    $moduleName = $recordModel->getmoduleName();

    if(Users_Privileges_Model::isPermitted($moduleName, 'DetailView', $recordModel->getId())) {
      $detailViewLinks = array(
          'linklabel' => vtranslate('LBL_EXPORT_TO_PDF', $moduleName),
          'linkurl' => $recordModel->getExportPDFURL(),
          'linkicon' => ''
            );
      $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($detailViewLinks);

      $sendEmailLink = array(
                'linklabel' => vtranslate('LBL_SEND_MAIL_PDF', $moduleName),
                'linkurl' => 'javascript:Inventory_Detail_Js.sendEmailPDFClickHandler(\''.$recordModel->getSendEmailPDFUrl().'\')',
                'linkicon' => ''
            );

            $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($sendEmailLink);
    }     
               
    return $linkModelList; 
  }

}

Just comment please adding Send Email with PDF and Export to PDF and your problem is solved.

<?php
/*+***********************************************************************************
 * The contents of this file are subject to the vtiger CRM Public License Version 1.0
 * ("License"); You may not use this file except in compliance with the License
 * The Original Code is:  vtiger CRM Open Source
 * The Initial Developer of the Original Code is vtiger.
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 *************************************************************************************/

class Inventory_DetailView_Model extends Vtiger_DetailView_Model {

  /**
   * Function to get the detail view links (links and widgets)
   * @param <array> $linkParams - parameters which will be used to calicaulate the params
   * @return <array> - array of link models in the format as below
   *					 array('linktype'=>list of link models);
   */
  public function getDetailViewLinks($linkParams) {
    $linkModelList = parent::getDetailViewLinks($linkParams);
    $recordModel = $this->getRecord();
    $moduleName = $recordModel->getmoduleName();
    /* ITS4You - START: Disable standard vtiger PDF Export and Send Email with PDF 
    if(Users_Privileges_Model::isPermitted($moduleName, 'DetailView', $recordModel->getId())) {
      $detailViewLinks = array(
          'linklabel' => vtranslate('LBL_EXPORT_TO_PDF', $moduleName),
          'linkurl' => $recordModel->getExportPDFURL(),
          'linkicon' => ''
            );
      $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($detailViewLinks);

      $sendEmailLink = array(
                'linklabel' => vtranslate('LBL_SEND_MAIL_PDF', $moduleName),
                'linkurl' => 'javascript:Inventory_Detail_Js.sendEmailPDFClickHandler(\''.$recordModel->getSendEmailPDFUrl().'\')',
                'linkicon' => ''
            );

            $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($sendEmailLink);
    }     
      ITS4You - END*/
    return $linkModelList; 
  }

}

 

Standard vtiger Export to PDF or Send Email with PDF has been disabled

Standard vtiger Export to PDF or Send Email with PDF has been disabled

Share this post

Comments (2)

  • Vtiger developer Reply

    Good Job! This is an awesome post. I couldn’t find it anywhere on google.

    April 29, 2019 at 12:39 pm
  • Miley Cryus Reply

    Thanks for the article, it was very helpful.

    October 31, 2019 at 7:19 am

Leave a Reply

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