<delect id="nhvxd"></delect>
<ol id="nhvxd"><address id="nhvxd"></address></ol>

        <em id="nhvxd"><listing id="nhvxd"></listing></em>

        <sub id="nhvxd"><listing id="nhvxd"><dfn id="nhvxd"></dfn></listing></sub>

          <b id="nhvxd"></b>
          <pre id="nhvxd"><meter id="nhvxd"></meter></pre><sub id="nhvxd"><thead id="nhvxd"><font id="nhvxd"></font></thead></sub>

          給 SuiteCRM 其他模塊添加 PDF 打印功能

          功能實現:創建了一個用于記錄內部生產問題的模塊。SuiteCRM 有一個內置Case模塊,可以輕松地在模塊構建器中創建該模塊的版本。作為其中的一部分,我們需要一種臨時打印 PDF 的方法,把Case模塊的數據生成一份PDF。

          在你開始之前…

          將所有 [CUSTOM MODULE NAME] 替換為您的模塊名稱,將 [PACKAGE NAME] 替換為您的包名稱。所有文件都應歸 www-data 所有,為此,請在您創建的所有新文件上運行“chown www-data:www-data”。

          配置用于打印 PDF 的模塊。

          1. 將目錄更改為自定義模塊目錄

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

          2. 在metadata/detailviewdefs.php中添加以下行

          4 => array ( 'customCode' => '<input type="button" class="button" onClick="showPopup(\'pdf\');" value="{$MOD.LBL_PRINT_AS_PDF}">')
          below
          
                  'buttons' =>
          
                  array (
          
                    0 => 'EDIT',
          
                    1 => 'DUPLICATE',
          
                    2 => 'DELETE',
          
                    3 => 'FIND_DUPLICATES',

          3. 在 vi??m language/en_us.lang.php 中確保該行

          'LBL_PRINT_AS_PDF' => 'Print as PDF',

          4.在模塊目錄下制作目錄視圖

          mkdir views 
          chown www-data:www-data views

          5.在views/view.detail.php中添加以下代碼

          <?php
          
          if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
          
          
          require_once('include/MVC/View/views/view.detail.php');
          
          
          class remed_RemedialsViewDetail extends ViewDetail {
          
                  function __construct(){
          
                          parent::__construct();
          
                  }
          
          
              /**
          
               * @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 remed_RemedialsViewDetail(){
          
                  $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();
          
              }
          
          
          
                  function display(){
          
          
                          if(empty($this->bean->id)){
          
                                  global $app_strings;
          
                                  sugar_die($app_strings['ERROR_NO_RECORD']);
          
                          }
          
                        require_once('modules/AOS_PDF_Templates/formLetter.php');
          
                        formLetter::DVPopupHtml('remed_Remedials');
          
          
                        $this->dv->process();
          
          
                          if(ACLController::checkAccess('Contacts', 'edit', true)) {
          
                                  $push_billing = $this->generatePushCode('billing');
          
                                  $push_shipping = $this->generatePushCode('shipping');
          
                          } else {
          
                                  $push_billing = '';
          
                                  $push_shipping = '';
          
                          }
          
                          $this->ss->assign("custom_code_billing", $push_billing);
          
                          $this->ss->assign("custom_code_shipping", $push_shipping);
          
          
                  if(empty($this->bean->id)){
          
                                  global $app_strings;
          
                                  sugar_die($app_strings['ERROR_NO_RECORD']);
          
                          }
          
                          echo $this->dv->display();
          
                  }
          
           
          
                  function generatePushCode($param)
          
                  {
          
                      global $mod_strings;
          
                      $address_fields = array('street', 'city', 'state', 'postalcode','country');
          
           
          
              //        $html = '<input class="button" title="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_LABEL'] .
          
                               '" type="button" onclick=\'open_contact_popup("Contacts", 600, 600, "&account_name=' .
          
                               $this->bean->name . '&html=change_address';
          
           
          
                      foreach ($address_fields as $value) {
          
                          $field_name = $param.'_address_'.$value;
          
               //           $html .= '&primary_address_'.$value.'='.str_replace(array("\rn", "\r", "\n"), array('','','<br>'), urlencode($this->bean->$field_name)) ;
          
                      }
          
           
          
                    //  $html .= '", true, false);\' value="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_TITLE']. '">';
          
                    //  return $html;
          
                  }
          
          }
          
          
          <?php
          
          if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
          
           
          
          require_once('include/MVC/View/views/view.detail.php');
          
           
          
          class remed_RemedialsViewDetail extends ViewDetail {
          
           
          
                  function __construct(){
          
                          parent::__construct();
          
                  }
          
          
              /**
          
               * @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 remed_RemedialsViewDetail(){
          
                  $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();
          
              }
          
          
          
                  function display(){
          
          
                          if(empty($this->bean->id)){
          
                                  global $app_strings;
          
                                  sugar_die($app_strings['ERROR_NO_RECORD']);
          
                          }
          
           
          
                        require_once('modules/AOS_PDF_Templates/formLetter.php');
          
                        formLetter::DVPopupHtml('remed_Remedials');
          
          
                        $this->dv->process();
          
          
                          if(ACLController::checkAccess('Contacts', 'edit', true)) {
          
                                  $push_billing = $this->generatePushCode('billing');
          
                                  $push_shipping = $this->generatePushCode('shipping');
          
                          } else {
          
                                  $push_billing = '';
          
                                  $push_shipping = '';
          
                          }
          
          
                          $this->ss->assign("custom_code_billing", $push_billing);
          
                          $this->ss->assign("custom_code_shipping", $push_shipping);
          
          
                  if(empty($this->bean->id)){
          
                                  global $app_strings;
          
                                  sugar_die($app_strings['ERROR_NO_RECORD']);
          
                          }
          
                          echo $this->dv->display();
          
                  }
          
           
          
                  function generatePushCode($param)
          
                  {
          
                      global $mod_strings;
          
                      $address_fields = array('street', 'city', 'state', 'postalcode','country');
          
           
          
              //        $html = '<input class="button" title="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_LABEL'] .
          
                               '" type="button" onclick=\'open_contact_popup("Contacts", 600, 600, "&account_name=' .
          
                               $this->bean->name . '&html=change_address';
          
           
          
                      foreach ($address_fields as $value) {
          
                          $field_name = $param.'_address_'.$value;
          
               //           $html .= '&primary_address_'.$value.'='.str_replace(array("\rn", "\r", "\n"), array('','','<br>'), urlencode($this->bean->$field_name)) ;
          
                      }
          
           
          
                    //  $html .= '", true, false);\' value="' . $mod_strings['LBL_PUSH_CONTACTS_BUTTON_TITLE']. '">';
          
                    //  return $html;
          
                  }
          
          }

          配置用于打印批量 PDF 的模塊

          按照前面步驟中的步驟 1、3 和 4 在模塊中創建單個 PDF 函數。

          1. 使用以下內容創建一個views.list.php

          require_once('include/MVC/View/views/view.list.php');
          
          require_once('modules/[CUSTOM MODULE NAME]/[CUSTOM MODULE NAME]ListViewSmarty.php');
          
           
          
          class [CUSTOM MODULE NAME]ViewList extends ViewList
          
          {
          
              /**
          
               * @see ViewList::preDisplay()
          
               */
          
              public function preDisplay(){
          
                  require_once('modules/AOS_PDF_Templates/formLetter.php');
          
                  formLetter::LVPopupHtml('[CUSTOM MODULE NAME]');
          
                  parent::preDisplay();
          
           
          
                  $this->lv = new [CUSTOM MODULE NAME]ListViewSmarty();
          
              }
          
          }

          2. 使用以下內容創建 [modulename]ListViewSmarty.php

          require_once('include/ListView/ListViewSmarty.php');
          
          require_once('modules/AOS_PDF_Templates/formLetter.php');
          
           
          
           
          
          class [CUSTOM MODULE NAME]ListViewSmarty extends ListViewSmarty {
          
           
          
                  function __construct(){
          
           
          
                          parent::__construct();
          
                          $this->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 .= "
          
                              " onclick=\"return sListView.send_form(true, 'jjwg_Maps', " .
          
                              "'index.php?entryPoint=jjwg_Maps&display_module={$_REQUEST['module']}', " .
          
                              "'{$app_strings['LBL_LISTVIEW_NO_SELECTED']}')\">{$app_strings['LBL_MAP']}";
          
           
          
                          return formLetter::LVSmarty().$script;
          
                  }
          
           
          
          }

          創建 PDF 模板

          從這里,您需要將模塊添加到下拉列表“pdf_template_type_dom”中,并在“PDF – 模板”中創建模板。

          補充:

          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;
                  }
          
          }
          滾動至頂部
          被夫上司强迫的女人在线中文_我被公满足舒服爽小茹_免费可以看的无遮挡av_亚洲欧美日韩中文字幕二
          <delect id="nhvxd"></delect>
          <ol id="nhvxd"><address id="nhvxd"></address></ol>

                <em id="nhvxd"><listing id="nhvxd"></listing></em>

                <sub id="nhvxd"><listing id="nhvxd"><dfn id="nhvxd"></dfn></listing></sub>

                  <b id="nhvxd"></b>
                  <pre id="nhvxd"><meter id="nhvxd"></meter></pre><sub id="nhvxd"><thead id="nhvxd"><font id="nhvxd"></font></thead></sub>