/** * Function to get this record and details as PDF */ public function getPDF() { $recordId = $this->getId(); $moduleName = $this->getModuleName(); $controller = new Vtiger_QuotePDFController($moduleName); $controller->loadRecord($recordId); $fileName = $moduleName . '_' . getModuleSequenceNumber($moduleName, $recordId); $controller->Output($fileName . '.pdf', 'D'); }
<?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. * ********************************************************************************/ include_once 'modules/PurchaseOrder/PurchaseOrderPDFController.php'; $controller = new Vtiger_PurchaseOrderPDFController($currentModule); $controller->loadRecord(vtlib_purify($_REQUEST['record'])); $purchaseorder_no = getModuleSequenceNumber($currentModule, vtlib_purify($_REQUEST['record'])); $controller->Output('PurchaseOrder_' . $purchaseorder_no . '.pdf', 'D'); //added file name to make it work in IE, also forces the download giving the user the option to save exit;
<?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. ********************************************************************************/ include_once 'modules/Invoice/InvoicePDFController.php'; $currentModule = vtlib_purify($_REQUEST['module']); $controller = new Vtiger_InvoicePDFController($currentModule); $controller->loadRecord(vtlib_purify($_REQUEST['record'])); $filenameid = vtlib_purify($_REQUEST['record']); $invoice_no = getModuleSequenceNumber($currentModule, vtlib_purify($_REQUEST['record'])); $moduleName = str_replace(' ', '', getTranslatedString('SINGLE_Invoice', $currentModule)); if (empty($filenameid)) { $filenameid = time(); } $filepath = 'storage/' . $moduleName . '_' . $invoice_no . '.pdf'; //added file name to make it work in IE, also forces the download giving the user the option to save $controller->Output($filepath, 'F'); // Added to fix annoying bug that includes HTML in your PDF echo '<script>window.history.back();</script>'; exit;
/** function used to get the Quotes/Invoice pdf * @param int $id - id -id * return string $output - pd link value */ function get_pdf($id, $block, $customerid, $sessionid) { $adb = PearDatabase::getInstance(); $log = vglobal('log'); global $currentModule, $mod_strings, $app_strings, $app_list_strings; $log->debug("Entering customer portal function get_pdf"); $isPermitted = check_permission($customerid, $block, $id); if ($isPermitted == false) { return array("#NOT AUTHORIZED#"); } if (!validateSession($customerid, $sessionid)) { return null; } require_once "config/config.php"; $current_user = Users::getActiveAdminUser(); $currentModule = $block; $current_language = vglobal('current_language'); $app_strings = return_application_language($current_language); $app_list_strings = return_app_list_strings_language($current_language); $mod_strings = return_module_language($current_language, $currentModule); $_REQUEST['record'] = $id; $_REQUEST['savemode'] = 'file'; $sequenceNo = getModuleSequenceNumber($block, $id); $filenamewithpath = 'storage/Products/' . $id . '_' . $block . '_' . $sequenceNo . '.pdf'; if (file_exists($filenamewithpath) && filesize($filenamewithpath) != 0) { unlink($filenamewithpath); } checkFileAccessForInclusion("modules/{$block}/CreatePDF.php"); include "modules/{$block}/CreatePDF.php"; if (file_exists($filenamewithpath) && filesize($filenamewithpath) != 0) { //we have to pass the file content $filecontents[] = base64_encode(file_get_contents($filenamewithpath)); unlink($filenamewithpath); // TODO: Delete the file to avoid public access. } else { $filecontents = "failure"; } $log->debug("Exiting customer portal function get_pdf"); return $filecontents; }
$smarty->assign('EDIT_PERMISSION', isPermitted($currentModule, 'EditView', $record)); $smarty->assign('CHECK', $tool_buttons); if (PerformancePrefs::getBoolean('DETAILVIEW_RECORD_NAVIGATION', true) && isset($_SESSION[$currentModule . '_listquery'])) { $recordNavigationInfo = ListViewSession::getListViewNavigation($focus->id); VT_detailViewNavigation($smarty, $recordNavigationInfo, $focus->id); } if (isPermitted('Invoice', 'EditView', $record) == 'yes') { $smarty->assign('CONVERTINVOICE', 'permitted'); } $smarty->assign('CONVERTMODE', 'sotoinvoice'); //Get the associated Products and then display above Terms and Conditions $smarty->assign('ASSOCIATED_PRODUCTS', getDetailAssociatedProducts($currentModule, $focus)); $smarty->assign('TODO_PERMISSION', CheckFieldPermission('parent_id', 'Calendar')); $smarty->assign('EVENT_PERMISSION', CheckFieldPermission('parent_id', 'Events')); $smarty->assign('CREATEPDF', 'permitted'); $salesorder_no = getModuleSequenceNumber($currentModule, $record); $smarty->assign('SO_NO', $salesorder_no); $smarty->assign('IS_REL_LIST', isPresentRelatedLists($currentModule)); $smarty->assign('SinglePane_View', $singlepane_view); if ($singlepane_view == 'true') { $related_array = getRelatedLists($currentModule, $focus); $smarty->assign("RELATEDLISTS", $related_array); require_once 'include/ListView/RelatedListViewSession.php'; if (!empty($_REQUEST['selected_header']) && !empty($_REQUEST['relation_id'])) { RelatedListViewSession::addRelatedModuleToSession(vtlib_purify($_REQUEST['relation_id']), vtlib_purify($_REQUEST['selected_header'])); } $open_related_modules = RelatedListViewSession::getRelatedModulesFromSession(); $smarty->assign("SELECTEDHEADERS", $open_related_modules); } if (isPermitted($currentModule, 'EditView', $record) == 'yes') { $smarty->assign('EDIT_DUPLICATE', 'permitted');
<?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. ************************************************************************************/ require_once 'Smarty_setup.php'; require_once 'user_privileges/default_module_view.php'; global $mod_strings, $app_strings, $currentModule, $current_user, $theme, $log, $singlepane_view; $smarty = new vtigerCRM_Smarty(); require_once 'modules/Vtiger/DetailView.php'; //Get the associated Products and then display above Terms and Conditions $smarty->assign('ASSOCIATED_PRODUCTS', getDetailAssociatedProducts($currentModule, $focus)); $smarty->assign('CREATEPDF', 'permitted'); $purchaseorder_no = getModuleSequenceNumber($currentModule, $record); $smarty->assign('PO_NO', $purchaseorder_no); $smarty->display('Inventory/InventoryDetailView.tpl');
<?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. ************************************************************************************/ require_once 'Smarty_setup.php'; require_once 'user_privileges/default_module_view.php'; global $mod_strings, $app_strings, $currentModule, $current_user, $theme, $log, $singlepane_view; $smarty = new vtigerCRM_Smarty(); require_once 'modules/Vtiger/DetailView.php'; //Get the associated Products and then display above Terms and Conditions $smarty->assign('ASSOCIATED_PRODUCTS', getDetailAssociatedProducts($currentModule, $focus)); $smarty->assign('CREATEPDF', 'permitted'); $invoice_no = getModuleSequenceNumber($currentModule, $record); $smarty->assign('INV_NO', $invoice_no); $smarty->display('Inventory/InventoryDetailView.tpl');
/** * Function to get the pdf file name . This will conver the invoice in to pdf and saves the file * @return <String> * */ public function getPDFFileName() { $moduleName = $this->getModuleName(); if ($moduleName == 'Quotes') { vimport("~modules/{$moduleName}/QuotePDFController.php"); $controllerClassName = "Vtiger_QuotePDFController"; } else { vimport("~modules/{$moduleName}/{$moduleName}" . "PDFController.php"); $controllerClassName = "Vtiger_" . $moduleName . "PDFController"; } $recordId = $this->getId(); $controller = new $controllerClassName($moduleName); $controller->loadRecord($recordId); $sequenceNo = getModuleSequenceNumber($moduleName, $recordId); $translatedName = vtranslate($moduleName, $moduleName); $filePath = "storage/{$translatedName}" . "_" . $sequenceNo . ".pdf"; //added file name to make it work in IE, also forces the download giving the user the option to save $controller->Output($filePath, 'F'); return $filePath; }
/** * Function to get the pdf file name . This will conver the invoice in to pdf and saves the file * @return <String> * */ public function getPDFFileName() { // SalesPlatform.ru begin global $root_directory; // SalesPlatform.ru end $moduleName = $this->getModuleName(); //SalesPlatform.ru begin equally controller class name form // if ($moduleName == 'Quotes') { // vimport("~~/modules/$moduleName/QuotePDFController.php"); // $controllerClassName = "Vtiger_QuotePDFController"; // } else { // vimport("~~/modules/$moduleName/$moduleName" . "PDFController.php"); // $controllerClassName = "Vtiger_" . $moduleName . "PDFController"; // } $controllerClassName = "Vtiger_" . $moduleName . "PDFController"; //SalesPlatform.ru end $recordId = $this->getId(); $controller = new $controllerClassName($moduleName); $controller->loadRecord($recordId); $sequenceNo = getModuleSequenceNumber($moduleName, $recordId); $translatedName = vtranslate($moduleName, $moduleName); // SalesPlatform.ru begin $filePath = $root_directory . "/storage/{$translatedName}" . "_" . $sequenceNo . ".pdf"; //$filePath = "storage/$translatedName"."_".$sequenceNo.".pdf"; // SalesPlatform.ru end //added file name to make it work in IE, also forces the download giving the user the option to save $controller->Output($filePath, 'F'); return $filePath; }
/** * Function to get the pdf file name. This will conver save file in storage. * @param int $templateId * @return <String> */ public function getSalesPlatformPDFFileName($templateId) { global $WERPASCOPESTORAGE; $moduleName = $this->getModuleName(); $recordId = $this->getId(); vimport("~~/modules/$moduleName/$moduleName" . "PDFController.php"); //import controller $controllerClassName = "SalesPlatform_" . $moduleName . "PDFController"; $controller = new $controllerClassName($moduleName, $templateId); $controller->loadRecord($recordId); $sequenceNo = getModuleSequenceNumber($moduleName,$recordId); $translatedName = vtranslate($moduleName, $moduleName); $filePath = $WERPASCOPESTORAGE."/$translatedName"."_".$sequenceNo.".pdf"; $controller->Output($filePath,'F'); return $filePath; }
/** function used to get the Quotes/Invoice pdf * @param int $id - id -id * return string $output - pd link value */ function get_pdf($id,$block,$customerid,$sessionid) { global $adb; global $current_user,$log,$default_language; global $currentModule,$mod_strings,$app_strings,$app_list_strings; $log->debug("Entering customer portal function get_pdf"); $isPermitted = check_permission($customerid,$block,$id); if($isPermitted == false) { return array("#NOT AUTHORIZED#"); } if(!validateSession($customerid,$sessionid)) return null; require_once("config.inc.php"); $current_user = Users::getActiveAdminUser(); $currentModule = $block; $current_language = $default_language; $app_strings = return_application_language($current_language); $app_list_strings = return_app_list_strings_language($current_language); $mod_strings = return_module_language($current_language, $currentModule); $_REQUEST['record']= $id; $_REQUEST['savemode']= 'file'; $sequenceNo = getModuleSequenceNumber($block, $id); // SalesPlatform.ru begin global $WERPASCOPETESTPRODUCT; $filenamewithpath=$WERPASCOPETESTPRODUCT.$id.'_'.getTranslatedString($block).'_'.$sequenceNo.'.pdf'; // SalesPlatform.ru end if (file_exists($filenamewithpath) && (filesize($filenamewithpath) != 0)) unlink($filenamewithpath); checkFileAccessForInclusion("modules/$block/CreatePDF.php"); include("modules/$block/CreatePDF.php"); if (file_exists($filenamewithpath) && (filesize($filenamewithpath) != 0)) { //we have to pass the file content $filecontents[] = base64_encode(file_get_contents($filenamewithpath)); unlink($filenamewithpath); // TODO: Delete the file to avoid public access. } else { $filecontents = "failure"; } $log->debug("Exiting customer portal function get_pdf"); return $filecontents; }
<?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. ************************************************************************************/ require_once 'Smarty_setup.php'; require_once 'user_privileges/default_module_view.php'; global $mod_strings, $app_strings, $currentModule, $current_user, $theme, $log, $singlepane_view; $smarty = new vtigerCRM_Smarty(); require_once 'modules/Vtiger/DetailView.php'; if (isPermitted('SalesOrder', 'CreateView', $record) == 'yes') { $smarty->assign('CONVERTSALESORDER', 'permitted'); } if (isPermitted('Invoice', 'CreateView', $record) == 'yes') { $smarty->assign('CONVERTINVOICE', 'permitted'); } $smarty->assign('CONVERTMODE', 'quotetoinvoice'); //Get the associated Products and then display above Terms and Conditions $smarty->assign('ASSOCIATED_PRODUCTS', getDetailAssociatedProducts($currentModule, $focus)); $smarty->assign('CREATEPDF', 'permitted'); $quote_no = getModuleSequenceNumber($currentModule, $record); $smarty->assign('QUO_NO', $quote_no); $smarty->display('Inventory/InventoryDetailView.tpl');