PageRenderTime 42ms CodeModel.GetById 14ms RepoModel.GetById 0ms app.codeStats 0ms

/trunk/modules/PDFSettings/serverfiles/modules/SalesOrder/DetailView.php

https://code.google.com/p/vtiger-ru-fork/
PHP | 153 lines | 93 code | 30 blank | 30 comment | 22 complexity | 1bf7770d0754a740dd717ac65eb64dc6 MD5 | raw file
Possible License(s): LGPL-2.1, MPL-2.0-no-copyleft-exception, GPL-2.0, LGPL-3.0
  1. <?php
  2. /*********************************************************************************
  3. * The contents of this file are subject to the SugarCRM Public License Version 1.1.2
  4. * ("License"); You may not use this file except in compliance with the
  5. * License. You may obtain a copy of the License at http://www.sugarcrm.com/SPL
  6. * Software distributed under the License is distributed on an "AS IS" basis,
  7. * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
  8. * the specific language governing rights and limitations under the License.
  9. * The Original Code is: SugarCRM Open Source
  10. * The Initial Developer of the Original Code is SugarCRM, Inc.
  11. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.;
  12. * All Rights Reserved.
  13. * Contributor(s): ______________________________________.
  14. ********************************************************************************/
  15. /*********************************************************************************
  16. * $Header$
  17. * Description: TODO To be written.
  18. * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc.
  19. * All Rights Reserved.
  20. * Contributor(s): ______________________________________..
  21. ********************************************************************************/
  22. require_once('Smarty_setup.php');
  23. require_once('data/Tracker.php');
  24. require_once('include/CustomFieldUtil.php');
  25. require_once('include/utils/utils.php');
  26. require_once('user_privileges/default_module_view.php');
  27. require_once('include/utils/PDFutils.php');
  28. global $mod_strings,$app_strings,$theme,$currentModule,$singlepane_view;
  29. $focus = CRMEntity::getInstance($currentModule);
  30. if(isset($_REQUEST['record']) && isset($_REQUEST['record'])) {
  31. $focus->retrieve_entity_info($_REQUEST['record'],"SalesOrder");
  32. $focus->id = $_REQUEST['record'];
  33. $focus->name=$focus->column_fields['subject'];
  34. }
  35. if(isset($_REQUEST['isDuplicate']) && $_REQUEST['isDuplicate'] == 'true') {
  36. $focus->id = "";
  37. }
  38. $theme_path="themes/".$theme."/";
  39. $image_path=$theme_path."images/";
  40. $log->info("SalesOrder detail view");
  41. $smarty = new vtigerCRM_Smarty;
  42. $smarty->assign("MOD", $mod_strings);
  43. $smarty->assign("APP", $app_strings);
  44. $smarty->assign("THEME", $theme);
  45. $smarty->assign("IMAGE_PATH", $image_path);
  46. $smarty->assign("PRINT_URL", "phprint.php?jt=".session_id().$GLOBALS['request_string']);
  47. if (isset($focus->name))
  48. $smarty->assign("NAME", $focus->name);
  49. else
  50. $smarty->assign("NAME", "");
  51. $smarty->assign("BLOCKS", getBlocks($currentModule,"detail_view",'',$focus->column_fields));
  52. $smarty->assign("UPDATEINFO",updateInfo($focus->id));
  53. $smarty->assign("CUSTOMFIELD", $cust_fld);
  54. $smarty->assign("ID", vtlib_purify($_REQUEST['record']));
  55. // Module Sequence Numbering
  56. $mod_seq_field = getModuleSequenceField($currentModule);
  57. if ($mod_seq_field != null) {
  58. $mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
  59. } else {
  60. $mod_seq_id = $focus->id;
  61. }
  62. $smarty->assign('MOD_SEQ_ID', $mod_seq_id);
  63. // END
  64. $smarty->assign("SINGLE_MOD", 'SalesOrder');
  65. $category = getParentTab();
  66. $smarty->assign("CATEGORY",$category);
  67. if(isPermitted("SalesOrder","EditView",$_REQUEST['record']) == 'yes')
  68. $smarty->assign("EDIT_DUPLICATE","permitted");
  69. $smarty->assign("CREATEPDF","permitted");
  70. if(isPermitted("Invoice","EditView",$_REQUEST['record']) == 'yes')
  71. $smarty->assign("CONVERTINVOICE","permitted");
  72. if(isPermitted("SalesOrder","Delete",$_REQUEST['record']) == 'yes')
  73. $smarty->assign("DELETE","permitted");
  74. $smarty->assign("MODULE", $currentModule);
  75. $smarty->assign("CONVERTMODE",'sotoinvoice');
  76. //Get the associated Products and then display above Terms and Conditions
  77. $smarty->assign("ASSOCIATED_PRODUCTS",getDetailAssociatedProducts('SalesOrder',$focus));
  78. $tabid = getTabid("SalesOrder");
  79. $validationData = getDBValidationData($focus->tab_name,$tabid);
  80. $data = split_validationdataArray($validationData);
  81. $smarty->assign("VALIDATION_DATA_FIELDNAME",$data['fieldname']);
  82. $smarty->assign("VALIDATION_DATA_FIELDDATATYPE",$data['datatype']);
  83. $smarty->assign("VALIDATION_DATA_FIELDLABEL",$data['fieldlabel']);
  84. $smarty->assign("TODO_PERMISSION",CheckFieldPermission('parent_id','Calendar'));
  85. $smarty->assign("EVENT_PERMISSION",CheckFieldPermission('parent_id','Events'));
  86. $check_button = Button_Check($module);
  87. $smarty->assign("CHECK", $check_button);
  88. $smarty->assign("EDIT_PERMISSION",isPermitted($currentModule,'EditView',$_REQUEST['record']));
  89. $smarty->assign("IS_REL_LIST",isPresentRelatedLists($currentModule));
  90. if($singlepane_view == 'true')
  91. {
  92. $related_array = getRelatedLists($currentModule,$focus);
  93. $smarty->assign("RELATEDLISTS", $related_array);
  94. require_once('include/ListView/RelatedListViewSession.php');
  95. if(!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) {
  96. RelatedListViewSession::addRelatedModuleToSession(vtlib_purify($_REQUEST['relation_id']),
  97. vtlib_purify($_REQUEST['selected_header']));
  98. }
  99. $open_related_modules = RelatedListViewSession::getRelatedModulesFromSession();
  100. $smarty->assign("SELECTEDHEADERS", $open_related_modules);
  101. }
  102. //crm-now: added for PDF as attachment to mail
  103. //crm-now extension
  104. //get stored language configuration
  105. $pdf_details = getAllPDFDetails($currentModule);
  106. $pdflanguage_selected = $pdf_details['pdflang'];
  107. $smarty->assign("PDFLANGUAGE",$pdf_details['pdflang']);
  108. $smarty->assign("SinglePane_View", $singlepane_view);
  109. if(PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule.'_listquery'])){
  110. $recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id);
  111. VT_detailViewNavigation($smarty,$recordNavigationInfo,$focus->id);
  112. }
  113. // Record Change Notification
  114. $focus->markAsViewed($current_user->id);
  115. // END
  116. // Gather the custom link information to display
  117. include_once('vtlib/Vtiger/Link.php');
  118. $customlink_params = Array('MODULE'=>$currentModule, 'RECORD'=>$focus->id, 'ACTION'=>vtlib_purify($_REQUEST['action']));
  119. $smarty->assign('CUSTOM_LINKS', Vtiger_Link::getAllByType(getTabid($currentModule), Array('DETAILVIEWBASIC','DETAILVIEW','DETAILVIEWWIDGET'), $customlink_params));
  120. // END
  121. $smarty->assign('DETAILVIEW_AJAX_EDIT', PerformancePrefs::getBoolean('DETAILVIEW_AJAX_EDIT', true));
  122. $smarty->display("Inventory/InventoryDetailView.tpl");
  123. ?>