Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('include/MVC/View/views/view.detail.php');
- class CustomQuotesViewDetail extends ViewDetail{
- private function _display_630(){
- global $beanFiles;
- require_once($beanFiles['Quote']);
- require_once($beanFiles['TaxRate']);
- require_once($beanFiles['Shipper']);
- $this->bean->load_relationship('product_bundles');
- $product_bundle_list = $this->bean->get_linked_beans('product_bundles','ProductBundle');
- if(is_array($product_bundle_list)){
- $ordered_bundle_list = array();
- foreach ($product_bundle_list as $id => $bean)
- {
- $index = $bean->get_index($this->bean->id);
- $ordered_bundle_list[(int)$index[0]['bundle_index']] = $bean;
- } //for
- ksort($ordered_bundle_list);
- } //if
- $this->ss->assign('ordered_bundle_list', $ordered_bundle_list);
- $currency = new Currency();
- $currency->retrieve($this->bean->currency_id);
- $this->ss->assign('CURRENCY_SYMBOL', $currency->symbol);
- $this->ss->assign('CURRENCY', $currency->iso4217);
- $this->ss->assign('CURRENCY_ID', $currency->id);
- require_once('modules/Quotes/Layouts.php');
- $this->ss->assign('LAYOUT_OPTIONS', get_select_options_with_id(get_layouts(), ''));
- if(!(strpos($_SERVER['HTTP_USER_AGENT'],'Mozilla/5') === false)) {
- $this->ss->assign('PDFMETHOD', 'POST');
- } else {
- $this->ss->assign('PDFMETHOD', 'GET');
- }
- global $app_list_strings, $current_user;
- $this->ss->assign('APP_LIST_STRINGS', $app_list_strings);
- $this->ss->assign('gridline', $current_user->getPreference('gridline') == 'on' ? '1' : '0');
- require_once('include/Sugarpdf/sugarpdf_config.php');
- if(PDF_CLASS == 'TCPDF') {
- $this->dv->defs['templateMeta']['form']['links'] = array('{$MOD.PDF_FORMAT} <select name="sugarpdf" id="sugarpdf">{$LAYOUT_OPTIONS}</select></form>');
- // Bug 41079 Check User Email Client Type
- $userPref = $current_user->getPreference('email_link_type');
- global $sugar_config;
- $defaultPref = $sugar_config['email_default_client'];
- if($userPref != '') {
- $client = $userPref;
- } else {
- $client = $defaultPref;
- }
- $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">';
- if ($client != 'sugar') {
- $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;"> ';
- } else {
- $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\';"> ';
- }
- $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}">';
- $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DUPLICATE', 'DELETE',
- 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>'),
- array('customCode'=>$pdfButtons)
- );
- }
- // the custom bit for Sage Payments integration...
- $new_array = array();
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][0]; // EDIT
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][1]; // DUPLICATE
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][2]; // DELETE
- $new_array[] = array(
- 'customCode' => '
- {if $fields.sage_is_processed_c.value == 0}
- <input type="submit" onclick="
- this.form.return_module.value=\'Quotes\';
- this.form.return_action.value=\'DetailView\';
- this.form.return_id.value=this.form.record.value;
- this.form.action.value=\'create_from\';
- this.form.action.name=\'entryPoint\';
- this.form.module.value=\'sage_Transactions\';
- this.form.record.value=\'\';
- SUGAR.ajaxUI.submitForm(this.form);
- " value="Authorize" />
- {/if}
- </form></td><td class="buttons" align="left" NOWRAP>',
- );
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][3]; // quote2opp
- $new_array[] = array('customCode'=>'</td><td class="buttons" align="left" NOWRAP>');
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][4]; // quote2pdf
- $new_array[] = array('customCode'=>'</td>');
- $this->dv->defs['templateMeta']['form']['buttons'] = $new_array;
- unset($this->dv->defs['templateMeta']['form']['closeFormBeforeCustomButtons']);
- parent::display();
- }
- private function _display_641(){
- global $beanFiles;
- require_once($beanFiles['Quote']);
- require_once($beanFiles['TaxRate']);
- require_once($beanFiles['Shipper']);
- $this->bean->load_relationship('product_bundles');
- $product_bundle_list = $this->bean->get_linked_beans('product_bundles','ProductBundle');
- if(is_array($product_bundle_list)){
- $ordered_bundle_list = array();
- foreach ($product_bundle_list as $id => $bean)
- {
- $index = $bean->get_index($this->bean->id);
- $ordered_bundle_list[(int)$index[0]['bundle_index']] = $bean;
- } //for
- ksort($ordered_bundle_list);
- } //if
- $this->ss->assign('ordered_bundle_list', $ordered_bundle_list);
- $currency = new Currency();
- $currency->retrieve($this->bean->currency_id);
- $this->ss->assign('CURRENCY_SYMBOL', $currency->symbol);
- $this->ss->assign('CURRENCY', $currency->iso4217);
- $this->ss->assign('CURRENCY_ID', $currency->id);
- require_once('modules/Quotes/Layouts.php');
- $this->ss->assign('LAYOUT_OPTIONS', get_select_options_with_id(get_layouts(), ''));
- if(!(strpos($_SERVER['HTTP_USER_AGENT'],'Mozilla/5') === false)) {
- $this->ss->assign('PDFMETHOD', 'POST');
- } else {
- $this->ss->assign('PDFMETHOD', 'GET');
- }
- global $app_list_strings, $current_user;
- $this->ss->assign('APP_LIST_STRINGS', $app_list_strings);
- $this->ss->assign('gridline', $current_user->getPreference('gridline') == 'on' ? '1' : '0');
- require_once('include/Sugarpdf/sugarpdf_config.php');
- if(PDF_CLASS == 'TCPDF') {
- $this->dv->defs['templateMeta']['form']['links'] = array('{$MOD.PDF_FORMAT} <select name="sugarpdf" id="sugarpdf">{$LAYOUT_OPTIONS}</select></form>');
- // Bug 41079 Check User Email Client Type
- $userPref = $current_user->getPreference('email_link_type');
- global $sugar_config;
- $defaultPref = $sugar_config['email_default_client'];
- if($userPref != '') {
- $client = $userPref;
- } else {
- $client = $defaultPref;
- }
- $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">';
- $pdfButtons .= '{nocache}';
- $pdfButtons .= '{sugar_email_btn}';
- $pdfButtons .= '{/nocache}';
- $pdfButtons .= '<input title="{$APP.LBL_VIEW_PDF_BUTTON_TITLE}" class="button" type="submit" name="button" value="{$APP.LBL_VIEW_PDF_BUTTON_LABEL}">';
- $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DUPLICATE', 'DELETE',
- 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>'),
- array('customCode'=>$pdfButtons)
- );
- }
- elseif(PDF_CLASS == 'EZPDF')
- {
- $this->dv->defs['templateMeta']['form']['links'] = array('{$MOD.PDF_FORMAT} <select name="layout" id="layout">{$LAYOUT_OPTIONS}</select></form>');
- $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DUPLICATE', 'DELETE',
- 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>'),
- 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}">')
- );
- }
- // the custom bit for Sage Payments integration...
- $new_array = array();
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][0]; // EDIT
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][1]; // DUPLICATE
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][2]; // DELETE
- $new_array[] = array(
- 'customCode' => '
- {if $fields.sage_is_processed_c.value == 0}
- <input type="submit" onclick="
- this.form.return_module.value=\'Quotes\';
- this.form.return_action.value=\'DetailView\';
- this.form.return_id.value=this.form.record.value;
- this.form.action.value=\'create_from\';
- this.form.action.name=\'entryPoint\';
- this.form.module.value=\'sage_Transactions\';
- this.form.record.value=\'\';
- SUGAR.ajaxUI.submitForm(this.form);
- " value="Authorize" />
- {/if}
- </form></td><td class="buttons" align="left" NOWRAP>',
- );
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][3]; // quote2opp
- $new_array[] = array('customCode'=>'</td><td class="buttons" align="left" NOWRAP>');
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][4]; // quote2pdf
- $new_array[] = array('customCode'=>'</td>');
- $this->dv->defs['templateMeta']['form']['buttons'] = $new_array;
- unset($this->dv->defs['templateMeta']['form']['closeFormBeforeCustomButtons']);
- parent::display();
- }
- private function _display_650()
- {
- global $beanFiles;
- require_once($beanFiles['Quote']);
- require_once($beanFiles['TaxRate']);
- require_once($beanFiles['Shipper']);
- $this->bean->load_relationship('product_bundles');
- $product_bundle_list = $this->bean->get_linked_beans('product_bundles','ProductBundle');
- if(is_array($product_bundle_list)){
- $ordered_bundle_list = array();
- foreach ($product_bundle_list as $id => $bean)
- {
- $index = $bean->get_index($this->bean->id);
- $ordered_bundle_list[(int)$index[0]['bundle_index']] = $bean;
- } //for
- ksort($ordered_bundle_list);
- } //if
- $this->ss->assign('ordered_bundle_list', $ordered_bundle_list);
- $currency = new Currency();
- $currency->retrieve($this->bean->currency_id);
- $this->ss->assign('CURRENCY_SYMBOL', $currency->symbol);
- $this->ss->assign('CURRENCY', $currency->iso4217);
- $this->ss->assign('CURRENCY_ID', $currency->id);
- require_once('modules/Quotes/Layouts.php');
- $this->ss->assign('LAYOUT_OPTIONS', get_select_options_with_id(get_layouts(), ''));
- if(!(strpos($_SERVER['HTTP_USER_AGENT'],'Mozilla/5') === false)) {
- $this->ss->assign('PDFMETHOD', 'POST');
- } else {
- $this->ss->assign('PDFMETHOD', 'GET');
- }
- global $app_list_strings, $current_user;
- $this->ss->assign('APP_LIST_STRINGS', $app_list_strings);
- $this->ss->assign('gridline', $current_user->getPreference('gridline') == 'on' ? '1' : '0');
- require_once('include/Sugarpdf/sugarpdf_config.php');
- if(PDF_CLASS == 'TCPDF') {
- $this->dv->defs['templateMeta']['form']['links'] = array('{$MOD.PDF_FORMAT} <select name="sugarpdf" id="sugarpdf">{$LAYOUT_OPTIONS}</select></form>');
- // Bug 41079 Check User Email Client Type
- $userPref = $current_user->getPreference('email_link_type');
- global $sugar_config;
- $defaultPref = $sugar_config['email_default_client'];
- if($userPref != '') {
- $client = $userPref;
- } else {
- $client = $defaultPref;
- }
- $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">';
- $pdfButtons .= '{nocache}';
- $pdfButtons .= '{sugar_email_btn}';
- $pdfButtons .= '{/nocache}</form>';
- $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">';
- $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>';
- $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DUPLICATE', 'DELETE',
- 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>'),
- array('customCode'=>$pdfButtons),
- array('customCode'=>$pdfViewButton),
- );
- }
- elseif(PDF_CLASS == 'EZPDF')
- {
- $this->dv->defs['templateMeta']['form']['links'] = array('{$MOD.PDF_FORMAT} <select name="layout" id="layout">{$LAYOUT_OPTIONS}</select></form>');
- $this->dv->defs['templateMeta']['form']['buttons'] = array('EDIT', 'DUPLICATE', 'DELETE',
- 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>'),
- 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>')
- );
- }
- // the custom bit for Sage Payments integration...
- $new_array = array();
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][0]; // EDIT
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][1]; // DUPLICATE
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][2]; // DELETE
- $new_array[] = array(
- 'customCode' => '
- {if $fields.sage_is_processed_c.value == 0}
- <input type="submit" onclick="
- this.form.return_module.value=\'Quotes\';
- this.form.return_action.value=\'DetailView\';
- this.form.return_id.value=this.form.record.value;
- this.form.action.value=\'create_from\';
- this.form.action.name=\'entryPoint\';
- this.form.module.value=\'sage_Transactions\';
- this.form.record.value=\'\';
- SUGAR.ajaxUI.submitForm(this.form);
- " value="Authorize" />
- {/if}
- </form></td><td class="buttons" align="left" NOWRAP>',
- );
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][3]; // quote2opp
- $new_array[] = array('customCode'=>'</td><td class="buttons" align="left" NOWRAP>');
- $new_array[] = $this->dv->defs['templateMeta']['form']['buttons'][4]; // quote2pdf
- $new_array[] = array('customCode'=>'</td>');
- $this->dv->defs['templateMeta']['form']['buttons'] = $new_array;
- unset($this->dv->defs['templateMeta']['form']['closeFormBeforeCustomButtons']);
- parent::display();
- }
- /**
- * @see SugarView::display()
- */
- public function display() {
- global $sugar_version;
- switch ($sugar_version){
- case "6.5.0":
- $this->_display_650();
- break;
- case "6.4.5":
- case "6.4.4":
- case "6.4.3":
- case "6.4.2":
- case "6.4.1":
- $this->_display_641();
- break;
- case "6.3.0":
- $this->_display_630();
- break;
- default:
- return false;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement