Advertisement
matthewpoer

SugarCRM: Custom Quote DetailView (view.detailview.php)

Aug 14th, 2012
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 23.16 KB | None | 0 0
  1. <?php
  2. require_once('include/MVC/View/views/view.detail.php');
  3. class CustomQuotesViewDetail extends ViewDetail{
  4.  
  5.     private function _display_630(){
  6.         global $beanFiles;
  7.         require_once($beanFiles['Quote']);
  8.         require_once($beanFiles['TaxRate']);
  9.         require_once($beanFiles['Shipper']);
  10.  
  11.         $this->bean->load_relationship('product_bundles');
  12.         $product_bundle_list = $this->bean->get_linked_beans('product_bundles','ProductBundle');
  13.         if(is_array($product_bundle_list)){
  14.  
  15.             $ordered_bundle_list = array();
  16.             foreach ($product_bundle_list as $id => $bean)
  17.             {
  18.                 $index = $bean->get_index($this->bean->id);
  19.                 $ordered_bundle_list[(int)$index[0]['bundle_index']] = $bean;
  20.             } //for
  21.             ksort($ordered_bundle_list);
  22.         } //if
  23.  
  24.         $this->ss->assign('ordered_bundle_list', $ordered_bundle_list);
  25.  
  26.         $currency = new Currency();
  27.         $currency->retrieve($this->bean->currency_id);
  28.         $this->ss->assign('CURRENCY_SYMBOL', $currency->symbol);
  29.         $this->ss->assign('CURRENCY', $currency->iso4217);
  30.         $this->ss->assign('CURRENCY_ID', $currency->id);
  31.         require_once('modules/Quotes/Layouts.php');
  32.         $this->ss->assign('LAYOUT_OPTIONS', get_select_options_with_id(get_layouts(), ''));
  33.  
  34.         if(!(strpos($_SERVER['HTTP_USER_AGENT'],'Mozilla/5') === false)) {
  35.             $this->ss->assign('PDFMETHOD', 'POST');
  36.         } else {
  37.             $this->ss->assign('PDFMETHOD', 'GET');
  38.         }
  39.  
  40.         global $app_list_strings, $current_user;
  41.         $this->ss->assign('APP_LIST_STRINGS', $app_list_strings);
  42.         $this->ss->assign('gridline', $current_user->getPreference('gridline') == 'on' ? '1' : '0');
  43.  
  44.         require_once('include/Sugarpdf/sugarpdf_config.php');
  45.         if(PDF_CLASS == 'TCPDF') {
  46.             $this->dv->defs['templateMeta']['form']['links'] = array('{$MOD.PDF_FORMAT} <select name="sugarpdf" id="sugarpdf">{$LAYOUT_OPTIONS}</select></form>');
  47.             // Bug 41079 Check User Email Client Type
  48.             $userPref = $current_user->getPreference('email_link_type');
  49.             global $sugar_config;
  50.             $defaultPref = $sugar_config['email_default_client'];
  51.             if($userPref != '') {
  52.                 $client = $userPref;
  53.             } else {
  54.                 $client = $defaultPref;
  55.             }
  56.             $pdfButtons = '<form action="index.php" method="{$PDFMETHOD}" name="ViewPDF" id="form"><input type="hidden" name="module" value="Quotes"><input type="hidden" name="record" value="{$fields.id.value}"><input type="hidden" name="action" value="sugarpdf"><input type="hidden" name="email_action">';
  57.             if ($client != 'sugar') {
  58.                 $pdfButtons .= '<input title="{$APP.LBL_EMAIL_COMPOSE}" accessKey="{$APP.LBL_EMAIL_PDF_BUTTON_KEY}" class="button" type="submit" name="button" value="{$APP.LBL_EMAIL_COMPOSE}" onclick="location.href=\'mailto:\';return false;"> ';
  59.             } else {
  60.                 $pdfButtons .= '<input title="{$APP.LBL_EMAIL_PDF_BUTTON_TITLE}" accessKey="{$APP.LBL_EMAIL_PDF_BUTTON_KEY}" class="button" type="submit" name="button" value="{$APP.LBL_EMAIL_PDF_BUTTON_LABEL}" onclick="this.form.email_action.value=\'EmailLayout\';"> ';
  61.             }
  62.             $pdfButtons .= '<input title="{$APP.LBL_VIEW_PDF_BUTTON_TITLE}" accessKey="{$APP.LBL_VIEW_PDF_BUTTON_KEY}" class="button" type="submit" name="button" value="{$APP.LBL_VIEW_PDF_BUTTON_LABEL}">';
  63.  
  64.             $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DUPLICATE', 'DELETE',
  65.                 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 title="{$APP.LBL_QUOTE_TO_OPPORTUNITY_TITLE}" accessKey="{$APP.LBL_QUOTE_TO_OPPORTUNITY_KEY}" class="button" type="submit" name="opp_to_quote_button" value="{$APP.LBL_QUOTE_TO_OPPORTUNITY_LABEL}"></form>'),
  66.                 array('customCode'=>$pdfButtons)
  67.             );
  68.  
  69.         }
  70.  
  71.         // the custom bit for Sage Payments integration...
  72.         $new_array = array();
  73.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][0]; // EDIT
  74.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][1]; // DUPLICATE
  75.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][2]; // DELETE
  76.         $new_array[] = array(
  77.             'customCode' => '
  78.             {if $fields.sage_is_processed_c.value == 0}
  79.             <input type="submit" onclick="
  80.                 this.form.return_module.value=\'Quotes\';
  81.                 this.form.return_action.value=\'DetailView\';
  82.                 this.form.return_id.value=this.form.record.value;
  83.                 this.form.action.value=\'create_from\';
  84.                 this.form.action.name=\'entryPoint\';
  85.                 this.form.module.value=\'sage_Transactions\';
  86.                 this.form.record.value=\'\';
  87.                 SUGAR.ajaxUI.submitForm(this.form);
  88.             " value="Authorize" />
  89.             {/if}
  90.             </form></td><td class="buttons" align="left" NOWRAP>',
  91.         );
  92.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][3]; // quote2opp
  93.         $new_array[] = array('customCode'=>'</td><td class="buttons" align="left" NOWRAP>');
  94.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][4]; // quote2pdf
  95.         $new_array[] = array('customCode'=>'</td>');
  96.         $this->dv->defs['templateMeta']['form']['buttons'] = $new_array;
  97.         unset($this->dv->defs['templateMeta']['form']['closeFormBeforeCustomButtons']);
  98.  
  99.         parent::display();
  100.     }
  101.  
  102.     private function _display_641(){
  103.         global $beanFiles;
  104.         require_once($beanFiles['Quote']);
  105.         require_once($beanFiles['TaxRate']);
  106.         require_once($beanFiles['Shipper']);
  107.  
  108.         $this->bean->load_relationship('product_bundles');
  109.         $product_bundle_list = $this->bean->get_linked_beans('product_bundles','ProductBundle');
  110.         if(is_array($product_bundle_list)){
  111.  
  112.             $ordered_bundle_list = array();
  113.             foreach ($product_bundle_list as $id => $bean)
  114.             {
  115.                 $index = $bean->get_index($this->bean->id);
  116.                 $ordered_bundle_list[(int)$index[0]['bundle_index']] = $bean;
  117.             } //for
  118.             ksort($ordered_bundle_list);
  119.         } //if
  120.  
  121.         $this->ss->assign('ordered_bundle_list', $ordered_bundle_list);
  122.  
  123.         $currency = new Currency();
  124.         $currency->retrieve($this->bean->currency_id);
  125.         $this->ss->assign('CURRENCY_SYMBOL', $currency->symbol);
  126.         $this->ss->assign('CURRENCY', $currency->iso4217);
  127.         $this->ss->assign('CURRENCY_ID', $currency->id);
  128.         require_once('modules/Quotes/Layouts.php');
  129.         $this->ss->assign('LAYOUT_OPTIONS', get_select_options_with_id(get_layouts(), ''));
  130.  
  131.         if(!(strpos($_SERVER['HTTP_USER_AGENT'],'Mozilla/5') === false)) {
  132.             $this->ss->assign('PDFMETHOD', 'POST');
  133.         } else {
  134.             $this->ss->assign('PDFMETHOD', 'GET');
  135.         }
  136.  
  137.         global $app_list_strings, $current_user;
  138.         $this->ss->assign('APP_LIST_STRINGS', $app_list_strings);
  139.         $this->ss->assign('gridline', $current_user->getPreference('gridline') == 'on' ? '1' : '0');
  140.  
  141.         require_once('include/Sugarpdf/sugarpdf_config.php');
  142.         if(PDF_CLASS == 'TCPDF') {
  143.             $this->dv->defs['templateMeta']['form']['links'] = array('{$MOD.PDF_FORMAT} <select name="sugarpdf" id="sugarpdf">{$LAYOUT_OPTIONS}</select></form>');
  144.             // Bug 41079 Check User Email Client Type
  145.             $userPref = $current_user->getPreference('email_link_type');
  146.             global $sugar_config;
  147.             $defaultPref = $sugar_config['email_default_client'];
  148.             if($userPref != '') {
  149.                 $client = $userPref;
  150.             } else {
  151.                 $client = $defaultPref;
  152.             }
  153.             $pdfButtons = '<form action="index.php" method="{$PDFMETHOD}" name="ViewPDF" id="form"><input type="hidden" name="module" value="Quotes"><input type="hidden" name="record" value="{$fields.id.value}"><input type="hidden" name="action" value="sugarpdf"><input type="hidden" name="email_action">';
  154.             $pdfButtons .= '{nocache}';
  155.             $pdfButtons .= '{sugar_email_btn}';
  156.             $pdfButtons .= '{/nocache}';
  157.             $pdfButtons .= '<input title="{$APP.LBL_VIEW_PDF_BUTTON_TITLE}" class="button" type="submit" name="button" value="{$APP.LBL_VIEW_PDF_BUTTON_LABEL}">';
  158.  
  159.             $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DUPLICATE', 'DELETE',
  160.                 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 title="{$APP.LBL_QUOTE_TO_OPPORTUNITY_TITLE}" class="button" type="submit" name="opp_to_quote_button" value="{$APP.LBL_QUOTE_TO_OPPORTUNITY_LABEL}"></form>'),
  161.                 array('customCode'=>$pdfButtons)
  162.             );
  163.  
  164.         }
  165.         elseif(PDF_CLASS == 'EZPDF')
  166.         {
  167.             $this->dv->defs['templateMeta']['form']['links'] = array('{$MOD.PDF_FORMAT} <select name="layout" id="layout">{$LAYOUT_OPTIONS}</select></form>');
  168.  
  169.             $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DUPLICATE', 'DELETE',
  170.                 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.new_sub.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 title="{$APP.LBL_QUOTE_TO_OPPORTUNITY_TITLE}" class="button" type="submit" name="opp_to_quote_button" value="{$APP.LBL_QUOTE_TO_OPPORTUNITY_LABEL}"></form>'),
  171.                 array('customCode'=>'<form action="index.php" method="{$PDFMETHOD}" name="ViewPDF" id="form"><input type="hidden" name="module" value="Quotes"><input type="hidden" name="record" value="{$fields.id.value}"><input type="hidden" name="action" value="Layouts"><input type="hidden" name="entryPoint" value="pdf"><input type="hidden" name="email_action"><input title="{$APP.LBL_EMAIL_PDF_BUTTON_TITLE}" class="button" type="submit" name="button" value="{$APP.LBL_EMAIL_PDF_BUTTON_LABEL}" onclick="this.form.email_action.value=\'EmailLayout\';"> <input title="{$APP.LBL_VIEW_PDF_BUTTON_TITLE}"  class="button" type="submit" name="button" value="{$APP.LBL_VIEW_PDF_BUTTON_LABEL}">')
  172.             );
  173.         }
  174.  
  175.         // the custom bit for Sage Payments integration...
  176.         $new_array = array();
  177.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][0]; // EDIT
  178.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][1]; // DUPLICATE
  179.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][2]; // DELETE
  180.         $new_array[] = array(
  181.             'customCode' => '
  182.             {if $fields.sage_is_processed_c.value == 0}
  183.             <input type="submit" onclick="
  184.                 this.form.return_module.value=\'Quotes\';
  185.                 this.form.return_action.value=\'DetailView\';
  186.                 this.form.return_id.value=this.form.record.value;
  187.                 this.form.action.value=\'create_from\';
  188.                 this.form.action.name=\'entryPoint\';
  189.                 this.form.module.value=\'sage_Transactions\';
  190.                 this.form.record.value=\'\';
  191.                 SUGAR.ajaxUI.submitForm(this.form);
  192.             " value="Authorize" />
  193.             {/if}
  194.             </form></td><td class="buttons" align="left" NOWRAP>',
  195.         );
  196.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][3]; // quote2opp
  197.         $new_array[] = array('customCode'=>'</td><td class="buttons" align="left" NOWRAP>');
  198.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][4]; // quote2pdf
  199.         $new_array[] = array('customCode'=>'</td>');
  200.         $this->dv->defs['templateMeta']['form']['buttons'] = $new_array;
  201.         unset($this->dv->defs['templateMeta']['form']['closeFormBeforeCustomButtons']);
  202.  
  203.         parent::display();
  204.     }
  205.  
  206.     private function _display_650()
  207.     {
  208.         global $beanFiles;
  209.         require_once($beanFiles['Quote']);
  210.         require_once($beanFiles['TaxRate']);
  211.         require_once($beanFiles['Shipper']);
  212.  
  213.         $this->bean->load_relationship('product_bundles');
  214.         $product_bundle_list = $this->bean->get_linked_beans('product_bundles','ProductBundle');
  215.         if(is_array($product_bundle_list)){
  216.  
  217.             $ordered_bundle_list = array();
  218.             foreach ($product_bundle_list as $id => $bean)
  219.             {
  220.                 $index = $bean->get_index($this->bean->id);
  221.                 $ordered_bundle_list[(int)$index[0]['bundle_index']] = $bean;
  222.             } //for
  223.             ksort($ordered_bundle_list);
  224.         } //if
  225.  
  226.         $this->ss->assign('ordered_bundle_list', $ordered_bundle_list);
  227.  
  228.         $currency = new Currency();
  229.         $currency->retrieve($this->bean->currency_id);
  230.         $this->ss->assign('CURRENCY_SYMBOL', $currency->symbol);
  231.         $this->ss->assign('CURRENCY', $currency->iso4217);
  232.         $this->ss->assign('CURRENCY_ID', $currency->id);
  233.         require_once('modules/Quotes/Layouts.php');
  234.         $this->ss->assign('LAYOUT_OPTIONS', get_select_options_with_id(get_layouts(), ''));
  235.  
  236.         if(!(strpos($_SERVER['HTTP_USER_AGENT'],'Mozilla/5') === false)) {
  237.             $this->ss->assign('PDFMETHOD', 'POST');
  238.         } else {
  239.             $this->ss->assign('PDFMETHOD', 'GET');
  240.         }
  241.  
  242.         global $app_list_strings, $current_user;
  243.         $this->ss->assign('APP_LIST_STRINGS', $app_list_strings);
  244.         $this->ss->assign('gridline', $current_user->getPreference('gridline') == 'on' ? '1' : '0');
  245.  
  246.         require_once('include/Sugarpdf/sugarpdf_config.php');
  247.         if(PDF_CLASS == 'TCPDF') {
  248.             $this->dv->defs['templateMeta']['form']['links'] = array('{$MOD.PDF_FORMAT} <select name="sugarpdf" id="sugarpdf">{$LAYOUT_OPTIONS}</select></form>');
  249.             // Bug 41079 Check User Email Client Type
  250.             $userPref = $current_user->getPreference('email_link_type');
  251.             global $sugar_config;
  252.             $defaultPref = $sugar_config['email_default_client'];
  253.             if($userPref != '') {
  254.                 $client = $userPref;
  255.             } else {
  256.                 $client = $defaultPref;
  257.             }
  258.             $pdfButtons = '<form action="index.php" method="{$PDFMETHOD}" name="ViewPDF" id="form" onsubmit="this.sugarpdf.value =(document.getElementById(\'sugarpdf\'))? document.getElementById(\'sugarpdf\').value: \'\';"><input type="hidden" name="module" value="Quotes"><input type="hidden" name="record" value="{$fields.id.value}"><input type="hidden" name="action" value="sugarpdf"><input type="hidden" name="email_action"><input type="hidden" name="sugarpdf">';
  259.             $pdfButtons .= '{nocache}';
  260.             $pdfButtons .= '{sugar_email_btn}';
  261.             $pdfButtons .= '{/nocache}</form>';
  262.  
  263.             $pdfViewButton = '<form action="index.php" method="{$PDFMETHOD}" name="ViewPDF" id="form" onsubmit="this.sugarpdf.value =(document.getElementById(\'sugarpdf\'))? document.getElementById(\'sugarpdf\').value: \'\';"><input type="hidden" name="module" value="Quotes"><input type="hidden" name="record" value="{$fields.id.value}"><input type="hidden" name="action" value="sugarpdf"><input type="hidden" name="email_action"><input type="hidden" name="sugarpdf">';
  264.             $pdfViewButton .= '<input id="print_as_pdf_button" title="{$APP.LBL_VIEW_PDF_BUTTON_TITLE}" class="button" type="submit" name="button" value="{$APP.LBL_VIEW_PDF_BUTTON_LABEL}"></form>';
  265.  
  266.             $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DUPLICATE', 'DELETE',
  267.                 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 title="{$APP.LBL_QUOTE_TO_OPPORTUNITY_TITLE}" id="create_opp_from_quote_button" class="button" type="submit" name="opp_to_quote_button" value="{$APP.LBL_QUOTE_TO_OPPORTUNITY_LABEL}"></form>'),
  268.                 array('customCode'=>$pdfButtons),
  269.                 array('customCode'=>$pdfViewButton),
  270.             );
  271.  
  272.         }
  273.         elseif(PDF_CLASS == 'EZPDF')
  274.         {
  275.             $this->dv->defs['templateMeta']['form']['links'] = array('{$MOD.PDF_FORMAT} <select name="layout" id="layout">{$LAYOUT_OPTIONS}</select></form>');
  276.  
  277.             $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DUPLICATE', 'DELETE',
  278.                 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.new_sub.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 title="{$APP.LBL_QUOTE_TO_OPPORTUNITY_TITLE}" class="button" type="submit" name="opp_to_quote_button" value="{$APP.LBL_QUOTE_TO_OPPORTUNITY_LABEL}"></form>'),
  279.                 array('customCode'=>'<form action="index.php" method="{$PDFMETHOD}" name="ViewPDF" id="form" onsubmit="this.sugarpdf.value =(document.getElementById(\'layout\'))? document.getElementById(\'sugarpdf\').value: \'\';"><input type="hidden" name="module" value="Quotes"><input type="hidden" name="record" value="{$fields.id.value}"><input type="hidden" name="action" value="Layouts"><input type="hidden" name="entryPoint" value="pdf"><input type="hidden" name="email_action"><input title="{$APP.LBL_EMAIL_PDF_BUTTON_TITLE}" class="button" type="submit" name="button" value="{$APP.LBL_EMAIL_PDF_BUTTON_LABEL}" onclick="this.form.email_action.value=\'EmailLayout\';"> <input title="{$APP.LBL_VIEW_PDF_BUTTON_TITLE}"  class="button" type="submit" name="button" value="{$APP.LBL_VIEW_PDF_BUTTON_LABEL}"></form>')
  280.             );
  281.         }
  282.  
  283.         // the custom bit for Sage Payments integration...
  284.         $new_array = array();
  285.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][0]; // EDIT
  286.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][1]; // DUPLICATE
  287.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][2]; // DELETE
  288.         $new_array[] = array(
  289.             'customCode' => '
  290.             {if $fields.sage_is_processed_c.value == 0}
  291.             <input type="submit" onclick="
  292.                 this.form.return_module.value=\'Quotes\';
  293.                 this.form.return_action.value=\'DetailView\';
  294.                 this.form.return_id.value=this.form.record.value;
  295.                 this.form.action.value=\'create_from\';
  296.                 this.form.action.name=\'entryPoint\';
  297.                 this.form.module.value=\'sage_Transactions\';
  298.                 this.form.record.value=\'\';
  299.                 SUGAR.ajaxUI.submitForm(this.form);
  300.             " value="Authorize" />
  301.             {/if}
  302.             </form></td><td class="buttons" align="left" NOWRAP>',
  303.         );
  304.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][3]; // quote2opp
  305.         $new_array[] = array('customCode'=>'</td><td class="buttons" align="left" NOWRAP>');
  306.         $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][4]; // quote2pdf
  307.         $new_array[] = array('customCode'=>'</td>');
  308.         $this->dv->defs['templateMeta']['form']['buttons'] = $new_array;
  309.         unset($this->dv->defs['templateMeta']['form']['closeFormBeforeCustomButtons']);
  310.  
  311.         parent::display();
  312.  
  313.     }
  314.  
  315.     /**
  316.      * @see SugarView::display()
  317.      */
  318.     public function display() {
  319.         global $sugar_version;
  320.         switch ($sugar_version){
  321.             case "6.5.0":
  322.                 $this->_display_650();
  323.                 break;
  324.             case "6.4.5":
  325.             case "6.4.4":
  326.             case "6.4.3":
  327.             case "6.4.2":
  328.             case "6.4.1":
  329.                 $this->_display_641();
  330.                 break;
  331.             case "6.3.0":
  332.                 $this->_display_630();
  333.                 break;
  334.             default:
  335.                 return false;
  336.         }
  337.     }
  338. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement