getModuleTemplates($currentModule); foreach($availableTemplates as $template) { if($template->getName() == 'Счет') { $templateId = $template->getId(); break; } } $controller = new $controllerClassName($currentModule, $templateId); //$controller = new Vtiger_InvoicePDFController($currentModule); // SalesPlatform.ru end $controller->loadRecord(vtlib_purify($_REQUEST['record'])); $invoice_no = getModuleSequenceNumber($currentModule,vtlib_purify($_REQUEST['record'])); $translatedmodname= vtranslate($currentModule,$currentModule); if(isset($_REQUEST['savemode']) && $_REQUEST['savemode'] == 'file') { $id = vtlib_purify($_REQUEST['record']); // SalesPlatform.ru begin Create SP pdf templates $filepath = $root_directory.'/test/product/'.$id.'_'.$translatedmodname.'_'.$invoice_no.'.pdf'; //$filepath='test/product/'.$id.'_'.$translatedmodname.'_'.$invoice_no.'.pdf'; // SalesPlatform.ru end $controller->Output($filepath,'F'); //added file name to make it work in IE, also forces the download giving the user the option to save } else { $controller->Output($translatedmodname.'_'.$invoice_no.'.pdf', 'D');//added file name to make it work in IE, also forces the download giving the user the option to save exit(); } ?>